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 | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 5950 | class bsn_lua_command_reply(bsn_header): |
| 5951 | version = 4 |
| 5952 | type = 4 |
| 5953 | experimenter = 6035143 |
| 5954 | subtype = 66 |
| 5955 | |
| 5956 | def __init__(self, xid=None, data=None): |
| 5957 | if xid != None: |
| 5958 | self.xid = xid |
| 5959 | else: |
| 5960 | self.xid = None |
| 5961 | if data != None: |
| 5962 | self.data = data |
| 5963 | else: |
| 5964 | self.data = '' |
| 5965 | return |
| 5966 | |
| 5967 | def pack(self): |
| 5968 | packed = [] |
| 5969 | packed.append(struct.pack("!B", self.version)) |
| 5970 | packed.append(struct.pack("!B", self.type)) |
| 5971 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5972 | packed.append(struct.pack("!L", self.xid)) |
| 5973 | packed.append(struct.pack("!L", self.experimenter)) |
| 5974 | packed.append(struct.pack("!L", self.subtype)) |
| 5975 | packed.append(self.data) |
| 5976 | length = sum([len(x) for x in packed]) |
| 5977 | packed[2] = struct.pack("!H", length) |
| 5978 | return ''.join(packed) |
| 5979 | |
| 5980 | @staticmethod |
| 5981 | def unpack(reader): |
| 5982 | obj = bsn_lua_command_reply() |
| 5983 | _version = reader.read("!B")[0] |
| 5984 | assert(_version == 4) |
| 5985 | _type = reader.read("!B")[0] |
| 5986 | assert(_type == 4) |
| 5987 | _length = reader.read("!H")[0] |
| 5988 | orig_reader = reader |
| 5989 | reader = orig_reader.slice(_length, 4) |
| 5990 | obj.xid = reader.read("!L")[0] |
| 5991 | _experimenter = reader.read("!L")[0] |
| 5992 | assert(_experimenter == 6035143) |
| 5993 | _subtype = reader.read("!L")[0] |
| 5994 | assert(_subtype == 66) |
| 5995 | obj.data = str(reader.read_all()) |
| 5996 | return obj |
| 5997 | |
| 5998 | def __eq__(self, other): |
| 5999 | if type(self) != type(other): return False |
| 6000 | if self.xid != other.xid: return False |
| 6001 | if self.data != other.data: return False |
| 6002 | return True |
| 6003 | |
| 6004 | def pretty_print(self, q): |
| 6005 | q.text("bsn_lua_command_reply {") |
| 6006 | with q.group(): |
| 6007 | with q.indent(2): |
| 6008 | q.breakable() |
| 6009 | q.text("xid = "); |
| 6010 | if self.xid != None: |
| 6011 | q.text("%#x" % self.xid) |
| 6012 | else: |
| 6013 | q.text('None') |
| 6014 | q.text(","); q.breakable() |
| 6015 | q.text("data = "); |
| 6016 | q.pp(self.data) |
| 6017 | q.breakable() |
| 6018 | q.text('}') |
| 6019 | |
| 6020 | bsn_header.subtypes[66] = bsn_lua_command_reply |
| 6021 | |
| 6022 | class bsn_lua_command_request(bsn_header): |
| 6023 | version = 4 |
| 6024 | type = 4 |
| 6025 | experimenter = 6035143 |
| 6026 | subtype = 65 |
| 6027 | |
| 6028 | def __init__(self, xid=None, data=None): |
| 6029 | if xid != None: |
| 6030 | self.xid = xid |
| 6031 | else: |
| 6032 | self.xid = None |
| 6033 | if data != None: |
| 6034 | self.data = data |
| 6035 | else: |
| 6036 | self.data = '' |
| 6037 | return |
| 6038 | |
| 6039 | def pack(self): |
| 6040 | packed = [] |
| 6041 | packed.append(struct.pack("!B", self.version)) |
| 6042 | packed.append(struct.pack("!B", self.type)) |
| 6043 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6044 | packed.append(struct.pack("!L", self.xid)) |
| 6045 | packed.append(struct.pack("!L", self.experimenter)) |
| 6046 | packed.append(struct.pack("!L", self.subtype)) |
| 6047 | packed.append(self.data) |
| 6048 | length = sum([len(x) for x in packed]) |
| 6049 | packed[2] = struct.pack("!H", length) |
| 6050 | return ''.join(packed) |
| 6051 | |
| 6052 | @staticmethod |
| 6053 | def unpack(reader): |
| 6054 | obj = bsn_lua_command_request() |
| 6055 | _version = reader.read("!B")[0] |
| 6056 | assert(_version == 4) |
| 6057 | _type = reader.read("!B")[0] |
| 6058 | assert(_type == 4) |
| 6059 | _length = reader.read("!H")[0] |
| 6060 | orig_reader = reader |
| 6061 | reader = orig_reader.slice(_length, 4) |
| 6062 | obj.xid = reader.read("!L")[0] |
| 6063 | _experimenter = reader.read("!L")[0] |
| 6064 | assert(_experimenter == 6035143) |
| 6065 | _subtype = reader.read("!L")[0] |
| 6066 | assert(_subtype == 65) |
| 6067 | obj.data = str(reader.read_all()) |
| 6068 | return obj |
| 6069 | |
| 6070 | def __eq__(self, other): |
| 6071 | if type(self) != type(other): return False |
| 6072 | if self.xid != other.xid: return False |
| 6073 | if self.data != other.data: return False |
| 6074 | return True |
| 6075 | |
| 6076 | def pretty_print(self, q): |
| 6077 | q.text("bsn_lua_command_request {") |
| 6078 | with q.group(): |
| 6079 | with q.indent(2): |
| 6080 | q.breakable() |
| 6081 | q.text("xid = "); |
| 6082 | if self.xid != None: |
| 6083 | q.text("%#x" % self.xid) |
| 6084 | else: |
| 6085 | q.text('None') |
| 6086 | q.text(","); q.breakable() |
| 6087 | q.text("data = "); |
| 6088 | q.pp(self.data) |
| 6089 | q.breakable() |
| 6090 | q.text('}') |
| 6091 | |
| 6092 | bsn_header.subtypes[65] = bsn_lua_command_request |
| 6093 | |
| 6094 | class bsn_lua_notification(bsn_header): |
| 6095 | version = 4 |
| 6096 | type = 4 |
| 6097 | experimenter = 6035143 |
| 6098 | subtype = 67 |
| 6099 | |
| 6100 | def __init__(self, xid=None, data=None): |
| 6101 | if xid != None: |
| 6102 | self.xid = xid |
| 6103 | else: |
| 6104 | self.xid = None |
| 6105 | if data != None: |
| 6106 | self.data = data |
| 6107 | else: |
| 6108 | self.data = '' |
| 6109 | return |
| 6110 | |
| 6111 | def pack(self): |
| 6112 | packed = [] |
| 6113 | packed.append(struct.pack("!B", self.version)) |
| 6114 | packed.append(struct.pack("!B", self.type)) |
| 6115 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6116 | packed.append(struct.pack("!L", self.xid)) |
| 6117 | packed.append(struct.pack("!L", self.experimenter)) |
| 6118 | packed.append(struct.pack("!L", self.subtype)) |
| 6119 | packed.append(self.data) |
| 6120 | length = sum([len(x) for x in packed]) |
| 6121 | packed[2] = struct.pack("!H", length) |
| 6122 | return ''.join(packed) |
| 6123 | |
| 6124 | @staticmethod |
| 6125 | def unpack(reader): |
| 6126 | obj = bsn_lua_notification() |
| 6127 | _version = reader.read("!B")[0] |
| 6128 | assert(_version == 4) |
| 6129 | _type = reader.read("!B")[0] |
| 6130 | assert(_type == 4) |
| 6131 | _length = reader.read("!H")[0] |
| 6132 | orig_reader = reader |
| 6133 | reader = orig_reader.slice(_length, 4) |
| 6134 | obj.xid = reader.read("!L")[0] |
| 6135 | _experimenter = reader.read("!L")[0] |
| 6136 | assert(_experimenter == 6035143) |
| 6137 | _subtype = reader.read("!L")[0] |
| 6138 | assert(_subtype == 67) |
| 6139 | obj.data = str(reader.read_all()) |
| 6140 | return obj |
| 6141 | |
| 6142 | def __eq__(self, other): |
| 6143 | if type(self) != type(other): return False |
| 6144 | if self.xid != other.xid: return False |
| 6145 | if self.data != other.data: return False |
| 6146 | return True |
| 6147 | |
| 6148 | def pretty_print(self, q): |
| 6149 | q.text("bsn_lua_notification {") |
| 6150 | with q.group(): |
| 6151 | with q.indent(2): |
| 6152 | q.breakable() |
| 6153 | q.text("xid = "); |
| 6154 | if self.xid != None: |
| 6155 | q.text("%#x" % self.xid) |
| 6156 | else: |
| 6157 | q.text('None') |
| 6158 | q.text(","); q.breakable() |
| 6159 | q.text("data = "); |
| 6160 | q.pp(self.data) |
| 6161 | q.breakable() |
| 6162 | q.text('}') |
| 6163 | |
| 6164 | bsn_header.subtypes[67] = bsn_lua_notification |
| 6165 | |
| 6166 | class bsn_lua_upload(bsn_header): |
| 6167 | version = 4 |
| 6168 | type = 4 |
| 6169 | experimenter = 6035143 |
| 6170 | subtype = 64 |
| 6171 | |
| 6172 | def __init__(self, xid=None, flags=None, filename=None, data=None): |
| 6173 | if xid != None: |
| 6174 | self.xid = xid |
| 6175 | else: |
| 6176 | self.xid = None |
| 6177 | if flags != None: |
| 6178 | self.flags = flags |
| 6179 | else: |
| 6180 | self.flags = 0 |
| 6181 | if filename != None: |
| 6182 | self.filename = filename |
| 6183 | else: |
| 6184 | self.filename = "" |
| 6185 | if data != None: |
| 6186 | self.data = data |
| 6187 | else: |
| 6188 | self.data = '' |
| 6189 | return |
| 6190 | |
| 6191 | def pack(self): |
| 6192 | packed = [] |
| 6193 | packed.append(struct.pack("!B", self.version)) |
| 6194 | packed.append(struct.pack("!B", self.type)) |
| 6195 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6196 | packed.append(struct.pack("!L", self.xid)) |
| 6197 | packed.append(struct.pack("!L", self.experimenter)) |
| 6198 | packed.append(struct.pack("!L", self.subtype)) |
| 6199 | packed.append(struct.pack("!H", self.flags)) |
| 6200 | packed.append(struct.pack("!64s", self.filename)) |
| 6201 | packed.append(self.data) |
| 6202 | length = sum([len(x) for x in packed]) |
| 6203 | packed[2] = struct.pack("!H", length) |
| 6204 | return ''.join(packed) |
| 6205 | |
| 6206 | @staticmethod |
| 6207 | def unpack(reader): |
| 6208 | obj = bsn_lua_upload() |
| 6209 | _version = reader.read("!B")[0] |
| 6210 | assert(_version == 4) |
| 6211 | _type = reader.read("!B")[0] |
| 6212 | assert(_type == 4) |
| 6213 | _length = reader.read("!H")[0] |
| 6214 | orig_reader = reader |
| 6215 | reader = orig_reader.slice(_length, 4) |
| 6216 | obj.xid = reader.read("!L")[0] |
| 6217 | _experimenter = reader.read("!L")[0] |
| 6218 | assert(_experimenter == 6035143) |
| 6219 | _subtype = reader.read("!L")[0] |
| 6220 | assert(_subtype == 64) |
| 6221 | obj.flags = reader.read("!H")[0] |
| 6222 | obj.filename = reader.read("!64s")[0].rstrip("\x00") |
| 6223 | obj.data = str(reader.read_all()) |
| 6224 | return obj |
| 6225 | |
| 6226 | def __eq__(self, other): |
| 6227 | if type(self) != type(other): return False |
| 6228 | if self.xid != other.xid: return False |
| 6229 | if self.flags != other.flags: return False |
| 6230 | if self.filename != other.filename: return False |
| 6231 | if self.data != other.data: return False |
| 6232 | return True |
| 6233 | |
| 6234 | def pretty_print(self, q): |
| 6235 | q.text("bsn_lua_upload {") |
| 6236 | with q.group(): |
| 6237 | with q.indent(2): |
| 6238 | q.breakable() |
| 6239 | q.text("xid = "); |
| 6240 | if self.xid != None: |
| 6241 | q.text("%#x" % self.xid) |
| 6242 | else: |
| 6243 | q.text('None') |
| 6244 | q.text(","); q.breakable() |
| 6245 | q.text("flags = "); |
| 6246 | q.text("%#x" % self.flags) |
| 6247 | q.text(","); q.breakable() |
| 6248 | q.text("filename = "); |
| 6249 | q.pp(self.filename) |
| 6250 | q.text(","); q.breakable() |
| 6251 | q.text("data = "); |
| 6252 | q.pp(self.data) |
| 6253 | q.breakable() |
| 6254 | q.text('}') |
| 6255 | |
| 6256 | bsn_header.subtypes[64] = bsn_lua_upload |
| 6257 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6258 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6259 | version = 4 |
| 6260 | type = 4 |
| 6261 | experimenter = 6035143 |
| 6262 | subtype = 34 |
| 6263 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6264 | 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] | 6265 | if xid != None: |
| 6266 | self.xid = xid |
| 6267 | else: |
| 6268 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6269 | if status != None: |
| 6270 | self.status = status |
| 6271 | else: |
| 6272 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6273 | if port_no != None: |
| 6274 | self.port_no = port_no |
| 6275 | else: |
| 6276 | self.port_no = 0 |
| 6277 | if slot_num != None: |
| 6278 | self.slot_num = slot_num |
| 6279 | else: |
| 6280 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6281 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6282 | |
| 6283 | def pack(self): |
| 6284 | packed = [] |
| 6285 | packed.append(struct.pack("!B", self.version)) |
| 6286 | packed.append(struct.pack("!B", self.type)) |
| 6287 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6288 | packed.append(struct.pack("!L", self.xid)) |
| 6289 | packed.append(struct.pack("!L", self.experimenter)) |
| 6290 | packed.append(struct.pack("!L", self.subtype)) |
| 6291 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6292 | packed.append(util.pack_port_no(self.port_no)) |
| 6293 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6294 | length = sum([len(x) for x in packed]) |
| 6295 | packed[2] = struct.pack("!H", length) |
| 6296 | return ''.join(packed) |
| 6297 | |
| 6298 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6299 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6300 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6301 | _version = reader.read("!B")[0] |
| 6302 | assert(_version == 4) |
| 6303 | _type = reader.read("!B")[0] |
| 6304 | assert(_type == 4) |
| 6305 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6306 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6307 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6308 | obj.xid = reader.read("!L")[0] |
| 6309 | _experimenter = reader.read("!L")[0] |
| 6310 | assert(_experimenter == 6035143) |
| 6311 | _subtype = reader.read("!L")[0] |
| 6312 | assert(_subtype == 34) |
| 6313 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6314 | obj.port_no = util.unpack_port_no(reader) |
| 6315 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6316 | return obj |
| 6317 | |
| 6318 | def __eq__(self, other): |
| 6319 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6320 | if self.xid != other.xid: return False |
| 6321 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6322 | if self.port_no != other.port_no: return False |
| 6323 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6324 | return True |
| 6325 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6326 | def pretty_print(self, q): |
| 6327 | q.text("bsn_pdu_rx_reply {") |
| 6328 | with q.group(): |
| 6329 | with q.indent(2): |
| 6330 | q.breakable() |
| 6331 | q.text("xid = "); |
| 6332 | if self.xid != None: |
| 6333 | q.text("%#x" % self.xid) |
| 6334 | else: |
| 6335 | q.text('None') |
| 6336 | q.text(","); q.breakable() |
| 6337 | q.text("status = "); |
| 6338 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6339 | q.text(","); q.breakable() |
| 6340 | q.text("port_no = "); |
| 6341 | q.text(util.pretty_port(self.port_no)) |
| 6342 | q.text(","); q.breakable() |
| 6343 | q.text("slot_num = "); |
| 6344 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6345 | q.breakable() |
| 6346 | q.text('}') |
| 6347 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6348 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 6349 | |
| 6350 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6351 | version = 4 |
| 6352 | type = 4 |
| 6353 | experimenter = 6035143 |
| 6354 | subtype = 33 |
| 6355 | |
| 6356 | 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] | 6357 | if xid != None: |
| 6358 | self.xid = xid |
| 6359 | else: |
| 6360 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6361 | if timeout_ms != None: |
| 6362 | self.timeout_ms = timeout_ms |
| 6363 | else: |
| 6364 | self.timeout_ms = 0 |
| 6365 | if port_no != None: |
| 6366 | self.port_no = port_no |
| 6367 | else: |
| 6368 | self.port_no = 0 |
| 6369 | if slot_num != None: |
| 6370 | self.slot_num = slot_num |
| 6371 | else: |
| 6372 | self.slot_num = 0 |
| 6373 | if data != None: |
| 6374 | self.data = data |
| 6375 | else: |
| 6376 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6377 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6378 | |
| 6379 | def pack(self): |
| 6380 | packed = [] |
| 6381 | packed.append(struct.pack("!B", self.version)) |
| 6382 | packed.append(struct.pack("!B", self.type)) |
| 6383 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6384 | packed.append(struct.pack("!L", self.xid)) |
| 6385 | packed.append(struct.pack("!L", self.experimenter)) |
| 6386 | packed.append(struct.pack("!L", self.subtype)) |
| 6387 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 6388 | packed.append(util.pack_port_no(self.port_no)) |
| 6389 | packed.append(struct.pack("!B", self.slot_num)) |
| 6390 | packed.append('\x00' * 3) |
| 6391 | packed.append(self.data) |
| 6392 | length = sum([len(x) for x in packed]) |
| 6393 | packed[2] = struct.pack("!H", length) |
| 6394 | return ''.join(packed) |
| 6395 | |
| 6396 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6397 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6398 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6399 | _version = reader.read("!B")[0] |
| 6400 | assert(_version == 4) |
| 6401 | _type = reader.read("!B")[0] |
| 6402 | assert(_type == 4) |
| 6403 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6404 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6405 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6406 | obj.xid = reader.read("!L")[0] |
| 6407 | _experimenter = reader.read("!L")[0] |
| 6408 | assert(_experimenter == 6035143) |
| 6409 | _subtype = reader.read("!L")[0] |
| 6410 | assert(_subtype == 33) |
| 6411 | obj.timeout_ms = reader.read("!L")[0] |
| 6412 | obj.port_no = util.unpack_port_no(reader) |
| 6413 | obj.slot_num = reader.read("!B")[0] |
| 6414 | reader.skip(3) |
| 6415 | obj.data = str(reader.read_all()) |
| 6416 | return obj |
| 6417 | |
| 6418 | def __eq__(self, other): |
| 6419 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6420 | if self.xid != other.xid: return False |
| 6421 | if self.timeout_ms != other.timeout_ms: return False |
| 6422 | if self.port_no != other.port_no: return False |
| 6423 | if self.slot_num != other.slot_num: return False |
| 6424 | if self.data != other.data: return False |
| 6425 | return True |
| 6426 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6427 | def pretty_print(self, q): |
| 6428 | q.text("bsn_pdu_rx_request {") |
| 6429 | with q.group(): |
| 6430 | with q.indent(2): |
| 6431 | q.breakable() |
| 6432 | q.text("xid = "); |
| 6433 | if self.xid != None: |
| 6434 | q.text("%#x" % self.xid) |
| 6435 | else: |
| 6436 | q.text('None') |
| 6437 | q.text(","); q.breakable() |
| 6438 | q.text("timeout_ms = "); |
| 6439 | q.text("%#x" % self.timeout_ms) |
| 6440 | q.text(","); q.breakable() |
| 6441 | q.text("port_no = "); |
| 6442 | q.text(util.pretty_port(self.port_no)) |
| 6443 | q.text(","); q.breakable() |
| 6444 | q.text("slot_num = "); |
| 6445 | q.text("%#x" % self.slot_num) |
| 6446 | q.text(","); q.breakable() |
| 6447 | q.text("data = "); |
| 6448 | q.pp(self.data) |
| 6449 | q.breakable() |
| 6450 | q.text('}') |
| 6451 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6452 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 6453 | |
| 6454 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6455 | version = 4 |
| 6456 | type = 4 |
| 6457 | experimenter = 6035143 |
| 6458 | subtype = 35 |
| 6459 | |
| 6460 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6461 | if xid != None: |
| 6462 | self.xid = xid |
| 6463 | else: |
| 6464 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6465 | if port_no != None: |
| 6466 | self.port_no = port_no |
| 6467 | else: |
| 6468 | self.port_no = 0 |
| 6469 | if slot_num != None: |
| 6470 | self.slot_num = slot_num |
| 6471 | else: |
| 6472 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6473 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6474 | |
| 6475 | def pack(self): |
| 6476 | packed = [] |
| 6477 | packed.append(struct.pack("!B", self.version)) |
| 6478 | packed.append(struct.pack("!B", self.type)) |
| 6479 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6480 | packed.append(struct.pack("!L", self.xid)) |
| 6481 | packed.append(struct.pack("!L", self.experimenter)) |
| 6482 | packed.append(struct.pack("!L", self.subtype)) |
| 6483 | packed.append(util.pack_port_no(self.port_no)) |
| 6484 | packed.append(struct.pack("!B", self.slot_num)) |
| 6485 | length = sum([len(x) for x in packed]) |
| 6486 | packed[2] = struct.pack("!H", length) |
| 6487 | return ''.join(packed) |
| 6488 | |
| 6489 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6490 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6491 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6492 | _version = reader.read("!B")[0] |
| 6493 | assert(_version == 4) |
| 6494 | _type = reader.read("!B")[0] |
| 6495 | assert(_type == 4) |
| 6496 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6497 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6498 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6499 | obj.xid = reader.read("!L")[0] |
| 6500 | _experimenter = reader.read("!L")[0] |
| 6501 | assert(_experimenter == 6035143) |
| 6502 | _subtype = reader.read("!L")[0] |
| 6503 | assert(_subtype == 35) |
| 6504 | obj.port_no = util.unpack_port_no(reader) |
| 6505 | obj.slot_num = reader.read("!B")[0] |
| 6506 | return obj |
| 6507 | |
| 6508 | def __eq__(self, other): |
| 6509 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6510 | if self.xid != other.xid: return False |
| 6511 | if self.port_no != other.port_no: return False |
| 6512 | if self.slot_num != other.slot_num: return False |
| 6513 | return True |
| 6514 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6515 | def pretty_print(self, q): |
| 6516 | q.text("bsn_pdu_rx_timeout {") |
| 6517 | with q.group(): |
| 6518 | with q.indent(2): |
| 6519 | q.breakable() |
| 6520 | q.text("xid = "); |
| 6521 | if self.xid != None: |
| 6522 | q.text("%#x" % self.xid) |
| 6523 | else: |
| 6524 | q.text('None') |
| 6525 | q.text(","); q.breakable() |
| 6526 | q.text("port_no = "); |
| 6527 | q.text(util.pretty_port(self.port_no)) |
| 6528 | q.text(","); q.breakable() |
| 6529 | q.text("slot_num = "); |
| 6530 | q.text("%#x" % self.slot_num) |
| 6531 | q.breakable() |
| 6532 | q.text('}') |
| 6533 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6534 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6535 | |
| 6536 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6537 | version = 4 |
| 6538 | type = 4 |
| 6539 | experimenter = 6035143 |
| 6540 | subtype = 32 |
| 6541 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6542 | 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] | 6543 | if xid != None: |
| 6544 | self.xid = xid |
| 6545 | else: |
| 6546 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6547 | if status != None: |
| 6548 | self.status = status |
| 6549 | else: |
| 6550 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6551 | if port_no != None: |
| 6552 | self.port_no = port_no |
| 6553 | else: |
| 6554 | self.port_no = 0 |
| 6555 | if slot_num != None: |
| 6556 | self.slot_num = slot_num |
| 6557 | else: |
| 6558 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6559 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6560 | |
| 6561 | def pack(self): |
| 6562 | packed = [] |
| 6563 | packed.append(struct.pack("!B", self.version)) |
| 6564 | packed.append(struct.pack("!B", self.type)) |
| 6565 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6566 | packed.append(struct.pack("!L", self.xid)) |
| 6567 | packed.append(struct.pack("!L", self.experimenter)) |
| 6568 | packed.append(struct.pack("!L", self.subtype)) |
| 6569 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6570 | packed.append(util.pack_port_no(self.port_no)) |
| 6571 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6572 | length = sum([len(x) for x in packed]) |
| 6573 | packed[2] = struct.pack("!H", length) |
| 6574 | return ''.join(packed) |
| 6575 | |
| 6576 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6577 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6578 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6579 | _version = reader.read("!B")[0] |
| 6580 | assert(_version == 4) |
| 6581 | _type = reader.read("!B")[0] |
| 6582 | assert(_type == 4) |
| 6583 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6584 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6585 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6586 | obj.xid = reader.read("!L")[0] |
| 6587 | _experimenter = reader.read("!L")[0] |
| 6588 | assert(_experimenter == 6035143) |
| 6589 | _subtype = reader.read("!L")[0] |
| 6590 | assert(_subtype == 32) |
| 6591 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6592 | obj.port_no = util.unpack_port_no(reader) |
| 6593 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6594 | return obj |
| 6595 | |
| 6596 | def __eq__(self, other): |
| 6597 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6598 | if self.xid != other.xid: return False |
| 6599 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6600 | if self.port_no != other.port_no: return False |
| 6601 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6602 | return True |
| 6603 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6604 | def pretty_print(self, q): |
| 6605 | q.text("bsn_pdu_tx_reply {") |
| 6606 | with q.group(): |
| 6607 | with q.indent(2): |
| 6608 | q.breakable() |
| 6609 | q.text("xid = "); |
| 6610 | if self.xid != None: |
| 6611 | q.text("%#x" % self.xid) |
| 6612 | else: |
| 6613 | q.text('None') |
| 6614 | q.text(","); q.breakable() |
| 6615 | q.text("status = "); |
| 6616 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6617 | q.text(","); q.breakable() |
| 6618 | q.text("port_no = "); |
| 6619 | q.text(util.pretty_port(self.port_no)) |
| 6620 | q.text(","); q.breakable() |
| 6621 | q.text("slot_num = "); |
| 6622 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6623 | q.breakable() |
| 6624 | q.text('}') |
| 6625 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6626 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6627 | |
| 6628 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6629 | version = 4 |
| 6630 | type = 4 |
| 6631 | experimenter = 6035143 |
| 6632 | subtype = 31 |
| 6633 | |
| 6634 | 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] | 6635 | if xid != None: |
| 6636 | self.xid = xid |
| 6637 | else: |
| 6638 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6639 | if tx_interval_ms != None: |
| 6640 | self.tx_interval_ms = tx_interval_ms |
| 6641 | else: |
| 6642 | self.tx_interval_ms = 0 |
| 6643 | if port_no != None: |
| 6644 | self.port_no = port_no |
| 6645 | else: |
| 6646 | self.port_no = 0 |
| 6647 | if slot_num != None: |
| 6648 | self.slot_num = slot_num |
| 6649 | else: |
| 6650 | self.slot_num = 0 |
| 6651 | if data != None: |
| 6652 | self.data = data |
| 6653 | else: |
| 6654 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6655 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6656 | |
| 6657 | def pack(self): |
| 6658 | packed = [] |
| 6659 | packed.append(struct.pack("!B", self.version)) |
| 6660 | packed.append(struct.pack("!B", self.type)) |
| 6661 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6662 | packed.append(struct.pack("!L", self.xid)) |
| 6663 | packed.append(struct.pack("!L", self.experimenter)) |
| 6664 | packed.append(struct.pack("!L", self.subtype)) |
| 6665 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6666 | packed.append(util.pack_port_no(self.port_no)) |
| 6667 | packed.append(struct.pack("!B", self.slot_num)) |
| 6668 | packed.append('\x00' * 3) |
| 6669 | packed.append(self.data) |
| 6670 | length = sum([len(x) for x in packed]) |
| 6671 | packed[2] = struct.pack("!H", length) |
| 6672 | return ''.join(packed) |
| 6673 | |
| 6674 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6675 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6676 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6677 | _version = reader.read("!B")[0] |
| 6678 | assert(_version == 4) |
| 6679 | _type = reader.read("!B")[0] |
| 6680 | assert(_type == 4) |
| 6681 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6682 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6683 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6684 | obj.xid = reader.read("!L")[0] |
| 6685 | _experimenter = reader.read("!L")[0] |
| 6686 | assert(_experimenter == 6035143) |
| 6687 | _subtype = reader.read("!L")[0] |
| 6688 | assert(_subtype == 31) |
| 6689 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6690 | obj.port_no = util.unpack_port_no(reader) |
| 6691 | obj.slot_num = reader.read("!B")[0] |
| 6692 | reader.skip(3) |
| 6693 | obj.data = str(reader.read_all()) |
| 6694 | return obj |
| 6695 | |
| 6696 | def __eq__(self, other): |
| 6697 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6698 | if self.xid != other.xid: return False |
| 6699 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6700 | if self.port_no != other.port_no: return False |
| 6701 | if self.slot_num != other.slot_num: return False |
| 6702 | if self.data != other.data: return False |
| 6703 | return True |
| 6704 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6705 | def pretty_print(self, q): |
| 6706 | q.text("bsn_pdu_tx_request {") |
| 6707 | with q.group(): |
| 6708 | with q.indent(2): |
| 6709 | q.breakable() |
| 6710 | q.text("xid = "); |
| 6711 | if self.xid != None: |
| 6712 | q.text("%#x" % self.xid) |
| 6713 | else: |
| 6714 | q.text('None') |
| 6715 | q.text(","); q.breakable() |
| 6716 | q.text("tx_interval_ms = "); |
| 6717 | q.text("%#x" % self.tx_interval_ms) |
| 6718 | q.text(","); q.breakable() |
| 6719 | q.text("port_no = "); |
| 6720 | q.text(util.pretty_port(self.port_no)) |
| 6721 | q.text(","); q.breakable() |
| 6722 | q.text("slot_num = "); |
| 6723 | q.text("%#x" % self.slot_num) |
| 6724 | q.text(","); q.breakable() |
| 6725 | q.text("data = "); |
| 6726 | q.pp(self.data) |
| 6727 | q.breakable() |
| 6728 | q.text('}') |
| 6729 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6730 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6731 | |
| 6732 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6733 | version = 4 |
| 6734 | type = 19 |
| 6735 | stats_type = 65535 |
| 6736 | experimenter = 6035143 |
| 6737 | subtype = 8 |
| 6738 | |
| 6739 | def __init__(self, xid=None, flags=None, entries=None): |
| 6740 | if xid != None: |
| 6741 | self.xid = xid |
| 6742 | else: |
| 6743 | self.xid = None |
| 6744 | if flags != None: |
| 6745 | self.flags = flags |
| 6746 | else: |
| 6747 | self.flags = 0 |
| 6748 | if entries != None: |
| 6749 | self.entries = entries |
| 6750 | else: |
| 6751 | self.entries = [] |
| 6752 | return |
| 6753 | |
| 6754 | def pack(self): |
| 6755 | packed = [] |
| 6756 | packed.append(struct.pack("!B", self.version)) |
| 6757 | packed.append(struct.pack("!B", self.type)) |
| 6758 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6759 | packed.append(struct.pack("!L", self.xid)) |
| 6760 | packed.append(struct.pack("!H", self.stats_type)) |
| 6761 | packed.append(struct.pack("!H", self.flags)) |
| 6762 | packed.append('\x00' * 4) |
| 6763 | packed.append(struct.pack("!L", self.experimenter)) |
| 6764 | packed.append(struct.pack("!L", self.subtype)) |
| 6765 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6766 | length = sum([len(x) for x in packed]) |
| 6767 | packed[2] = struct.pack("!H", length) |
| 6768 | return ''.join(packed) |
| 6769 | |
| 6770 | @staticmethod |
| 6771 | def unpack(reader): |
| 6772 | obj = bsn_port_counter_stats_reply() |
| 6773 | _version = reader.read("!B")[0] |
| 6774 | assert(_version == 4) |
| 6775 | _type = reader.read("!B")[0] |
| 6776 | assert(_type == 19) |
| 6777 | _length = reader.read("!H")[0] |
| 6778 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6779 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6780 | obj.xid = reader.read("!L")[0] |
| 6781 | _stats_type = reader.read("!H")[0] |
| 6782 | assert(_stats_type == 65535) |
| 6783 | obj.flags = reader.read("!H")[0] |
| 6784 | reader.skip(4) |
| 6785 | _experimenter = reader.read("!L")[0] |
| 6786 | assert(_experimenter == 6035143) |
| 6787 | _subtype = reader.read("!L")[0] |
| 6788 | assert(_subtype == 8) |
| 6789 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 6790 | return obj |
| 6791 | |
| 6792 | def __eq__(self, other): |
| 6793 | if type(self) != type(other): return False |
| 6794 | if self.xid != other.xid: return False |
| 6795 | if self.flags != other.flags: return False |
| 6796 | if self.entries != other.entries: return False |
| 6797 | return True |
| 6798 | |
| 6799 | def pretty_print(self, q): |
| 6800 | q.text("bsn_port_counter_stats_reply {") |
| 6801 | with q.group(): |
| 6802 | with q.indent(2): |
| 6803 | q.breakable() |
| 6804 | q.text("xid = "); |
| 6805 | if self.xid != None: |
| 6806 | q.text("%#x" % self.xid) |
| 6807 | else: |
| 6808 | q.text('None') |
| 6809 | q.text(","); q.breakable() |
| 6810 | q.text("flags = "); |
| 6811 | q.text("%#x" % self.flags) |
| 6812 | q.text(","); q.breakable() |
| 6813 | q.text("entries = "); |
| 6814 | q.pp(self.entries) |
| 6815 | q.breakable() |
| 6816 | q.text('}') |
| 6817 | |
| 6818 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6819 | |
| 6820 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6821 | version = 4 |
| 6822 | type = 18 |
| 6823 | stats_type = 65535 |
| 6824 | experimenter = 6035143 |
| 6825 | subtype = 8 |
| 6826 | |
| 6827 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6828 | if xid != None: |
| 6829 | self.xid = xid |
| 6830 | else: |
| 6831 | self.xid = None |
| 6832 | if flags != None: |
| 6833 | self.flags = flags |
| 6834 | else: |
| 6835 | self.flags = 0 |
| 6836 | if port_no != None: |
| 6837 | self.port_no = port_no |
| 6838 | else: |
| 6839 | self.port_no = 0 |
| 6840 | return |
| 6841 | |
| 6842 | def pack(self): |
| 6843 | packed = [] |
| 6844 | packed.append(struct.pack("!B", self.version)) |
| 6845 | packed.append(struct.pack("!B", self.type)) |
| 6846 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6847 | packed.append(struct.pack("!L", self.xid)) |
| 6848 | packed.append(struct.pack("!H", self.stats_type)) |
| 6849 | packed.append(struct.pack("!H", self.flags)) |
| 6850 | packed.append('\x00' * 4) |
| 6851 | packed.append(struct.pack("!L", self.experimenter)) |
| 6852 | packed.append(struct.pack("!L", self.subtype)) |
| 6853 | packed.append(util.pack_port_no(self.port_no)) |
| 6854 | length = sum([len(x) for x in packed]) |
| 6855 | packed[2] = struct.pack("!H", length) |
| 6856 | return ''.join(packed) |
| 6857 | |
| 6858 | @staticmethod |
| 6859 | def unpack(reader): |
| 6860 | obj = bsn_port_counter_stats_request() |
| 6861 | _version = reader.read("!B")[0] |
| 6862 | assert(_version == 4) |
| 6863 | _type = reader.read("!B")[0] |
| 6864 | assert(_type == 18) |
| 6865 | _length = reader.read("!H")[0] |
| 6866 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6867 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6868 | obj.xid = reader.read("!L")[0] |
| 6869 | _stats_type = reader.read("!H")[0] |
| 6870 | assert(_stats_type == 65535) |
| 6871 | obj.flags = reader.read("!H")[0] |
| 6872 | reader.skip(4) |
| 6873 | _experimenter = reader.read("!L")[0] |
| 6874 | assert(_experimenter == 6035143) |
| 6875 | _subtype = reader.read("!L")[0] |
| 6876 | assert(_subtype == 8) |
| 6877 | obj.port_no = util.unpack_port_no(reader) |
| 6878 | return obj |
| 6879 | |
| 6880 | def __eq__(self, other): |
| 6881 | if type(self) != type(other): return False |
| 6882 | if self.xid != other.xid: return False |
| 6883 | if self.flags != other.flags: return False |
| 6884 | if self.port_no != other.port_no: return False |
| 6885 | return True |
| 6886 | |
| 6887 | def pretty_print(self, q): |
| 6888 | q.text("bsn_port_counter_stats_request {") |
| 6889 | with q.group(): |
| 6890 | with q.indent(2): |
| 6891 | q.breakable() |
| 6892 | q.text("xid = "); |
| 6893 | if self.xid != None: |
| 6894 | q.text("%#x" % self.xid) |
| 6895 | else: |
| 6896 | q.text('None') |
| 6897 | q.text(","); q.breakable() |
| 6898 | q.text("flags = "); |
| 6899 | q.text("%#x" % self.flags) |
| 6900 | q.text(","); q.breakable() |
| 6901 | q.text("port_no = "); |
| 6902 | q.text(util.pretty_port(self.port_no)) |
| 6903 | q.breakable() |
| 6904 | q.text('}') |
| 6905 | |
| 6906 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6907 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6908 | class bsn_role_status(bsn_header): |
| 6909 | version = 4 |
| 6910 | type = 4 |
| 6911 | experimenter = 6035143 |
| 6912 | subtype = 55 |
| 6913 | |
| 6914 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6915 | if xid != None: |
| 6916 | self.xid = xid |
| 6917 | else: |
| 6918 | self.xid = None |
| 6919 | if role != None: |
| 6920 | self.role = role |
| 6921 | else: |
| 6922 | self.role = 0 |
| 6923 | if reason != None: |
| 6924 | self.reason = reason |
| 6925 | else: |
| 6926 | self.reason = 0 |
| 6927 | if generation_id != None: |
| 6928 | self.generation_id = generation_id |
| 6929 | else: |
| 6930 | self.generation_id = 0 |
| 6931 | return |
| 6932 | |
| 6933 | def pack(self): |
| 6934 | packed = [] |
| 6935 | packed.append(struct.pack("!B", self.version)) |
| 6936 | packed.append(struct.pack("!B", self.type)) |
| 6937 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6938 | packed.append(struct.pack("!L", self.xid)) |
| 6939 | packed.append(struct.pack("!L", self.experimenter)) |
| 6940 | packed.append(struct.pack("!L", self.subtype)) |
| 6941 | packed.append(struct.pack("!L", self.role)) |
| 6942 | packed.append(struct.pack("!B", self.reason)) |
| 6943 | packed.append('\x00' * 3) |
| 6944 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6945 | length = sum([len(x) for x in packed]) |
| 6946 | packed[2] = struct.pack("!H", length) |
| 6947 | return ''.join(packed) |
| 6948 | |
| 6949 | @staticmethod |
| 6950 | def unpack(reader): |
| 6951 | obj = bsn_role_status() |
| 6952 | _version = reader.read("!B")[0] |
| 6953 | assert(_version == 4) |
| 6954 | _type = reader.read("!B")[0] |
| 6955 | assert(_type == 4) |
| 6956 | _length = reader.read("!H")[0] |
| 6957 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6958 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6959 | obj.xid = reader.read("!L")[0] |
| 6960 | _experimenter = reader.read("!L")[0] |
| 6961 | assert(_experimenter == 6035143) |
| 6962 | _subtype = reader.read("!L")[0] |
| 6963 | assert(_subtype == 55) |
| 6964 | obj.role = reader.read("!L")[0] |
| 6965 | obj.reason = reader.read("!B")[0] |
| 6966 | reader.skip(3) |
| 6967 | obj.generation_id = reader.read("!Q")[0] |
| 6968 | return obj |
| 6969 | |
| 6970 | def __eq__(self, other): |
| 6971 | if type(self) != type(other): return False |
| 6972 | if self.xid != other.xid: return False |
| 6973 | if self.role != other.role: return False |
| 6974 | if self.reason != other.reason: return False |
| 6975 | if self.generation_id != other.generation_id: return False |
| 6976 | return True |
| 6977 | |
| 6978 | def pretty_print(self, q): |
| 6979 | q.text("bsn_role_status {") |
| 6980 | with q.group(): |
| 6981 | with q.indent(2): |
| 6982 | q.breakable() |
| 6983 | q.text("xid = "); |
| 6984 | if self.xid != None: |
| 6985 | q.text("%#x" % self.xid) |
| 6986 | else: |
| 6987 | q.text('None') |
| 6988 | q.text(","); q.breakable() |
| 6989 | q.text("role = "); |
| 6990 | q.text("%#x" % self.role) |
| 6991 | q.text(","); q.breakable() |
| 6992 | q.text("reason = "); |
| 6993 | q.text("%#x" % self.reason) |
| 6994 | q.text(","); q.breakable() |
| 6995 | q.text("generation_id = "); |
| 6996 | q.text("%#x" % self.generation_id) |
| 6997 | q.breakable() |
| 6998 | q.text('}') |
| 6999 | |
| 7000 | bsn_header.subtypes[55] = bsn_role_status |
| 7001 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7002 | class bsn_set_aux_cxns_reply(bsn_header): |
| 7003 | version = 4 |
| 7004 | type = 4 |
| 7005 | experimenter = 6035143 |
| 7006 | subtype = 59 |
| 7007 | |
| 7008 | def __init__(self, xid=None, num_aux=None, status=None): |
| 7009 | if xid != None: |
| 7010 | self.xid = xid |
| 7011 | else: |
| 7012 | self.xid = None |
| 7013 | if num_aux != None: |
| 7014 | self.num_aux = num_aux |
| 7015 | else: |
| 7016 | self.num_aux = 0 |
| 7017 | if status != None: |
| 7018 | self.status = status |
| 7019 | else: |
| 7020 | self.status = 0 |
| 7021 | return |
| 7022 | |
| 7023 | def pack(self): |
| 7024 | packed = [] |
| 7025 | packed.append(struct.pack("!B", self.version)) |
| 7026 | packed.append(struct.pack("!B", self.type)) |
| 7027 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7028 | packed.append(struct.pack("!L", self.xid)) |
| 7029 | packed.append(struct.pack("!L", self.experimenter)) |
| 7030 | packed.append(struct.pack("!L", self.subtype)) |
| 7031 | packed.append(struct.pack("!L", self.num_aux)) |
| 7032 | packed.append(struct.pack("!L", self.status)) |
| 7033 | length = sum([len(x) for x in packed]) |
| 7034 | packed[2] = struct.pack("!H", length) |
| 7035 | return ''.join(packed) |
| 7036 | |
| 7037 | @staticmethod |
| 7038 | def unpack(reader): |
| 7039 | obj = bsn_set_aux_cxns_reply() |
| 7040 | _version = reader.read("!B")[0] |
| 7041 | assert(_version == 4) |
| 7042 | _type = reader.read("!B")[0] |
| 7043 | assert(_type == 4) |
| 7044 | _length = reader.read("!H")[0] |
| 7045 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7046 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7047 | obj.xid = reader.read("!L")[0] |
| 7048 | _experimenter = reader.read("!L")[0] |
| 7049 | assert(_experimenter == 6035143) |
| 7050 | _subtype = reader.read("!L")[0] |
| 7051 | assert(_subtype == 59) |
| 7052 | obj.num_aux = reader.read("!L")[0] |
| 7053 | obj.status = reader.read("!L")[0] |
| 7054 | return obj |
| 7055 | |
| 7056 | def __eq__(self, other): |
| 7057 | if type(self) != type(other): return False |
| 7058 | if self.xid != other.xid: return False |
| 7059 | if self.num_aux != other.num_aux: return False |
| 7060 | if self.status != other.status: return False |
| 7061 | return True |
| 7062 | |
| 7063 | def pretty_print(self, q): |
| 7064 | q.text("bsn_set_aux_cxns_reply {") |
| 7065 | with q.group(): |
| 7066 | with q.indent(2): |
| 7067 | q.breakable() |
| 7068 | q.text("xid = "); |
| 7069 | if self.xid != None: |
| 7070 | q.text("%#x" % self.xid) |
| 7071 | else: |
| 7072 | q.text('None') |
| 7073 | q.text(","); q.breakable() |
| 7074 | q.text("num_aux = "); |
| 7075 | q.text("%#x" % self.num_aux) |
| 7076 | q.text(","); q.breakable() |
| 7077 | q.text("status = "); |
| 7078 | q.text("%#x" % self.status) |
| 7079 | q.breakable() |
| 7080 | q.text('}') |
| 7081 | |
| 7082 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 7083 | |
| 7084 | class bsn_set_aux_cxns_request(bsn_header): |
| 7085 | version = 4 |
| 7086 | type = 4 |
| 7087 | experimenter = 6035143 |
| 7088 | subtype = 58 |
| 7089 | |
| 7090 | def __init__(self, xid=None, num_aux=None): |
| 7091 | if xid != None: |
| 7092 | self.xid = xid |
| 7093 | else: |
| 7094 | self.xid = None |
| 7095 | if num_aux != None: |
| 7096 | self.num_aux = num_aux |
| 7097 | else: |
| 7098 | self.num_aux = 0 |
| 7099 | return |
| 7100 | |
| 7101 | def pack(self): |
| 7102 | packed = [] |
| 7103 | packed.append(struct.pack("!B", self.version)) |
| 7104 | packed.append(struct.pack("!B", self.type)) |
| 7105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7106 | packed.append(struct.pack("!L", self.xid)) |
| 7107 | packed.append(struct.pack("!L", self.experimenter)) |
| 7108 | packed.append(struct.pack("!L", self.subtype)) |
| 7109 | packed.append(struct.pack("!L", self.num_aux)) |
| 7110 | length = sum([len(x) for x in packed]) |
| 7111 | packed[2] = struct.pack("!H", length) |
| 7112 | return ''.join(packed) |
| 7113 | |
| 7114 | @staticmethod |
| 7115 | def unpack(reader): |
| 7116 | obj = bsn_set_aux_cxns_request() |
| 7117 | _version = reader.read("!B")[0] |
| 7118 | assert(_version == 4) |
| 7119 | _type = reader.read("!B")[0] |
| 7120 | assert(_type == 4) |
| 7121 | _length = reader.read("!H")[0] |
| 7122 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7123 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7124 | obj.xid = reader.read("!L")[0] |
| 7125 | _experimenter = reader.read("!L")[0] |
| 7126 | assert(_experimenter == 6035143) |
| 7127 | _subtype = reader.read("!L")[0] |
| 7128 | assert(_subtype == 58) |
| 7129 | obj.num_aux = reader.read("!L")[0] |
| 7130 | return obj |
| 7131 | |
| 7132 | def __eq__(self, other): |
| 7133 | if type(self) != type(other): return False |
| 7134 | if self.xid != other.xid: return False |
| 7135 | if self.num_aux != other.num_aux: return False |
| 7136 | return True |
| 7137 | |
| 7138 | def pretty_print(self, q): |
| 7139 | q.text("bsn_set_aux_cxns_request {") |
| 7140 | with q.group(): |
| 7141 | with q.indent(2): |
| 7142 | q.breakable() |
| 7143 | q.text("xid = "); |
| 7144 | if self.xid != None: |
| 7145 | q.text("%#x" % self.xid) |
| 7146 | else: |
| 7147 | q.text('None') |
| 7148 | q.text(","); q.breakable() |
| 7149 | q.text("num_aux = "); |
| 7150 | q.text("%#x" % self.num_aux) |
| 7151 | q.breakable() |
| 7152 | q.text('}') |
| 7153 | |
| 7154 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 7155 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7156 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7157 | version = 4 |
| 7158 | type = 4 |
| 7159 | experimenter = 6035143 |
| 7160 | subtype = 42 |
| 7161 | |
| 7162 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7163 | if xid != None: |
| 7164 | self.xid = xid |
| 7165 | else: |
| 7166 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7167 | if status != None: |
| 7168 | self.status = status |
| 7169 | else: |
| 7170 | self.status = 0 |
| 7171 | if port_no != None: |
| 7172 | self.port_no = port_no |
| 7173 | else: |
| 7174 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7175 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7176 | |
| 7177 | def pack(self): |
| 7178 | packed = [] |
| 7179 | packed.append(struct.pack("!B", self.version)) |
| 7180 | packed.append(struct.pack("!B", self.type)) |
| 7181 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7182 | packed.append(struct.pack("!L", self.xid)) |
| 7183 | packed.append(struct.pack("!L", self.experimenter)) |
| 7184 | packed.append(struct.pack("!L", self.subtype)) |
| 7185 | packed.append(struct.pack("!L", self.status)) |
| 7186 | packed.append(util.pack_port_no(self.port_no)) |
| 7187 | length = sum([len(x) for x in packed]) |
| 7188 | packed[2] = struct.pack("!H", length) |
| 7189 | return ''.join(packed) |
| 7190 | |
| 7191 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7192 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7193 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7194 | _version = reader.read("!B")[0] |
| 7195 | assert(_version == 4) |
| 7196 | _type = reader.read("!B")[0] |
| 7197 | assert(_type == 4) |
| 7198 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7199 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7200 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7201 | obj.xid = reader.read("!L")[0] |
| 7202 | _experimenter = reader.read("!L")[0] |
| 7203 | assert(_experimenter == 6035143) |
| 7204 | _subtype = reader.read("!L")[0] |
| 7205 | assert(_subtype == 42) |
| 7206 | obj.status = reader.read("!L")[0] |
| 7207 | obj.port_no = util.unpack_port_no(reader) |
| 7208 | return obj |
| 7209 | |
| 7210 | def __eq__(self, other): |
| 7211 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7212 | if self.xid != other.xid: return False |
| 7213 | if self.status != other.status: return False |
| 7214 | if self.port_no != other.port_no: return False |
| 7215 | return True |
| 7216 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7217 | def pretty_print(self, q): |
| 7218 | q.text("bsn_set_lacp_reply {") |
| 7219 | with q.group(): |
| 7220 | with q.indent(2): |
| 7221 | q.breakable() |
| 7222 | q.text("xid = "); |
| 7223 | if self.xid != None: |
| 7224 | q.text("%#x" % self.xid) |
| 7225 | else: |
| 7226 | q.text('None') |
| 7227 | q.text(","); q.breakable() |
| 7228 | q.text("status = "); |
| 7229 | q.text("%#x" % self.status) |
| 7230 | q.text(","); q.breakable() |
| 7231 | q.text("port_no = "); |
| 7232 | q.text(util.pretty_port(self.port_no)) |
| 7233 | q.breakable() |
| 7234 | q.text('}') |
| 7235 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7236 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 7237 | |
| 7238 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7239 | version = 4 |
| 7240 | type = 4 |
| 7241 | experimenter = 6035143 |
| 7242 | subtype = 41 |
| 7243 | |
| 7244 | 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] | 7245 | if xid != None: |
| 7246 | self.xid = xid |
| 7247 | else: |
| 7248 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7249 | if enabled != None: |
| 7250 | self.enabled = enabled |
| 7251 | else: |
| 7252 | self.enabled = 0 |
| 7253 | if port_no != None: |
| 7254 | self.port_no = port_no |
| 7255 | else: |
| 7256 | self.port_no = 0 |
| 7257 | if actor_sys_priority != None: |
| 7258 | self.actor_sys_priority = actor_sys_priority |
| 7259 | else: |
| 7260 | self.actor_sys_priority = 0 |
| 7261 | if actor_sys_mac != None: |
| 7262 | self.actor_sys_mac = actor_sys_mac |
| 7263 | else: |
| 7264 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 7265 | if actor_port_priority != None: |
| 7266 | self.actor_port_priority = actor_port_priority |
| 7267 | else: |
| 7268 | self.actor_port_priority = 0 |
| 7269 | if actor_port_num != None: |
| 7270 | self.actor_port_num = actor_port_num |
| 7271 | else: |
| 7272 | self.actor_port_num = 0 |
| 7273 | if actor_key != None: |
| 7274 | self.actor_key = actor_key |
| 7275 | else: |
| 7276 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7277 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7278 | |
| 7279 | def pack(self): |
| 7280 | packed = [] |
| 7281 | packed.append(struct.pack("!B", self.version)) |
| 7282 | packed.append(struct.pack("!B", self.type)) |
| 7283 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7284 | packed.append(struct.pack("!L", self.xid)) |
| 7285 | packed.append(struct.pack("!L", self.experimenter)) |
| 7286 | packed.append(struct.pack("!L", self.subtype)) |
| 7287 | packed.append(struct.pack("!B", self.enabled)) |
| 7288 | packed.append('\x00' * 3) |
| 7289 | packed.append(util.pack_port_no(self.port_no)) |
| 7290 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 7291 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 7292 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 7293 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 7294 | packed.append(struct.pack("!H", self.actor_key)) |
| 7295 | length = sum([len(x) for x in packed]) |
| 7296 | packed[2] = struct.pack("!H", length) |
| 7297 | return ''.join(packed) |
| 7298 | |
| 7299 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7300 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7301 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7302 | _version = reader.read("!B")[0] |
| 7303 | assert(_version == 4) |
| 7304 | _type = reader.read("!B")[0] |
| 7305 | assert(_type == 4) |
| 7306 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7307 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7308 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7309 | obj.xid = reader.read("!L")[0] |
| 7310 | _experimenter = reader.read("!L")[0] |
| 7311 | assert(_experimenter == 6035143) |
| 7312 | _subtype = reader.read("!L")[0] |
| 7313 | assert(_subtype == 41) |
| 7314 | obj.enabled = reader.read("!B")[0] |
| 7315 | reader.skip(3) |
| 7316 | obj.port_no = util.unpack_port_no(reader) |
| 7317 | obj.actor_sys_priority = reader.read("!H")[0] |
| 7318 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 7319 | obj.actor_port_priority = reader.read("!H")[0] |
| 7320 | obj.actor_port_num = reader.read("!H")[0] |
| 7321 | obj.actor_key = reader.read("!H")[0] |
| 7322 | return obj |
| 7323 | |
| 7324 | def __eq__(self, other): |
| 7325 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7326 | if self.xid != other.xid: return False |
| 7327 | if self.enabled != other.enabled: return False |
| 7328 | if self.port_no != other.port_no: return False |
| 7329 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 7330 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 7331 | if self.actor_port_priority != other.actor_port_priority: return False |
| 7332 | if self.actor_port_num != other.actor_port_num: return False |
| 7333 | if self.actor_key != other.actor_key: return False |
| 7334 | return True |
| 7335 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7336 | def pretty_print(self, q): |
| 7337 | q.text("bsn_set_lacp_request {") |
| 7338 | with q.group(): |
| 7339 | with q.indent(2): |
| 7340 | q.breakable() |
| 7341 | q.text("xid = "); |
| 7342 | if self.xid != None: |
| 7343 | q.text("%#x" % self.xid) |
| 7344 | else: |
| 7345 | q.text('None') |
| 7346 | q.text(","); q.breakable() |
| 7347 | q.text("enabled = "); |
| 7348 | q.text("%#x" % self.enabled) |
| 7349 | q.text(","); q.breakable() |
| 7350 | q.text("port_no = "); |
| 7351 | q.text(util.pretty_port(self.port_no)) |
| 7352 | q.text(","); q.breakable() |
| 7353 | q.text("actor_sys_priority = "); |
| 7354 | q.text("%#x" % self.actor_sys_priority) |
| 7355 | q.text(","); q.breakable() |
| 7356 | q.text("actor_sys_mac = "); |
| 7357 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 7358 | q.text(","); q.breakable() |
| 7359 | q.text("actor_port_priority = "); |
| 7360 | q.text("%#x" % self.actor_port_priority) |
| 7361 | q.text(","); q.breakable() |
| 7362 | q.text("actor_port_num = "); |
| 7363 | q.text("%#x" % self.actor_port_num) |
| 7364 | q.text(","); q.breakable() |
| 7365 | q.text("actor_key = "); |
| 7366 | q.text("%#x" % self.actor_key) |
| 7367 | q.breakable() |
| 7368 | q.text('}') |
| 7369 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7370 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 7371 | |
| 7372 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7373 | version = 4 |
| 7374 | type = 4 |
| 7375 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7376 | subtype = 3 |
| 7377 | |
| 7378 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7379 | if xid != None: |
| 7380 | self.xid = xid |
| 7381 | else: |
| 7382 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7383 | if report_mirror_ports != None: |
| 7384 | self.report_mirror_ports = report_mirror_ports |
| 7385 | else: |
| 7386 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7387 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7388 | |
| 7389 | def pack(self): |
| 7390 | packed = [] |
| 7391 | packed.append(struct.pack("!B", self.version)) |
| 7392 | packed.append(struct.pack("!B", self.type)) |
| 7393 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7394 | packed.append(struct.pack("!L", self.xid)) |
| 7395 | packed.append(struct.pack("!L", self.experimenter)) |
| 7396 | packed.append(struct.pack("!L", self.subtype)) |
| 7397 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 7398 | packed.append('\x00' * 3) |
| 7399 | length = sum([len(x) for x in packed]) |
| 7400 | packed[2] = struct.pack("!H", length) |
| 7401 | return ''.join(packed) |
| 7402 | |
| 7403 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7404 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7405 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7406 | _version = reader.read("!B")[0] |
| 7407 | assert(_version == 4) |
| 7408 | _type = reader.read("!B")[0] |
| 7409 | assert(_type == 4) |
| 7410 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7411 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7412 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7413 | obj.xid = reader.read("!L")[0] |
| 7414 | _experimenter = reader.read("!L")[0] |
| 7415 | assert(_experimenter == 6035143) |
| 7416 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7417 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7418 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7419 | reader.skip(3) |
| 7420 | return obj |
| 7421 | |
| 7422 | def __eq__(self, other): |
| 7423 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7424 | if self.xid != other.xid: return False |
| 7425 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 7426 | return True |
| 7427 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7428 | def pretty_print(self, q): |
| 7429 | q.text("bsn_set_mirroring {") |
| 7430 | with q.group(): |
| 7431 | with q.indent(2): |
| 7432 | q.breakable() |
| 7433 | q.text("xid = "); |
| 7434 | if self.xid != None: |
| 7435 | q.text("%#x" % self.xid) |
| 7436 | else: |
| 7437 | q.text('None') |
| 7438 | q.text(","); q.breakable() |
| 7439 | q.text("report_mirror_ports = "); |
| 7440 | q.text("%#x" % self.report_mirror_ports) |
| 7441 | q.breakable() |
| 7442 | q.text('}') |
| 7443 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7444 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 7445 | |
| 7446 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7447 | version = 4 |
| 7448 | type = 4 |
| 7449 | experimenter = 6035143 |
| 7450 | subtype = 25 |
| 7451 | |
| 7452 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7453 | if xid != None: |
| 7454 | self.xid = xid |
| 7455 | else: |
| 7456 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7457 | if status != None: |
| 7458 | self.status = status |
| 7459 | else: |
| 7460 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7461 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7462 | |
| 7463 | def pack(self): |
| 7464 | packed = [] |
| 7465 | packed.append(struct.pack("!B", self.version)) |
| 7466 | packed.append(struct.pack("!B", self.type)) |
| 7467 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7468 | packed.append(struct.pack("!L", self.xid)) |
| 7469 | packed.append(struct.pack("!L", self.experimenter)) |
| 7470 | packed.append(struct.pack("!L", self.subtype)) |
| 7471 | packed.append(struct.pack("!L", self.status)) |
| 7472 | length = sum([len(x) for x in packed]) |
| 7473 | packed[2] = struct.pack("!H", length) |
| 7474 | return ''.join(packed) |
| 7475 | |
| 7476 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7477 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7478 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7479 | _version = reader.read("!B")[0] |
| 7480 | assert(_version == 4) |
| 7481 | _type = reader.read("!B")[0] |
| 7482 | assert(_type == 4) |
| 7483 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7484 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7485 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7486 | obj.xid = reader.read("!L")[0] |
| 7487 | _experimenter = reader.read("!L")[0] |
| 7488 | assert(_experimenter == 6035143) |
| 7489 | _subtype = reader.read("!L")[0] |
| 7490 | assert(_subtype == 25) |
| 7491 | obj.status = reader.read("!L")[0] |
| 7492 | return obj |
| 7493 | |
| 7494 | def __eq__(self, other): |
| 7495 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7496 | if self.xid != other.xid: return False |
| 7497 | if self.status != other.status: return False |
| 7498 | return True |
| 7499 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7500 | def pretty_print(self, q): |
| 7501 | q.text("bsn_set_pktin_suppression_reply {") |
| 7502 | with q.group(): |
| 7503 | with q.indent(2): |
| 7504 | q.breakable() |
| 7505 | q.text("xid = "); |
| 7506 | if self.xid != None: |
| 7507 | q.text("%#x" % self.xid) |
| 7508 | else: |
| 7509 | q.text('None') |
| 7510 | q.text(","); q.breakable() |
| 7511 | q.text("status = "); |
| 7512 | q.text("%#x" % self.status) |
| 7513 | q.breakable() |
| 7514 | q.text('}') |
| 7515 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7516 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7517 | |
| 7518 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7519 | version = 4 |
| 7520 | type = 4 |
| 7521 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7522 | subtype = 11 |
| 7523 | |
| 7524 | 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] | 7525 | if xid != None: |
| 7526 | self.xid = xid |
| 7527 | else: |
| 7528 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7529 | if enabled != None: |
| 7530 | self.enabled = enabled |
| 7531 | else: |
| 7532 | self.enabled = 0 |
| 7533 | if idle_timeout != None: |
| 7534 | self.idle_timeout = idle_timeout |
| 7535 | else: |
| 7536 | self.idle_timeout = 0 |
| 7537 | if hard_timeout != None: |
| 7538 | self.hard_timeout = hard_timeout |
| 7539 | else: |
| 7540 | self.hard_timeout = 0 |
| 7541 | if priority != None: |
| 7542 | self.priority = priority |
| 7543 | else: |
| 7544 | self.priority = 0 |
| 7545 | if cookie != None: |
| 7546 | self.cookie = cookie |
| 7547 | else: |
| 7548 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7549 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7550 | |
| 7551 | def pack(self): |
| 7552 | packed = [] |
| 7553 | packed.append(struct.pack("!B", self.version)) |
| 7554 | packed.append(struct.pack("!B", self.type)) |
| 7555 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7556 | packed.append(struct.pack("!L", self.xid)) |
| 7557 | packed.append(struct.pack("!L", self.experimenter)) |
| 7558 | packed.append(struct.pack("!L", self.subtype)) |
| 7559 | packed.append(struct.pack("!B", self.enabled)) |
| 7560 | packed.append('\x00' * 1) |
| 7561 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7562 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7563 | packed.append(struct.pack("!H", self.priority)) |
| 7564 | packed.append(struct.pack("!Q", self.cookie)) |
| 7565 | length = sum([len(x) for x in packed]) |
| 7566 | packed[2] = struct.pack("!H", length) |
| 7567 | return ''.join(packed) |
| 7568 | |
| 7569 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7570 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7571 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7572 | _version = reader.read("!B")[0] |
| 7573 | assert(_version == 4) |
| 7574 | _type = reader.read("!B")[0] |
| 7575 | assert(_type == 4) |
| 7576 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7577 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7578 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7579 | obj.xid = reader.read("!L")[0] |
| 7580 | _experimenter = reader.read("!L")[0] |
| 7581 | assert(_experimenter == 6035143) |
| 7582 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7583 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7584 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7585 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7586 | obj.idle_timeout = reader.read("!H")[0] |
| 7587 | obj.hard_timeout = reader.read("!H")[0] |
| 7588 | obj.priority = reader.read("!H")[0] |
| 7589 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7590 | return obj |
| 7591 | |
| 7592 | def __eq__(self, other): |
| 7593 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7594 | if self.xid != other.xid: return False |
| 7595 | if self.enabled != other.enabled: return False |
| 7596 | if self.idle_timeout != other.idle_timeout: return False |
| 7597 | if self.hard_timeout != other.hard_timeout: return False |
| 7598 | if self.priority != other.priority: return False |
| 7599 | if self.cookie != other.cookie: return False |
| 7600 | return True |
| 7601 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7602 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7603 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7604 | with q.group(): |
| 7605 | with q.indent(2): |
| 7606 | q.breakable() |
| 7607 | q.text("xid = "); |
| 7608 | if self.xid != None: |
| 7609 | q.text("%#x" % self.xid) |
| 7610 | else: |
| 7611 | q.text('None') |
| 7612 | q.text(","); q.breakable() |
| 7613 | q.text("enabled = "); |
| 7614 | q.text("%#x" % self.enabled) |
| 7615 | q.text(","); q.breakable() |
| 7616 | q.text("idle_timeout = "); |
| 7617 | q.text("%#x" % self.idle_timeout) |
| 7618 | q.text(","); q.breakable() |
| 7619 | q.text("hard_timeout = "); |
| 7620 | q.text("%#x" % self.hard_timeout) |
| 7621 | q.text(","); q.breakable() |
| 7622 | q.text("priority = "); |
| 7623 | q.text("%#x" % self.priority) |
| 7624 | q.text(","); q.breakable() |
| 7625 | q.text("cookie = "); |
| 7626 | q.text("%#x" % self.cookie) |
| 7627 | q.breakable() |
| 7628 | q.text('}') |
| 7629 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7630 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7631 | |
| 7632 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7633 | version = 4 |
| 7634 | type = 4 |
| 7635 | experimenter = 6035143 |
| 7636 | subtype = 54 |
| 7637 | |
| 7638 | def __init__(self, xid=None, status=None): |
| 7639 | if xid != None: |
| 7640 | self.xid = xid |
| 7641 | else: |
| 7642 | self.xid = None |
| 7643 | if status != None: |
| 7644 | self.status = status |
| 7645 | else: |
| 7646 | self.status = 0 |
| 7647 | return |
| 7648 | |
| 7649 | def pack(self): |
| 7650 | packed = [] |
| 7651 | packed.append(struct.pack("!B", self.version)) |
| 7652 | packed.append(struct.pack("!B", self.type)) |
| 7653 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7654 | packed.append(struct.pack("!L", self.xid)) |
| 7655 | packed.append(struct.pack("!L", self.experimenter)) |
| 7656 | packed.append(struct.pack("!L", self.subtype)) |
| 7657 | packed.append(struct.pack("!L", self.status)) |
| 7658 | length = sum([len(x) for x in packed]) |
| 7659 | packed[2] = struct.pack("!H", length) |
| 7660 | return ''.join(packed) |
| 7661 | |
| 7662 | @staticmethod |
| 7663 | def unpack(reader): |
| 7664 | obj = bsn_set_switch_pipeline_reply() |
| 7665 | _version = reader.read("!B")[0] |
| 7666 | assert(_version == 4) |
| 7667 | _type = reader.read("!B")[0] |
| 7668 | assert(_type == 4) |
| 7669 | _length = reader.read("!H")[0] |
| 7670 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7671 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7672 | obj.xid = reader.read("!L")[0] |
| 7673 | _experimenter = reader.read("!L")[0] |
| 7674 | assert(_experimenter == 6035143) |
| 7675 | _subtype = reader.read("!L")[0] |
| 7676 | assert(_subtype == 54) |
| 7677 | obj.status = reader.read("!L")[0] |
| 7678 | return obj |
| 7679 | |
| 7680 | def __eq__(self, other): |
| 7681 | if type(self) != type(other): return False |
| 7682 | if self.xid != other.xid: return False |
| 7683 | if self.status != other.status: return False |
| 7684 | return True |
| 7685 | |
| 7686 | def pretty_print(self, q): |
| 7687 | q.text("bsn_set_switch_pipeline_reply {") |
| 7688 | with q.group(): |
| 7689 | with q.indent(2): |
| 7690 | q.breakable() |
| 7691 | q.text("xid = "); |
| 7692 | if self.xid != None: |
| 7693 | q.text("%#x" % self.xid) |
| 7694 | else: |
| 7695 | q.text('None') |
| 7696 | q.text(","); q.breakable() |
| 7697 | q.text("status = "); |
| 7698 | q.text("%#x" % self.status) |
| 7699 | q.breakable() |
| 7700 | q.text('}') |
| 7701 | |
| 7702 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7703 | |
| 7704 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7705 | version = 4 |
| 7706 | type = 4 |
| 7707 | experimenter = 6035143 |
| 7708 | subtype = 53 |
| 7709 | |
| 7710 | def __init__(self, xid=None, pipeline=None): |
| 7711 | if xid != None: |
| 7712 | self.xid = xid |
| 7713 | else: |
| 7714 | self.xid = None |
| 7715 | if pipeline != None: |
| 7716 | self.pipeline = pipeline |
| 7717 | else: |
| 7718 | self.pipeline = "" |
| 7719 | return |
| 7720 | |
| 7721 | def pack(self): |
| 7722 | packed = [] |
| 7723 | packed.append(struct.pack("!B", self.version)) |
| 7724 | packed.append(struct.pack("!B", self.type)) |
| 7725 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7726 | packed.append(struct.pack("!L", self.xid)) |
| 7727 | packed.append(struct.pack("!L", self.experimenter)) |
| 7728 | packed.append(struct.pack("!L", self.subtype)) |
| 7729 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7730 | length = sum([len(x) for x in packed]) |
| 7731 | packed[2] = struct.pack("!H", length) |
| 7732 | return ''.join(packed) |
| 7733 | |
| 7734 | @staticmethod |
| 7735 | def unpack(reader): |
| 7736 | obj = bsn_set_switch_pipeline_request() |
| 7737 | _version = reader.read("!B")[0] |
| 7738 | assert(_version == 4) |
| 7739 | _type = reader.read("!B")[0] |
| 7740 | assert(_type == 4) |
| 7741 | _length = reader.read("!H")[0] |
| 7742 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7743 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7744 | obj.xid = reader.read("!L")[0] |
| 7745 | _experimenter = reader.read("!L")[0] |
| 7746 | assert(_experimenter == 6035143) |
| 7747 | _subtype = reader.read("!L")[0] |
| 7748 | assert(_subtype == 53) |
| 7749 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7750 | return obj |
| 7751 | |
| 7752 | def __eq__(self, other): |
| 7753 | if type(self) != type(other): return False |
| 7754 | if self.xid != other.xid: return False |
| 7755 | if self.pipeline != other.pipeline: return False |
| 7756 | return True |
| 7757 | |
| 7758 | def pretty_print(self, q): |
| 7759 | q.text("bsn_set_switch_pipeline_request {") |
| 7760 | with q.group(): |
| 7761 | with q.indent(2): |
| 7762 | q.breakable() |
| 7763 | q.text("xid = "); |
| 7764 | if self.xid != None: |
| 7765 | q.text("%#x" % self.xid) |
| 7766 | else: |
| 7767 | q.text('None') |
| 7768 | q.text(","); q.breakable() |
| 7769 | q.text("pipeline = "); |
| 7770 | q.pp(self.pipeline) |
| 7771 | q.breakable() |
| 7772 | q.text('}') |
| 7773 | |
| 7774 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7775 | |
| 7776 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7777 | version = 4 |
| 7778 | type = 19 |
| 7779 | stats_type = 65535 |
| 7780 | experimenter = 6035143 |
| 7781 | subtype = 6 |
| 7782 | |
| 7783 | def __init__(self, xid=None, flags=None, entries=None): |
| 7784 | if xid != None: |
| 7785 | self.xid = xid |
| 7786 | else: |
| 7787 | self.xid = None |
| 7788 | if flags != None: |
| 7789 | self.flags = flags |
| 7790 | else: |
| 7791 | self.flags = 0 |
| 7792 | if entries != None: |
| 7793 | self.entries = entries |
| 7794 | else: |
| 7795 | self.entries = [] |
| 7796 | return |
| 7797 | |
| 7798 | def pack(self): |
| 7799 | packed = [] |
| 7800 | packed.append(struct.pack("!B", self.version)) |
| 7801 | packed.append(struct.pack("!B", self.type)) |
| 7802 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7803 | packed.append(struct.pack("!L", self.xid)) |
| 7804 | packed.append(struct.pack("!H", self.stats_type)) |
| 7805 | packed.append(struct.pack("!H", self.flags)) |
| 7806 | packed.append('\x00' * 4) |
| 7807 | packed.append(struct.pack("!L", self.experimenter)) |
| 7808 | packed.append(struct.pack("!L", self.subtype)) |
| 7809 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7810 | length = sum([len(x) for x in packed]) |
| 7811 | packed[2] = struct.pack("!H", length) |
| 7812 | return ''.join(packed) |
| 7813 | |
| 7814 | @staticmethod |
| 7815 | def unpack(reader): |
| 7816 | obj = bsn_switch_pipeline_stats_reply() |
| 7817 | _version = reader.read("!B")[0] |
| 7818 | assert(_version == 4) |
| 7819 | _type = reader.read("!B")[0] |
| 7820 | assert(_type == 19) |
| 7821 | _length = reader.read("!H")[0] |
| 7822 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7823 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7824 | obj.xid = reader.read("!L")[0] |
| 7825 | _stats_type = reader.read("!H")[0] |
| 7826 | assert(_stats_type == 65535) |
| 7827 | obj.flags = reader.read("!H")[0] |
| 7828 | reader.skip(4) |
| 7829 | _experimenter = reader.read("!L")[0] |
| 7830 | assert(_experimenter == 6035143) |
| 7831 | _subtype = reader.read("!L")[0] |
| 7832 | assert(_subtype == 6) |
| 7833 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 7834 | return obj |
| 7835 | |
| 7836 | def __eq__(self, other): |
| 7837 | if type(self) != type(other): return False |
| 7838 | if self.xid != other.xid: return False |
| 7839 | if self.flags != other.flags: return False |
| 7840 | if self.entries != other.entries: return False |
| 7841 | return True |
| 7842 | |
| 7843 | def pretty_print(self, q): |
| 7844 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7845 | with q.group(): |
| 7846 | with q.indent(2): |
| 7847 | q.breakable() |
| 7848 | q.text("xid = "); |
| 7849 | if self.xid != None: |
| 7850 | q.text("%#x" % self.xid) |
| 7851 | else: |
| 7852 | q.text('None') |
| 7853 | q.text(","); q.breakable() |
| 7854 | q.text("flags = "); |
| 7855 | q.text("%#x" % self.flags) |
| 7856 | q.text(","); q.breakable() |
| 7857 | q.text("entries = "); |
| 7858 | q.pp(self.entries) |
| 7859 | q.breakable() |
| 7860 | q.text('}') |
| 7861 | |
| 7862 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7863 | |
| 7864 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7865 | version = 4 |
| 7866 | type = 18 |
| 7867 | stats_type = 65535 |
| 7868 | experimenter = 6035143 |
| 7869 | subtype = 6 |
| 7870 | |
| 7871 | def __init__(self, xid=None, flags=None): |
| 7872 | if xid != None: |
| 7873 | self.xid = xid |
| 7874 | else: |
| 7875 | self.xid = None |
| 7876 | if flags != None: |
| 7877 | self.flags = flags |
| 7878 | else: |
| 7879 | self.flags = 0 |
| 7880 | return |
| 7881 | |
| 7882 | def pack(self): |
| 7883 | packed = [] |
| 7884 | packed.append(struct.pack("!B", self.version)) |
| 7885 | packed.append(struct.pack("!B", self.type)) |
| 7886 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7887 | packed.append(struct.pack("!L", self.xid)) |
| 7888 | packed.append(struct.pack("!H", self.stats_type)) |
| 7889 | packed.append(struct.pack("!H", self.flags)) |
| 7890 | packed.append('\x00' * 4) |
| 7891 | packed.append(struct.pack("!L", self.experimenter)) |
| 7892 | packed.append(struct.pack("!L", self.subtype)) |
| 7893 | length = sum([len(x) for x in packed]) |
| 7894 | packed[2] = struct.pack("!H", length) |
| 7895 | return ''.join(packed) |
| 7896 | |
| 7897 | @staticmethod |
| 7898 | def unpack(reader): |
| 7899 | obj = bsn_switch_pipeline_stats_request() |
| 7900 | _version = reader.read("!B")[0] |
| 7901 | assert(_version == 4) |
| 7902 | _type = reader.read("!B")[0] |
| 7903 | assert(_type == 18) |
| 7904 | _length = reader.read("!H")[0] |
| 7905 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7906 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7907 | obj.xid = reader.read("!L")[0] |
| 7908 | _stats_type = reader.read("!H")[0] |
| 7909 | assert(_stats_type == 65535) |
| 7910 | obj.flags = reader.read("!H")[0] |
| 7911 | reader.skip(4) |
| 7912 | _experimenter = reader.read("!L")[0] |
| 7913 | assert(_experimenter == 6035143) |
| 7914 | _subtype = reader.read("!L")[0] |
| 7915 | assert(_subtype == 6) |
| 7916 | return obj |
| 7917 | |
| 7918 | def __eq__(self, other): |
| 7919 | if type(self) != type(other): return False |
| 7920 | if self.xid != other.xid: return False |
| 7921 | if self.flags != other.flags: return False |
| 7922 | return True |
| 7923 | |
| 7924 | def pretty_print(self, q): |
| 7925 | q.text("bsn_switch_pipeline_stats_request {") |
| 7926 | with q.group(): |
| 7927 | with q.indent(2): |
| 7928 | q.breakable() |
| 7929 | q.text("xid = "); |
| 7930 | if self.xid != None: |
| 7931 | q.text("%#x" % self.xid) |
| 7932 | else: |
| 7933 | q.text('None') |
| 7934 | q.text(","); q.breakable() |
| 7935 | q.text("flags = "); |
| 7936 | q.text("%#x" % self.flags) |
| 7937 | q.breakable() |
| 7938 | q.text('}') |
| 7939 | |
| 7940 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7941 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7942 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7943 | version = 4 |
| 7944 | type = 19 |
| 7945 | stats_type = 65535 |
| 7946 | experimenter = 6035143 |
| 7947 | subtype = 11 |
| 7948 | |
| 7949 | def __init__(self, xid=None, flags=None, entries=None): |
| 7950 | if xid != None: |
| 7951 | self.xid = xid |
| 7952 | else: |
| 7953 | self.xid = None |
| 7954 | if flags != None: |
| 7955 | self.flags = flags |
| 7956 | else: |
| 7957 | self.flags = 0 |
| 7958 | if entries != None: |
| 7959 | self.entries = entries |
| 7960 | else: |
| 7961 | self.entries = [] |
| 7962 | return |
| 7963 | |
| 7964 | def pack(self): |
| 7965 | packed = [] |
| 7966 | packed.append(struct.pack("!B", self.version)) |
| 7967 | packed.append(struct.pack("!B", self.type)) |
| 7968 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7969 | packed.append(struct.pack("!L", self.xid)) |
| 7970 | packed.append(struct.pack("!H", self.stats_type)) |
| 7971 | packed.append(struct.pack("!H", self.flags)) |
| 7972 | packed.append('\x00' * 4) |
| 7973 | packed.append(struct.pack("!L", self.experimenter)) |
| 7974 | packed.append(struct.pack("!L", self.subtype)) |
| 7975 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7976 | length = sum([len(x) for x in packed]) |
| 7977 | packed[2] = struct.pack("!H", length) |
| 7978 | return ''.join(packed) |
| 7979 | |
| 7980 | @staticmethod |
| 7981 | def unpack(reader): |
| 7982 | obj = bsn_table_checksum_stats_reply() |
| 7983 | _version = reader.read("!B")[0] |
| 7984 | assert(_version == 4) |
| 7985 | _type = reader.read("!B")[0] |
| 7986 | assert(_type == 19) |
| 7987 | _length = reader.read("!H")[0] |
| 7988 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7989 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7990 | obj.xid = reader.read("!L")[0] |
| 7991 | _stats_type = reader.read("!H")[0] |
| 7992 | assert(_stats_type == 65535) |
| 7993 | obj.flags = reader.read("!H")[0] |
| 7994 | reader.skip(4) |
| 7995 | _experimenter = reader.read("!L")[0] |
| 7996 | assert(_experimenter == 6035143) |
| 7997 | _subtype = reader.read("!L")[0] |
| 7998 | assert(_subtype == 11) |
| 7999 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack) |
| 8000 | return obj |
| 8001 | |
| 8002 | def __eq__(self, other): |
| 8003 | if type(self) != type(other): return False |
| 8004 | if self.xid != other.xid: return False |
| 8005 | if self.flags != other.flags: return False |
| 8006 | if self.entries != other.entries: return False |
| 8007 | return True |
| 8008 | |
| 8009 | def pretty_print(self, q): |
| 8010 | q.text("bsn_table_checksum_stats_reply {") |
| 8011 | with q.group(): |
| 8012 | with q.indent(2): |
| 8013 | q.breakable() |
| 8014 | q.text("xid = "); |
| 8015 | if self.xid != None: |
| 8016 | q.text("%#x" % self.xid) |
| 8017 | else: |
| 8018 | q.text('None') |
| 8019 | q.text(","); q.breakable() |
| 8020 | q.text("flags = "); |
| 8021 | q.text("%#x" % self.flags) |
| 8022 | q.text(","); q.breakable() |
| 8023 | q.text("entries = "); |
| 8024 | q.pp(self.entries) |
| 8025 | q.breakable() |
| 8026 | q.text('}') |
| 8027 | |
| 8028 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 8029 | |
| 8030 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 8031 | version = 4 |
| 8032 | type = 18 |
| 8033 | stats_type = 65535 |
| 8034 | experimenter = 6035143 |
| 8035 | subtype = 11 |
| 8036 | |
| 8037 | def __init__(self, xid=None, flags=None): |
| 8038 | if xid != None: |
| 8039 | self.xid = xid |
| 8040 | else: |
| 8041 | self.xid = None |
| 8042 | if flags != None: |
| 8043 | self.flags = flags |
| 8044 | else: |
| 8045 | self.flags = 0 |
| 8046 | return |
| 8047 | |
| 8048 | def pack(self): |
| 8049 | packed = [] |
| 8050 | packed.append(struct.pack("!B", self.version)) |
| 8051 | packed.append(struct.pack("!B", self.type)) |
| 8052 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8053 | packed.append(struct.pack("!L", self.xid)) |
| 8054 | packed.append(struct.pack("!H", self.stats_type)) |
| 8055 | packed.append(struct.pack("!H", self.flags)) |
| 8056 | packed.append('\x00' * 4) |
| 8057 | packed.append(struct.pack("!L", self.experimenter)) |
| 8058 | packed.append(struct.pack("!L", self.subtype)) |
| 8059 | length = sum([len(x) for x in packed]) |
| 8060 | packed[2] = struct.pack("!H", length) |
| 8061 | return ''.join(packed) |
| 8062 | |
| 8063 | @staticmethod |
| 8064 | def unpack(reader): |
| 8065 | obj = bsn_table_checksum_stats_request() |
| 8066 | _version = reader.read("!B")[0] |
| 8067 | assert(_version == 4) |
| 8068 | _type = reader.read("!B")[0] |
| 8069 | assert(_type == 18) |
| 8070 | _length = reader.read("!H")[0] |
| 8071 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8072 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8073 | obj.xid = reader.read("!L")[0] |
| 8074 | _stats_type = reader.read("!H")[0] |
| 8075 | assert(_stats_type == 65535) |
| 8076 | obj.flags = reader.read("!H")[0] |
| 8077 | reader.skip(4) |
| 8078 | _experimenter = reader.read("!L")[0] |
| 8079 | assert(_experimenter == 6035143) |
| 8080 | _subtype = reader.read("!L")[0] |
| 8081 | assert(_subtype == 11) |
| 8082 | return obj |
| 8083 | |
| 8084 | def __eq__(self, other): |
| 8085 | if type(self) != type(other): return False |
| 8086 | if self.xid != other.xid: return False |
| 8087 | if self.flags != other.flags: return False |
| 8088 | return True |
| 8089 | |
| 8090 | def pretty_print(self, q): |
| 8091 | q.text("bsn_table_checksum_stats_request {") |
| 8092 | with q.group(): |
| 8093 | with q.indent(2): |
| 8094 | q.breakable() |
| 8095 | q.text("xid = "); |
| 8096 | if self.xid != None: |
| 8097 | q.text("%#x" % self.xid) |
| 8098 | else: |
| 8099 | q.text('None') |
| 8100 | q.text(","); q.breakable() |
| 8101 | q.text("flags = "); |
| 8102 | q.text("%#x" % self.flags) |
| 8103 | q.breakable() |
| 8104 | q.text('}') |
| 8105 | |
| 8106 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 8107 | |
| 8108 | class bsn_table_set_buckets_size(bsn_header): |
| 8109 | version = 4 |
| 8110 | type = 4 |
| 8111 | experimenter = 6035143 |
| 8112 | subtype = 61 |
| 8113 | |
| 8114 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 8115 | if xid != None: |
| 8116 | self.xid = xid |
| 8117 | else: |
| 8118 | self.xid = None |
| 8119 | if table_id != None: |
| 8120 | self.table_id = table_id |
| 8121 | else: |
| 8122 | self.table_id = 0 |
| 8123 | if buckets_size != None: |
| 8124 | self.buckets_size = buckets_size |
| 8125 | else: |
| 8126 | self.buckets_size = 0 |
| 8127 | return |
| 8128 | |
| 8129 | def pack(self): |
| 8130 | packed = [] |
| 8131 | packed.append(struct.pack("!B", self.version)) |
| 8132 | packed.append(struct.pack("!B", self.type)) |
| 8133 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8134 | packed.append(struct.pack("!L", self.xid)) |
| 8135 | packed.append(struct.pack("!L", self.experimenter)) |
| 8136 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8137 | packed.append('\x00' * 1) |
| 8138 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8139 | packed.append('\x00' * 2) |
| 8140 | packed.append(struct.pack("!L", self.buckets_size)) |
| 8141 | length = sum([len(x) for x in packed]) |
| 8142 | packed[2] = struct.pack("!H", length) |
| 8143 | return ''.join(packed) |
| 8144 | |
| 8145 | @staticmethod |
| 8146 | def unpack(reader): |
| 8147 | obj = bsn_table_set_buckets_size() |
| 8148 | _version = reader.read("!B")[0] |
| 8149 | assert(_version == 4) |
| 8150 | _type = reader.read("!B")[0] |
| 8151 | assert(_type == 4) |
| 8152 | _length = reader.read("!H")[0] |
| 8153 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8154 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8155 | obj.xid = reader.read("!L")[0] |
| 8156 | _experimenter = reader.read("!L")[0] |
| 8157 | assert(_experimenter == 6035143) |
| 8158 | _subtype = reader.read("!L")[0] |
| 8159 | assert(_subtype == 61) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8160 | reader.skip(1) |
| 8161 | obj.table_id = reader.read("!B")[0] |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8162 | reader.skip(2) |
| 8163 | obj.buckets_size = reader.read("!L")[0] |
| 8164 | return obj |
| 8165 | |
| 8166 | def __eq__(self, other): |
| 8167 | if type(self) != type(other): return False |
| 8168 | if self.xid != other.xid: return False |
| 8169 | if self.table_id != other.table_id: return False |
| 8170 | if self.buckets_size != other.buckets_size: return False |
| 8171 | return True |
| 8172 | |
| 8173 | def pretty_print(self, q): |
| 8174 | q.text("bsn_table_set_buckets_size {") |
| 8175 | with q.group(): |
| 8176 | with q.indent(2): |
| 8177 | q.breakable() |
| 8178 | q.text("xid = "); |
| 8179 | if self.xid != None: |
| 8180 | q.text("%#x" % self.xid) |
| 8181 | else: |
| 8182 | q.text('None') |
| 8183 | q.text(","); q.breakable() |
| 8184 | q.text("table_id = "); |
| 8185 | q.text("%#x" % self.table_id) |
| 8186 | q.text(","); q.breakable() |
| 8187 | q.text("buckets_size = "); |
| 8188 | q.text("%#x" % self.buckets_size) |
| 8189 | q.breakable() |
| 8190 | q.text('}') |
| 8191 | |
| 8192 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 8193 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8194 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8195 | version = 4 |
| 8196 | type = 4 |
| 8197 | experimenter = 6035143 |
| 8198 | subtype = 45 |
| 8199 | |
| 8200 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8201 | if xid != None: |
| 8202 | self.xid = xid |
| 8203 | else: |
| 8204 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8205 | if time_ms != None: |
| 8206 | self.time_ms = time_ms |
| 8207 | else: |
| 8208 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8209 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8210 | |
| 8211 | def pack(self): |
| 8212 | packed = [] |
| 8213 | packed.append(struct.pack("!B", self.version)) |
| 8214 | packed.append(struct.pack("!B", self.type)) |
| 8215 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8216 | packed.append(struct.pack("!L", self.xid)) |
| 8217 | packed.append(struct.pack("!L", self.experimenter)) |
| 8218 | packed.append(struct.pack("!L", self.subtype)) |
| 8219 | packed.append(struct.pack("!Q", self.time_ms)) |
| 8220 | length = sum([len(x) for x in packed]) |
| 8221 | packed[2] = struct.pack("!H", length) |
| 8222 | return ''.join(packed) |
| 8223 | |
| 8224 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8225 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8226 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8227 | _version = reader.read("!B")[0] |
| 8228 | assert(_version == 4) |
| 8229 | _type = reader.read("!B")[0] |
| 8230 | assert(_type == 4) |
| 8231 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8232 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8233 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8234 | obj.xid = reader.read("!L")[0] |
| 8235 | _experimenter = reader.read("!L")[0] |
| 8236 | assert(_experimenter == 6035143) |
| 8237 | _subtype = reader.read("!L")[0] |
| 8238 | assert(_subtype == 45) |
| 8239 | obj.time_ms = reader.read("!Q")[0] |
| 8240 | return obj |
| 8241 | |
| 8242 | def __eq__(self, other): |
| 8243 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8244 | if self.xid != other.xid: return False |
| 8245 | if self.time_ms != other.time_ms: return False |
| 8246 | return True |
| 8247 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8248 | def pretty_print(self, q): |
| 8249 | q.text("bsn_time_reply {") |
| 8250 | with q.group(): |
| 8251 | with q.indent(2): |
| 8252 | q.breakable() |
| 8253 | q.text("xid = "); |
| 8254 | if self.xid != None: |
| 8255 | q.text("%#x" % self.xid) |
| 8256 | else: |
| 8257 | q.text('None') |
| 8258 | q.text(","); q.breakable() |
| 8259 | q.text("time_ms = "); |
| 8260 | q.text("%#x" % self.time_ms) |
| 8261 | q.breakable() |
| 8262 | q.text('}') |
| 8263 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8264 | bsn_header.subtypes[45] = bsn_time_reply |
| 8265 | |
| 8266 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8267 | version = 4 |
| 8268 | type = 4 |
| 8269 | experimenter = 6035143 |
| 8270 | subtype = 44 |
| 8271 | |
| 8272 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8273 | if xid != None: |
| 8274 | self.xid = xid |
| 8275 | else: |
| 8276 | self.xid = None |
| 8277 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8278 | |
| 8279 | def pack(self): |
| 8280 | packed = [] |
| 8281 | packed.append(struct.pack("!B", self.version)) |
| 8282 | packed.append(struct.pack("!B", self.type)) |
| 8283 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8284 | packed.append(struct.pack("!L", self.xid)) |
| 8285 | packed.append(struct.pack("!L", self.experimenter)) |
| 8286 | packed.append(struct.pack("!L", self.subtype)) |
| 8287 | length = sum([len(x) for x in packed]) |
| 8288 | packed[2] = struct.pack("!H", length) |
| 8289 | return ''.join(packed) |
| 8290 | |
| 8291 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8292 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8293 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8294 | _version = reader.read("!B")[0] |
| 8295 | assert(_version == 4) |
| 8296 | _type = reader.read("!B")[0] |
| 8297 | assert(_type == 4) |
| 8298 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8299 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8300 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8301 | obj.xid = reader.read("!L")[0] |
| 8302 | _experimenter = reader.read("!L")[0] |
| 8303 | assert(_experimenter == 6035143) |
| 8304 | _subtype = reader.read("!L")[0] |
| 8305 | assert(_subtype == 44) |
| 8306 | return obj |
| 8307 | |
| 8308 | def __eq__(self, other): |
| 8309 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8310 | if self.xid != other.xid: return False |
| 8311 | return True |
| 8312 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8313 | def pretty_print(self, q): |
| 8314 | q.text("bsn_time_request {") |
| 8315 | with q.group(): |
| 8316 | with q.indent(2): |
| 8317 | q.breakable() |
| 8318 | q.text("xid = "); |
| 8319 | if self.xid != None: |
| 8320 | q.text("%#x" % self.xid) |
| 8321 | else: |
| 8322 | q.text('None') |
| 8323 | q.breakable() |
| 8324 | q.text('}') |
| 8325 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8326 | bsn_header.subtypes[44] = bsn_time_request |
| 8327 | |
| 8328 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8329 | version = 4 |
| 8330 | type = 4 |
| 8331 | experimenter = 6035143 |
| 8332 | subtype = 16 |
| 8333 | |
| 8334 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8335 | if xid != None: |
| 8336 | self.xid = xid |
| 8337 | else: |
| 8338 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8339 | if status != None: |
| 8340 | self.status = status |
| 8341 | else: |
| 8342 | self.status = 0 |
| 8343 | if vport_no != None: |
| 8344 | self.vport_no = vport_no |
| 8345 | else: |
| 8346 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8347 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8348 | |
| 8349 | def pack(self): |
| 8350 | packed = [] |
| 8351 | packed.append(struct.pack("!B", self.version)) |
| 8352 | packed.append(struct.pack("!B", self.type)) |
| 8353 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8354 | packed.append(struct.pack("!L", self.xid)) |
| 8355 | packed.append(struct.pack("!L", self.experimenter)) |
| 8356 | packed.append(struct.pack("!L", self.subtype)) |
| 8357 | packed.append(struct.pack("!L", self.status)) |
| 8358 | packed.append(struct.pack("!L", self.vport_no)) |
| 8359 | length = sum([len(x) for x in packed]) |
| 8360 | packed[2] = struct.pack("!H", length) |
| 8361 | return ''.join(packed) |
| 8362 | |
| 8363 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8364 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8365 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8366 | _version = reader.read("!B")[0] |
| 8367 | assert(_version == 4) |
| 8368 | _type = reader.read("!B")[0] |
| 8369 | assert(_type == 4) |
| 8370 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8371 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8372 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8373 | obj.xid = reader.read("!L")[0] |
| 8374 | _experimenter = reader.read("!L")[0] |
| 8375 | assert(_experimenter == 6035143) |
| 8376 | _subtype = reader.read("!L")[0] |
| 8377 | assert(_subtype == 16) |
| 8378 | obj.status = reader.read("!L")[0] |
| 8379 | obj.vport_no = reader.read("!L")[0] |
| 8380 | return obj |
| 8381 | |
| 8382 | def __eq__(self, other): |
| 8383 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8384 | if self.xid != other.xid: return False |
| 8385 | if self.status != other.status: return False |
| 8386 | if self.vport_no != other.vport_no: return False |
| 8387 | return True |
| 8388 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8389 | def pretty_print(self, q): |
| 8390 | q.text("bsn_virtual_port_create_reply {") |
| 8391 | with q.group(): |
| 8392 | with q.indent(2): |
| 8393 | q.breakable() |
| 8394 | q.text("xid = "); |
| 8395 | if self.xid != None: |
| 8396 | q.text("%#x" % self.xid) |
| 8397 | else: |
| 8398 | q.text('None') |
| 8399 | q.text(","); q.breakable() |
| 8400 | q.text("status = "); |
| 8401 | q.text("%#x" % self.status) |
| 8402 | q.text(","); q.breakable() |
| 8403 | q.text("vport_no = "); |
| 8404 | q.text("%#x" % self.vport_no) |
| 8405 | q.breakable() |
| 8406 | q.text('}') |
| 8407 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8408 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 8409 | |
| 8410 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8411 | version = 4 |
| 8412 | type = 4 |
| 8413 | experimenter = 6035143 |
| 8414 | subtype = 15 |
| 8415 | |
| 8416 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8417 | if xid != None: |
| 8418 | self.xid = xid |
| 8419 | else: |
| 8420 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8421 | if vport != None: |
| 8422 | self.vport = vport |
| 8423 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 8424 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8425 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8426 | |
| 8427 | def pack(self): |
| 8428 | packed = [] |
| 8429 | packed.append(struct.pack("!B", self.version)) |
| 8430 | packed.append(struct.pack("!B", self.type)) |
| 8431 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8432 | packed.append(struct.pack("!L", self.xid)) |
| 8433 | packed.append(struct.pack("!L", self.experimenter)) |
| 8434 | packed.append(struct.pack("!L", self.subtype)) |
| 8435 | packed.append(self.vport.pack()) |
| 8436 | length = sum([len(x) for x in packed]) |
| 8437 | packed[2] = struct.pack("!H", length) |
| 8438 | return ''.join(packed) |
| 8439 | |
| 8440 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8441 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8442 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8443 | _version = reader.read("!B")[0] |
| 8444 | assert(_version == 4) |
| 8445 | _type = reader.read("!B")[0] |
| 8446 | assert(_type == 4) |
| 8447 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8448 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8449 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8450 | obj.xid = reader.read("!L")[0] |
| 8451 | _experimenter = reader.read("!L")[0] |
| 8452 | assert(_experimenter == 6035143) |
| 8453 | _subtype = reader.read("!L")[0] |
| 8454 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 8455 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8456 | return obj |
| 8457 | |
| 8458 | def __eq__(self, other): |
| 8459 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8460 | if self.xid != other.xid: return False |
| 8461 | if self.vport != other.vport: return False |
| 8462 | return True |
| 8463 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8464 | def pretty_print(self, q): |
| 8465 | q.text("bsn_virtual_port_create_request {") |
| 8466 | with q.group(): |
| 8467 | with q.indent(2): |
| 8468 | q.breakable() |
| 8469 | q.text("xid = "); |
| 8470 | if self.xid != None: |
| 8471 | q.text("%#x" % self.xid) |
| 8472 | else: |
| 8473 | q.text('None') |
| 8474 | q.text(","); q.breakable() |
| 8475 | q.text("vport = "); |
| 8476 | q.pp(self.vport) |
| 8477 | q.breakable() |
| 8478 | q.text('}') |
| 8479 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8480 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 8481 | |
| 8482 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8483 | version = 4 |
| 8484 | type = 4 |
| 8485 | experimenter = 6035143 |
| 8486 | subtype = 26 |
| 8487 | |
| 8488 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8489 | if xid != None: |
| 8490 | self.xid = xid |
| 8491 | else: |
| 8492 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8493 | if status != None: |
| 8494 | self.status = status |
| 8495 | else: |
| 8496 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8497 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8498 | |
| 8499 | def pack(self): |
| 8500 | packed = [] |
| 8501 | packed.append(struct.pack("!B", self.version)) |
| 8502 | packed.append(struct.pack("!B", self.type)) |
| 8503 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8504 | packed.append(struct.pack("!L", self.xid)) |
| 8505 | packed.append(struct.pack("!L", self.experimenter)) |
| 8506 | packed.append(struct.pack("!L", self.subtype)) |
| 8507 | packed.append(struct.pack("!L", self.status)) |
| 8508 | length = sum([len(x) for x in packed]) |
| 8509 | packed[2] = struct.pack("!H", length) |
| 8510 | return ''.join(packed) |
| 8511 | |
| 8512 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8513 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8514 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8515 | _version = reader.read("!B")[0] |
| 8516 | assert(_version == 4) |
| 8517 | _type = reader.read("!B")[0] |
| 8518 | assert(_type == 4) |
| 8519 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8520 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8521 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8522 | obj.xid = reader.read("!L")[0] |
| 8523 | _experimenter = reader.read("!L")[0] |
| 8524 | assert(_experimenter == 6035143) |
| 8525 | _subtype = reader.read("!L")[0] |
| 8526 | assert(_subtype == 26) |
| 8527 | obj.status = reader.read("!L")[0] |
| 8528 | return obj |
| 8529 | |
| 8530 | def __eq__(self, other): |
| 8531 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8532 | if self.xid != other.xid: return False |
| 8533 | if self.status != other.status: return False |
| 8534 | return True |
| 8535 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8536 | def pretty_print(self, q): |
| 8537 | q.text("bsn_virtual_port_remove_reply {") |
| 8538 | with q.group(): |
| 8539 | with q.indent(2): |
| 8540 | q.breakable() |
| 8541 | q.text("xid = "); |
| 8542 | if self.xid != None: |
| 8543 | q.text("%#x" % self.xid) |
| 8544 | else: |
| 8545 | q.text('None') |
| 8546 | q.text(","); q.breakable() |
| 8547 | q.text("status = "); |
| 8548 | q.text("%#x" % self.status) |
| 8549 | q.breakable() |
| 8550 | q.text('}') |
| 8551 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8552 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8553 | |
| 8554 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8555 | version = 4 |
| 8556 | type = 4 |
| 8557 | experimenter = 6035143 |
| 8558 | subtype = 17 |
| 8559 | |
| 8560 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8561 | if xid != None: |
| 8562 | self.xid = xid |
| 8563 | else: |
| 8564 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8565 | if vport_no != None: |
| 8566 | self.vport_no = vport_no |
| 8567 | else: |
| 8568 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8569 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8570 | |
| 8571 | def pack(self): |
| 8572 | packed = [] |
| 8573 | packed.append(struct.pack("!B", self.version)) |
| 8574 | packed.append(struct.pack("!B", self.type)) |
| 8575 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8576 | packed.append(struct.pack("!L", self.xid)) |
| 8577 | packed.append(struct.pack("!L", self.experimenter)) |
| 8578 | packed.append(struct.pack("!L", self.subtype)) |
| 8579 | packed.append(struct.pack("!L", self.vport_no)) |
| 8580 | length = sum([len(x) for x in packed]) |
| 8581 | packed[2] = struct.pack("!H", length) |
| 8582 | return ''.join(packed) |
| 8583 | |
| 8584 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8585 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8586 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8587 | _version = reader.read("!B")[0] |
| 8588 | assert(_version == 4) |
| 8589 | _type = reader.read("!B")[0] |
| 8590 | assert(_type == 4) |
| 8591 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8592 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8593 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8594 | obj.xid = reader.read("!L")[0] |
| 8595 | _experimenter = reader.read("!L")[0] |
| 8596 | assert(_experimenter == 6035143) |
| 8597 | _subtype = reader.read("!L")[0] |
| 8598 | assert(_subtype == 17) |
| 8599 | obj.vport_no = reader.read("!L")[0] |
| 8600 | return obj |
| 8601 | |
| 8602 | def __eq__(self, other): |
| 8603 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8604 | if self.xid != other.xid: return False |
| 8605 | if self.vport_no != other.vport_no: return False |
| 8606 | return True |
| 8607 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8608 | def pretty_print(self, q): |
| 8609 | q.text("bsn_virtual_port_remove_request {") |
| 8610 | with q.group(): |
| 8611 | with q.indent(2): |
| 8612 | q.breakable() |
| 8613 | q.text("xid = "); |
| 8614 | if self.xid != None: |
| 8615 | q.text("%#x" % self.xid) |
| 8616 | else: |
| 8617 | q.text('None') |
| 8618 | q.text(","); q.breakable() |
| 8619 | q.text("vport_no = "); |
| 8620 | q.text("%#x" % self.vport_no) |
| 8621 | q.breakable() |
| 8622 | q.text('}') |
| 8623 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8624 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8625 | |
| 8626 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8627 | version = 4 |
| 8628 | type = 19 |
| 8629 | stats_type = 65535 |
| 8630 | experimenter = 6035143 |
| 8631 | subtype = 9 |
| 8632 | |
| 8633 | def __init__(self, xid=None, flags=None, entries=None): |
| 8634 | if xid != None: |
| 8635 | self.xid = xid |
| 8636 | else: |
| 8637 | self.xid = None |
| 8638 | if flags != None: |
| 8639 | self.flags = flags |
| 8640 | else: |
| 8641 | self.flags = 0 |
| 8642 | if entries != None: |
| 8643 | self.entries = entries |
| 8644 | else: |
| 8645 | self.entries = [] |
| 8646 | return |
| 8647 | |
| 8648 | def pack(self): |
| 8649 | packed = [] |
| 8650 | packed.append(struct.pack("!B", self.version)) |
| 8651 | packed.append(struct.pack("!B", self.type)) |
| 8652 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8653 | packed.append(struct.pack("!L", self.xid)) |
| 8654 | packed.append(struct.pack("!H", self.stats_type)) |
| 8655 | packed.append(struct.pack("!H", self.flags)) |
| 8656 | packed.append('\x00' * 4) |
| 8657 | packed.append(struct.pack("!L", self.experimenter)) |
| 8658 | packed.append(struct.pack("!L", self.subtype)) |
| 8659 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8660 | length = sum([len(x) for x in packed]) |
| 8661 | packed[2] = struct.pack("!H", length) |
| 8662 | return ''.join(packed) |
| 8663 | |
| 8664 | @staticmethod |
| 8665 | def unpack(reader): |
| 8666 | obj = bsn_vlan_counter_stats_reply() |
| 8667 | _version = reader.read("!B")[0] |
| 8668 | assert(_version == 4) |
| 8669 | _type = reader.read("!B")[0] |
| 8670 | assert(_type == 19) |
| 8671 | _length = reader.read("!H")[0] |
| 8672 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8673 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8674 | obj.xid = reader.read("!L")[0] |
| 8675 | _stats_type = reader.read("!H")[0] |
| 8676 | assert(_stats_type == 65535) |
| 8677 | obj.flags = reader.read("!H")[0] |
| 8678 | reader.skip(4) |
| 8679 | _experimenter = reader.read("!L")[0] |
| 8680 | assert(_experimenter == 6035143) |
| 8681 | _subtype = reader.read("!L")[0] |
| 8682 | assert(_subtype == 9) |
| 8683 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 8684 | return obj |
| 8685 | |
| 8686 | def __eq__(self, other): |
| 8687 | if type(self) != type(other): return False |
| 8688 | if self.xid != other.xid: return False |
| 8689 | if self.flags != other.flags: return False |
| 8690 | if self.entries != other.entries: return False |
| 8691 | return True |
| 8692 | |
| 8693 | def pretty_print(self, q): |
| 8694 | q.text("bsn_vlan_counter_stats_reply {") |
| 8695 | with q.group(): |
| 8696 | with q.indent(2): |
| 8697 | q.breakable() |
| 8698 | q.text("xid = "); |
| 8699 | if self.xid != None: |
| 8700 | q.text("%#x" % self.xid) |
| 8701 | else: |
| 8702 | q.text('None') |
| 8703 | q.text(","); q.breakable() |
| 8704 | q.text("flags = "); |
| 8705 | q.text("%#x" % self.flags) |
| 8706 | q.text(","); q.breakable() |
| 8707 | q.text("entries = "); |
| 8708 | q.pp(self.entries) |
| 8709 | q.breakable() |
| 8710 | q.text('}') |
| 8711 | |
| 8712 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8713 | |
| 8714 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8715 | version = 4 |
| 8716 | type = 18 |
| 8717 | stats_type = 65535 |
| 8718 | experimenter = 6035143 |
| 8719 | subtype = 9 |
| 8720 | |
| 8721 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8722 | if xid != None: |
| 8723 | self.xid = xid |
| 8724 | else: |
| 8725 | self.xid = None |
| 8726 | if flags != None: |
| 8727 | self.flags = flags |
| 8728 | else: |
| 8729 | self.flags = 0 |
| 8730 | if vlan_vid != None: |
| 8731 | self.vlan_vid = vlan_vid |
| 8732 | else: |
| 8733 | self.vlan_vid = 0 |
| 8734 | return |
| 8735 | |
| 8736 | def pack(self): |
| 8737 | packed = [] |
| 8738 | packed.append(struct.pack("!B", self.version)) |
| 8739 | packed.append(struct.pack("!B", self.type)) |
| 8740 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8741 | packed.append(struct.pack("!L", self.xid)) |
| 8742 | packed.append(struct.pack("!H", self.stats_type)) |
| 8743 | packed.append(struct.pack("!H", self.flags)) |
| 8744 | packed.append('\x00' * 4) |
| 8745 | packed.append(struct.pack("!L", self.experimenter)) |
| 8746 | packed.append(struct.pack("!L", self.subtype)) |
| 8747 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8748 | length = sum([len(x) for x in packed]) |
| 8749 | packed[2] = struct.pack("!H", length) |
| 8750 | return ''.join(packed) |
| 8751 | |
| 8752 | @staticmethod |
| 8753 | def unpack(reader): |
| 8754 | obj = bsn_vlan_counter_stats_request() |
| 8755 | _version = reader.read("!B")[0] |
| 8756 | assert(_version == 4) |
| 8757 | _type = reader.read("!B")[0] |
| 8758 | assert(_type == 18) |
| 8759 | _length = reader.read("!H")[0] |
| 8760 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8761 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8762 | obj.xid = reader.read("!L")[0] |
| 8763 | _stats_type = reader.read("!H")[0] |
| 8764 | assert(_stats_type == 65535) |
| 8765 | obj.flags = reader.read("!H")[0] |
| 8766 | reader.skip(4) |
| 8767 | _experimenter = reader.read("!L")[0] |
| 8768 | assert(_experimenter == 6035143) |
| 8769 | _subtype = reader.read("!L")[0] |
| 8770 | assert(_subtype == 9) |
| 8771 | obj.vlan_vid = reader.read("!H")[0] |
| 8772 | return obj |
| 8773 | |
| 8774 | def __eq__(self, other): |
| 8775 | if type(self) != type(other): return False |
| 8776 | if self.xid != other.xid: return False |
| 8777 | if self.flags != other.flags: return False |
| 8778 | if self.vlan_vid != other.vlan_vid: return False |
| 8779 | return True |
| 8780 | |
| 8781 | def pretty_print(self, q): |
| 8782 | q.text("bsn_vlan_counter_stats_request {") |
| 8783 | with q.group(): |
| 8784 | with q.indent(2): |
| 8785 | q.breakable() |
| 8786 | q.text("xid = "); |
| 8787 | if self.xid != None: |
| 8788 | q.text("%#x" % self.xid) |
| 8789 | else: |
| 8790 | q.text('None') |
| 8791 | q.text(","); q.breakable() |
| 8792 | q.text("flags = "); |
| 8793 | q.text("%#x" % self.flags) |
| 8794 | q.text(","); q.breakable() |
| 8795 | q.text("vlan_vid = "); |
| 8796 | q.text("%#x" % self.vlan_vid) |
| 8797 | q.breakable() |
| 8798 | q.text('}') |
| 8799 | |
| 8800 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8801 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8802 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8803 | version = 4 |
| 8804 | type = 19 |
| 8805 | stats_type = 65535 |
| 8806 | experimenter = 6035143 |
| 8807 | subtype = 15 |
| 8808 | |
| 8809 | def __init__(self, xid=None, flags=None, entries=None): |
| 8810 | if xid != None: |
| 8811 | self.xid = xid |
| 8812 | else: |
| 8813 | self.xid = None |
| 8814 | if flags != None: |
| 8815 | self.flags = flags |
| 8816 | else: |
| 8817 | self.flags = 0 |
| 8818 | if entries != None: |
| 8819 | self.entries = entries |
| 8820 | else: |
| 8821 | self.entries = [] |
| 8822 | return |
| 8823 | |
| 8824 | def pack(self): |
| 8825 | packed = [] |
| 8826 | packed.append(struct.pack("!B", self.version)) |
| 8827 | packed.append(struct.pack("!B", self.type)) |
| 8828 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8829 | packed.append(struct.pack("!L", self.xid)) |
| 8830 | packed.append(struct.pack("!H", self.stats_type)) |
| 8831 | packed.append(struct.pack("!H", self.flags)) |
| 8832 | packed.append('\x00' * 4) |
| 8833 | packed.append(struct.pack("!L", self.experimenter)) |
| 8834 | packed.append(struct.pack("!L", self.subtype)) |
| 8835 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8836 | length = sum([len(x) for x in packed]) |
| 8837 | packed[2] = struct.pack("!H", length) |
| 8838 | return ''.join(packed) |
| 8839 | |
| 8840 | @staticmethod |
| 8841 | def unpack(reader): |
| 8842 | obj = bsn_vrf_counter_stats_reply() |
| 8843 | _version = reader.read("!B")[0] |
| 8844 | assert(_version == 4) |
| 8845 | _type = reader.read("!B")[0] |
| 8846 | assert(_type == 19) |
| 8847 | _length = reader.read("!H")[0] |
| 8848 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8849 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8850 | obj.xid = reader.read("!L")[0] |
| 8851 | _stats_type = reader.read("!H")[0] |
| 8852 | assert(_stats_type == 65535) |
| 8853 | obj.flags = reader.read("!H")[0] |
| 8854 | reader.skip(4) |
| 8855 | _experimenter = reader.read("!L")[0] |
| 8856 | assert(_experimenter == 6035143) |
| 8857 | _subtype = reader.read("!L")[0] |
| 8858 | assert(_subtype == 15) |
| 8859 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack) |
| 8860 | return obj |
| 8861 | |
| 8862 | def __eq__(self, other): |
| 8863 | if type(self) != type(other): return False |
| 8864 | if self.xid != other.xid: return False |
| 8865 | if self.flags != other.flags: return False |
| 8866 | if self.entries != other.entries: return False |
| 8867 | return True |
| 8868 | |
| 8869 | def pretty_print(self, q): |
| 8870 | q.text("bsn_vrf_counter_stats_reply {") |
| 8871 | with q.group(): |
| 8872 | with q.indent(2): |
| 8873 | q.breakable() |
| 8874 | q.text("xid = "); |
| 8875 | if self.xid != None: |
| 8876 | q.text("%#x" % self.xid) |
| 8877 | else: |
| 8878 | q.text('None') |
| 8879 | q.text(","); q.breakable() |
| 8880 | q.text("flags = "); |
| 8881 | q.text("%#x" % self.flags) |
| 8882 | q.text(","); q.breakable() |
| 8883 | q.text("entries = "); |
| 8884 | q.pp(self.entries) |
| 8885 | q.breakable() |
| 8886 | q.text('}') |
| 8887 | |
| 8888 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8889 | |
| 8890 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8891 | version = 4 |
| 8892 | type = 18 |
| 8893 | stats_type = 65535 |
| 8894 | experimenter = 6035143 |
| 8895 | subtype = 15 |
| 8896 | |
| 8897 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8898 | if xid != None: |
| 8899 | self.xid = xid |
| 8900 | else: |
| 8901 | self.xid = None |
| 8902 | if flags != None: |
| 8903 | self.flags = flags |
| 8904 | else: |
| 8905 | self.flags = 0 |
| 8906 | if vrf != None: |
| 8907 | self.vrf = vrf |
| 8908 | else: |
| 8909 | self.vrf = 0 |
| 8910 | return |
| 8911 | |
| 8912 | def pack(self): |
| 8913 | packed = [] |
| 8914 | packed.append(struct.pack("!B", self.version)) |
| 8915 | packed.append(struct.pack("!B", self.type)) |
| 8916 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8917 | packed.append(struct.pack("!L", self.xid)) |
| 8918 | packed.append(struct.pack("!H", self.stats_type)) |
| 8919 | packed.append(struct.pack("!H", self.flags)) |
| 8920 | packed.append('\x00' * 4) |
| 8921 | packed.append(struct.pack("!L", self.experimenter)) |
| 8922 | packed.append(struct.pack("!L", self.subtype)) |
| 8923 | packed.append(struct.pack("!L", self.vrf)) |
| 8924 | length = sum([len(x) for x in packed]) |
| 8925 | packed[2] = struct.pack("!H", length) |
| 8926 | return ''.join(packed) |
| 8927 | |
| 8928 | @staticmethod |
| 8929 | def unpack(reader): |
| 8930 | obj = bsn_vrf_counter_stats_request() |
| 8931 | _version = reader.read("!B")[0] |
| 8932 | assert(_version == 4) |
| 8933 | _type = reader.read("!B")[0] |
| 8934 | assert(_type == 18) |
| 8935 | _length = reader.read("!H")[0] |
| 8936 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8937 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8938 | obj.xid = reader.read("!L")[0] |
| 8939 | _stats_type = reader.read("!H")[0] |
| 8940 | assert(_stats_type == 65535) |
| 8941 | obj.flags = reader.read("!H")[0] |
| 8942 | reader.skip(4) |
| 8943 | _experimenter = reader.read("!L")[0] |
| 8944 | assert(_experimenter == 6035143) |
| 8945 | _subtype = reader.read("!L")[0] |
| 8946 | assert(_subtype == 15) |
| 8947 | obj.vrf = reader.read("!L")[0] |
| 8948 | return obj |
| 8949 | |
| 8950 | def __eq__(self, other): |
| 8951 | if type(self) != type(other): return False |
| 8952 | if self.xid != other.xid: return False |
| 8953 | if self.flags != other.flags: return False |
| 8954 | if self.vrf != other.vrf: return False |
| 8955 | return True |
| 8956 | |
| 8957 | def pretty_print(self, q): |
| 8958 | q.text("bsn_vrf_counter_stats_request {") |
| 8959 | with q.group(): |
| 8960 | with q.indent(2): |
| 8961 | q.breakable() |
| 8962 | q.text("xid = "); |
| 8963 | if self.xid != None: |
| 8964 | q.text("%#x" % self.xid) |
| 8965 | else: |
| 8966 | q.text('None') |
| 8967 | q.text(","); q.breakable() |
| 8968 | q.text("flags = "); |
| 8969 | q.text("%#x" % self.flags) |
| 8970 | q.text(","); q.breakable() |
| 8971 | q.text("vrf = "); |
| 8972 | q.text("%#x" % self.vrf) |
| 8973 | q.breakable() |
| 8974 | q.text('}') |
| 8975 | |
| 8976 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 8977 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8978 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8979 | version = 4 |
| 8980 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8981 | stats_type = 0 |
| 8982 | |
| 8983 | 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] | 8984 | if xid != None: |
| 8985 | self.xid = xid |
| 8986 | else: |
| 8987 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8988 | if flags != None: |
| 8989 | self.flags = flags |
| 8990 | else: |
| 8991 | self.flags = 0 |
| 8992 | if mfr_desc != None: |
| 8993 | self.mfr_desc = mfr_desc |
| 8994 | else: |
| 8995 | self.mfr_desc = "" |
| 8996 | if hw_desc != None: |
| 8997 | self.hw_desc = hw_desc |
| 8998 | else: |
| 8999 | self.hw_desc = "" |
| 9000 | if sw_desc != None: |
| 9001 | self.sw_desc = sw_desc |
| 9002 | else: |
| 9003 | self.sw_desc = "" |
| 9004 | if serial_num != None: |
| 9005 | self.serial_num = serial_num |
| 9006 | else: |
| 9007 | self.serial_num = "" |
| 9008 | if dp_desc != None: |
| 9009 | self.dp_desc = dp_desc |
| 9010 | else: |
| 9011 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9012 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9013 | |
| 9014 | def pack(self): |
| 9015 | packed = [] |
| 9016 | packed.append(struct.pack("!B", self.version)) |
| 9017 | packed.append(struct.pack("!B", self.type)) |
| 9018 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9019 | packed.append(struct.pack("!L", self.xid)) |
| 9020 | packed.append(struct.pack("!H", self.stats_type)) |
| 9021 | packed.append(struct.pack("!H", self.flags)) |
| 9022 | packed.append('\x00' * 4) |
| 9023 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 9024 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 9025 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 9026 | packed.append(struct.pack("!32s", self.serial_num)) |
| 9027 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 9028 | length = sum([len(x) for x in packed]) |
| 9029 | packed[2] = struct.pack("!H", length) |
| 9030 | return ''.join(packed) |
| 9031 | |
| 9032 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9033 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9034 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9035 | _version = reader.read("!B")[0] |
| 9036 | assert(_version == 4) |
| 9037 | _type = reader.read("!B")[0] |
| 9038 | assert(_type == 19) |
| 9039 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9040 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9041 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9042 | obj.xid = reader.read("!L")[0] |
| 9043 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9044 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9045 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9046 | reader.skip(4) |
| 9047 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9048 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9049 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9050 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 9051 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9052 | return obj |
| 9053 | |
| 9054 | def __eq__(self, other): |
| 9055 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9056 | if self.xid != other.xid: return False |
| 9057 | if self.flags != other.flags: return False |
| 9058 | if self.mfr_desc != other.mfr_desc: return False |
| 9059 | if self.hw_desc != other.hw_desc: return False |
| 9060 | if self.sw_desc != other.sw_desc: return False |
| 9061 | if self.serial_num != other.serial_num: return False |
| 9062 | if self.dp_desc != other.dp_desc: return False |
| 9063 | return True |
| 9064 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9065 | def pretty_print(self, q): |
| 9066 | q.text("desc_stats_reply {") |
| 9067 | with q.group(): |
| 9068 | with q.indent(2): |
| 9069 | q.breakable() |
| 9070 | q.text("xid = "); |
| 9071 | if self.xid != None: |
| 9072 | q.text("%#x" % self.xid) |
| 9073 | else: |
| 9074 | q.text('None') |
| 9075 | q.text(","); q.breakable() |
| 9076 | q.text("flags = "); |
| 9077 | q.text("%#x" % self.flags) |
| 9078 | q.text(","); q.breakable() |
| 9079 | q.text("mfr_desc = "); |
| 9080 | q.pp(self.mfr_desc) |
| 9081 | q.text(","); q.breakable() |
| 9082 | q.text("hw_desc = "); |
| 9083 | q.pp(self.hw_desc) |
| 9084 | q.text(","); q.breakable() |
| 9085 | q.text("sw_desc = "); |
| 9086 | q.pp(self.sw_desc) |
| 9087 | q.text(","); q.breakable() |
| 9088 | q.text("serial_num = "); |
| 9089 | q.pp(self.serial_num) |
| 9090 | q.text(","); q.breakable() |
| 9091 | q.text("dp_desc = "); |
| 9092 | q.pp(self.dp_desc) |
| 9093 | q.breakable() |
| 9094 | q.text('}') |
| 9095 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9096 | stats_reply.subtypes[0] = desc_stats_reply |
| 9097 | |
| 9098 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9099 | version = 4 |
| 9100 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9101 | stats_type = 0 |
| 9102 | |
| 9103 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9104 | if xid != None: |
| 9105 | self.xid = xid |
| 9106 | else: |
| 9107 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9108 | if flags != None: |
| 9109 | self.flags = flags |
| 9110 | else: |
| 9111 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9112 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9113 | |
| 9114 | def pack(self): |
| 9115 | packed = [] |
| 9116 | packed.append(struct.pack("!B", self.version)) |
| 9117 | packed.append(struct.pack("!B", self.type)) |
| 9118 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9119 | packed.append(struct.pack("!L", self.xid)) |
| 9120 | packed.append(struct.pack("!H", self.stats_type)) |
| 9121 | packed.append(struct.pack("!H", self.flags)) |
| 9122 | packed.append('\x00' * 4) |
| 9123 | length = sum([len(x) for x in packed]) |
| 9124 | packed[2] = struct.pack("!H", length) |
| 9125 | return ''.join(packed) |
| 9126 | |
| 9127 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9128 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9129 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9130 | _version = reader.read("!B")[0] |
| 9131 | assert(_version == 4) |
| 9132 | _type = reader.read("!B")[0] |
| 9133 | assert(_type == 18) |
| 9134 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9135 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9136 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9137 | obj.xid = reader.read("!L")[0] |
| 9138 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9139 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9140 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9141 | reader.skip(4) |
| 9142 | return obj |
| 9143 | |
| 9144 | def __eq__(self, other): |
| 9145 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9146 | if self.xid != other.xid: return False |
| 9147 | if self.flags != other.flags: return False |
| 9148 | return True |
| 9149 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9150 | def pretty_print(self, q): |
| 9151 | q.text("desc_stats_request {") |
| 9152 | with q.group(): |
| 9153 | with q.indent(2): |
| 9154 | q.breakable() |
| 9155 | q.text("xid = "); |
| 9156 | if self.xid != None: |
| 9157 | q.text("%#x" % self.xid) |
| 9158 | else: |
| 9159 | q.text('None') |
| 9160 | q.text(","); q.breakable() |
| 9161 | q.text("flags = "); |
| 9162 | q.text("%#x" % self.flags) |
| 9163 | q.breakable() |
| 9164 | q.text('}') |
| 9165 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9166 | stats_request.subtypes[0] = desc_stats_request |
| 9167 | |
| 9168 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9169 | version = 4 |
| 9170 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9171 | |
| 9172 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9173 | if xid != None: |
| 9174 | self.xid = xid |
| 9175 | else: |
| 9176 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9177 | if data != None: |
| 9178 | self.data = data |
| 9179 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9180 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9181 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9182 | |
| 9183 | def pack(self): |
| 9184 | packed = [] |
| 9185 | packed.append(struct.pack("!B", self.version)) |
| 9186 | packed.append(struct.pack("!B", self.type)) |
| 9187 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9188 | packed.append(struct.pack("!L", self.xid)) |
| 9189 | packed.append(self.data) |
| 9190 | length = sum([len(x) for x in packed]) |
| 9191 | packed[2] = struct.pack("!H", length) |
| 9192 | return ''.join(packed) |
| 9193 | |
| 9194 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9195 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9196 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9197 | _version = reader.read("!B")[0] |
| 9198 | assert(_version == 4) |
| 9199 | _type = reader.read("!B")[0] |
| 9200 | assert(_type == 3) |
| 9201 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9202 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9203 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9204 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9205 | obj.data = str(reader.read_all()) |
| 9206 | return obj |
| 9207 | |
| 9208 | def __eq__(self, other): |
| 9209 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9210 | if self.xid != other.xid: return False |
| 9211 | if self.data != other.data: return False |
| 9212 | return True |
| 9213 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9214 | def pretty_print(self, q): |
| 9215 | q.text("echo_reply {") |
| 9216 | with q.group(): |
| 9217 | with q.indent(2): |
| 9218 | q.breakable() |
| 9219 | q.text("xid = "); |
| 9220 | if self.xid != None: |
| 9221 | q.text("%#x" % self.xid) |
| 9222 | else: |
| 9223 | q.text('None') |
| 9224 | q.text(","); q.breakable() |
| 9225 | q.text("data = "); |
| 9226 | q.pp(self.data) |
| 9227 | q.breakable() |
| 9228 | q.text('}') |
| 9229 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9230 | message.subtypes[3] = echo_reply |
| 9231 | |
| 9232 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9233 | version = 4 |
| 9234 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9235 | |
| 9236 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9237 | if xid != None: |
| 9238 | self.xid = xid |
| 9239 | else: |
| 9240 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9241 | if data != None: |
| 9242 | self.data = data |
| 9243 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9244 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9245 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9246 | |
| 9247 | def pack(self): |
| 9248 | packed = [] |
| 9249 | packed.append(struct.pack("!B", self.version)) |
| 9250 | packed.append(struct.pack("!B", self.type)) |
| 9251 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9252 | packed.append(struct.pack("!L", self.xid)) |
| 9253 | packed.append(self.data) |
| 9254 | length = sum([len(x) for x in packed]) |
| 9255 | packed[2] = struct.pack("!H", length) |
| 9256 | return ''.join(packed) |
| 9257 | |
| 9258 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9259 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9260 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9261 | _version = reader.read("!B")[0] |
| 9262 | assert(_version == 4) |
| 9263 | _type = reader.read("!B")[0] |
| 9264 | assert(_type == 2) |
| 9265 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9266 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9267 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9268 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9269 | obj.data = str(reader.read_all()) |
| 9270 | return obj |
| 9271 | |
| 9272 | def __eq__(self, other): |
| 9273 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9274 | if self.xid != other.xid: return False |
| 9275 | if self.data != other.data: return False |
| 9276 | return True |
| 9277 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9278 | def pretty_print(self, q): |
| 9279 | q.text("echo_request {") |
| 9280 | with q.group(): |
| 9281 | with q.indent(2): |
| 9282 | q.breakable() |
| 9283 | q.text("xid = "); |
| 9284 | if self.xid != None: |
| 9285 | q.text("%#x" % self.xid) |
| 9286 | else: |
| 9287 | q.text('None') |
| 9288 | q.text(","); q.breakable() |
| 9289 | q.text("data = "); |
| 9290 | q.pp(self.data) |
| 9291 | q.breakable() |
| 9292 | q.text('}') |
| 9293 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9294 | message.subtypes[2] = echo_request |
| 9295 | |
| 9296 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9297 | version = 4 |
| 9298 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9299 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9300 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9301 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9302 | if xid != None: |
| 9303 | self.xid = xid |
| 9304 | else: |
| 9305 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9306 | if subtype != None: |
| 9307 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9308 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9309 | self.subtype = 0 |
| 9310 | if experimenter != None: |
| 9311 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9312 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9313 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9314 | if data != None: |
| 9315 | self.data = data |
| 9316 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9317 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9318 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9319 | |
| 9320 | def pack(self): |
| 9321 | packed = [] |
| 9322 | packed.append(struct.pack("!B", self.version)) |
| 9323 | packed.append(struct.pack("!B", self.type)) |
| 9324 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9325 | packed.append(struct.pack("!L", self.xid)) |
| 9326 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9327 | packed.append(struct.pack("!H", self.subtype)) |
| 9328 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9329 | packed.append(self.data) |
| 9330 | length = sum([len(x) for x in packed]) |
| 9331 | packed[2] = struct.pack("!H", length) |
| 9332 | return ''.join(packed) |
| 9333 | |
| 9334 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9335 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9336 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9337 | _version = reader.read("!B")[0] |
| 9338 | assert(_version == 4) |
| 9339 | _type = reader.read("!B")[0] |
| 9340 | assert(_type == 1) |
| 9341 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9342 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9343 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9344 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9345 | _err_type = reader.read("!H")[0] |
| 9346 | assert(_err_type == 65535) |
| 9347 | obj.subtype = reader.read("!H")[0] |
| 9348 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9349 | obj.data = str(reader.read_all()) |
| 9350 | return obj |
| 9351 | |
| 9352 | def __eq__(self, other): |
| 9353 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9354 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9355 | if self.subtype != other.subtype: return False |
| 9356 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9357 | if self.data != other.data: return False |
| 9358 | return True |
| 9359 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9360 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9361 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9362 | with q.group(): |
| 9363 | with q.indent(2): |
| 9364 | q.breakable() |
| 9365 | q.text("xid = "); |
| 9366 | if self.xid != None: |
| 9367 | q.text("%#x" % self.xid) |
| 9368 | else: |
| 9369 | q.text('None') |
| 9370 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9371 | q.text("subtype = "); |
| 9372 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9373 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9374 | q.text("experimenter = "); |
| 9375 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9376 | q.text(","); q.breakable() |
| 9377 | q.text("data = "); |
| 9378 | q.pp(self.data) |
| 9379 | q.breakable() |
| 9380 | q.text('}') |
| 9381 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9382 | error_msg.subtypes[65535] = experimenter_error_msg |
| 9383 | |
| 9384 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9385 | version = 4 |
| 9386 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9387 | |
| 9388 | 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] | 9389 | if xid != None: |
| 9390 | self.xid = xid |
| 9391 | else: |
| 9392 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9393 | if datapath_id != None: |
| 9394 | self.datapath_id = datapath_id |
| 9395 | else: |
| 9396 | self.datapath_id = 0 |
| 9397 | if n_buffers != None: |
| 9398 | self.n_buffers = n_buffers |
| 9399 | else: |
| 9400 | self.n_buffers = 0 |
| 9401 | if n_tables != None: |
| 9402 | self.n_tables = n_tables |
| 9403 | else: |
| 9404 | self.n_tables = 0 |
| 9405 | if auxiliary_id != None: |
| 9406 | self.auxiliary_id = auxiliary_id |
| 9407 | else: |
| 9408 | self.auxiliary_id = 0 |
| 9409 | if capabilities != None: |
| 9410 | self.capabilities = capabilities |
| 9411 | else: |
| 9412 | self.capabilities = 0 |
| 9413 | if reserved != None: |
| 9414 | self.reserved = reserved |
| 9415 | else: |
| 9416 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9417 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9418 | |
| 9419 | def pack(self): |
| 9420 | packed = [] |
| 9421 | packed.append(struct.pack("!B", self.version)) |
| 9422 | packed.append(struct.pack("!B", self.type)) |
| 9423 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9424 | packed.append(struct.pack("!L", self.xid)) |
| 9425 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 9426 | packed.append(struct.pack("!L", self.n_buffers)) |
| 9427 | packed.append(struct.pack("!B", self.n_tables)) |
| 9428 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 9429 | packed.append('\x00' * 2) |
| 9430 | packed.append(struct.pack("!L", self.capabilities)) |
| 9431 | packed.append(struct.pack("!L", self.reserved)) |
| 9432 | length = sum([len(x) for x in packed]) |
| 9433 | packed[2] = struct.pack("!H", length) |
| 9434 | return ''.join(packed) |
| 9435 | |
| 9436 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9437 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9438 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9439 | _version = reader.read("!B")[0] |
| 9440 | assert(_version == 4) |
| 9441 | _type = reader.read("!B")[0] |
| 9442 | assert(_type == 6) |
| 9443 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9444 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9445 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9446 | obj.xid = reader.read("!L")[0] |
| 9447 | obj.datapath_id = reader.read("!Q")[0] |
| 9448 | obj.n_buffers = reader.read("!L")[0] |
| 9449 | obj.n_tables = reader.read("!B")[0] |
| 9450 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9451 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9452 | obj.capabilities = reader.read("!L")[0] |
| 9453 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9454 | return obj |
| 9455 | |
| 9456 | def __eq__(self, other): |
| 9457 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9458 | if self.xid != other.xid: return False |
| 9459 | if self.datapath_id != other.datapath_id: return False |
| 9460 | if self.n_buffers != other.n_buffers: return False |
| 9461 | if self.n_tables != other.n_tables: return False |
| 9462 | if self.auxiliary_id != other.auxiliary_id: return False |
| 9463 | if self.capabilities != other.capabilities: return False |
| 9464 | if self.reserved != other.reserved: return False |
| 9465 | return True |
| 9466 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9467 | def pretty_print(self, q): |
| 9468 | q.text("features_reply {") |
| 9469 | with q.group(): |
| 9470 | with q.indent(2): |
| 9471 | q.breakable() |
| 9472 | q.text("xid = "); |
| 9473 | if self.xid != None: |
| 9474 | q.text("%#x" % self.xid) |
| 9475 | else: |
| 9476 | q.text('None') |
| 9477 | q.text(","); q.breakable() |
| 9478 | q.text("datapath_id = "); |
| 9479 | q.text("%#x" % self.datapath_id) |
| 9480 | q.text(","); q.breakable() |
| 9481 | q.text("n_buffers = "); |
| 9482 | q.text("%#x" % self.n_buffers) |
| 9483 | q.text(","); q.breakable() |
| 9484 | q.text("n_tables = "); |
| 9485 | q.text("%#x" % self.n_tables) |
| 9486 | q.text(","); q.breakable() |
| 9487 | q.text("auxiliary_id = "); |
| 9488 | q.text("%#x" % self.auxiliary_id) |
| 9489 | q.text(","); q.breakable() |
| 9490 | q.text("capabilities = "); |
| 9491 | q.text("%#x" % self.capabilities) |
| 9492 | q.text(","); q.breakable() |
| 9493 | q.text("reserved = "); |
| 9494 | q.text("%#x" % self.reserved) |
| 9495 | q.breakable() |
| 9496 | q.text('}') |
| 9497 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9498 | message.subtypes[6] = features_reply |
| 9499 | |
| 9500 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9501 | version = 4 |
| 9502 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9503 | |
| 9504 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9505 | if xid != None: |
| 9506 | self.xid = xid |
| 9507 | else: |
| 9508 | self.xid = None |
| 9509 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9510 | |
| 9511 | def pack(self): |
| 9512 | packed = [] |
| 9513 | packed.append(struct.pack("!B", self.version)) |
| 9514 | packed.append(struct.pack("!B", self.type)) |
| 9515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9516 | packed.append(struct.pack("!L", self.xid)) |
| 9517 | length = sum([len(x) for x in packed]) |
| 9518 | packed[2] = struct.pack("!H", length) |
| 9519 | return ''.join(packed) |
| 9520 | |
| 9521 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9522 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9523 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9524 | _version = reader.read("!B")[0] |
| 9525 | assert(_version == 4) |
| 9526 | _type = reader.read("!B")[0] |
| 9527 | assert(_type == 5) |
| 9528 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9529 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9530 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9531 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9532 | return obj |
| 9533 | |
| 9534 | def __eq__(self, other): |
| 9535 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9536 | if self.xid != other.xid: return False |
| 9537 | return True |
| 9538 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9539 | def pretty_print(self, q): |
| 9540 | q.text("features_request {") |
| 9541 | with q.group(): |
| 9542 | with q.indent(2): |
| 9543 | q.breakable() |
| 9544 | q.text("xid = "); |
| 9545 | if self.xid != None: |
| 9546 | q.text("%#x" % self.xid) |
| 9547 | else: |
| 9548 | q.text('None') |
| 9549 | q.breakable() |
| 9550 | q.text('}') |
| 9551 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9552 | message.subtypes[5] = features_request |
| 9553 | |
| 9554 | class flow_mod(message): |
| 9555 | subtypes = {} |
| 9556 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9557 | version = 4 |
| 9558 | type = 14 |
| 9559 | |
| 9560 | 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): |
| 9561 | if xid != None: |
| 9562 | self.xid = xid |
| 9563 | else: |
| 9564 | self.xid = None |
| 9565 | if cookie != None: |
| 9566 | self.cookie = cookie |
| 9567 | else: |
| 9568 | self.cookie = 0 |
| 9569 | if cookie_mask != None: |
| 9570 | self.cookie_mask = cookie_mask |
| 9571 | else: |
| 9572 | self.cookie_mask = 0 |
| 9573 | if table_id != None: |
| 9574 | self.table_id = table_id |
| 9575 | else: |
| 9576 | self.table_id = 0 |
| 9577 | if _command != None: |
| 9578 | self._command = _command |
| 9579 | else: |
| 9580 | self._command = 0 |
| 9581 | if idle_timeout != None: |
| 9582 | self.idle_timeout = idle_timeout |
| 9583 | else: |
| 9584 | self.idle_timeout = 0 |
| 9585 | if hard_timeout != None: |
| 9586 | self.hard_timeout = hard_timeout |
| 9587 | else: |
| 9588 | self.hard_timeout = 0 |
| 9589 | if priority != None: |
| 9590 | self.priority = priority |
| 9591 | else: |
| 9592 | self.priority = 0 |
| 9593 | if buffer_id != None: |
| 9594 | self.buffer_id = buffer_id |
| 9595 | else: |
| 9596 | self.buffer_id = 0 |
| 9597 | if out_port != None: |
| 9598 | self.out_port = out_port |
| 9599 | else: |
| 9600 | self.out_port = 0 |
| 9601 | if out_group != None: |
| 9602 | self.out_group = out_group |
| 9603 | else: |
| 9604 | self.out_group = 0 |
| 9605 | if flags != None: |
| 9606 | self.flags = flags |
| 9607 | else: |
| 9608 | self.flags = 0 |
| 9609 | if match != None: |
| 9610 | self.match = match |
| 9611 | else: |
| 9612 | self.match = common.match() |
| 9613 | if instructions != None: |
| 9614 | self.instructions = instructions |
| 9615 | else: |
| 9616 | self.instructions = [] |
| 9617 | return |
| 9618 | |
| 9619 | def pack(self): |
| 9620 | packed = [] |
| 9621 | packed.append(struct.pack("!B", self.version)) |
| 9622 | packed.append(struct.pack("!B", self.type)) |
| 9623 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9624 | packed.append(struct.pack("!L", self.xid)) |
| 9625 | packed.append(struct.pack("!Q", self.cookie)) |
| 9626 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9627 | packed.append(struct.pack("!B", self.table_id)) |
| 9628 | packed.append(util.pack_fm_cmd(self._command)) |
| 9629 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9630 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9631 | packed.append(struct.pack("!H", self.priority)) |
| 9632 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9633 | packed.append(util.pack_port_no(self.out_port)) |
| 9634 | packed.append(struct.pack("!L", self.out_group)) |
| 9635 | packed.append(struct.pack("!H", self.flags)) |
| 9636 | packed.append('\x00' * 2) |
| 9637 | packed.append(self.match.pack()) |
| 9638 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9639 | length = sum([len(x) for x in packed]) |
| 9640 | packed[2] = struct.pack("!H", length) |
| 9641 | return ''.join(packed) |
| 9642 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9643 | @staticmethod |
| 9644 | def unpack(reader): |
| 9645 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9646 | subclass = flow_mod.subtypes.get(subtype) |
| 9647 | if subclass: |
| 9648 | return subclass.unpack(reader) |
| 9649 | |
| 9650 | obj = flow_mod() |
| 9651 | _version = reader.read("!B")[0] |
| 9652 | assert(_version == 4) |
| 9653 | _type = reader.read("!B")[0] |
| 9654 | assert(_type == 14) |
| 9655 | _length = reader.read("!H")[0] |
| 9656 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9657 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9658 | obj.xid = reader.read("!L")[0] |
| 9659 | obj.cookie = reader.read("!Q")[0] |
| 9660 | obj.cookie_mask = reader.read("!Q")[0] |
| 9661 | obj.table_id = reader.read("!B")[0] |
| 9662 | obj._command = util.unpack_fm_cmd(reader) |
| 9663 | obj.idle_timeout = reader.read("!H")[0] |
| 9664 | obj.hard_timeout = reader.read("!H")[0] |
| 9665 | obj.priority = reader.read("!H")[0] |
| 9666 | obj.buffer_id = reader.read("!L")[0] |
| 9667 | obj.out_port = util.unpack_port_no(reader) |
| 9668 | obj.out_group = reader.read("!L")[0] |
| 9669 | obj.flags = reader.read("!H")[0] |
| 9670 | reader.skip(2) |
| 9671 | obj.match = common.match.unpack(reader) |
| 9672 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 9673 | return obj |
| 9674 | |
| 9675 | def __eq__(self, other): |
| 9676 | if type(self) != type(other): return False |
| 9677 | if self.xid != other.xid: return False |
| 9678 | if self.cookie != other.cookie: return False |
| 9679 | if self.cookie_mask != other.cookie_mask: return False |
| 9680 | if self.table_id != other.table_id: return False |
| 9681 | if self._command != other._command: return False |
| 9682 | if self.idle_timeout != other.idle_timeout: return False |
| 9683 | if self.hard_timeout != other.hard_timeout: return False |
| 9684 | if self.priority != other.priority: return False |
| 9685 | if self.buffer_id != other.buffer_id: return False |
| 9686 | if self.out_port != other.out_port: return False |
| 9687 | if self.out_group != other.out_group: return False |
| 9688 | if self.flags != other.flags: return False |
| 9689 | if self.match != other.match: return False |
| 9690 | if self.instructions != other.instructions: return False |
| 9691 | return True |
| 9692 | |
| 9693 | def pretty_print(self, q): |
| 9694 | q.text("flow_mod {") |
| 9695 | with q.group(): |
| 9696 | with q.indent(2): |
| 9697 | q.breakable() |
| 9698 | q.text("xid = "); |
| 9699 | if self.xid != None: |
| 9700 | q.text("%#x" % self.xid) |
| 9701 | else: |
| 9702 | q.text('None') |
| 9703 | q.text(","); q.breakable() |
| 9704 | q.text("cookie = "); |
| 9705 | q.text("%#x" % self.cookie) |
| 9706 | q.text(","); q.breakable() |
| 9707 | q.text("cookie_mask = "); |
| 9708 | q.text("%#x" % self.cookie_mask) |
| 9709 | q.text(","); q.breakable() |
| 9710 | q.text("table_id = "); |
| 9711 | q.text("%#x" % self.table_id) |
| 9712 | q.text(","); q.breakable() |
| 9713 | q.text("idle_timeout = "); |
| 9714 | q.text("%#x" % self.idle_timeout) |
| 9715 | q.text(","); q.breakable() |
| 9716 | q.text("hard_timeout = "); |
| 9717 | q.text("%#x" % self.hard_timeout) |
| 9718 | q.text(","); q.breakable() |
| 9719 | q.text("priority = "); |
| 9720 | q.text("%#x" % self.priority) |
| 9721 | q.text(","); q.breakable() |
| 9722 | q.text("buffer_id = "); |
| 9723 | q.text("%#x" % self.buffer_id) |
| 9724 | q.text(","); q.breakable() |
| 9725 | q.text("out_port = "); |
| 9726 | q.text(util.pretty_port(self.out_port)) |
| 9727 | q.text(","); q.breakable() |
| 9728 | q.text("out_group = "); |
| 9729 | q.text("%#x" % self.out_group) |
| 9730 | q.text(","); q.breakable() |
| 9731 | q.text("flags = "); |
| 9732 | q.text("%#x" % self.flags) |
| 9733 | q.text(","); q.breakable() |
| 9734 | q.text("match = "); |
| 9735 | q.pp(self.match) |
| 9736 | q.text(","); q.breakable() |
| 9737 | q.text("instructions = "); |
| 9738 | q.pp(self.instructions) |
| 9739 | q.breakable() |
| 9740 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9741 | |
| 9742 | message.subtypes[14] = flow_mod |
| 9743 | |
| 9744 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9745 | version = 4 |
| 9746 | type = 14 |
| 9747 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9748 | |
| 9749 | 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] | 9750 | if xid != None: |
| 9751 | self.xid = xid |
| 9752 | else: |
| 9753 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9754 | if cookie != None: |
| 9755 | self.cookie = cookie |
| 9756 | else: |
| 9757 | self.cookie = 0 |
| 9758 | if cookie_mask != None: |
| 9759 | self.cookie_mask = cookie_mask |
| 9760 | else: |
| 9761 | self.cookie_mask = 0 |
| 9762 | if table_id != None: |
| 9763 | self.table_id = table_id |
| 9764 | else: |
| 9765 | self.table_id = 0 |
| 9766 | if idle_timeout != None: |
| 9767 | self.idle_timeout = idle_timeout |
| 9768 | else: |
| 9769 | self.idle_timeout = 0 |
| 9770 | if hard_timeout != None: |
| 9771 | self.hard_timeout = hard_timeout |
| 9772 | else: |
| 9773 | self.hard_timeout = 0 |
| 9774 | if priority != None: |
| 9775 | self.priority = priority |
| 9776 | else: |
| 9777 | self.priority = 0 |
| 9778 | if buffer_id != None: |
| 9779 | self.buffer_id = buffer_id |
| 9780 | else: |
| 9781 | self.buffer_id = 0 |
| 9782 | if out_port != None: |
| 9783 | self.out_port = out_port |
| 9784 | else: |
| 9785 | self.out_port = 0 |
| 9786 | if out_group != None: |
| 9787 | self.out_group = out_group |
| 9788 | else: |
| 9789 | self.out_group = 0 |
| 9790 | if flags != None: |
| 9791 | self.flags = flags |
| 9792 | else: |
| 9793 | self.flags = 0 |
| 9794 | if match != None: |
| 9795 | self.match = match |
| 9796 | else: |
| 9797 | self.match = common.match() |
| 9798 | if instructions != None: |
| 9799 | self.instructions = instructions |
| 9800 | else: |
| 9801 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9802 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9803 | |
| 9804 | def pack(self): |
| 9805 | packed = [] |
| 9806 | packed.append(struct.pack("!B", self.version)) |
| 9807 | packed.append(struct.pack("!B", self.type)) |
| 9808 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9809 | packed.append(struct.pack("!L", self.xid)) |
| 9810 | packed.append(struct.pack("!Q", self.cookie)) |
| 9811 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9812 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9813 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9814 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9815 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9816 | packed.append(struct.pack("!H", self.priority)) |
| 9817 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9818 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9819 | packed.append(struct.pack("!L", self.out_group)) |
| 9820 | packed.append(struct.pack("!H", self.flags)) |
| 9821 | packed.append('\x00' * 2) |
| 9822 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9823 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9824 | length = sum([len(x) for x in packed]) |
| 9825 | packed[2] = struct.pack("!H", length) |
| 9826 | return ''.join(packed) |
| 9827 | |
| 9828 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9829 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9830 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9831 | _version = reader.read("!B")[0] |
| 9832 | assert(_version == 4) |
| 9833 | _type = reader.read("!B")[0] |
| 9834 | assert(_type == 14) |
| 9835 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9836 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9837 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9838 | obj.xid = reader.read("!L")[0] |
| 9839 | obj.cookie = reader.read("!Q")[0] |
| 9840 | obj.cookie_mask = reader.read("!Q")[0] |
| 9841 | obj.table_id = reader.read("!B")[0] |
| 9842 | __command = util.unpack_fm_cmd(reader) |
| 9843 | assert(__command == 0) |
| 9844 | obj.idle_timeout = reader.read("!H")[0] |
| 9845 | obj.hard_timeout = reader.read("!H")[0] |
| 9846 | obj.priority = reader.read("!H")[0] |
| 9847 | obj.buffer_id = reader.read("!L")[0] |
| 9848 | obj.out_port = util.unpack_port_no(reader) |
| 9849 | obj.out_group = reader.read("!L")[0] |
| 9850 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9851 | reader.skip(2) |
| 9852 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9853 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9854 | return obj |
| 9855 | |
| 9856 | def __eq__(self, other): |
| 9857 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9858 | if self.xid != other.xid: return False |
| 9859 | if self.cookie != other.cookie: return False |
| 9860 | if self.cookie_mask != other.cookie_mask: return False |
| 9861 | if self.table_id != other.table_id: return False |
| 9862 | if self.idle_timeout != other.idle_timeout: return False |
| 9863 | if self.hard_timeout != other.hard_timeout: return False |
| 9864 | if self.priority != other.priority: return False |
| 9865 | if self.buffer_id != other.buffer_id: return False |
| 9866 | if self.out_port != other.out_port: return False |
| 9867 | if self.out_group != other.out_group: return False |
| 9868 | if self.flags != other.flags: return False |
| 9869 | if self.match != other.match: return False |
| 9870 | if self.instructions != other.instructions: return False |
| 9871 | return True |
| 9872 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9873 | def pretty_print(self, q): |
| 9874 | q.text("flow_add {") |
| 9875 | with q.group(): |
| 9876 | with q.indent(2): |
| 9877 | q.breakable() |
| 9878 | q.text("xid = "); |
| 9879 | if self.xid != None: |
| 9880 | q.text("%#x" % self.xid) |
| 9881 | else: |
| 9882 | q.text('None') |
| 9883 | q.text(","); q.breakable() |
| 9884 | q.text("cookie = "); |
| 9885 | q.text("%#x" % self.cookie) |
| 9886 | q.text(","); q.breakable() |
| 9887 | q.text("cookie_mask = "); |
| 9888 | q.text("%#x" % self.cookie_mask) |
| 9889 | q.text(","); q.breakable() |
| 9890 | q.text("table_id = "); |
| 9891 | q.text("%#x" % self.table_id) |
| 9892 | q.text(","); q.breakable() |
| 9893 | q.text("idle_timeout = "); |
| 9894 | q.text("%#x" % self.idle_timeout) |
| 9895 | q.text(","); q.breakable() |
| 9896 | q.text("hard_timeout = "); |
| 9897 | q.text("%#x" % self.hard_timeout) |
| 9898 | q.text(","); q.breakable() |
| 9899 | q.text("priority = "); |
| 9900 | q.text("%#x" % self.priority) |
| 9901 | q.text(","); q.breakable() |
| 9902 | q.text("buffer_id = "); |
| 9903 | q.text("%#x" % self.buffer_id) |
| 9904 | q.text(","); q.breakable() |
| 9905 | q.text("out_port = "); |
| 9906 | q.text(util.pretty_port(self.out_port)) |
| 9907 | q.text(","); q.breakable() |
| 9908 | q.text("out_group = "); |
| 9909 | q.text("%#x" % self.out_group) |
| 9910 | q.text(","); q.breakable() |
| 9911 | q.text("flags = "); |
| 9912 | q.text("%#x" % self.flags) |
| 9913 | q.text(","); q.breakable() |
| 9914 | q.text("match = "); |
| 9915 | q.pp(self.match) |
| 9916 | q.text(","); q.breakable() |
| 9917 | q.text("instructions = "); |
| 9918 | q.pp(self.instructions) |
| 9919 | q.breakable() |
| 9920 | q.text('}') |
| 9921 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9922 | flow_mod.subtypes[0] = flow_add |
| 9923 | |
| 9924 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9925 | version = 4 |
| 9926 | type = 14 |
| 9927 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9928 | |
| 9929 | 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] | 9930 | if xid != None: |
| 9931 | self.xid = xid |
| 9932 | else: |
| 9933 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9934 | if cookie != None: |
| 9935 | self.cookie = cookie |
| 9936 | else: |
| 9937 | self.cookie = 0 |
| 9938 | if cookie_mask != None: |
| 9939 | self.cookie_mask = cookie_mask |
| 9940 | else: |
| 9941 | self.cookie_mask = 0 |
| 9942 | if table_id != None: |
| 9943 | self.table_id = table_id |
| 9944 | else: |
| 9945 | self.table_id = 0 |
| 9946 | if idle_timeout != None: |
| 9947 | self.idle_timeout = idle_timeout |
| 9948 | else: |
| 9949 | self.idle_timeout = 0 |
| 9950 | if hard_timeout != None: |
| 9951 | self.hard_timeout = hard_timeout |
| 9952 | else: |
| 9953 | self.hard_timeout = 0 |
| 9954 | if priority != None: |
| 9955 | self.priority = priority |
| 9956 | else: |
| 9957 | self.priority = 0 |
| 9958 | if buffer_id != None: |
| 9959 | self.buffer_id = buffer_id |
| 9960 | else: |
| 9961 | self.buffer_id = 0 |
| 9962 | if out_port != None: |
| 9963 | self.out_port = out_port |
| 9964 | else: |
| 9965 | self.out_port = 0 |
| 9966 | if out_group != None: |
| 9967 | self.out_group = out_group |
| 9968 | else: |
| 9969 | self.out_group = 0 |
| 9970 | if flags != None: |
| 9971 | self.flags = flags |
| 9972 | else: |
| 9973 | self.flags = 0 |
| 9974 | if match != None: |
| 9975 | self.match = match |
| 9976 | else: |
| 9977 | self.match = common.match() |
| 9978 | if instructions != None: |
| 9979 | self.instructions = instructions |
| 9980 | else: |
| 9981 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9982 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9983 | |
| 9984 | def pack(self): |
| 9985 | packed = [] |
| 9986 | packed.append(struct.pack("!B", self.version)) |
| 9987 | packed.append(struct.pack("!B", self.type)) |
| 9988 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9989 | packed.append(struct.pack("!L", self.xid)) |
| 9990 | packed.append(struct.pack("!Q", self.cookie)) |
| 9991 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9992 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9993 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9994 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9995 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9996 | packed.append(struct.pack("!H", self.priority)) |
| 9997 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9998 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9999 | packed.append(struct.pack("!L", self.out_group)) |
| 10000 | packed.append(struct.pack("!H", self.flags)) |
| 10001 | packed.append('\x00' * 2) |
| 10002 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10003 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10004 | length = sum([len(x) for x in packed]) |
| 10005 | packed[2] = struct.pack("!H", length) |
| 10006 | return ''.join(packed) |
| 10007 | |
| 10008 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10009 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10010 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10011 | _version = reader.read("!B")[0] |
| 10012 | assert(_version == 4) |
| 10013 | _type = reader.read("!B")[0] |
| 10014 | assert(_type == 14) |
| 10015 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10016 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10017 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10018 | obj.xid = reader.read("!L")[0] |
| 10019 | obj.cookie = reader.read("!Q")[0] |
| 10020 | obj.cookie_mask = reader.read("!Q")[0] |
| 10021 | obj.table_id = reader.read("!B")[0] |
| 10022 | __command = util.unpack_fm_cmd(reader) |
| 10023 | assert(__command == 3) |
| 10024 | obj.idle_timeout = reader.read("!H")[0] |
| 10025 | obj.hard_timeout = reader.read("!H")[0] |
| 10026 | obj.priority = reader.read("!H")[0] |
| 10027 | obj.buffer_id = reader.read("!L")[0] |
| 10028 | obj.out_port = util.unpack_port_no(reader) |
| 10029 | obj.out_group = reader.read("!L")[0] |
| 10030 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10031 | reader.skip(2) |
| 10032 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10033 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10034 | return obj |
| 10035 | |
| 10036 | def __eq__(self, other): |
| 10037 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10038 | if self.xid != other.xid: return False |
| 10039 | if self.cookie != other.cookie: return False |
| 10040 | if self.cookie_mask != other.cookie_mask: return False |
| 10041 | if self.table_id != other.table_id: return False |
| 10042 | if self.idle_timeout != other.idle_timeout: return False |
| 10043 | if self.hard_timeout != other.hard_timeout: return False |
| 10044 | if self.priority != other.priority: return False |
| 10045 | if self.buffer_id != other.buffer_id: return False |
| 10046 | if self.out_port != other.out_port: return False |
| 10047 | if self.out_group != other.out_group: return False |
| 10048 | if self.flags != other.flags: return False |
| 10049 | if self.match != other.match: return False |
| 10050 | if self.instructions != other.instructions: return False |
| 10051 | return True |
| 10052 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10053 | def pretty_print(self, q): |
| 10054 | q.text("flow_delete {") |
| 10055 | with q.group(): |
| 10056 | with q.indent(2): |
| 10057 | q.breakable() |
| 10058 | q.text("xid = "); |
| 10059 | if self.xid != None: |
| 10060 | q.text("%#x" % self.xid) |
| 10061 | else: |
| 10062 | q.text('None') |
| 10063 | q.text(","); q.breakable() |
| 10064 | q.text("cookie = "); |
| 10065 | q.text("%#x" % self.cookie) |
| 10066 | q.text(","); q.breakable() |
| 10067 | q.text("cookie_mask = "); |
| 10068 | q.text("%#x" % self.cookie_mask) |
| 10069 | q.text(","); q.breakable() |
| 10070 | q.text("table_id = "); |
| 10071 | q.text("%#x" % self.table_id) |
| 10072 | q.text(","); q.breakable() |
| 10073 | q.text("idle_timeout = "); |
| 10074 | q.text("%#x" % self.idle_timeout) |
| 10075 | q.text(","); q.breakable() |
| 10076 | q.text("hard_timeout = "); |
| 10077 | q.text("%#x" % self.hard_timeout) |
| 10078 | q.text(","); q.breakable() |
| 10079 | q.text("priority = "); |
| 10080 | q.text("%#x" % self.priority) |
| 10081 | q.text(","); q.breakable() |
| 10082 | q.text("buffer_id = "); |
| 10083 | q.text("%#x" % self.buffer_id) |
| 10084 | q.text(","); q.breakable() |
| 10085 | q.text("out_port = "); |
| 10086 | q.text(util.pretty_port(self.out_port)) |
| 10087 | q.text(","); q.breakable() |
| 10088 | q.text("out_group = "); |
| 10089 | q.text("%#x" % self.out_group) |
| 10090 | q.text(","); q.breakable() |
| 10091 | q.text("flags = "); |
| 10092 | q.text("%#x" % self.flags) |
| 10093 | q.text(","); q.breakable() |
| 10094 | q.text("match = "); |
| 10095 | q.pp(self.match) |
| 10096 | q.text(","); q.breakable() |
| 10097 | q.text("instructions = "); |
| 10098 | q.pp(self.instructions) |
| 10099 | q.breakable() |
| 10100 | q.text('}') |
| 10101 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10102 | flow_mod.subtypes[3] = flow_delete |
| 10103 | |
| 10104 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10105 | version = 4 |
| 10106 | type = 14 |
| 10107 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10108 | |
| 10109 | 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] | 10110 | if xid != None: |
| 10111 | self.xid = xid |
| 10112 | else: |
| 10113 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10114 | if cookie != None: |
| 10115 | self.cookie = cookie |
| 10116 | else: |
| 10117 | self.cookie = 0 |
| 10118 | if cookie_mask != None: |
| 10119 | self.cookie_mask = cookie_mask |
| 10120 | else: |
| 10121 | self.cookie_mask = 0 |
| 10122 | if table_id != None: |
| 10123 | self.table_id = table_id |
| 10124 | else: |
| 10125 | self.table_id = 0 |
| 10126 | if idle_timeout != None: |
| 10127 | self.idle_timeout = idle_timeout |
| 10128 | else: |
| 10129 | self.idle_timeout = 0 |
| 10130 | if hard_timeout != None: |
| 10131 | self.hard_timeout = hard_timeout |
| 10132 | else: |
| 10133 | self.hard_timeout = 0 |
| 10134 | if priority != None: |
| 10135 | self.priority = priority |
| 10136 | else: |
| 10137 | self.priority = 0 |
| 10138 | if buffer_id != None: |
| 10139 | self.buffer_id = buffer_id |
| 10140 | else: |
| 10141 | self.buffer_id = 0 |
| 10142 | if out_port != None: |
| 10143 | self.out_port = out_port |
| 10144 | else: |
| 10145 | self.out_port = 0 |
| 10146 | if out_group != None: |
| 10147 | self.out_group = out_group |
| 10148 | else: |
| 10149 | self.out_group = 0 |
| 10150 | if flags != None: |
| 10151 | self.flags = flags |
| 10152 | else: |
| 10153 | self.flags = 0 |
| 10154 | if match != None: |
| 10155 | self.match = match |
| 10156 | else: |
| 10157 | self.match = common.match() |
| 10158 | if instructions != None: |
| 10159 | self.instructions = instructions |
| 10160 | else: |
| 10161 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10162 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10163 | |
| 10164 | def pack(self): |
| 10165 | packed = [] |
| 10166 | packed.append(struct.pack("!B", self.version)) |
| 10167 | packed.append(struct.pack("!B", self.type)) |
| 10168 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10169 | packed.append(struct.pack("!L", self.xid)) |
| 10170 | packed.append(struct.pack("!Q", self.cookie)) |
| 10171 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10172 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10173 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10174 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10175 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10176 | packed.append(struct.pack("!H", self.priority)) |
| 10177 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10178 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10179 | packed.append(struct.pack("!L", self.out_group)) |
| 10180 | packed.append(struct.pack("!H", self.flags)) |
| 10181 | packed.append('\x00' * 2) |
| 10182 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10183 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10184 | length = sum([len(x) for x in packed]) |
| 10185 | packed[2] = struct.pack("!H", length) |
| 10186 | return ''.join(packed) |
| 10187 | |
| 10188 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10189 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10190 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10191 | _version = reader.read("!B")[0] |
| 10192 | assert(_version == 4) |
| 10193 | _type = reader.read("!B")[0] |
| 10194 | assert(_type == 14) |
| 10195 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10196 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10197 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10198 | obj.xid = reader.read("!L")[0] |
| 10199 | obj.cookie = reader.read("!Q")[0] |
| 10200 | obj.cookie_mask = reader.read("!Q")[0] |
| 10201 | obj.table_id = reader.read("!B")[0] |
| 10202 | __command = util.unpack_fm_cmd(reader) |
| 10203 | assert(__command == 4) |
| 10204 | obj.idle_timeout = reader.read("!H")[0] |
| 10205 | obj.hard_timeout = reader.read("!H")[0] |
| 10206 | obj.priority = reader.read("!H")[0] |
| 10207 | obj.buffer_id = reader.read("!L")[0] |
| 10208 | obj.out_port = util.unpack_port_no(reader) |
| 10209 | obj.out_group = reader.read("!L")[0] |
| 10210 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10211 | reader.skip(2) |
| 10212 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10213 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10214 | return obj |
| 10215 | |
| 10216 | def __eq__(self, other): |
| 10217 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10218 | if self.xid != other.xid: return False |
| 10219 | if self.cookie != other.cookie: return False |
| 10220 | if self.cookie_mask != other.cookie_mask: return False |
| 10221 | if self.table_id != other.table_id: return False |
| 10222 | if self.idle_timeout != other.idle_timeout: return False |
| 10223 | if self.hard_timeout != other.hard_timeout: return False |
| 10224 | if self.priority != other.priority: return False |
| 10225 | if self.buffer_id != other.buffer_id: return False |
| 10226 | if self.out_port != other.out_port: return False |
| 10227 | if self.out_group != other.out_group: return False |
| 10228 | if self.flags != other.flags: return False |
| 10229 | if self.match != other.match: return False |
| 10230 | if self.instructions != other.instructions: return False |
| 10231 | return True |
| 10232 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10233 | def pretty_print(self, q): |
| 10234 | q.text("flow_delete_strict {") |
| 10235 | with q.group(): |
| 10236 | with q.indent(2): |
| 10237 | q.breakable() |
| 10238 | q.text("xid = "); |
| 10239 | if self.xid != None: |
| 10240 | q.text("%#x" % self.xid) |
| 10241 | else: |
| 10242 | q.text('None') |
| 10243 | q.text(","); q.breakable() |
| 10244 | q.text("cookie = "); |
| 10245 | q.text("%#x" % self.cookie) |
| 10246 | q.text(","); q.breakable() |
| 10247 | q.text("cookie_mask = "); |
| 10248 | q.text("%#x" % self.cookie_mask) |
| 10249 | q.text(","); q.breakable() |
| 10250 | q.text("table_id = "); |
| 10251 | q.text("%#x" % self.table_id) |
| 10252 | q.text(","); q.breakable() |
| 10253 | q.text("idle_timeout = "); |
| 10254 | q.text("%#x" % self.idle_timeout) |
| 10255 | q.text(","); q.breakable() |
| 10256 | q.text("hard_timeout = "); |
| 10257 | q.text("%#x" % self.hard_timeout) |
| 10258 | q.text(","); q.breakable() |
| 10259 | q.text("priority = "); |
| 10260 | q.text("%#x" % self.priority) |
| 10261 | q.text(","); q.breakable() |
| 10262 | q.text("buffer_id = "); |
| 10263 | q.text("%#x" % self.buffer_id) |
| 10264 | q.text(","); q.breakable() |
| 10265 | q.text("out_port = "); |
| 10266 | q.text(util.pretty_port(self.out_port)) |
| 10267 | q.text(","); q.breakable() |
| 10268 | q.text("out_group = "); |
| 10269 | q.text("%#x" % self.out_group) |
| 10270 | q.text(","); q.breakable() |
| 10271 | q.text("flags = "); |
| 10272 | q.text("%#x" % self.flags) |
| 10273 | q.text(","); q.breakable() |
| 10274 | q.text("match = "); |
| 10275 | q.pp(self.match) |
| 10276 | q.text(","); q.breakable() |
| 10277 | q.text("instructions = "); |
| 10278 | q.pp(self.instructions) |
| 10279 | q.breakable() |
| 10280 | q.text('}') |
| 10281 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10282 | flow_mod.subtypes[4] = flow_delete_strict |
| 10283 | |
| 10284 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10285 | version = 4 |
| 10286 | type = 1 |
| 10287 | err_type = 5 |
| 10288 | |
| 10289 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10290 | if xid != None: |
| 10291 | self.xid = xid |
| 10292 | else: |
| 10293 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10294 | if code != None: |
| 10295 | self.code = code |
| 10296 | else: |
| 10297 | self.code = 0 |
| 10298 | if data != None: |
| 10299 | self.data = data |
| 10300 | else: |
| 10301 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10302 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10303 | |
| 10304 | def pack(self): |
| 10305 | packed = [] |
| 10306 | packed.append(struct.pack("!B", self.version)) |
| 10307 | packed.append(struct.pack("!B", self.type)) |
| 10308 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10309 | packed.append(struct.pack("!L", self.xid)) |
| 10310 | packed.append(struct.pack("!H", self.err_type)) |
| 10311 | packed.append(struct.pack("!H", self.code)) |
| 10312 | packed.append(self.data) |
| 10313 | length = sum([len(x) for x in packed]) |
| 10314 | packed[2] = struct.pack("!H", length) |
| 10315 | return ''.join(packed) |
| 10316 | |
| 10317 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10318 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10319 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10320 | _version = reader.read("!B")[0] |
| 10321 | assert(_version == 4) |
| 10322 | _type = reader.read("!B")[0] |
| 10323 | assert(_type == 1) |
| 10324 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10325 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10326 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10327 | obj.xid = reader.read("!L")[0] |
| 10328 | _err_type = reader.read("!H")[0] |
| 10329 | assert(_err_type == 5) |
| 10330 | obj.code = reader.read("!H")[0] |
| 10331 | obj.data = str(reader.read_all()) |
| 10332 | return obj |
| 10333 | |
| 10334 | def __eq__(self, other): |
| 10335 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10336 | if self.xid != other.xid: return False |
| 10337 | if self.code != other.code: return False |
| 10338 | if self.data != other.data: return False |
| 10339 | return True |
| 10340 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10341 | def pretty_print(self, q): |
| 10342 | q.text("flow_mod_failed_error_msg {") |
| 10343 | with q.group(): |
| 10344 | with q.indent(2): |
| 10345 | q.breakable() |
| 10346 | q.text("xid = "); |
| 10347 | if self.xid != None: |
| 10348 | q.text("%#x" % self.xid) |
| 10349 | else: |
| 10350 | q.text('None') |
| 10351 | q.text(","); q.breakable() |
| 10352 | q.text("code = "); |
| 10353 | q.text("%#x" % self.code) |
| 10354 | q.text(","); q.breakable() |
| 10355 | q.text("data = "); |
| 10356 | q.pp(self.data) |
| 10357 | q.breakable() |
| 10358 | q.text('}') |
| 10359 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10360 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 10361 | |
| 10362 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10363 | version = 4 |
| 10364 | type = 14 |
| 10365 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10366 | |
| 10367 | 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] | 10368 | if xid != None: |
| 10369 | self.xid = xid |
| 10370 | else: |
| 10371 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10372 | if cookie != None: |
| 10373 | self.cookie = cookie |
| 10374 | else: |
| 10375 | self.cookie = 0 |
| 10376 | if cookie_mask != None: |
| 10377 | self.cookie_mask = cookie_mask |
| 10378 | else: |
| 10379 | self.cookie_mask = 0 |
| 10380 | if table_id != None: |
| 10381 | self.table_id = table_id |
| 10382 | else: |
| 10383 | self.table_id = 0 |
| 10384 | if idle_timeout != None: |
| 10385 | self.idle_timeout = idle_timeout |
| 10386 | else: |
| 10387 | self.idle_timeout = 0 |
| 10388 | if hard_timeout != None: |
| 10389 | self.hard_timeout = hard_timeout |
| 10390 | else: |
| 10391 | self.hard_timeout = 0 |
| 10392 | if priority != None: |
| 10393 | self.priority = priority |
| 10394 | else: |
| 10395 | self.priority = 0 |
| 10396 | if buffer_id != None: |
| 10397 | self.buffer_id = buffer_id |
| 10398 | else: |
| 10399 | self.buffer_id = 0 |
| 10400 | if out_port != None: |
| 10401 | self.out_port = out_port |
| 10402 | else: |
| 10403 | self.out_port = 0 |
| 10404 | if out_group != None: |
| 10405 | self.out_group = out_group |
| 10406 | else: |
| 10407 | self.out_group = 0 |
| 10408 | if flags != None: |
| 10409 | self.flags = flags |
| 10410 | else: |
| 10411 | self.flags = 0 |
| 10412 | if match != None: |
| 10413 | self.match = match |
| 10414 | else: |
| 10415 | self.match = common.match() |
| 10416 | if instructions != None: |
| 10417 | self.instructions = instructions |
| 10418 | else: |
| 10419 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10420 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10421 | |
| 10422 | def pack(self): |
| 10423 | packed = [] |
| 10424 | packed.append(struct.pack("!B", self.version)) |
| 10425 | packed.append(struct.pack("!B", self.type)) |
| 10426 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10427 | packed.append(struct.pack("!L", self.xid)) |
| 10428 | packed.append(struct.pack("!Q", self.cookie)) |
| 10429 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10430 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10431 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10432 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10433 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10434 | packed.append(struct.pack("!H", self.priority)) |
| 10435 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10436 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10437 | packed.append(struct.pack("!L", self.out_group)) |
| 10438 | packed.append(struct.pack("!H", self.flags)) |
| 10439 | packed.append('\x00' * 2) |
| 10440 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10441 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10442 | length = sum([len(x) for x in packed]) |
| 10443 | packed[2] = struct.pack("!H", length) |
| 10444 | return ''.join(packed) |
| 10445 | |
| 10446 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10447 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10448 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10449 | _version = reader.read("!B")[0] |
| 10450 | assert(_version == 4) |
| 10451 | _type = reader.read("!B")[0] |
| 10452 | assert(_type == 14) |
| 10453 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10454 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10455 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10456 | obj.xid = reader.read("!L")[0] |
| 10457 | obj.cookie = reader.read("!Q")[0] |
| 10458 | obj.cookie_mask = reader.read("!Q")[0] |
| 10459 | obj.table_id = reader.read("!B")[0] |
| 10460 | __command = util.unpack_fm_cmd(reader) |
| 10461 | assert(__command == 1) |
| 10462 | obj.idle_timeout = reader.read("!H")[0] |
| 10463 | obj.hard_timeout = reader.read("!H")[0] |
| 10464 | obj.priority = reader.read("!H")[0] |
| 10465 | obj.buffer_id = reader.read("!L")[0] |
| 10466 | obj.out_port = util.unpack_port_no(reader) |
| 10467 | obj.out_group = reader.read("!L")[0] |
| 10468 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10469 | reader.skip(2) |
| 10470 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10471 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10472 | return obj |
| 10473 | |
| 10474 | def __eq__(self, other): |
| 10475 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10476 | if self.xid != other.xid: return False |
| 10477 | if self.cookie != other.cookie: return False |
| 10478 | if self.cookie_mask != other.cookie_mask: return False |
| 10479 | if self.table_id != other.table_id: return False |
| 10480 | if self.idle_timeout != other.idle_timeout: return False |
| 10481 | if self.hard_timeout != other.hard_timeout: return False |
| 10482 | if self.priority != other.priority: return False |
| 10483 | if self.buffer_id != other.buffer_id: return False |
| 10484 | if self.out_port != other.out_port: return False |
| 10485 | if self.out_group != other.out_group: return False |
| 10486 | if self.flags != other.flags: return False |
| 10487 | if self.match != other.match: return False |
| 10488 | if self.instructions != other.instructions: return False |
| 10489 | return True |
| 10490 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10491 | def pretty_print(self, q): |
| 10492 | q.text("flow_modify {") |
| 10493 | with q.group(): |
| 10494 | with q.indent(2): |
| 10495 | q.breakable() |
| 10496 | q.text("xid = "); |
| 10497 | if self.xid != None: |
| 10498 | q.text("%#x" % self.xid) |
| 10499 | else: |
| 10500 | q.text('None') |
| 10501 | q.text(","); q.breakable() |
| 10502 | q.text("cookie = "); |
| 10503 | q.text("%#x" % self.cookie) |
| 10504 | q.text(","); q.breakable() |
| 10505 | q.text("cookie_mask = "); |
| 10506 | q.text("%#x" % self.cookie_mask) |
| 10507 | q.text(","); q.breakable() |
| 10508 | q.text("table_id = "); |
| 10509 | q.text("%#x" % self.table_id) |
| 10510 | q.text(","); q.breakable() |
| 10511 | q.text("idle_timeout = "); |
| 10512 | q.text("%#x" % self.idle_timeout) |
| 10513 | q.text(","); q.breakable() |
| 10514 | q.text("hard_timeout = "); |
| 10515 | q.text("%#x" % self.hard_timeout) |
| 10516 | q.text(","); q.breakable() |
| 10517 | q.text("priority = "); |
| 10518 | q.text("%#x" % self.priority) |
| 10519 | q.text(","); q.breakable() |
| 10520 | q.text("buffer_id = "); |
| 10521 | q.text("%#x" % self.buffer_id) |
| 10522 | q.text(","); q.breakable() |
| 10523 | q.text("out_port = "); |
| 10524 | q.text(util.pretty_port(self.out_port)) |
| 10525 | q.text(","); q.breakable() |
| 10526 | q.text("out_group = "); |
| 10527 | q.text("%#x" % self.out_group) |
| 10528 | q.text(","); q.breakable() |
| 10529 | q.text("flags = "); |
| 10530 | q.text("%#x" % self.flags) |
| 10531 | q.text(","); q.breakable() |
| 10532 | q.text("match = "); |
| 10533 | q.pp(self.match) |
| 10534 | q.text(","); q.breakable() |
| 10535 | q.text("instructions = "); |
| 10536 | q.pp(self.instructions) |
| 10537 | q.breakable() |
| 10538 | q.text('}') |
| 10539 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10540 | flow_mod.subtypes[1] = flow_modify |
| 10541 | |
| 10542 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10543 | version = 4 |
| 10544 | type = 14 |
| 10545 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10546 | |
| 10547 | 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] | 10548 | if xid != None: |
| 10549 | self.xid = xid |
| 10550 | else: |
| 10551 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10552 | if cookie != None: |
| 10553 | self.cookie = cookie |
| 10554 | else: |
| 10555 | self.cookie = 0 |
| 10556 | if cookie_mask != None: |
| 10557 | self.cookie_mask = cookie_mask |
| 10558 | else: |
| 10559 | self.cookie_mask = 0 |
| 10560 | if table_id != None: |
| 10561 | self.table_id = table_id |
| 10562 | else: |
| 10563 | self.table_id = 0 |
| 10564 | if idle_timeout != None: |
| 10565 | self.idle_timeout = idle_timeout |
| 10566 | else: |
| 10567 | self.idle_timeout = 0 |
| 10568 | if hard_timeout != None: |
| 10569 | self.hard_timeout = hard_timeout |
| 10570 | else: |
| 10571 | self.hard_timeout = 0 |
| 10572 | if priority != None: |
| 10573 | self.priority = priority |
| 10574 | else: |
| 10575 | self.priority = 0 |
| 10576 | if buffer_id != None: |
| 10577 | self.buffer_id = buffer_id |
| 10578 | else: |
| 10579 | self.buffer_id = 0 |
| 10580 | if out_port != None: |
| 10581 | self.out_port = out_port |
| 10582 | else: |
| 10583 | self.out_port = 0 |
| 10584 | if out_group != None: |
| 10585 | self.out_group = out_group |
| 10586 | else: |
| 10587 | self.out_group = 0 |
| 10588 | if flags != None: |
| 10589 | self.flags = flags |
| 10590 | else: |
| 10591 | self.flags = 0 |
| 10592 | if match != None: |
| 10593 | self.match = match |
| 10594 | else: |
| 10595 | self.match = common.match() |
| 10596 | if instructions != None: |
| 10597 | self.instructions = instructions |
| 10598 | else: |
| 10599 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10600 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10601 | |
| 10602 | def pack(self): |
| 10603 | packed = [] |
| 10604 | packed.append(struct.pack("!B", self.version)) |
| 10605 | packed.append(struct.pack("!B", self.type)) |
| 10606 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10607 | packed.append(struct.pack("!L", self.xid)) |
| 10608 | packed.append(struct.pack("!Q", self.cookie)) |
| 10609 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10610 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10611 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10612 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10613 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10614 | packed.append(struct.pack("!H", self.priority)) |
| 10615 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10616 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10617 | packed.append(struct.pack("!L", self.out_group)) |
| 10618 | packed.append(struct.pack("!H", self.flags)) |
| 10619 | packed.append('\x00' * 2) |
| 10620 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10621 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10622 | length = sum([len(x) for x in packed]) |
| 10623 | packed[2] = struct.pack("!H", length) |
| 10624 | return ''.join(packed) |
| 10625 | |
| 10626 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10627 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10628 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10629 | _version = reader.read("!B")[0] |
| 10630 | assert(_version == 4) |
| 10631 | _type = reader.read("!B")[0] |
| 10632 | assert(_type == 14) |
| 10633 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10634 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10635 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10636 | obj.xid = reader.read("!L")[0] |
| 10637 | obj.cookie = reader.read("!Q")[0] |
| 10638 | obj.cookie_mask = reader.read("!Q")[0] |
| 10639 | obj.table_id = reader.read("!B")[0] |
| 10640 | __command = util.unpack_fm_cmd(reader) |
| 10641 | assert(__command == 2) |
| 10642 | obj.idle_timeout = reader.read("!H")[0] |
| 10643 | obj.hard_timeout = reader.read("!H")[0] |
| 10644 | obj.priority = reader.read("!H")[0] |
| 10645 | obj.buffer_id = reader.read("!L")[0] |
| 10646 | obj.out_port = util.unpack_port_no(reader) |
| 10647 | obj.out_group = reader.read("!L")[0] |
| 10648 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10649 | reader.skip(2) |
| 10650 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10651 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10652 | return obj |
| 10653 | |
| 10654 | def __eq__(self, other): |
| 10655 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10656 | if self.xid != other.xid: return False |
| 10657 | if self.cookie != other.cookie: return False |
| 10658 | if self.cookie_mask != other.cookie_mask: return False |
| 10659 | if self.table_id != other.table_id: return False |
| 10660 | if self.idle_timeout != other.idle_timeout: return False |
| 10661 | if self.hard_timeout != other.hard_timeout: return False |
| 10662 | if self.priority != other.priority: return False |
| 10663 | if self.buffer_id != other.buffer_id: return False |
| 10664 | if self.out_port != other.out_port: return False |
| 10665 | if self.out_group != other.out_group: return False |
| 10666 | if self.flags != other.flags: return False |
| 10667 | if self.match != other.match: return False |
| 10668 | if self.instructions != other.instructions: return False |
| 10669 | return True |
| 10670 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10671 | def pretty_print(self, q): |
| 10672 | q.text("flow_modify_strict {") |
| 10673 | with q.group(): |
| 10674 | with q.indent(2): |
| 10675 | q.breakable() |
| 10676 | q.text("xid = "); |
| 10677 | if self.xid != None: |
| 10678 | q.text("%#x" % self.xid) |
| 10679 | else: |
| 10680 | q.text('None') |
| 10681 | q.text(","); q.breakable() |
| 10682 | q.text("cookie = "); |
| 10683 | q.text("%#x" % self.cookie) |
| 10684 | q.text(","); q.breakable() |
| 10685 | q.text("cookie_mask = "); |
| 10686 | q.text("%#x" % self.cookie_mask) |
| 10687 | q.text(","); q.breakable() |
| 10688 | q.text("table_id = "); |
| 10689 | q.text("%#x" % self.table_id) |
| 10690 | q.text(","); q.breakable() |
| 10691 | q.text("idle_timeout = "); |
| 10692 | q.text("%#x" % self.idle_timeout) |
| 10693 | q.text(","); q.breakable() |
| 10694 | q.text("hard_timeout = "); |
| 10695 | q.text("%#x" % self.hard_timeout) |
| 10696 | q.text(","); q.breakable() |
| 10697 | q.text("priority = "); |
| 10698 | q.text("%#x" % self.priority) |
| 10699 | q.text(","); q.breakable() |
| 10700 | q.text("buffer_id = "); |
| 10701 | q.text("%#x" % self.buffer_id) |
| 10702 | q.text(","); q.breakable() |
| 10703 | q.text("out_port = "); |
| 10704 | q.text(util.pretty_port(self.out_port)) |
| 10705 | q.text(","); q.breakable() |
| 10706 | q.text("out_group = "); |
| 10707 | q.text("%#x" % self.out_group) |
| 10708 | q.text(","); q.breakable() |
| 10709 | q.text("flags = "); |
| 10710 | q.text("%#x" % self.flags) |
| 10711 | q.text(","); q.breakable() |
| 10712 | q.text("match = "); |
| 10713 | q.pp(self.match) |
| 10714 | q.text(","); q.breakable() |
| 10715 | q.text("instructions = "); |
| 10716 | q.pp(self.instructions) |
| 10717 | q.breakable() |
| 10718 | q.text('}') |
| 10719 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10720 | flow_mod.subtypes[2] = flow_modify_strict |
| 10721 | |
| 10722 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10723 | version = 4 |
| 10724 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10725 | |
| 10726 | 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] | 10727 | if xid != None: |
| 10728 | self.xid = xid |
| 10729 | else: |
| 10730 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10731 | if cookie != None: |
| 10732 | self.cookie = cookie |
| 10733 | else: |
| 10734 | self.cookie = 0 |
| 10735 | if priority != None: |
| 10736 | self.priority = priority |
| 10737 | else: |
| 10738 | self.priority = 0 |
| 10739 | if reason != None: |
| 10740 | self.reason = reason |
| 10741 | else: |
| 10742 | self.reason = 0 |
| 10743 | if table_id != None: |
| 10744 | self.table_id = table_id |
| 10745 | else: |
| 10746 | self.table_id = 0 |
| 10747 | if duration_sec != None: |
| 10748 | self.duration_sec = duration_sec |
| 10749 | else: |
| 10750 | self.duration_sec = 0 |
| 10751 | if duration_nsec != None: |
| 10752 | self.duration_nsec = duration_nsec |
| 10753 | else: |
| 10754 | self.duration_nsec = 0 |
| 10755 | if idle_timeout != None: |
| 10756 | self.idle_timeout = idle_timeout |
| 10757 | else: |
| 10758 | self.idle_timeout = 0 |
| 10759 | if hard_timeout != None: |
| 10760 | self.hard_timeout = hard_timeout |
| 10761 | else: |
| 10762 | self.hard_timeout = 0 |
| 10763 | if packet_count != None: |
| 10764 | self.packet_count = packet_count |
| 10765 | else: |
| 10766 | self.packet_count = 0 |
| 10767 | if byte_count != None: |
| 10768 | self.byte_count = byte_count |
| 10769 | else: |
| 10770 | self.byte_count = 0 |
| 10771 | if match != None: |
| 10772 | self.match = match |
| 10773 | else: |
| 10774 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10775 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10776 | |
| 10777 | def pack(self): |
| 10778 | packed = [] |
| 10779 | packed.append(struct.pack("!B", self.version)) |
| 10780 | packed.append(struct.pack("!B", self.type)) |
| 10781 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10782 | packed.append(struct.pack("!L", self.xid)) |
| 10783 | packed.append(struct.pack("!Q", self.cookie)) |
| 10784 | packed.append(struct.pack("!H", self.priority)) |
| 10785 | packed.append(struct.pack("!B", self.reason)) |
| 10786 | packed.append(struct.pack("!B", self.table_id)) |
| 10787 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10788 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10789 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10790 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10791 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10792 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10793 | packed.append(self.match.pack()) |
| 10794 | length = sum([len(x) for x in packed]) |
| 10795 | packed[2] = struct.pack("!H", length) |
| 10796 | return ''.join(packed) |
| 10797 | |
| 10798 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10799 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10800 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10801 | _version = reader.read("!B")[0] |
| 10802 | assert(_version == 4) |
| 10803 | _type = reader.read("!B")[0] |
| 10804 | assert(_type == 11) |
| 10805 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10806 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10807 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10808 | obj.xid = reader.read("!L")[0] |
| 10809 | obj.cookie = reader.read("!Q")[0] |
| 10810 | obj.priority = reader.read("!H")[0] |
| 10811 | obj.reason = reader.read("!B")[0] |
| 10812 | obj.table_id = reader.read("!B")[0] |
| 10813 | obj.duration_sec = reader.read("!L")[0] |
| 10814 | obj.duration_nsec = reader.read("!L")[0] |
| 10815 | obj.idle_timeout = reader.read("!H")[0] |
| 10816 | obj.hard_timeout = reader.read("!H")[0] |
| 10817 | obj.packet_count = reader.read("!Q")[0] |
| 10818 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10819 | obj.match = common.match.unpack(reader) |
| 10820 | return obj |
| 10821 | |
| 10822 | def __eq__(self, other): |
| 10823 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10824 | if self.xid != other.xid: return False |
| 10825 | if self.cookie != other.cookie: return False |
| 10826 | if self.priority != other.priority: return False |
| 10827 | if self.reason != other.reason: return False |
| 10828 | if self.table_id != other.table_id: return False |
| 10829 | if self.duration_sec != other.duration_sec: return False |
| 10830 | if self.duration_nsec != other.duration_nsec: return False |
| 10831 | if self.idle_timeout != other.idle_timeout: return False |
| 10832 | if self.hard_timeout != other.hard_timeout: return False |
| 10833 | if self.packet_count != other.packet_count: return False |
| 10834 | if self.byte_count != other.byte_count: return False |
| 10835 | if self.match != other.match: return False |
| 10836 | return True |
| 10837 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10838 | def pretty_print(self, q): |
| 10839 | q.text("flow_removed {") |
| 10840 | with q.group(): |
| 10841 | with q.indent(2): |
| 10842 | q.breakable() |
| 10843 | q.text("xid = "); |
| 10844 | if self.xid != None: |
| 10845 | q.text("%#x" % self.xid) |
| 10846 | else: |
| 10847 | q.text('None') |
| 10848 | q.text(","); q.breakable() |
| 10849 | q.text("cookie = "); |
| 10850 | q.text("%#x" % self.cookie) |
| 10851 | q.text(","); q.breakable() |
| 10852 | q.text("priority = "); |
| 10853 | q.text("%#x" % self.priority) |
| 10854 | q.text(","); q.breakable() |
| 10855 | q.text("reason = "); |
| 10856 | q.text("%#x" % self.reason) |
| 10857 | q.text(","); q.breakable() |
| 10858 | q.text("table_id = "); |
| 10859 | q.text("%#x" % self.table_id) |
| 10860 | q.text(","); q.breakable() |
| 10861 | q.text("duration_sec = "); |
| 10862 | q.text("%#x" % self.duration_sec) |
| 10863 | q.text(","); q.breakable() |
| 10864 | q.text("duration_nsec = "); |
| 10865 | q.text("%#x" % self.duration_nsec) |
| 10866 | q.text(","); q.breakable() |
| 10867 | q.text("idle_timeout = "); |
| 10868 | q.text("%#x" % self.idle_timeout) |
| 10869 | q.text(","); q.breakable() |
| 10870 | q.text("hard_timeout = "); |
| 10871 | q.text("%#x" % self.hard_timeout) |
| 10872 | q.text(","); q.breakable() |
| 10873 | q.text("packet_count = "); |
| 10874 | q.text("%#x" % self.packet_count) |
| 10875 | q.text(","); q.breakable() |
| 10876 | q.text("byte_count = "); |
| 10877 | q.text("%#x" % self.byte_count) |
| 10878 | q.text(","); q.breakable() |
| 10879 | q.text("match = "); |
| 10880 | q.pp(self.match) |
| 10881 | q.breakable() |
| 10882 | q.text('}') |
| 10883 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10884 | message.subtypes[11] = flow_removed |
| 10885 | |
| 10886 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10887 | version = 4 |
| 10888 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10889 | stats_type = 1 |
| 10890 | |
| 10891 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10892 | if xid != None: |
| 10893 | self.xid = xid |
| 10894 | else: |
| 10895 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10896 | if flags != None: |
| 10897 | self.flags = flags |
| 10898 | else: |
| 10899 | self.flags = 0 |
| 10900 | if entries != None: |
| 10901 | self.entries = entries |
| 10902 | else: |
| 10903 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10904 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10905 | |
| 10906 | def pack(self): |
| 10907 | packed = [] |
| 10908 | packed.append(struct.pack("!B", self.version)) |
| 10909 | packed.append(struct.pack("!B", self.type)) |
| 10910 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10911 | packed.append(struct.pack("!L", self.xid)) |
| 10912 | packed.append(struct.pack("!H", self.stats_type)) |
| 10913 | packed.append(struct.pack("!H", self.flags)) |
| 10914 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10915 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10916 | length = sum([len(x) for x in packed]) |
| 10917 | packed[2] = struct.pack("!H", length) |
| 10918 | return ''.join(packed) |
| 10919 | |
| 10920 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10921 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10922 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10923 | _version = reader.read("!B")[0] |
| 10924 | assert(_version == 4) |
| 10925 | _type = reader.read("!B")[0] |
| 10926 | assert(_type == 19) |
| 10927 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10928 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10929 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10930 | obj.xid = reader.read("!L")[0] |
| 10931 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10932 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10933 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10934 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10935 | 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] | 10936 | return obj |
| 10937 | |
| 10938 | def __eq__(self, other): |
| 10939 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10940 | if self.xid != other.xid: return False |
| 10941 | if self.flags != other.flags: return False |
| 10942 | if self.entries != other.entries: return False |
| 10943 | return True |
| 10944 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10945 | def pretty_print(self, q): |
| 10946 | q.text("flow_stats_reply {") |
| 10947 | with q.group(): |
| 10948 | with q.indent(2): |
| 10949 | q.breakable() |
| 10950 | q.text("xid = "); |
| 10951 | if self.xid != None: |
| 10952 | q.text("%#x" % self.xid) |
| 10953 | else: |
| 10954 | q.text('None') |
| 10955 | q.text(","); q.breakable() |
| 10956 | q.text("flags = "); |
| 10957 | q.text("%#x" % self.flags) |
| 10958 | q.text(","); q.breakable() |
| 10959 | q.text("entries = "); |
| 10960 | q.pp(self.entries) |
| 10961 | q.breakable() |
| 10962 | q.text('}') |
| 10963 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10964 | stats_reply.subtypes[1] = flow_stats_reply |
| 10965 | |
| 10966 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10967 | version = 4 |
| 10968 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10969 | stats_type = 1 |
| 10970 | |
| 10971 | 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] | 10972 | if xid != None: |
| 10973 | self.xid = xid |
| 10974 | else: |
| 10975 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10976 | if flags != None: |
| 10977 | self.flags = flags |
| 10978 | else: |
| 10979 | self.flags = 0 |
| 10980 | if table_id != None: |
| 10981 | self.table_id = table_id |
| 10982 | else: |
| 10983 | self.table_id = 0 |
| 10984 | if out_port != None: |
| 10985 | self.out_port = out_port |
| 10986 | else: |
| 10987 | self.out_port = 0 |
| 10988 | if out_group != None: |
| 10989 | self.out_group = out_group |
| 10990 | else: |
| 10991 | self.out_group = 0 |
| 10992 | if cookie != None: |
| 10993 | self.cookie = cookie |
| 10994 | else: |
| 10995 | self.cookie = 0 |
| 10996 | if cookie_mask != None: |
| 10997 | self.cookie_mask = cookie_mask |
| 10998 | else: |
| 10999 | self.cookie_mask = 0 |
| 11000 | if match != None: |
| 11001 | self.match = match |
| 11002 | else: |
| 11003 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11004 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11005 | |
| 11006 | def pack(self): |
| 11007 | packed = [] |
| 11008 | packed.append(struct.pack("!B", self.version)) |
| 11009 | packed.append(struct.pack("!B", self.type)) |
| 11010 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11011 | packed.append(struct.pack("!L", self.xid)) |
| 11012 | packed.append(struct.pack("!H", self.stats_type)) |
| 11013 | packed.append(struct.pack("!H", self.flags)) |
| 11014 | packed.append('\x00' * 4) |
| 11015 | packed.append(struct.pack("!B", self.table_id)) |
| 11016 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11017 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11018 | packed.append(struct.pack("!L", self.out_group)) |
| 11019 | packed.append('\x00' * 4) |
| 11020 | packed.append(struct.pack("!Q", self.cookie)) |
| 11021 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 11022 | packed.append(self.match.pack()) |
| 11023 | length = sum([len(x) for x in packed]) |
| 11024 | packed[2] = struct.pack("!H", length) |
| 11025 | return ''.join(packed) |
| 11026 | |
| 11027 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11028 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11029 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11030 | _version = reader.read("!B")[0] |
| 11031 | assert(_version == 4) |
| 11032 | _type = reader.read("!B")[0] |
| 11033 | assert(_type == 18) |
| 11034 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11035 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11036 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11037 | obj.xid = reader.read("!L")[0] |
| 11038 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11039 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11040 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11041 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11042 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11043 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11044 | obj.out_port = util.unpack_port_no(reader) |
| 11045 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11046 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11047 | obj.cookie = reader.read("!Q")[0] |
| 11048 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11049 | obj.match = common.match.unpack(reader) |
| 11050 | return obj |
| 11051 | |
| 11052 | def __eq__(self, other): |
| 11053 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11054 | if self.xid != other.xid: return False |
| 11055 | if self.flags != other.flags: return False |
| 11056 | if self.table_id != other.table_id: return False |
| 11057 | if self.out_port != other.out_port: return False |
| 11058 | if self.out_group != other.out_group: return False |
| 11059 | if self.cookie != other.cookie: return False |
| 11060 | if self.cookie_mask != other.cookie_mask: return False |
| 11061 | if self.match != other.match: return False |
| 11062 | return True |
| 11063 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11064 | def pretty_print(self, q): |
| 11065 | q.text("flow_stats_request {") |
| 11066 | with q.group(): |
| 11067 | with q.indent(2): |
| 11068 | q.breakable() |
| 11069 | q.text("xid = "); |
| 11070 | if self.xid != None: |
| 11071 | q.text("%#x" % self.xid) |
| 11072 | else: |
| 11073 | q.text('None') |
| 11074 | q.text(","); q.breakable() |
| 11075 | q.text("flags = "); |
| 11076 | q.text("%#x" % self.flags) |
| 11077 | q.text(","); q.breakable() |
| 11078 | q.text("table_id = "); |
| 11079 | q.text("%#x" % self.table_id) |
| 11080 | q.text(","); q.breakable() |
| 11081 | q.text("out_port = "); |
| 11082 | q.text(util.pretty_port(self.out_port)) |
| 11083 | q.text(","); q.breakable() |
| 11084 | q.text("out_group = "); |
| 11085 | q.text("%#x" % self.out_group) |
| 11086 | q.text(","); q.breakable() |
| 11087 | q.text("cookie = "); |
| 11088 | q.text("%#x" % self.cookie) |
| 11089 | q.text(","); q.breakable() |
| 11090 | q.text("cookie_mask = "); |
| 11091 | q.text("%#x" % self.cookie_mask) |
| 11092 | q.text(","); q.breakable() |
| 11093 | q.text("match = "); |
| 11094 | q.pp(self.match) |
| 11095 | q.breakable() |
| 11096 | q.text('}') |
| 11097 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11098 | stats_request.subtypes[1] = flow_stats_request |
| 11099 | |
| 11100 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11101 | version = 4 |
| 11102 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11103 | |
| 11104 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11105 | if xid != None: |
| 11106 | self.xid = xid |
| 11107 | else: |
| 11108 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11109 | if flags != None: |
| 11110 | self.flags = flags |
| 11111 | else: |
| 11112 | self.flags = 0 |
| 11113 | if miss_send_len != None: |
| 11114 | self.miss_send_len = miss_send_len |
| 11115 | else: |
| 11116 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11117 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11118 | |
| 11119 | def pack(self): |
| 11120 | packed = [] |
| 11121 | packed.append(struct.pack("!B", self.version)) |
| 11122 | packed.append(struct.pack("!B", self.type)) |
| 11123 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11124 | packed.append(struct.pack("!L", self.xid)) |
| 11125 | packed.append(struct.pack("!H", self.flags)) |
| 11126 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 11127 | length = sum([len(x) for x in packed]) |
| 11128 | packed[2] = struct.pack("!H", length) |
| 11129 | return ''.join(packed) |
| 11130 | |
| 11131 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11132 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11133 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11134 | _version = reader.read("!B")[0] |
| 11135 | assert(_version == 4) |
| 11136 | _type = reader.read("!B")[0] |
| 11137 | assert(_type == 8) |
| 11138 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11139 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11140 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11141 | obj.xid = reader.read("!L")[0] |
| 11142 | obj.flags = reader.read("!H")[0] |
| 11143 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11144 | return obj |
| 11145 | |
| 11146 | def __eq__(self, other): |
| 11147 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11148 | if self.xid != other.xid: return False |
| 11149 | if self.flags != other.flags: return False |
| 11150 | if self.miss_send_len != other.miss_send_len: return False |
| 11151 | return True |
| 11152 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11153 | def pretty_print(self, q): |
| 11154 | q.text("get_config_reply {") |
| 11155 | with q.group(): |
| 11156 | with q.indent(2): |
| 11157 | q.breakable() |
| 11158 | q.text("xid = "); |
| 11159 | if self.xid != None: |
| 11160 | q.text("%#x" % self.xid) |
| 11161 | else: |
| 11162 | q.text('None') |
| 11163 | q.text(","); q.breakable() |
| 11164 | q.text("flags = "); |
| 11165 | q.text("%#x" % self.flags) |
| 11166 | q.text(","); q.breakable() |
| 11167 | q.text("miss_send_len = "); |
| 11168 | q.text("%#x" % self.miss_send_len) |
| 11169 | q.breakable() |
| 11170 | q.text('}') |
| 11171 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11172 | message.subtypes[8] = get_config_reply |
| 11173 | |
| 11174 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11175 | version = 4 |
| 11176 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11177 | |
| 11178 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11179 | if xid != None: |
| 11180 | self.xid = xid |
| 11181 | else: |
| 11182 | self.xid = None |
| 11183 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11184 | |
| 11185 | def pack(self): |
| 11186 | packed = [] |
| 11187 | packed.append(struct.pack("!B", self.version)) |
| 11188 | packed.append(struct.pack("!B", self.type)) |
| 11189 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11190 | packed.append(struct.pack("!L", self.xid)) |
| 11191 | length = sum([len(x) for x in packed]) |
| 11192 | packed[2] = struct.pack("!H", length) |
| 11193 | return ''.join(packed) |
| 11194 | |
| 11195 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11196 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11197 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11198 | _version = reader.read("!B")[0] |
| 11199 | assert(_version == 4) |
| 11200 | _type = reader.read("!B")[0] |
| 11201 | assert(_type == 7) |
| 11202 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11203 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11204 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11205 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11206 | return obj |
| 11207 | |
| 11208 | def __eq__(self, other): |
| 11209 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11210 | if self.xid != other.xid: return False |
| 11211 | return True |
| 11212 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11213 | def pretty_print(self, q): |
| 11214 | q.text("get_config_request {") |
| 11215 | with q.group(): |
| 11216 | with q.indent(2): |
| 11217 | q.breakable() |
| 11218 | q.text("xid = "); |
| 11219 | if self.xid != None: |
| 11220 | q.text("%#x" % self.xid) |
| 11221 | else: |
| 11222 | q.text('None') |
| 11223 | q.breakable() |
| 11224 | q.text('}') |
| 11225 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11226 | message.subtypes[7] = get_config_request |
| 11227 | |
| 11228 | class group_mod(message): |
| 11229 | subtypes = {} |
| 11230 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11231 | version = 4 |
| 11232 | type = 15 |
| 11233 | |
| 11234 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 11235 | if xid != None: |
| 11236 | self.xid = xid |
| 11237 | else: |
| 11238 | self.xid = None |
| 11239 | if command != None: |
| 11240 | self.command = command |
| 11241 | else: |
| 11242 | self.command = 0 |
| 11243 | if group_type != None: |
| 11244 | self.group_type = group_type |
| 11245 | else: |
| 11246 | self.group_type = 0 |
| 11247 | if group_id != None: |
| 11248 | self.group_id = group_id |
| 11249 | else: |
| 11250 | self.group_id = 0 |
| 11251 | if buckets != None: |
| 11252 | self.buckets = buckets |
| 11253 | else: |
| 11254 | self.buckets = [] |
| 11255 | return |
| 11256 | |
| 11257 | def pack(self): |
| 11258 | packed = [] |
| 11259 | packed.append(struct.pack("!B", self.version)) |
| 11260 | packed.append(struct.pack("!B", self.type)) |
| 11261 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11262 | packed.append(struct.pack("!L", self.xid)) |
| 11263 | packed.append(struct.pack("!H", self.command)) |
| 11264 | packed.append(struct.pack("!B", self.group_type)) |
| 11265 | packed.append('\x00' * 1) |
| 11266 | packed.append(struct.pack("!L", self.group_id)) |
| 11267 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11268 | length = sum([len(x) for x in packed]) |
| 11269 | packed[2] = struct.pack("!H", length) |
| 11270 | return ''.join(packed) |
| 11271 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11272 | @staticmethod |
| 11273 | def unpack(reader): |
| 11274 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11275 | subclass = group_mod.subtypes.get(subtype) |
| 11276 | if subclass: |
| 11277 | return subclass.unpack(reader) |
| 11278 | |
| 11279 | obj = group_mod() |
| 11280 | _version = reader.read("!B")[0] |
| 11281 | assert(_version == 4) |
| 11282 | _type = reader.read("!B")[0] |
| 11283 | assert(_type == 15) |
| 11284 | _length = reader.read("!H")[0] |
| 11285 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11286 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11287 | obj.xid = reader.read("!L")[0] |
| 11288 | obj.command = reader.read("!H")[0] |
| 11289 | obj.group_type = reader.read("!B")[0] |
| 11290 | reader.skip(1) |
| 11291 | obj.group_id = reader.read("!L")[0] |
| 11292 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 11293 | return obj |
| 11294 | |
| 11295 | def __eq__(self, other): |
| 11296 | if type(self) != type(other): return False |
| 11297 | if self.xid != other.xid: return False |
| 11298 | if self.command != other.command: return False |
| 11299 | if self.group_type != other.group_type: return False |
| 11300 | if self.group_id != other.group_id: return False |
| 11301 | if self.buckets != other.buckets: return False |
| 11302 | return True |
| 11303 | |
| 11304 | def pretty_print(self, q): |
| 11305 | q.text("group_mod {") |
| 11306 | with q.group(): |
| 11307 | with q.indent(2): |
| 11308 | q.breakable() |
| 11309 | q.text("xid = "); |
| 11310 | if self.xid != None: |
| 11311 | q.text("%#x" % self.xid) |
| 11312 | else: |
| 11313 | q.text('None') |
| 11314 | q.text(","); q.breakable() |
| 11315 | q.text("group_type = "); |
| 11316 | q.text("%#x" % self.group_type) |
| 11317 | q.text(","); q.breakable() |
| 11318 | q.text("group_id = "); |
| 11319 | q.text("%#x" % self.group_id) |
| 11320 | q.text(","); q.breakable() |
| 11321 | q.text("buckets = "); |
| 11322 | q.pp(self.buckets) |
| 11323 | q.breakable() |
| 11324 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11325 | |
| 11326 | message.subtypes[15] = group_mod |
| 11327 | |
| 11328 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11329 | version = 4 |
| 11330 | type = 15 |
| 11331 | command = 0 |
| 11332 | |
| 11333 | 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] | 11334 | if xid != None: |
| 11335 | self.xid = xid |
| 11336 | else: |
| 11337 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11338 | if group_type != None: |
| 11339 | self.group_type = group_type |
| 11340 | else: |
| 11341 | self.group_type = 0 |
| 11342 | if group_id != None: |
| 11343 | self.group_id = group_id |
| 11344 | else: |
| 11345 | self.group_id = 0 |
| 11346 | if buckets != None: |
| 11347 | self.buckets = buckets |
| 11348 | else: |
| 11349 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11350 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11351 | |
| 11352 | def pack(self): |
| 11353 | packed = [] |
| 11354 | packed.append(struct.pack("!B", self.version)) |
| 11355 | packed.append(struct.pack("!B", self.type)) |
| 11356 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11357 | packed.append(struct.pack("!L", self.xid)) |
| 11358 | packed.append(struct.pack("!H", self.command)) |
| 11359 | packed.append(struct.pack("!B", self.group_type)) |
| 11360 | packed.append('\x00' * 1) |
| 11361 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11362 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11363 | length = sum([len(x) for x in packed]) |
| 11364 | packed[2] = struct.pack("!H", length) |
| 11365 | return ''.join(packed) |
| 11366 | |
| 11367 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11368 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11369 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11370 | _version = reader.read("!B")[0] |
| 11371 | assert(_version == 4) |
| 11372 | _type = reader.read("!B")[0] |
| 11373 | assert(_type == 15) |
| 11374 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11375 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11376 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11377 | obj.xid = reader.read("!L")[0] |
| 11378 | _command = reader.read("!H")[0] |
| 11379 | assert(_command == 0) |
| 11380 | obj.group_type = reader.read("!B")[0] |
| 11381 | reader.skip(1) |
| 11382 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11383 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11384 | return obj |
| 11385 | |
| 11386 | def __eq__(self, other): |
| 11387 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11388 | if self.xid != other.xid: return False |
| 11389 | if self.group_type != other.group_type: return False |
| 11390 | if self.group_id != other.group_id: return False |
| 11391 | if self.buckets != other.buckets: return False |
| 11392 | return True |
| 11393 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11394 | def pretty_print(self, q): |
| 11395 | q.text("group_add {") |
| 11396 | with q.group(): |
| 11397 | with q.indent(2): |
| 11398 | q.breakable() |
| 11399 | q.text("xid = "); |
| 11400 | if self.xid != None: |
| 11401 | q.text("%#x" % self.xid) |
| 11402 | else: |
| 11403 | q.text('None') |
| 11404 | q.text(","); q.breakable() |
| 11405 | q.text("group_type = "); |
| 11406 | q.text("%#x" % self.group_type) |
| 11407 | q.text(","); q.breakable() |
| 11408 | q.text("group_id = "); |
| 11409 | q.text("%#x" % self.group_id) |
| 11410 | q.text(","); q.breakable() |
| 11411 | q.text("buckets = "); |
| 11412 | q.pp(self.buckets) |
| 11413 | q.breakable() |
| 11414 | q.text('}') |
| 11415 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11416 | group_mod.subtypes[0] = group_add |
| 11417 | |
| 11418 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11419 | version = 4 |
| 11420 | type = 15 |
| 11421 | command = 2 |
| 11422 | |
| 11423 | 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] | 11424 | if xid != None: |
| 11425 | self.xid = xid |
| 11426 | else: |
| 11427 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11428 | if group_type != None: |
| 11429 | self.group_type = group_type |
| 11430 | else: |
| 11431 | self.group_type = 0 |
| 11432 | if group_id != None: |
| 11433 | self.group_id = group_id |
| 11434 | else: |
| 11435 | self.group_id = 0 |
| 11436 | if buckets != None: |
| 11437 | self.buckets = buckets |
| 11438 | else: |
| 11439 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11440 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11441 | |
| 11442 | def pack(self): |
| 11443 | packed = [] |
| 11444 | packed.append(struct.pack("!B", self.version)) |
| 11445 | packed.append(struct.pack("!B", self.type)) |
| 11446 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11447 | packed.append(struct.pack("!L", self.xid)) |
| 11448 | packed.append(struct.pack("!H", self.command)) |
| 11449 | packed.append(struct.pack("!B", self.group_type)) |
| 11450 | packed.append('\x00' * 1) |
| 11451 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11452 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11453 | length = sum([len(x) for x in packed]) |
| 11454 | packed[2] = struct.pack("!H", length) |
| 11455 | return ''.join(packed) |
| 11456 | |
| 11457 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11458 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11459 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11460 | _version = reader.read("!B")[0] |
| 11461 | assert(_version == 4) |
| 11462 | _type = reader.read("!B")[0] |
| 11463 | assert(_type == 15) |
| 11464 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11465 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11466 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11467 | obj.xid = reader.read("!L")[0] |
| 11468 | _command = reader.read("!H")[0] |
| 11469 | assert(_command == 2) |
| 11470 | obj.group_type = reader.read("!B")[0] |
| 11471 | reader.skip(1) |
| 11472 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11473 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11474 | return obj |
| 11475 | |
| 11476 | def __eq__(self, other): |
| 11477 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11478 | if self.xid != other.xid: return False |
| 11479 | if self.group_type != other.group_type: return False |
| 11480 | if self.group_id != other.group_id: return False |
| 11481 | if self.buckets != other.buckets: return False |
| 11482 | return True |
| 11483 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11484 | def pretty_print(self, q): |
| 11485 | q.text("group_delete {") |
| 11486 | with q.group(): |
| 11487 | with q.indent(2): |
| 11488 | q.breakable() |
| 11489 | q.text("xid = "); |
| 11490 | if self.xid != None: |
| 11491 | q.text("%#x" % self.xid) |
| 11492 | else: |
| 11493 | q.text('None') |
| 11494 | q.text(","); q.breakable() |
| 11495 | q.text("group_type = "); |
| 11496 | q.text("%#x" % self.group_type) |
| 11497 | q.text(","); q.breakable() |
| 11498 | q.text("group_id = "); |
| 11499 | q.text("%#x" % self.group_id) |
| 11500 | q.text(","); q.breakable() |
| 11501 | q.text("buckets = "); |
| 11502 | q.pp(self.buckets) |
| 11503 | q.breakable() |
| 11504 | q.text('}') |
| 11505 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11506 | group_mod.subtypes[2] = group_delete |
| 11507 | |
| 11508 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11509 | version = 4 |
| 11510 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11511 | stats_type = 7 |
| 11512 | |
| 11513 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11514 | if xid != None: |
| 11515 | self.xid = xid |
| 11516 | else: |
| 11517 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11518 | if flags != None: |
| 11519 | self.flags = flags |
| 11520 | else: |
| 11521 | self.flags = 0 |
| 11522 | if entries != None: |
| 11523 | self.entries = entries |
| 11524 | else: |
| 11525 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11526 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11527 | |
| 11528 | def pack(self): |
| 11529 | packed = [] |
| 11530 | packed.append(struct.pack("!B", self.version)) |
| 11531 | packed.append(struct.pack("!B", self.type)) |
| 11532 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11533 | packed.append(struct.pack("!L", self.xid)) |
| 11534 | packed.append(struct.pack("!H", self.stats_type)) |
| 11535 | packed.append(struct.pack("!H", self.flags)) |
| 11536 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11537 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11538 | length = sum([len(x) for x in packed]) |
| 11539 | packed[2] = struct.pack("!H", length) |
| 11540 | return ''.join(packed) |
| 11541 | |
| 11542 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11543 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11544 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11545 | _version = reader.read("!B")[0] |
| 11546 | assert(_version == 4) |
| 11547 | _type = reader.read("!B")[0] |
| 11548 | assert(_type == 19) |
| 11549 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11550 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11551 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11552 | obj.xid = reader.read("!L")[0] |
| 11553 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11554 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11555 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11556 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11557 | 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] | 11558 | return obj |
| 11559 | |
| 11560 | def __eq__(self, other): |
| 11561 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11562 | if self.xid != other.xid: return False |
| 11563 | if self.flags != other.flags: return False |
| 11564 | if self.entries != other.entries: return False |
| 11565 | return True |
| 11566 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11567 | def pretty_print(self, q): |
| 11568 | q.text("group_desc_stats_reply {") |
| 11569 | with q.group(): |
| 11570 | with q.indent(2): |
| 11571 | q.breakable() |
| 11572 | q.text("xid = "); |
| 11573 | if self.xid != None: |
| 11574 | q.text("%#x" % self.xid) |
| 11575 | else: |
| 11576 | q.text('None') |
| 11577 | q.text(","); q.breakable() |
| 11578 | q.text("flags = "); |
| 11579 | q.text("%#x" % self.flags) |
| 11580 | q.text(","); q.breakable() |
| 11581 | q.text("entries = "); |
| 11582 | q.pp(self.entries) |
| 11583 | q.breakable() |
| 11584 | q.text('}') |
| 11585 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11586 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 11587 | |
| 11588 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11589 | version = 4 |
| 11590 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11591 | stats_type = 7 |
| 11592 | |
| 11593 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11594 | if xid != None: |
| 11595 | self.xid = xid |
| 11596 | else: |
| 11597 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11598 | if flags != None: |
| 11599 | self.flags = flags |
| 11600 | else: |
| 11601 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11602 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11603 | |
| 11604 | def pack(self): |
| 11605 | packed = [] |
| 11606 | packed.append(struct.pack("!B", self.version)) |
| 11607 | packed.append(struct.pack("!B", self.type)) |
| 11608 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11609 | packed.append(struct.pack("!L", self.xid)) |
| 11610 | packed.append(struct.pack("!H", self.stats_type)) |
| 11611 | packed.append(struct.pack("!H", self.flags)) |
| 11612 | packed.append('\x00' * 4) |
| 11613 | length = sum([len(x) for x in packed]) |
| 11614 | packed[2] = struct.pack("!H", length) |
| 11615 | return ''.join(packed) |
| 11616 | |
| 11617 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11618 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11619 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11620 | _version = reader.read("!B")[0] |
| 11621 | assert(_version == 4) |
| 11622 | _type = reader.read("!B")[0] |
| 11623 | assert(_type == 18) |
| 11624 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11625 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11626 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11627 | obj.xid = reader.read("!L")[0] |
| 11628 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11629 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11630 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11631 | reader.skip(4) |
| 11632 | return obj |
| 11633 | |
| 11634 | def __eq__(self, other): |
| 11635 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11636 | if self.xid != other.xid: return False |
| 11637 | if self.flags != other.flags: return False |
| 11638 | return True |
| 11639 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11640 | def pretty_print(self, q): |
| 11641 | q.text("group_desc_stats_request {") |
| 11642 | with q.group(): |
| 11643 | with q.indent(2): |
| 11644 | q.breakable() |
| 11645 | q.text("xid = "); |
| 11646 | if self.xid != None: |
| 11647 | q.text("%#x" % self.xid) |
| 11648 | else: |
| 11649 | q.text('None') |
| 11650 | q.text(","); q.breakable() |
| 11651 | q.text("flags = "); |
| 11652 | q.text("%#x" % self.flags) |
| 11653 | q.breakable() |
| 11654 | q.text('}') |
| 11655 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11656 | stats_request.subtypes[7] = group_desc_stats_request |
| 11657 | |
| 11658 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11659 | version = 4 |
| 11660 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11661 | stats_type = 8 |
| 11662 | |
| 11663 | 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] | 11664 | if xid != None: |
| 11665 | self.xid = xid |
| 11666 | else: |
| 11667 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11668 | if flags != None: |
| 11669 | self.flags = flags |
| 11670 | else: |
| 11671 | self.flags = 0 |
| 11672 | if types != None: |
| 11673 | self.types = types |
| 11674 | else: |
| 11675 | self.types = 0 |
| 11676 | if capabilities != None: |
| 11677 | self.capabilities = capabilities |
| 11678 | else: |
| 11679 | self.capabilities = 0 |
| 11680 | if max_groups_all != None: |
| 11681 | self.max_groups_all = max_groups_all |
| 11682 | else: |
| 11683 | self.max_groups_all = 0 |
| 11684 | if max_groups_select != None: |
| 11685 | self.max_groups_select = max_groups_select |
| 11686 | else: |
| 11687 | self.max_groups_select = 0 |
| 11688 | if max_groups_indirect != None: |
| 11689 | self.max_groups_indirect = max_groups_indirect |
| 11690 | else: |
| 11691 | self.max_groups_indirect = 0 |
| 11692 | if max_groups_ff != None: |
| 11693 | self.max_groups_ff = max_groups_ff |
| 11694 | else: |
| 11695 | self.max_groups_ff = 0 |
| 11696 | if actions_all != None: |
| 11697 | self.actions_all = actions_all |
| 11698 | else: |
| 11699 | self.actions_all = 0 |
| 11700 | if actions_select != None: |
| 11701 | self.actions_select = actions_select |
| 11702 | else: |
| 11703 | self.actions_select = 0 |
| 11704 | if actions_indirect != None: |
| 11705 | self.actions_indirect = actions_indirect |
| 11706 | else: |
| 11707 | self.actions_indirect = 0 |
| 11708 | if actions_ff != None: |
| 11709 | self.actions_ff = actions_ff |
| 11710 | else: |
| 11711 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11712 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11713 | |
| 11714 | def pack(self): |
| 11715 | packed = [] |
| 11716 | packed.append(struct.pack("!B", self.version)) |
| 11717 | packed.append(struct.pack("!B", self.type)) |
| 11718 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11719 | packed.append(struct.pack("!L", self.xid)) |
| 11720 | packed.append(struct.pack("!H", self.stats_type)) |
| 11721 | packed.append(struct.pack("!H", self.flags)) |
| 11722 | packed.append('\x00' * 4) |
| 11723 | packed.append(struct.pack("!L", self.types)) |
| 11724 | packed.append(struct.pack("!L", self.capabilities)) |
| 11725 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 11726 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 11727 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 11728 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 11729 | packed.append(struct.pack("!L", self.actions_all)) |
| 11730 | packed.append(struct.pack("!L", self.actions_select)) |
| 11731 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 11732 | packed.append(struct.pack("!L", self.actions_ff)) |
| 11733 | length = sum([len(x) for x in packed]) |
| 11734 | packed[2] = struct.pack("!H", length) |
| 11735 | return ''.join(packed) |
| 11736 | |
| 11737 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11738 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11739 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11740 | _version = reader.read("!B")[0] |
| 11741 | assert(_version == 4) |
| 11742 | _type = reader.read("!B")[0] |
| 11743 | assert(_type == 19) |
| 11744 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11745 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11746 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11747 | obj.xid = reader.read("!L")[0] |
| 11748 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11749 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11750 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11751 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11752 | obj.types = reader.read("!L")[0] |
| 11753 | obj.capabilities = reader.read("!L")[0] |
| 11754 | obj.max_groups_all = reader.read("!L")[0] |
| 11755 | obj.max_groups_select = reader.read("!L")[0] |
| 11756 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11757 | obj.max_groups_ff = reader.read("!L")[0] |
| 11758 | obj.actions_all = reader.read("!L")[0] |
| 11759 | obj.actions_select = reader.read("!L")[0] |
| 11760 | obj.actions_indirect = reader.read("!L")[0] |
| 11761 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11762 | return obj |
| 11763 | |
| 11764 | def __eq__(self, other): |
| 11765 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11766 | if self.xid != other.xid: return False |
| 11767 | if self.flags != other.flags: return False |
| 11768 | if self.types != other.types: return False |
| 11769 | if self.capabilities != other.capabilities: return False |
| 11770 | if self.max_groups_all != other.max_groups_all: return False |
| 11771 | if self.max_groups_select != other.max_groups_select: return False |
| 11772 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11773 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11774 | if self.actions_all != other.actions_all: return False |
| 11775 | if self.actions_select != other.actions_select: return False |
| 11776 | if self.actions_indirect != other.actions_indirect: return False |
| 11777 | if self.actions_ff != other.actions_ff: return False |
| 11778 | return True |
| 11779 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11780 | def pretty_print(self, q): |
| 11781 | q.text("group_features_stats_reply {") |
| 11782 | with q.group(): |
| 11783 | with q.indent(2): |
| 11784 | q.breakable() |
| 11785 | q.text("xid = "); |
| 11786 | if self.xid != None: |
| 11787 | q.text("%#x" % self.xid) |
| 11788 | else: |
| 11789 | q.text('None') |
| 11790 | q.text(","); q.breakable() |
| 11791 | q.text("flags = "); |
| 11792 | q.text("%#x" % self.flags) |
| 11793 | q.text(","); q.breakable() |
| 11794 | q.text("types = "); |
| 11795 | q.text("%#x" % self.types) |
| 11796 | q.text(","); q.breakable() |
| 11797 | q.text("capabilities = "); |
| 11798 | q.text("%#x" % self.capabilities) |
| 11799 | q.text(","); q.breakable() |
| 11800 | q.text("max_groups_all = "); |
| 11801 | q.text("%#x" % self.max_groups_all) |
| 11802 | q.text(","); q.breakable() |
| 11803 | q.text("max_groups_select = "); |
| 11804 | q.text("%#x" % self.max_groups_select) |
| 11805 | q.text(","); q.breakable() |
| 11806 | q.text("max_groups_indirect = "); |
| 11807 | q.text("%#x" % self.max_groups_indirect) |
| 11808 | q.text(","); q.breakable() |
| 11809 | q.text("max_groups_ff = "); |
| 11810 | q.text("%#x" % self.max_groups_ff) |
| 11811 | q.text(","); q.breakable() |
| 11812 | q.text("actions_all = "); |
| 11813 | q.text("%#x" % self.actions_all) |
| 11814 | q.text(","); q.breakable() |
| 11815 | q.text("actions_select = "); |
| 11816 | q.text("%#x" % self.actions_select) |
| 11817 | q.text(","); q.breakable() |
| 11818 | q.text("actions_indirect = "); |
| 11819 | q.text("%#x" % self.actions_indirect) |
| 11820 | q.text(","); q.breakable() |
| 11821 | q.text("actions_ff = "); |
| 11822 | q.text("%#x" % self.actions_ff) |
| 11823 | q.breakable() |
| 11824 | q.text('}') |
| 11825 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11826 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11827 | |
| 11828 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11829 | version = 4 |
| 11830 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11831 | stats_type = 8 |
| 11832 | |
| 11833 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11834 | if xid != None: |
| 11835 | self.xid = xid |
| 11836 | else: |
| 11837 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11838 | if flags != None: |
| 11839 | self.flags = flags |
| 11840 | else: |
| 11841 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11842 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11843 | |
| 11844 | def pack(self): |
| 11845 | packed = [] |
| 11846 | packed.append(struct.pack("!B", self.version)) |
| 11847 | packed.append(struct.pack("!B", self.type)) |
| 11848 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11849 | packed.append(struct.pack("!L", self.xid)) |
| 11850 | packed.append(struct.pack("!H", self.stats_type)) |
| 11851 | packed.append(struct.pack("!H", self.flags)) |
| 11852 | packed.append('\x00' * 4) |
| 11853 | length = sum([len(x) for x in packed]) |
| 11854 | packed[2] = struct.pack("!H", length) |
| 11855 | return ''.join(packed) |
| 11856 | |
| 11857 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11858 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11859 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11860 | _version = reader.read("!B")[0] |
| 11861 | assert(_version == 4) |
| 11862 | _type = reader.read("!B")[0] |
| 11863 | assert(_type == 18) |
| 11864 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11865 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11866 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11867 | obj.xid = reader.read("!L")[0] |
| 11868 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11869 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11870 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11871 | reader.skip(4) |
| 11872 | return obj |
| 11873 | |
| 11874 | def __eq__(self, other): |
| 11875 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11876 | if self.xid != other.xid: return False |
| 11877 | if self.flags != other.flags: return False |
| 11878 | return True |
| 11879 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11880 | def pretty_print(self, q): |
| 11881 | q.text("group_features_stats_request {") |
| 11882 | with q.group(): |
| 11883 | with q.indent(2): |
| 11884 | q.breakable() |
| 11885 | q.text("xid = "); |
| 11886 | if self.xid != None: |
| 11887 | q.text("%#x" % self.xid) |
| 11888 | else: |
| 11889 | q.text('None') |
| 11890 | q.text(","); q.breakable() |
| 11891 | q.text("flags = "); |
| 11892 | q.text("%#x" % self.flags) |
| 11893 | q.breakable() |
| 11894 | q.text('}') |
| 11895 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11896 | stats_request.subtypes[8] = group_features_stats_request |
| 11897 | |
| 11898 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11899 | version = 4 |
| 11900 | type = 1 |
| 11901 | err_type = 6 |
| 11902 | |
| 11903 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11904 | if xid != None: |
| 11905 | self.xid = xid |
| 11906 | else: |
| 11907 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11908 | if code != None: |
| 11909 | self.code = code |
| 11910 | else: |
| 11911 | self.code = 0 |
| 11912 | if data != None: |
| 11913 | self.data = data |
| 11914 | else: |
| 11915 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11916 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11917 | |
| 11918 | def pack(self): |
| 11919 | packed = [] |
| 11920 | packed.append(struct.pack("!B", self.version)) |
| 11921 | packed.append(struct.pack("!B", self.type)) |
| 11922 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11923 | packed.append(struct.pack("!L", self.xid)) |
| 11924 | packed.append(struct.pack("!H", self.err_type)) |
| 11925 | packed.append(struct.pack("!H", self.code)) |
| 11926 | packed.append(self.data) |
| 11927 | length = sum([len(x) for x in packed]) |
| 11928 | packed[2] = struct.pack("!H", length) |
| 11929 | return ''.join(packed) |
| 11930 | |
| 11931 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11932 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11933 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11934 | _version = reader.read("!B")[0] |
| 11935 | assert(_version == 4) |
| 11936 | _type = reader.read("!B")[0] |
| 11937 | assert(_type == 1) |
| 11938 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11939 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11940 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11941 | obj.xid = reader.read("!L")[0] |
| 11942 | _err_type = reader.read("!H")[0] |
| 11943 | assert(_err_type == 6) |
| 11944 | obj.code = reader.read("!H")[0] |
| 11945 | obj.data = str(reader.read_all()) |
| 11946 | return obj |
| 11947 | |
| 11948 | def __eq__(self, other): |
| 11949 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11950 | if self.xid != other.xid: return False |
| 11951 | if self.code != other.code: return False |
| 11952 | if self.data != other.data: return False |
| 11953 | return True |
| 11954 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11955 | def pretty_print(self, q): |
| 11956 | q.text("group_mod_failed_error_msg {") |
| 11957 | with q.group(): |
| 11958 | with q.indent(2): |
| 11959 | q.breakable() |
| 11960 | q.text("xid = "); |
| 11961 | if self.xid != None: |
| 11962 | q.text("%#x" % self.xid) |
| 11963 | else: |
| 11964 | q.text('None') |
| 11965 | q.text(","); q.breakable() |
| 11966 | q.text("code = "); |
| 11967 | q.text("%#x" % self.code) |
| 11968 | q.text(","); q.breakable() |
| 11969 | q.text("data = "); |
| 11970 | q.pp(self.data) |
| 11971 | q.breakable() |
| 11972 | q.text('}') |
| 11973 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11974 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11975 | |
| 11976 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11977 | version = 4 |
| 11978 | type = 15 |
| 11979 | command = 1 |
| 11980 | |
| 11981 | 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] | 11982 | if xid != None: |
| 11983 | self.xid = xid |
| 11984 | else: |
| 11985 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11986 | if group_type != None: |
| 11987 | self.group_type = group_type |
| 11988 | else: |
| 11989 | self.group_type = 0 |
| 11990 | if group_id != None: |
| 11991 | self.group_id = group_id |
| 11992 | else: |
| 11993 | self.group_id = 0 |
| 11994 | if buckets != None: |
| 11995 | self.buckets = buckets |
| 11996 | else: |
| 11997 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11998 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11999 | |
| 12000 | def pack(self): |
| 12001 | packed = [] |
| 12002 | packed.append(struct.pack("!B", self.version)) |
| 12003 | packed.append(struct.pack("!B", self.type)) |
| 12004 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12005 | packed.append(struct.pack("!L", self.xid)) |
| 12006 | packed.append(struct.pack("!H", self.command)) |
| 12007 | packed.append(struct.pack("!B", self.group_type)) |
| 12008 | packed.append('\x00' * 1) |
| 12009 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12010 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12011 | length = sum([len(x) for x in packed]) |
| 12012 | packed[2] = struct.pack("!H", length) |
| 12013 | return ''.join(packed) |
| 12014 | |
| 12015 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12016 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12017 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12018 | _version = reader.read("!B")[0] |
| 12019 | assert(_version == 4) |
| 12020 | _type = reader.read("!B")[0] |
| 12021 | assert(_type == 15) |
| 12022 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12023 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12024 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12025 | obj.xid = reader.read("!L")[0] |
| 12026 | _command = reader.read("!H")[0] |
| 12027 | assert(_command == 1) |
| 12028 | obj.group_type = reader.read("!B")[0] |
| 12029 | reader.skip(1) |
| 12030 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12031 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12032 | return obj |
| 12033 | |
| 12034 | def __eq__(self, other): |
| 12035 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12036 | if self.xid != other.xid: return False |
| 12037 | if self.group_type != other.group_type: return False |
| 12038 | if self.group_id != other.group_id: return False |
| 12039 | if self.buckets != other.buckets: return False |
| 12040 | return True |
| 12041 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12042 | def pretty_print(self, q): |
| 12043 | q.text("group_modify {") |
| 12044 | with q.group(): |
| 12045 | with q.indent(2): |
| 12046 | q.breakable() |
| 12047 | q.text("xid = "); |
| 12048 | if self.xid != None: |
| 12049 | q.text("%#x" % self.xid) |
| 12050 | else: |
| 12051 | q.text('None') |
| 12052 | q.text(","); q.breakable() |
| 12053 | q.text("group_type = "); |
| 12054 | q.text("%#x" % self.group_type) |
| 12055 | q.text(","); q.breakable() |
| 12056 | q.text("group_id = "); |
| 12057 | q.text("%#x" % self.group_id) |
| 12058 | q.text(","); q.breakable() |
| 12059 | q.text("buckets = "); |
| 12060 | q.pp(self.buckets) |
| 12061 | q.breakable() |
| 12062 | q.text('}') |
| 12063 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12064 | group_mod.subtypes[1] = group_modify |
| 12065 | |
| 12066 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12067 | version = 4 |
| 12068 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12069 | stats_type = 6 |
| 12070 | |
| 12071 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12072 | if xid != None: |
| 12073 | self.xid = xid |
| 12074 | else: |
| 12075 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12076 | if flags != None: |
| 12077 | self.flags = flags |
| 12078 | else: |
| 12079 | self.flags = 0 |
| 12080 | if entries != None: |
| 12081 | self.entries = entries |
| 12082 | else: |
| 12083 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12084 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12085 | |
| 12086 | def pack(self): |
| 12087 | packed = [] |
| 12088 | packed.append(struct.pack("!B", self.version)) |
| 12089 | packed.append(struct.pack("!B", self.type)) |
| 12090 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12091 | packed.append(struct.pack("!L", self.xid)) |
| 12092 | packed.append(struct.pack("!H", self.stats_type)) |
| 12093 | packed.append(struct.pack("!H", self.flags)) |
| 12094 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12095 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12096 | length = sum([len(x) for x in packed]) |
| 12097 | packed[2] = struct.pack("!H", length) |
| 12098 | return ''.join(packed) |
| 12099 | |
| 12100 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12101 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12102 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12103 | _version = reader.read("!B")[0] |
| 12104 | assert(_version == 4) |
| 12105 | _type = reader.read("!B")[0] |
| 12106 | assert(_type == 19) |
| 12107 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12108 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12109 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12110 | obj.xid = reader.read("!L")[0] |
| 12111 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12112 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12113 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12114 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12115 | 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] | 12116 | return obj |
| 12117 | |
| 12118 | def __eq__(self, other): |
| 12119 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12120 | if self.xid != other.xid: return False |
| 12121 | if self.flags != other.flags: return False |
| 12122 | if self.entries != other.entries: return False |
| 12123 | return True |
| 12124 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12125 | def pretty_print(self, q): |
| 12126 | q.text("group_stats_reply {") |
| 12127 | with q.group(): |
| 12128 | with q.indent(2): |
| 12129 | q.breakable() |
| 12130 | q.text("xid = "); |
| 12131 | if self.xid != None: |
| 12132 | q.text("%#x" % self.xid) |
| 12133 | else: |
| 12134 | q.text('None') |
| 12135 | q.text(","); q.breakable() |
| 12136 | q.text("flags = "); |
| 12137 | q.text("%#x" % self.flags) |
| 12138 | q.text(","); q.breakable() |
| 12139 | q.text("entries = "); |
| 12140 | q.pp(self.entries) |
| 12141 | q.breakable() |
| 12142 | q.text('}') |
| 12143 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12144 | stats_reply.subtypes[6] = group_stats_reply |
| 12145 | |
| 12146 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12147 | version = 4 |
| 12148 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12149 | stats_type = 6 |
| 12150 | |
| 12151 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12152 | if xid != None: |
| 12153 | self.xid = xid |
| 12154 | else: |
| 12155 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12156 | if flags != None: |
| 12157 | self.flags = flags |
| 12158 | else: |
| 12159 | self.flags = 0 |
| 12160 | if group_id != None: |
| 12161 | self.group_id = group_id |
| 12162 | else: |
| 12163 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12164 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12165 | |
| 12166 | def pack(self): |
| 12167 | packed = [] |
| 12168 | packed.append(struct.pack("!B", self.version)) |
| 12169 | packed.append(struct.pack("!B", self.type)) |
| 12170 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12171 | packed.append(struct.pack("!L", self.xid)) |
| 12172 | packed.append(struct.pack("!H", self.stats_type)) |
| 12173 | packed.append(struct.pack("!H", self.flags)) |
| 12174 | packed.append('\x00' * 4) |
| 12175 | packed.append(struct.pack("!L", self.group_id)) |
| 12176 | packed.append('\x00' * 4) |
| 12177 | length = sum([len(x) for x in packed]) |
| 12178 | packed[2] = struct.pack("!H", length) |
| 12179 | return ''.join(packed) |
| 12180 | |
| 12181 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12182 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12183 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12184 | _version = reader.read("!B")[0] |
| 12185 | assert(_version == 4) |
| 12186 | _type = reader.read("!B")[0] |
| 12187 | assert(_type == 18) |
| 12188 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12189 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12190 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12191 | obj.xid = reader.read("!L")[0] |
| 12192 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12193 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12194 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12195 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12196 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12197 | reader.skip(4) |
| 12198 | return obj |
| 12199 | |
| 12200 | def __eq__(self, other): |
| 12201 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12202 | if self.xid != other.xid: return False |
| 12203 | if self.flags != other.flags: return False |
| 12204 | if self.group_id != other.group_id: return False |
| 12205 | return True |
| 12206 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12207 | def pretty_print(self, q): |
| 12208 | q.text("group_stats_request {") |
| 12209 | with q.group(): |
| 12210 | with q.indent(2): |
| 12211 | q.breakable() |
| 12212 | q.text("xid = "); |
| 12213 | if self.xid != None: |
| 12214 | q.text("%#x" % self.xid) |
| 12215 | else: |
| 12216 | q.text('None') |
| 12217 | q.text(","); q.breakable() |
| 12218 | q.text("flags = "); |
| 12219 | q.text("%#x" % self.flags) |
| 12220 | q.text(","); q.breakable() |
| 12221 | q.text("group_id = "); |
| 12222 | q.text("%#x" % self.group_id) |
| 12223 | q.breakable() |
| 12224 | q.text('}') |
| 12225 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12226 | stats_request.subtypes[6] = group_stats_request |
| 12227 | |
| 12228 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12229 | version = 4 |
| 12230 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12231 | |
| 12232 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12233 | if xid != None: |
| 12234 | self.xid = xid |
| 12235 | else: |
| 12236 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12237 | if elements != None: |
| 12238 | self.elements = elements |
| 12239 | else: |
| 12240 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12241 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12242 | |
| 12243 | def pack(self): |
| 12244 | packed = [] |
| 12245 | packed.append(struct.pack("!B", self.version)) |
| 12246 | packed.append(struct.pack("!B", self.type)) |
| 12247 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12248 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12249 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12250 | length = sum([len(x) for x in packed]) |
| 12251 | packed[2] = struct.pack("!H", length) |
| 12252 | return ''.join(packed) |
| 12253 | |
| 12254 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12255 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12256 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12257 | _version = reader.read("!B")[0] |
| 12258 | assert(_version == 4) |
| 12259 | _type = reader.read("!B")[0] |
| 12260 | assert(_type == 0) |
| 12261 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12262 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12263 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12264 | obj.xid = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 12265 | obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12266 | return obj |
| 12267 | |
| 12268 | def __eq__(self, other): |
| 12269 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12270 | if self.xid != other.xid: return False |
| 12271 | if self.elements != other.elements: return False |
| 12272 | return True |
| 12273 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12274 | def pretty_print(self, q): |
| 12275 | q.text("hello {") |
| 12276 | with q.group(): |
| 12277 | with q.indent(2): |
| 12278 | q.breakable() |
| 12279 | q.text("xid = "); |
| 12280 | if self.xid != None: |
| 12281 | q.text("%#x" % self.xid) |
| 12282 | else: |
| 12283 | q.text('None') |
| 12284 | q.text(","); q.breakable() |
| 12285 | q.text("elements = "); |
| 12286 | q.pp(self.elements) |
| 12287 | q.breakable() |
| 12288 | q.text('}') |
| 12289 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12290 | message.subtypes[0] = hello |
| 12291 | |
| 12292 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12293 | version = 4 |
| 12294 | type = 1 |
| 12295 | err_type = 0 |
| 12296 | |
| 12297 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12298 | if xid != None: |
| 12299 | self.xid = xid |
| 12300 | else: |
| 12301 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12302 | if code != None: |
| 12303 | self.code = code |
| 12304 | else: |
| 12305 | self.code = 0 |
| 12306 | if data != None: |
| 12307 | self.data = data |
| 12308 | else: |
| 12309 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12310 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12311 | |
| 12312 | def pack(self): |
| 12313 | packed = [] |
| 12314 | packed.append(struct.pack("!B", self.version)) |
| 12315 | packed.append(struct.pack("!B", self.type)) |
| 12316 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12317 | packed.append(struct.pack("!L", self.xid)) |
| 12318 | packed.append(struct.pack("!H", self.err_type)) |
| 12319 | packed.append(struct.pack("!H", self.code)) |
| 12320 | packed.append(self.data) |
| 12321 | length = sum([len(x) for x in packed]) |
| 12322 | packed[2] = struct.pack("!H", length) |
| 12323 | return ''.join(packed) |
| 12324 | |
| 12325 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12326 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12327 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12328 | _version = reader.read("!B")[0] |
| 12329 | assert(_version == 4) |
| 12330 | _type = reader.read("!B")[0] |
| 12331 | assert(_type == 1) |
| 12332 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12333 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12334 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12335 | obj.xid = reader.read("!L")[0] |
| 12336 | _err_type = reader.read("!H")[0] |
| 12337 | assert(_err_type == 0) |
| 12338 | obj.code = reader.read("!H")[0] |
| 12339 | obj.data = str(reader.read_all()) |
| 12340 | return obj |
| 12341 | |
| 12342 | def __eq__(self, other): |
| 12343 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12344 | if self.xid != other.xid: return False |
| 12345 | if self.code != other.code: return False |
| 12346 | if self.data != other.data: return False |
| 12347 | return True |
| 12348 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12349 | def pretty_print(self, q): |
| 12350 | q.text("hello_failed_error_msg {") |
| 12351 | with q.group(): |
| 12352 | with q.indent(2): |
| 12353 | q.breakable() |
| 12354 | q.text("xid = "); |
| 12355 | if self.xid != None: |
| 12356 | q.text("%#x" % self.xid) |
| 12357 | else: |
| 12358 | q.text('None') |
| 12359 | q.text(","); q.breakable() |
| 12360 | q.text("code = "); |
| 12361 | q.text("%#x" % self.code) |
| 12362 | q.text(","); q.breakable() |
| 12363 | q.text("data = "); |
| 12364 | q.pp(self.data) |
| 12365 | q.breakable() |
| 12366 | q.text('}') |
| 12367 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12368 | error_msg.subtypes[0] = hello_failed_error_msg |
| 12369 | |
| 12370 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12371 | version = 4 |
| 12372 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12373 | stats_type = 10 |
| 12374 | |
| 12375 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12376 | if xid != None: |
| 12377 | self.xid = xid |
| 12378 | else: |
| 12379 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12380 | if flags != None: |
| 12381 | self.flags = flags |
| 12382 | else: |
| 12383 | self.flags = 0 |
| 12384 | if entries != None: |
| 12385 | self.entries = entries |
| 12386 | else: |
| 12387 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12388 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12389 | |
| 12390 | def pack(self): |
| 12391 | packed = [] |
| 12392 | packed.append(struct.pack("!B", self.version)) |
| 12393 | packed.append(struct.pack("!B", self.type)) |
| 12394 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12395 | packed.append(struct.pack("!L", self.xid)) |
| 12396 | packed.append(struct.pack("!H", self.stats_type)) |
| 12397 | packed.append(struct.pack("!H", self.flags)) |
| 12398 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12399 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12400 | length = sum([len(x) for x in packed]) |
| 12401 | packed[2] = struct.pack("!H", length) |
| 12402 | return ''.join(packed) |
| 12403 | |
| 12404 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12405 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12406 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12407 | _version = reader.read("!B")[0] |
| 12408 | assert(_version == 4) |
| 12409 | _type = reader.read("!B")[0] |
| 12410 | assert(_type == 19) |
| 12411 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12412 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12413 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12414 | obj.xid = reader.read("!L")[0] |
| 12415 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12416 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12417 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12418 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12419 | 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] | 12420 | return obj |
| 12421 | |
| 12422 | def __eq__(self, other): |
| 12423 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12424 | if self.xid != other.xid: return False |
| 12425 | if self.flags != other.flags: return False |
| 12426 | if self.entries != other.entries: return False |
| 12427 | return True |
| 12428 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12429 | def pretty_print(self, q): |
| 12430 | q.text("meter_config_stats_reply {") |
| 12431 | with q.group(): |
| 12432 | with q.indent(2): |
| 12433 | q.breakable() |
| 12434 | q.text("xid = "); |
| 12435 | if self.xid != None: |
| 12436 | q.text("%#x" % self.xid) |
| 12437 | else: |
| 12438 | q.text('None') |
| 12439 | q.text(","); q.breakable() |
| 12440 | q.text("flags = "); |
| 12441 | q.text("%#x" % self.flags) |
| 12442 | q.text(","); q.breakable() |
| 12443 | q.text("entries = "); |
| 12444 | q.pp(self.entries) |
| 12445 | q.breakable() |
| 12446 | q.text('}') |
| 12447 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12448 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 12449 | |
| 12450 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12451 | version = 4 |
| 12452 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12453 | stats_type = 10 |
| 12454 | |
| 12455 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12456 | if xid != None: |
| 12457 | self.xid = xid |
| 12458 | else: |
| 12459 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12460 | if flags != None: |
| 12461 | self.flags = flags |
| 12462 | else: |
| 12463 | self.flags = 0 |
| 12464 | if meter_id != None: |
| 12465 | self.meter_id = meter_id |
| 12466 | else: |
| 12467 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12468 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12469 | |
| 12470 | def pack(self): |
| 12471 | packed = [] |
| 12472 | packed.append(struct.pack("!B", self.version)) |
| 12473 | packed.append(struct.pack("!B", self.type)) |
| 12474 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12475 | packed.append(struct.pack("!L", self.xid)) |
| 12476 | packed.append(struct.pack("!H", self.stats_type)) |
| 12477 | packed.append(struct.pack("!H", self.flags)) |
| 12478 | packed.append('\x00' * 4) |
| 12479 | packed.append(struct.pack("!L", self.meter_id)) |
| 12480 | packed.append('\x00' * 4) |
| 12481 | length = sum([len(x) for x in packed]) |
| 12482 | packed[2] = struct.pack("!H", length) |
| 12483 | return ''.join(packed) |
| 12484 | |
| 12485 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12486 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12487 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12488 | _version = reader.read("!B")[0] |
| 12489 | assert(_version == 4) |
| 12490 | _type = reader.read("!B")[0] |
| 12491 | assert(_type == 18) |
| 12492 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12493 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12494 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12495 | obj.xid = reader.read("!L")[0] |
| 12496 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12497 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12498 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12499 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12500 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12501 | reader.skip(4) |
| 12502 | return obj |
| 12503 | |
| 12504 | def __eq__(self, other): |
| 12505 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12506 | if self.xid != other.xid: return False |
| 12507 | if self.flags != other.flags: return False |
| 12508 | if self.meter_id != other.meter_id: return False |
| 12509 | return True |
| 12510 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12511 | def pretty_print(self, q): |
| 12512 | q.text("meter_config_stats_request {") |
| 12513 | with q.group(): |
| 12514 | with q.indent(2): |
| 12515 | q.breakable() |
| 12516 | q.text("xid = "); |
| 12517 | if self.xid != None: |
| 12518 | q.text("%#x" % self.xid) |
| 12519 | else: |
| 12520 | q.text('None') |
| 12521 | q.text(","); q.breakable() |
| 12522 | q.text("flags = "); |
| 12523 | q.text("%#x" % self.flags) |
| 12524 | q.text(","); q.breakable() |
| 12525 | q.text("meter_id = "); |
| 12526 | q.text("%#x" % self.meter_id) |
| 12527 | q.breakable() |
| 12528 | q.text('}') |
| 12529 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12530 | stats_request.subtypes[10] = meter_config_stats_request |
| 12531 | |
| 12532 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12533 | version = 4 |
| 12534 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12535 | stats_type = 11 |
| 12536 | |
| 12537 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12538 | if xid != None: |
| 12539 | self.xid = xid |
| 12540 | else: |
| 12541 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12542 | if flags != None: |
| 12543 | self.flags = flags |
| 12544 | else: |
| 12545 | self.flags = 0 |
| 12546 | if features != None: |
| 12547 | self.features = features |
| 12548 | else: |
| 12549 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12550 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12551 | |
| 12552 | def pack(self): |
| 12553 | packed = [] |
| 12554 | packed.append(struct.pack("!B", self.version)) |
| 12555 | packed.append(struct.pack("!B", self.type)) |
| 12556 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12557 | packed.append(struct.pack("!L", self.xid)) |
| 12558 | packed.append(struct.pack("!H", self.stats_type)) |
| 12559 | packed.append(struct.pack("!H", self.flags)) |
| 12560 | packed.append('\x00' * 4) |
| 12561 | packed.append(self.features.pack()) |
| 12562 | length = sum([len(x) for x in packed]) |
| 12563 | packed[2] = struct.pack("!H", length) |
| 12564 | return ''.join(packed) |
| 12565 | |
| 12566 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12567 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12568 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12569 | _version = reader.read("!B")[0] |
| 12570 | assert(_version == 4) |
| 12571 | _type = reader.read("!B")[0] |
| 12572 | assert(_type == 19) |
| 12573 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12574 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12575 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12576 | obj.xid = reader.read("!L")[0] |
| 12577 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12578 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12579 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12580 | reader.skip(4) |
| 12581 | obj.features = common.meter_features.unpack(reader) |
| 12582 | return obj |
| 12583 | |
| 12584 | def __eq__(self, other): |
| 12585 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12586 | if self.xid != other.xid: return False |
| 12587 | if self.flags != other.flags: return False |
| 12588 | if self.features != other.features: return False |
| 12589 | return True |
| 12590 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12591 | def pretty_print(self, q): |
| 12592 | q.text("meter_features_stats_reply {") |
| 12593 | with q.group(): |
| 12594 | with q.indent(2): |
| 12595 | q.breakable() |
| 12596 | q.text("xid = "); |
| 12597 | if self.xid != None: |
| 12598 | q.text("%#x" % self.xid) |
| 12599 | else: |
| 12600 | q.text('None') |
| 12601 | q.text(","); q.breakable() |
| 12602 | q.text("flags = "); |
| 12603 | q.text("%#x" % self.flags) |
| 12604 | q.text(","); q.breakable() |
| 12605 | q.text("features = "); |
| 12606 | q.pp(self.features) |
| 12607 | q.breakable() |
| 12608 | q.text('}') |
| 12609 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12610 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 12611 | |
| 12612 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12613 | version = 4 |
| 12614 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12615 | stats_type = 11 |
| 12616 | |
| 12617 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12618 | if xid != None: |
| 12619 | self.xid = xid |
| 12620 | else: |
| 12621 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12622 | if flags != None: |
| 12623 | self.flags = flags |
| 12624 | else: |
| 12625 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12626 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12627 | |
| 12628 | def pack(self): |
| 12629 | packed = [] |
| 12630 | packed.append(struct.pack("!B", self.version)) |
| 12631 | packed.append(struct.pack("!B", self.type)) |
| 12632 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12633 | packed.append(struct.pack("!L", self.xid)) |
| 12634 | packed.append(struct.pack("!H", self.stats_type)) |
| 12635 | packed.append(struct.pack("!H", self.flags)) |
| 12636 | packed.append('\x00' * 4) |
| 12637 | length = sum([len(x) for x in packed]) |
| 12638 | packed[2] = struct.pack("!H", length) |
| 12639 | return ''.join(packed) |
| 12640 | |
| 12641 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12642 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12643 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12644 | _version = reader.read("!B")[0] |
| 12645 | assert(_version == 4) |
| 12646 | _type = reader.read("!B")[0] |
| 12647 | assert(_type == 18) |
| 12648 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12650 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12651 | obj.xid = reader.read("!L")[0] |
| 12652 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12653 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12654 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12655 | reader.skip(4) |
| 12656 | return obj |
| 12657 | |
| 12658 | def __eq__(self, other): |
| 12659 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12660 | if self.xid != other.xid: return False |
| 12661 | if self.flags != other.flags: return False |
| 12662 | return True |
| 12663 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12664 | def pretty_print(self, q): |
| 12665 | q.text("meter_features_stats_request {") |
| 12666 | with q.group(): |
| 12667 | with q.indent(2): |
| 12668 | q.breakable() |
| 12669 | q.text("xid = "); |
| 12670 | if self.xid != None: |
| 12671 | q.text("%#x" % self.xid) |
| 12672 | else: |
| 12673 | q.text('None') |
| 12674 | q.text(","); q.breakable() |
| 12675 | q.text("flags = "); |
| 12676 | q.text("%#x" % self.flags) |
| 12677 | q.breakable() |
| 12678 | q.text('}') |
| 12679 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12680 | stats_request.subtypes[11] = meter_features_stats_request |
| 12681 | |
| 12682 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12683 | version = 4 |
| 12684 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12685 | |
| 12686 | 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] | 12687 | if xid != None: |
| 12688 | self.xid = xid |
| 12689 | else: |
| 12690 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12691 | if command != None: |
| 12692 | self.command = command |
| 12693 | else: |
| 12694 | self.command = 0 |
| 12695 | if flags != None: |
| 12696 | self.flags = flags |
| 12697 | else: |
| 12698 | self.flags = 0 |
| 12699 | if meter_id != None: |
| 12700 | self.meter_id = meter_id |
| 12701 | else: |
| 12702 | self.meter_id = 0 |
| 12703 | if meters != None: |
| 12704 | self.meters = meters |
| 12705 | else: |
| 12706 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12707 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12708 | |
| 12709 | def pack(self): |
| 12710 | packed = [] |
| 12711 | packed.append(struct.pack("!B", self.version)) |
| 12712 | packed.append(struct.pack("!B", self.type)) |
| 12713 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12714 | packed.append(struct.pack("!L", self.xid)) |
| 12715 | packed.append(struct.pack("!H", self.command)) |
| 12716 | packed.append(struct.pack("!H", self.flags)) |
| 12717 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12718 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12719 | length = sum([len(x) for x in packed]) |
| 12720 | packed[2] = struct.pack("!H", length) |
| 12721 | return ''.join(packed) |
| 12722 | |
| 12723 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12724 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12725 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12726 | _version = reader.read("!B")[0] |
| 12727 | assert(_version == 4) |
| 12728 | _type = reader.read("!B")[0] |
| 12729 | assert(_type == 29) |
| 12730 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12731 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12732 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12733 | obj.xid = reader.read("!L")[0] |
| 12734 | obj.command = reader.read("!H")[0] |
| 12735 | obj.flags = reader.read("!H")[0] |
| 12736 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12737 | 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] | 12738 | return obj |
| 12739 | |
| 12740 | def __eq__(self, other): |
| 12741 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12742 | if self.xid != other.xid: return False |
| 12743 | if self.command != other.command: return False |
| 12744 | if self.flags != other.flags: return False |
| 12745 | if self.meter_id != other.meter_id: return False |
| 12746 | if self.meters != other.meters: return False |
| 12747 | return True |
| 12748 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12749 | def pretty_print(self, q): |
| 12750 | q.text("meter_mod {") |
| 12751 | with q.group(): |
| 12752 | with q.indent(2): |
| 12753 | q.breakable() |
| 12754 | q.text("xid = "); |
| 12755 | if self.xid != None: |
| 12756 | q.text("%#x" % self.xid) |
| 12757 | else: |
| 12758 | q.text('None') |
| 12759 | q.text(","); q.breakable() |
| 12760 | q.text("command = "); |
| 12761 | q.text("%#x" % self.command) |
| 12762 | q.text(","); q.breakable() |
| 12763 | q.text("flags = "); |
| 12764 | q.text("%#x" % self.flags) |
| 12765 | q.text(","); q.breakable() |
| 12766 | q.text("meter_id = "); |
| 12767 | q.text("%#x" % self.meter_id) |
| 12768 | q.text(","); q.breakable() |
| 12769 | q.text("meters = "); |
| 12770 | q.pp(self.meters) |
| 12771 | q.breakable() |
| 12772 | q.text('}') |
| 12773 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12774 | message.subtypes[29] = meter_mod |
| 12775 | |
| 12776 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12777 | version = 4 |
| 12778 | type = 1 |
| 12779 | err_type = 12 |
| 12780 | |
| 12781 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12782 | if xid != None: |
| 12783 | self.xid = xid |
| 12784 | else: |
| 12785 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12786 | if code != None: |
| 12787 | self.code = code |
| 12788 | else: |
| 12789 | self.code = 0 |
| 12790 | if data != None: |
| 12791 | self.data = data |
| 12792 | else: |
| 12793 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12794 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12795 | |
| 12796 | def pack(self): |
| 12797 | packed = [] |
| 12798 | packed.append(struct.pack("!B", self.version)) |
| 12799 | packed.append(struct.pack("!B", self.type)) |
| 12800 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12801 | packed.append(struct.pack("!L", self.xid)) |
| 12802 | packed.append(struct.pack("!H", self.err_type)) |
| 12803 | packed.append(struct.pack("!H", self.code)) |
| 12804 | packed.append(self.data) |
| 12805 | length = sum([len(x) for x in packed]) |
| 12806 | packed[2] = struct.pack("!H", length) |
| 12807 | return ''.join(packed) |
| 12808 | |
| 12809 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12810 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12811 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12812 | _version = reader.read("!B")[0] |
| 12813 | assert(_version == 4) |
| 12814 | _type = reader.read("!B")[0] |
| 12815 | assert(_type == 1) |
| 12816 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12817 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12818 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12819 | obj.xid = reader.read("!L")[0] |
| 12820 | _err_type = reader.read("!H")[0] |
| 12821 | assert(_err_type == 12) |
| 12822 | obj.code = reader.read("!H")[0] |
| 12823 | obj.data = str(reader.read_all()) |
| 12824 | return obj |
| 12825 | |
| 12826 | def __eq__(self, other): |
| 12827 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12828 | if self.xid != other.xid: return False |
| 12829 | if self.code != other.code: return False |
| 12830 | if self.data != other.data: return False |
| 12831 | return True |
| 12832 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12833 | def pretty_print(self, q): |
| 12834 | q.text("meter_mod_failed_error_msg {") |
| 12835 | with q.group(): |
| 12836 | with q.indent(2): |
| 12837 | q.breakable() |
| 12838 | q.text("xid = "); |
| 12839 | if self.xid != None: |
| 12840 | q.text("%#x" % self.xid) |
| 12841 | else: |
| 12842 | q.text('None') |
| 12843 | q.text(","); q.breakable() |
| 12844 | q.text("code = "); |
| 12845 | q.text("%#x" % self.code) |
| 12846 | q.text(","); q.breakable() |
| 12847 | q.text("data = "); |
| 12848 | q.pp(self.data) |
| 12849 | q.breakable() |
| 12850 | q.text('}') |
| 12851 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12852 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12853 | |
| 12854 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12855 | version = 4 |
| 12856 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12857 | stats_type = 9 |
| 12858 | |
| 12859 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12860 | if xid != None: |
| 12861 | self.xid = xid |
| 12862 | else: |
| 12863 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12864 | if flags != None: |
| 12865 | self.flags = flags |
| 12866 | else: |
| 12867 | self.flags = 0 |
| 12868 | if entries != None: |
| 12869 | self.entries = entries |
| 12870 | else: |
| 12871 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12872 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12873 | |
| 12874 | def pack(self): |
| 12875 | packed = [] |
| 12876 | packed.append(struct.pack("!B", self.version)) |
| 12877 | packed.append(struct.pack("!B", self.type)) |
| 12878 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12879 | packed.append(struct.pack("!L", self.xid)) |
| 12880 | packed.append(struct.pack("!H", self.stats_type)) |
| 12881 | packed.append(struct.pack("!H", self.flags)) |
| 12882 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12883 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12884 | length = sum([len(x) for x in packed]) |
| 12885 | packed[2] = struct.pack("!H", length) |
| 12886 | return ''.join(packed) |
| 12887 | |
| 12888 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12889 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12890 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12891 | _version = reader.read("!B")[0] |
| 12892 | assert(_version == 4) |
| 12893 | _type = reader.read("!B")[0] |
| 12894 | assert(_type == 19) |
| 12895 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12896 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12897 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12898 | obj.xid = reader.read("!L")[0] |
| 12899 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12900 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12901 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12902 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12903 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12904 | return obj |
| 12905 | |
| 12906 | def __eq__(self, other): |
| 12907 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12908 | if self.xid != other.xid: return False |
| 12909 | if self.flags != other.flags: return False |
| 12910 | if self.entries != other.entries: return False |
| 12911 | return True |
| 12912 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12913 | def pretty_print(self, q): |
| 12914 | q.text("meter_stats_reply {") |
| 12915 | with q.group(): |
| 12916 | with q.indent(2): |
| 12917 | q.breakable() |
| 12918 | q.text("xid = "); |
| 12919 | if self.xid != None: |
| 12920 | q.text("%#x" % self.xid) |
| 12921 | else: |
| 12922 | q.text('None') |
| 12923 | q.text(","); q.breakable() |
| 12924 | q.text("flags = "); |
| 12925 | q.text("%#x" % self.flags) |
| 12926 | q.text(","); q.breakable() |
| 12927 | q.text("entries = "); |
| 12928 | q.pp(self.entries) |
| 12929 | q.breakable() |
| 12930 | q.text('}') |
| 12931 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12932 | stats_reply.subtypes[9] = meter_stats_reply |
| 12933 | |
| 12934 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12935 | version = 4 |
| 12936 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12937 | stats_type = 9 |
| 12938 | |
| 12939 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12940 | if xid != None: |
| 12941 | self.xid = xid |
| 12942 | else: |
| 12943 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12944 | if flags != None: |
| 12945 | self.flags = flags |
| 12946 | else: |
| 12947 | self.flags = 0 |
| 12948 | if meter_id != None: |
| 12949 | self.meter_id = meter_id |
| 12950 | else: |
| 12951 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12952 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12953 | |
| 12954 | def pack(self): |
| 12955 | packed = [] |
| 12956 | packed.append(struct.pack("!B", self.version)) |
| 12957 | packed.append(struct.pack("!B", self.type)) |
| 12958 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12959 | packed.append(struct.pack("!L", self.xid)) |
| 12960 | packed.append(struct.pack("!H", self.stats_type)) |
| 12961 | packed.append(struct.pack("!H", self.flags)) |
| 12962 | packed.append('\x00' * 4) |
| 12963 | packed.append(struct.pack("!L", self.meter_id)) |
| 12964 | packed.append('\x00' * 4) |
| 12965 | length = sum([len(x) for x in packed]) |
| 12966 | packed[2] = struct.pack("!H", length) |
| 12967 | return ''.join(packed) |
| 12968 | |
| 12969 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12970 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12971 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12972 | _version = reader.read("!B")[0] |
| 12973 | assert(_version == 4) |
| 12974 | _type = reader.read("!B")[0] |
| 12975 | assert(_type == 18) |
| 12976 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12977 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12978 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12979 | obj.xid = reader.read("!L")[0] |
| 12980 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12981 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12982 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12983 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12984 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12985 | reader.skip(4) |
| 12986 | return obj |
| 12987 | |
| 12988 | def __eq__(self, other): |
| 12989 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12990 | if self.xid != other.xid: return False |
| 12991 | if self.flags != other.flags: return False |
| 12992 | if self.meter_id != other.meter_id: return False |
| 12993 | return True |
| 12994 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12995 | def pretty_print(self, q): |
| 12996 | q.text("meter_stats_request {") |
| 12997 | with q.group(): |
| 12998 | with q.indent(2): |
| 12999 | q.breakable() |
| 13000 | q.text("xid = "); |
| 13001 | if self.xid != None: |
| 13002 | q.text("%#x" % self.xid) |
| 13003 | else: |
| 13004 | q.text('None') |
| 13005 | q.text(","); q.breakable() |
| 13006 | q.text("flags = "); |
| 13007 | q.text("%#x" % self.flags) |
| 13008 | q.text(","); q.breakable() |
| 13009 | q.text("meter_id = "); |
| 13010 | q.text("%#x" % self.meter_id) |
| 13011 | q.breakable() |
| 13012 | q.text('}') |
| 13013 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13014 | stats_request.subtypes[9] = meter_stats_request |
| 13015 | |
| 13016 | class nicira_header(experimenter): |
| 13017 | subtypes = {} |
| 13018 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13019 | version = 4 |
| 13020 | type = 4 |
| 13021 | experimenter = 8992 |
| 13022 | |
| 13023 | def __init__(self, xid=None, subtype=None): |
| 13024 | if xid != None: |
| 13025 | self.xid = xid |
| 13026 | else: |
| 13027 | self.xid = None |
| 13028 | if subtype != None: |
| 13029 | self.subtype = subtype |
| 13030 | else: |
| 13031 | self.subtype = 0 |
| 13032 | return |
| 13033 | |
| 13034 | def pack(self): |
| 13035 | packed = [] |
| 13036 | packed.append(struct.pack("!B", self.version)) |
| 13037 | packed.append(struct.pack("!B", self.type)) |
| 13038 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13039 | packed.append(struct.pack("!L", self.xid)) |
| 13040 | packed.append(struct.pack("!L", self.experimenter)) |
| 13041 | packed.append(struct.pack("!L", self.subtype)) |
| 13042 | length = sum([len(x) for x in packed]) |
| 13043 | packed[2] = struct.pack("!H", length) |
| 13044 | return ''.join(packed) |
| 13045 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13046 | @staticmethod |
| 13047 | def unpack(reader): |
| 13048 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13049 | subclass = nicira_header.subtypes.get(subtype) |
| 13050 | if subclass: |
| 13051 | return subclass.unpack(reader) |
| 13052 | |
| 13053 | obj = nicira_header() |
| 13054 | _version = reader.read("!B")[0] |
| 13055 | assert(_version == 4) |
| 13056 | _type = reader.read("!B")[0] |
| 13057 | assert(_type == 4) |
| 13058 | _length = reader.read("!H")[0] |
| 13059 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13060 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13061 | obj.xid = reader.read("!L")[0] |
| 13062 | _experimenter = reader.read("!L")[0] |
| 13063 | assert(_experimenter == 8992) |
| 13064 | obj.subtype = reader.read("!L")[0] |
| 13065 | return obj |
| 13066 | |
| 13067 | def __eq__(self, other): |
| 13068 | if type(self) != type(other): return False |
| 13069 | if self.xid != other.xid: return False |
| 13070 | if self.subtype != other.subtype: return False |
| 13071 | return True |
| 13072 | |
| 13073 | def pretty_print(self, q): |
| 13074 | q.text("nicira_header {") |
| 13075 | with q.group(): |
| 13076 | with q.indent(2): |
| 13077 | q.breakable() |
| 13078 | q.text("xid = "); |
| 13079 | if self.xid != None: |
| 13080 | q.text("%#x" % self.xid) |
| 13081 | else: |
| 13082 | q.text('None') |
| 13083 | q.breakable() |
| 13084 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13085 | |
| 13086 | experimenter.subtypes[8992] = nicira_header |
| 13087 | |
| 13088 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13089 | version = 4 |
| 13090 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13091 | |
| 13092 | 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] | 13093 | if xid != None: |
| 13094 | self.xid = xid |
| 13095 | else: |
| 13096 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13097 | if buffer_id != None: |
| 13098 | self.buffer_id = buffer_id |
| 13099 | else: |
| 13100 | self.buffer_id = 0 |
| 13101 | if total_len != None: |
| 13102 | self.total_len = total_len |
| 13103 | else: |
| 13104 | self.total_len = 0 |
| 13105 | if reason != None: |
| 13106 | self.reason = reason |
| 13107 | else: |
| 13108 | self.reason = 0 |
| 13109 | if table_id != None: |
| 13110 | self.table_id = table_id |
| 13111 | else: |
| 13112 | self.table_id = 0 |
| 13113 | if cookie != None: |
| 13114 | self.cookie = cookie |
| 13115 | else: |
| 13116 | self.cookie = 0 |
| 13117 | if match != None: |
| 13118 | self.match = match |
| 13119 | else: |
| 13120 | self.match = common.match() |
| 13121 | if data != None: |
| 13122 | self.data = data |
| 13123 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13124 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13125 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13126 | |
| 13127 | def pack(self): |
| 13128 | packed = [] |
| 13129 | packed.append(struct.pack("!B", self.version)) |
| 13130 | packed.append(struct.pack("!B", self.type)) |
| 13131 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13132 | packed.append(struct.pack("!L", self.xid)) |
| 13133 | packed.append(struct.pack("!L", self.buffer_id)) |
| 13134 | packed.append(struct.pack("!H", self.total_len)) |
| 13135 | packed.append(struct.pack("!B", self.reason)) |
| 13136 | packed.append(struct.pack("!B", self.table_id)) |
| 13137 | packed.append(struct.pack("!Q", self.cookie)) |
| 13138 | packed.append(self.match.pack()) |
| 13139 | packed.append('\x00' * 2) |
| 13140 | packed.append(self.data) |
| 13141 | length = sum([len(x) for x in packed]) |
| 13142 | packed[2] = struct.pack("!H", length) |
| 13143 | return ''.join(packed) |
| 13144 | |
| 13145 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13146 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13147 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13148 | _version = reader.read("!B")[0] |
| 13149 | assert(_version == 4) |
| 13150 | _type = reader.read("!B")[0] |
| 13151 | assert(_type == 10) |
| 13152 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13153 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13154 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13155 | obj.xid = reader.read("!L")[0] |
| 13156 | obj.buffer_id = reader.read("!L")[0] |
| 13157 | obj.total_len = reader.read("!H")[0] |
| 13158 | obj.reason = reader.read("!B")[0] |
| 13159 | obj.table_id = reader.read("!B")[0] |
| 13160 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13161 | obj.match = common.match.unpack(reader) |
| 13162 | reader.skip(2) |
| 13163 | obj.data = str(reader.read_all()) |
| 13164 | return obj |
| 13165 | |
| 13166 | def __eq__(self, other): |
| 13167 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13168 | if self.xid != other.xid: return False |
| 13169 | if self.buffer_id != other.buffer_id: return False |
| 13170 | if self.total_len != other.total_len: return False |
| 13171 | if self.reason != other.reason: return False |
| 13172 | if self.table_id != other.table_id: return False |
| 13173 | if self.cookie != other.cookie: return False |
| 13174 | if self.match != other.match: return False |
| 13175 | if self.data != other.data: return False |
| 13176 | return True |
| 13177 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13178 | def pretty_print(self, q): |
| 13179 | q.text("packet_in {") |
| 13180 | with q.group(): |
| 13181 | with q.indent(2): |
| 13182 | q.breakable() |
| 13183 | q.text("xid = "); |
| 13184 | if self.xid != None: |
| 13185 | q.text("%#x" % self.xid) |
| 13186 | else: |
| 13187 | q.text('None') |
| 13188 | q.text(","); q.breakable() |
| 13189 | q.text("buffer_id = "); |
| 13190 | q.text("%#x" % self.buffer_id) |
| 13191 | q.text(","); q.breakable() |
| 13192 | q.text("total_len = "); |
| 13193 | q.text("%#x" % self.total_len) |
| 13194 | q.text(","); q.breakable() |
| 13195 | q.text("reason = "); |
| 13196 | q.text("%#x" % self.reason) |
| 13197 | q.text(","); q.breakable() |
| 13198 | q.text("table_id = "); |
| 13199 | q.text("%#x" % self.table_id) |
| 13200 | q.text(","); q.breakable() |
| 13201 | q.text("cookie = "); |
| 13202 | q.text("%#x" % self.cookie) |
| 13203 | q.text(","); q.breakable() |
| 13204 | q.text("match = "); |
| 13205 | q.pp(self.match) |
| 13206 | q.text(","); q.breakable() |
| 13207 | q.text("data = "); |
| 13208 | q.pp(self.data) |
| 13209 | q.breakable() |
| 13210 | q.text('}') |
| 13211 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13212 | message.subtypes[10] = packet_in |
| 13213 | |
| 13214 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13215 | version = 4 |
| 13216 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13217 | |
| 13218 | 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] | 13219 | if xid != None: |
| 13220 | self.xid = xid |
| 13221 | else: |
| 13222 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13223 | if buffer_id != None: |
| 13224 | self.buffer_id = buffer_id |
| 13225 | else: |
| 13226 | self.buffer_id = 0 |
| 13227 | if in_port != None: |
| 13228 | self.in_port = in_port |
| 13229 | else: |
| 13230 | self.in_port = 0 |
| 13231 | if actions != None: |
| 13232 | self.actions = actions |
| 13233 | else: |
| 13234 | self.actions = [] |
| 13235 | if data != None: |
| 13236 | self.data = data |
| 13237 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13238 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13239 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13240 | |
| 13241 | def pack(self): |
| 13242 | packed = [] |
| 13243 | packed.append(struct.pack("!B", self.version)) |
| 13244 | packed.append(struct.pack("!B", self.type)) |
| 13245 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13246 | packed.append(struct.pack("!L", self.xid)) |
| 13247 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13248 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13249 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 13250 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13251 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13252 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 13253 | packed.append(self.data) |
| 13254 | length = sum([len(x) for x in packed]) |
| 13255 | packed[2] = struct.pack("!H", length) |
| 13256 | return ''.join(packed) |
| 13257 | |
| 13258 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13259 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13260 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13261 | _version = reader.read("!B")[0] |
| 13262 | assert(_version == 4) |
| 13263 | _type = reader.read("!B")[0] |
| 13264 | assert(_type == 13) |
| 13265 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13266 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13267 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13268 | obj.xid = reader.read("!L")[0] |
| 13269 | obj.buffer_id = reader.read("!L")[0] |
| 13270 | obj.in_port = util.unpack_port_no(reader) |
| 13271 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13272 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13273 | 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] | 13274 | obj.data = str(reader.read_all()) |
| 13275 | return obj |
| 13276 | |
| 13277 | def __eq__(self, other): |
| 13278 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13279 | if self.xid != other.xid: return False |
| 13280 | if self.buffer_id != other.buffer_id: return False |
| 13281 | if self.in_port != other.in_port: return False |
| 13282 | if self.actions != other.actions: return False |
| 13283 | if self.data != other.data: return False |
| 13284 | return True |
| 13285 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13286 | def pretty_print(self, q): |
| 13287 | q.text("packet_out {") |
| 13288 | with q.group(): |
| 13289 | with q.indent(2): |
| 13290 | q.breakable() |
| 13291 | q.text("xid = "); |
| 13292 | if self.xid != None: |
| 13293 | q.text("%#x" % self.xid) |
| 13294 | else: |
| 13295 | q.text('None') |
| 13296 | q.text(","); q.breakable() |
| 13297 | q.text("buffer_id = "); |
| 13298 | q.text("%#x" % self.buffer_id) |
| 13299 | q.text(","); q.breakable() |
| 13300 | q.text("in_port = "); |
| 13301 | q.text(util.pretty_port(self.in_port)) |
| 13302 | q.text(","); q.breakable() |
| 13303 | q.text("actions = "); |
| 13304 | q.pp(self.actions) |
| 13305 | q.text(","); q.breakable() |
| 13306 | q.text("data = "); |
| 13307 | q.pp(self.data) |
| 13308 | q.breakable() |
| 13309 | q.text('}') |
| 13310 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13311 | message.subtypes[13] = packet_out |
| 13312 | |
| 13313 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13314 | version = 4 |
| 13315 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13316 | stats_type = 13 |
| 13317 | |
| 13318 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13319 | if xid != None: |
| 13320 | self.xid = xid |
| 13321 | else: |
| 13322 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13323 | if flags != None: |
| 13324 | self.flags = flags |
| 13325 | else: |
| 13326 | self.flags = 0 |
| 13327 | if entries != None: |
| 13328 | self.entries = entries |
| 13329 | else: |
| 13330 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13331 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13332 | |
| 13333 | def pack(self): |
| 13334 | packed = [] |
| 13335 | packed.append(struct.pack("!B", self.version)) |
| 13336 | packed.append(struct.pack("!B", self.type)) |
| 13337 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13338 | packed.append(struct.pack("!L", self.xid)) |
| 13339 | packed.append(struct.pack("!H", self.stats_type)) |
| 13340 | packed.append(struct.pack("!H", self.flags)) |
| 13341 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13342 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13343 | length = sum([len(x) for x in packed]) |
| 13344 | packed[2] = struct.pack("!H", length) |
| 13345 | return ''.join(packed) |
| 13346 | |
| 13347 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13348 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13349 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13350 | _version = reader.read("!B")[0] |
| 13351 | assert(_version == 4) |
| 13352 | _type = reader.read("!B")[0] |
| 13353 | assert(_type == 19) |
| 13354 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13355 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13356 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13357 | obj.xid = reader.read("!L")[0] |
| 13358 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13359 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13360 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13361 | reader.skip(4) |
| 13362 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 13363 | return obj |
| 13364 | |
| 13365 | def __eq__(self, other): |
| 13366 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13367 | if self.xid != other.xid: return False |
| 13368 | if self.flags != other.flags: return False |
| 13369 | if self.entries != other.entries: return False |
| 13370 | return True |
| 13371 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13372 | def pretty_print(self, q): |
| 13373 | q.text("port_desc_stats_reply {") |
| 13374 | with q.group(): |
| 13375 | with q.indent(2): |
| 13376 | q.breakable() |
| 13377 | q.text("xid = "); |
| 13378 | if self.xid != None: |
| 13379 | q.text("%#x" % self.xid) |
| 13380 | else: |
| 13381 | q.text('None') |
| 13382 | q.text(","); q.breakable() |
| 13383 | q.text("flags = "); |
| 13384 | q.text("%#x" % self.flags) |
| 13385 | q.text(","); q.breakable() |
| 13386 | q.text("entries = "); |
| 13387 | q.pp(self.entries) |
| 13388 | q.breakable() |
| 13389 | q.text('}') |
| 13390 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13391 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 13392 | |
| 13393 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13394 | version = 4 |
| 13395 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13396 | stats_type = 13 |
| 13397 | |
| 13398 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13399 | if xid != None: |
| 13400 | self.xid = xid |
| 13401 | else: |
| 13402 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13403 | if flags != None: |
| 13404 | self.flags = flags |
| 13405 | else: |
| 13406 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13407 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13408 | |
| 13409 | def pack(self): |
| 13410 | packed = [] |
| 13411 | packed.append(struct.pack("!B", self.version)) |
| 13412 | packed.append(struct.pack("!B", self.type)) |
| 13413 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13414 | packed.append(struct.pack("!L", self.xid)) |
| 13415 | packed.append(struct.pack("!H", self.stats_type)) |
| 13416 | packed.append(struct.pack("!H", self.flags)) |
| 13417 | packed.append('\x00' * 4) |
| 13418 | length = sum([len(x) for x in packed]) |
| 13419 | packed[2] = struct.pack("!H", length) |
| 13420 | return ''.join(packed) |
| 13421 | |
| 13422 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13423 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13424 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13425 | _version = reader.read("!B")[0] |
| 13426 | assert(_version == 4) |
| 13427 | _type = reader.read("!B")[0] |
| 13428 | assert(_type == 18) |
| 13429 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13430 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13431 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13432 | obj.xid = reader.read("!L")[0] |
| 13433 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13434 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13435 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13436 | reader.skip(4) |
| 13437 | return obj |
| 13438 | |
| 13439 | def __eq__(self, other): |
| 13440 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13441 | if self.xid != other.xid: return False |
| 13442 | if self.flags != other.flags: return False |
| 13443 | return True |
| 13444 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13445 | def pretty_print(self, q): |
| 13446 | q.text("port_desc_stats_request {") |
| 13447 | with q.group(): |
| 13448 | with q.indent(2): |
| 13449 | q.breakable() |
| 13450 | q.text("xid = "); |
| 13451 | if self.xid != None: |
| 13452 | q.text("%#x" % self.xid) |
| 13453 | else: |
| 13454 | q.text('None') |
| 13455 | q.text(","); q.breakable() |
| 13456 | q.text("flags = "); |
| 13457 | q.text("%#x" % self.flags) |
| 13458 | q.breakable() |
| 13459 | q.text('}') |
| 13460 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13461 | stats_request.subtypes[13] = port_desc_stats_request |
| 13462 | |
| 13463 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13464 | version = 4 |
| 13465 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13466 | |
| 13467 | 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] | 13468 | if xid != None: |
| 13469 | self.xid = xid |
| 13470 | else: |
| 13471 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13472 | if port_no != None: |
| 13473 | self.port_no = port_no |
| 13474 | else: |
| 13475 | self.port_no = 0 |
| 13476 | if hw_addr != None: |
| 13477 | self.hw_addr = hw_addr |
| 13478 | else: |
| 13479 | self.hw_addr = [0,0,0,0,0,0] |
| 13480 | if config != None: |
| 13481 | self.config = config |
| 13482 | else: |
| 13483 | self.config = 0 |
| 13484 | if mask != None: |
| 13485 | self.mask = mask |
| 13486 | else: |
| 13487 | self.mask = 0 |
| 13488 | if advertise != None: |
| 13489 | self.advertise = advertise |
| 13490 | else: |
| 13491 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13492 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13493 | |
| 13494 | def pack(self): |
| 13495 | packed = [] |
| 13496 | packed.append(struct.pack("!B", self.version)) |
| 13497 | packed.append(struct.pack("!B", self.type)) |
| 13498 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13499 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13500 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13501 | packed.append('\x00' * 4) |
| 13502 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13503 | packed.append('\x00' * 2) |
| 13504 | packed.append(struct.pack("!L", self.config)) |
| 13505 | packed.append(struct.pack("!L", self.mask)) |
| 13506 | packed.append(struct.pack("!L", self.advertise)) |
| 13507 | packed.append('\x00' * 4) |
| 13508 | length = sum([len(x) for x in packed]) |
| 13509 | packed[2] = struct.pack("!H", length) |
| 13510 | return ''.join(packed) |
| 13511 | |
| 13512 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13513 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13514 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13515 | _version = reader.read("!B")[0] |
| 13516 | assert(_version == 4) |
| 13517 | _type = reader.read("!B")[0] |
| 13518 | assert(_type == 16) |
| 13519 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13520 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13521 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13522 | obj.xid = reader.read("!L")[0] |
| 13523 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13524 | reader.skip(4) |
| 13525 | obj.hw_addr = list(reader.read('!6B')) |
| 13526 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13527 | obj.config = reader.read("!L")[0] |
| 13528 | obj.mask = reader.read("!L")[0] |
| 13529 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13530 | reader.skip(4) |
| 13531 | return obj |
| 13532 | |
| 13533 | def __eq__(self, other): |
| 13534 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13535 | if self.xid != other.xid: return False |
| 13536 | if self.port_no != other.port_no: return False |
| 13537 | if self.hw_addr != other.hw_addr: return False |
| 13538 | if self.config != other.config: return False |
| 13539 | if self.mask != other.mask: return False |
| 13540 | if self.advertise != other.advertise: return False |
| 13541 | return True |
| 13542 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13543 | def pretty_print(self, q): |
| 13544 | q.text("port_mod {") |
| 13545 | with q.group(): |
| 13546 | with q.indent(2): |
| 13547 | q.breakable() |
| 13548 | q.text("xid = "); |
| 13549 | if self.xid != None: |
| 13550 | q.text("%#x" % self.xid) |
| 13551 | else: |
| 13552 | q.text('None') |
| 13553 | q.text(","); q.breakable() |
| 13554 | q.text("port_no = "); |
| 13555 | q.text(util.pretty_port(self.port_no)) |
| 13556 | q.text(","); q.breakable() |
| 13557 | q.text("hw_addr = "); |
| 13558 | q.text(util.pretty_mac(self.hw_addr)) |
| 13559 | q.text(","); q.breakable() |
| 13560 | q.text("config = "); |
| 13561 | q.text("%#x" % self.config) |
| 13562 | q.text(","); q.breakable() |
| 13563 | q.text("mask = "); |
| 13564 | q.text("%#x" % self.mask) |
| 13565 | q.text(","); q.breakable() |
| 13566 | q.text("advertise = "); |
| 13567 | q.text("%#x" % self.advertise) |
| 13568 | q.breakable() |
| 13569 | q.text('}') |
| 13570 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13571 | message.subtypes[16] = port_mod |
| 13572 | |
| 13573 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13574 | version = 4 |
| 13575 | type = 1 |
| 13576 | err_type = 7 |
| 13577 | |
| 13578 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13579 | if xid != None: |
| 13580 | self.xid = xid |
| 13581 | else: |
| 13582 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13583 | if code != None: |
| 13584 | self.code = code |
| 13585 | else: |
| 13586 | self.code = 0 |
| 13587 | if data != None: |
| 13588 | self.data = data |
| 13589 | else: |
| 13590 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13591 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13592 | |
| 13593 | def pack(self): |
| 13594 | packed = [] |
| 13595 | packed.append(struct.pack("!B", self.version)) |
| 13596 | packed.append(struct.pack("!B", self.type)) |
| 13597 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13598 | packed.append(struct.pack("!L", self.xid)) |
| 13599 | packed.append(struct.pack("!H", self.err_type)) |
| 13600 | packed.append(struct.pack("!H", self.code)) |
| 13601 | packed.append(self.data) |
| 13602 | length = sum([len(x) for x in packed]) |
| 13603 | packed[2] = struct.pack("!H", length) |
| 13604 | return ''.join(packed) |
| 13605 | |
| 13606 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13607 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13608 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13609 | _version = reader.read("!B")[0] |
| 13610 | assert(_version == 4) |
| 13611 | _type = reader.read("!B")[0] |
| 13612 | assert(_type == 1) |
| 13613 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13614 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13615 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13616 | obj.xid = reader.read("!L")[0] |
| 13617 | _err_type = reader.read("!H")[0] |
| 13618 | assert(_err_type == 7) |
| 13619 | obj.code = reader.read("!H")[0] |
| 13620 | obj.data = str(reader.read_all()) |
| 13621 | return obj |
| 13622 | |
| 13623 | def __eq__(self, other): |
| 13624 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13625 | if self.xid != other.xid: return False |
| 13626 | if self.code != other.code: return False |
| 13627 | if self.data != other.data: return False |
| 13628 | return True |
| 13629 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13630 | def pretty_print(self, q): |
| 13631 | q.text("port_mod_failed_error_msg {") |
| 13632 | with q.group(): |
| 13633 | with q.indent(2): |
| 13634 | q.breakable() |
| 13635 | q.text("xid = "); |
| 13636 | if self.xid != None: |
| 13637 | q.text("%#x" % self.xid) |
| 13638 | else: |
| 13639 | q.text('None') |
| 13640 | q.text(","); q.breakable() |
| 13641 | q.text("code = "); |
| 13642 | q.text("%#x" % self.code) |
| 13643 | q.text(","); q.breakable() |
| 13644 | q.text("data = "); |
| 13645 | q.pp(self.data) |
| 13646 | q.breakable() |
| 13647 | q.text('}') |
| 13648 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13649 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 13650 | |
| 13651 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13652 | version = 4 |
| 13653 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13654 | stats_type = 4 |
| 13655 | |
| 13656 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13657 | if xid != None: |
| 13658 | self.xid = xid |
| 13659 | else: |
| 13660 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13661 | if flags != None: |
| 13662 | self.flags = flags |
| 13663 | else: |
| 13664 | self.flags = 0 |
| 13665 | if entries != None: |
| 13666 | self.entries = entries |
| 13667 | else: |
| 13668 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13669 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13670 | |
| 13671 | def pack(self): |
| 13672 | packed = [] |
| 13673 | packed.append(struct.pack("!B", self.version)) |
| 13674 | packed.append(struct.pack("!B", self.type)) |
| 13675 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13676 | packed.append(struct.pack("!L", self.xid)) |
| 13677 | packed.append(struct.pack("!H", self.stats_type)) |
| 13678 | packed.append(struct.pack("!H", self.flags)) |
| 13679 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13680 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13681 | length = sum([len(x) for x in packed]) |
| 13682 | packed[2] = struct.pack("!H", length) |
| 13683 | return ''.join(packed) |
| 13684 | |
| 13685 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13686 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13687 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13688 | _version = reader.read("!B")[0] |
| 13689 | assert(_version == 4) |
| 13690 | _type = reader.read("!B")[0] |
| 13691 | assert(_type == 19) |
| 13692 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13693 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13694 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13695 | obj.xid = reader.read("!L")[0] |
| 13696 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13697 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13698 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13699 | reader.skip(4) |
| 13700 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 13701 | return obj |
| 13702 | |
| 13703 | def __eq__(self, other): |
| 13704 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13705 | if self.xid != other.xid: return False |
| 13706 | if self.flags != other.flags: return False |
| 13707 | if self.entries != other.entries: return False |
| 13708 | return True |
| 13709 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13710 | def pretty_print(self, q): |
| 13711 | q.text("port_stats_reply {") |
| 13712 | with q.group(): |
| 13713 | with q.indent(2): |
| 13714 | q.breakable() |
| 13715 | q.text("xid = "); |
| 13716 | if self.xid != None: |
| 13717 | q.text("%#x" % self.xid) |
| 13718 | else: |
| 13719 | q.text('None') |
| 13720 | q.text(","); q.breakable() |
| 13721 | q.text("flags = "); |
| 13722 | q.text("%#x" % self.flags) |
| 13723 | q.text(","); q.breakable() |
| 13724 | q.text("entries = "); |
| 13725 | q.pp(self.entries) |
| 13726 | q.breakable() |
| 13727 | q.text('}') |
| 13728 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13729 | stats_reply.subtypes[4] = port_stats_reply |
| 13730 | |
| 13731 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13732 | version = 4 |
| 13733 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13734 | stats_type = 4 |
| 13735 | |
| 13736 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13737 | if xid != None: |
| 13738 | self.xid = xid |
| 13739 | else: |
| 13740 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13741 | if flags != None: |
| 13742 | self.flags = flags |
| 13743 | else: |
| 13744 | self.flags = 0 |
| 13745 | if port_no != None: |
| 13746 | self.port_no = port_no |
| 13747 | else: |
| 13748 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13749 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13750 | |
| 13751 | def pack(self): |
| 13752 | packed = [] |
| 13753 | packed.append(struct.pack("!B", self.version)) |
| 13754 | packed.append(struct.pack("!B", self.type)) |
| 13755 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13756 | packed.append(struct.pack("!L", self.xid)) |
| 13757 | packed.append(struct.pack("!H", self.stats_type)) |
| 13758 | packed.append(struct.pack("!H", self.flags)) |
| 13759 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13760 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13761 | packed.append('\x00' * 4) |
| 13762 | length = sum([len(x) for x in packed]) |
| 13763 | packed[2] = struct.pack("!H", length) |
| 13764 | return ''.join(packed) |
| 13765 | |
| 13766 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13767 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13768 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13769 | _version = reader.read("!B")[0] |
| 13770 | assert(_version == 4) |
| 13771 | _type = reader.read("!B")[0] |
| 13772 | assert(_type == 18) |
| 13773 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13774 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13775 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13776 | obj.xid = reader.read("!L")[0] |
| 13777 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13778 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13779 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13780 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13781 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13782 | reader.skip(4) |
| 13783 | return obj |
| 13784 | |
| 13785 | def __eq__(self, other): |
| 13786 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13787 | if self.xid != other.xid: return False |
| 13788 | if self.flags != other.flags: return False |
| 13789 | if self.port_no != other.port_no: return False |
| 13790 | return True |
| 13791 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13792 | def pretty_print(self, q): |
| 13793 | q.text("port_stats_request {") |
| 13794 | with q.group(): |
| 13795 | with q.indent(2): |
| 13796 | q.breakable() |
| 13797 | q.text("xid = "); |
| 13798 | if self.xid != None: |
| 13799 | q.text("%#x" % self.xid) |
| 13800 | else: |
| 13801 | q.text('None') |
| 13802 | q.text(","); q.breakable() |
| 13803 | q.text("flags = "); |
| 13804 | q.text("%#x" % self.flags) |
| 13805 | q.text(","); q.breakable() |
| 13806 | q.text("port_no = "); |
| 13807 | q.text(util.pretty_port(self.port_no)) |
| 13808 | q.breakable() |
| 13809 | q.text('}') |
| 13810 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13811 | stats_request.subtypes[4] = port_stats_request |
| 13812 | |
| 13813 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13814 | version = 4 |
| 13815 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13816 | |
| 13817 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13818 | if xid != None: |
| 13819 | self.xid = xid |
| 13820 | else: |
| 13821 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13822 | if reason != None: |
| 13823 | self.reason = reason |
| 13824 | else: |
| 13825 | self.reason = 0 |
| 13826 | if desc != None: |
| 13827 | self.desc = desc |
| 13828 | else: |
| 13829 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13830 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13831 | |
| 13832 | def pack(self): |
| 13833 | packed = [] |
| 13834 | packed.append(struct.pack("!B", self.version)) |
| 13835 | packed.append(struct.pack("!B", self.type)) |
| 13836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13837 | packed.append(struct.pack("!L", self.xid)) |
| 13838 | packed.append(struct.pack("!B", self.reason)) |
| 13839 | packed.append('\x00' * 7) |
| 13840 | packed.append(self.desc.pack()) |
| 13841 | length = sum([len(x) for x in packed]) |
| 13842 | packed[2] = struct.pack("!H", length) |
| 13843 | return ''.join(packed) |
| 13844 | |
| 13845 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13846 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13847 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13848 | _version = reader.read("!B")[0] |
| 13849 | assert(_version == 4) |
| 13850 | _type = reader.read("!B")[0] |
| 13851 | assert(_type == 12) |
| 13852 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13853 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13854 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13855 | obj.xid = reader.read("!L")[0] |
| 13856 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13857 | reader.skip(7) |
| 13858 | obj.desc = common.port_desc.unpack(reader) |
| 13859 | return obj |
| 13860 | |
| 13861 | def __eq__(self, other): |
| 13862 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13863 | if self.xid != other.xid: return False |
| 13864 | if self.reason != other.reason: return False |
| 13865 | if self.desc != other.desc: return False |
| 13866 | return True |
| 13867 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13868 | def pretty_print(self, q): |
| 13869 | q.text("port_status {") |
| 13870 | with q.group(): |
| 13871 | with q.indent(2): |
| 13872 | q.breakable() |
| 13873 | q.text("xid = "); |
| 13874 | if self.xid != None: |
| 13875 | q.text("%#x" % self.xid) |
| 13876 | else: |
| 13877 | q.text('None') |
| 13878 | q.text(","); q.breakable() |
| 13879 | q.text("reason = "); |
| 13880 | q.text("%#x" % self.reason) |
| 13881 | q.text(","); q.breakable() |
| 13882 | q.text("desc = "); |
| 13883 | q.pp(self.desc) |
| 13884 | q.breakable() |
| 13885 | q.text('}') |
| 13886 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13887 | message.subtypes[12] = port_status |
| 13888 | |
| 13889 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13890 | version = 4 |
| 13891 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13892 | |
| 13893 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13894 | if xid != None: |
| 13895 | self.xid = xid |
| 13896 | else: |
| 13897 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13898 | if port != None: |
| 13899 | self.port = port |
| 13900 | else: |
| 13901 | self.port = 0 |
| 13902 | if queues != None: |
| 13903 | self.queues = queues |
| 13904 | else: |
| 13905 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13906 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13907 | |
| 13908 | def pack(self): |
| 13909 | packed = [] |
| 13910 | packed.append(struct.pack("!B", self.version)) |
| 13911 | packed.append(struct.pack("!B", self.type)) |
| 13912 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13913 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13914 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13915 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13916 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13917 | length = sum([len(x) for x in packed]) |
| 13918 | packed[2] = struct.pack("!H", length) |
| 13919 | return ''.join(packed) |
| 13920 | |
| 13921 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13922 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13923 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13924 | _version = reader.read("!B")[0] |
| 13925 | assert(_version == 4) |
| 13926 | _type = reader.read("!B")[0] |
| 13927 | assert(_type == 23) |
| 13928 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13929 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13930 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13931 | obj.xid = reader.read("!L")[0] |
| 13932 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13933 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13934 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13935 | return obj |
| 13936 | |
| 13937 | def __eq__(self, other): |
| 13938 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13939 | if self.xid != other.xid: return False |
| 13940 | if self.port != other.port: return False |
| 13941 | if self.queues != other.queues: return False |
| 13942 | return True |
| 13943 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13944 | def pretty_print(self, q): |
| 13945 | q.text("queue_get_config_reply {") |
| 13946 | with q.group(): |
| 13947 | with q.indent(2): |
| 13948 | q.breakable() |
| 13949 | q.text("xid = "); |
| 13950 | if self.xid != None: |
| 13951 | q.text("%#x" % self.xid) |
| 13952 | else: |
| 13953 | q.text('None') |
| 13954 | q.text(","); q.breakable() |
| 13955 | q.text("port = "); |
| 13956 | q.text(util.pretty_port(self.port)) |
| 13957 | q.text(","); q.breakable() |
| 13958 | q.text("queues = "); |
| 13959 | q.pp(self.queues) |
| 13960 | q.breakable() |
| 13961 | q.text('}') |
| 13962 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13963 | message.subtypes[23] = queue_get_config_reply |
| 13964 | |
| 13965 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13966 | version = 4 |
| 13967 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13968 | |
| 13969 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13970 | if xid != None: |
| 13971 | self.xid = xid |
| 13972 | else: |
| 13973 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13974 | if port != None: |
| 13975 | self.port = port |
| 13976 | else: |
| 13977 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13978 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13979 | |
| 13980 | def pack(self): |
| 13981 | packed = [] |
| 13982 | packed.append(struct.pack("!B", self.version)) |
| 13983 | packed.append(struct.pack("!B", self.type)) |
| 13984 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13985 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13986 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13987 | packed.append('\x00' * 4) |
| 13988 | length = sum([len(x) for x in packed]) |
| 13989 | packed[2] = struct.pack("!H", length) |
| 13990 | return ''.join(packed) |
| 13991 | |
| 13992 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13993 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13994 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13995 | _version = reader.read("!B")[0] |
| 13996 | assert(_version == 4) |
| 13997 | _type = reader.read("!B")[0] |
| 13998 | assert(_type == 22) |
| 13999 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14000 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14001 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14002 | obj.xid = reader.read("!L")[0] |
| 14003 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14004 | reader.skip(4) |
| 14005 | return obj |
| 14006 | |
| 14007 | def __eq__(self, other): |
| 14008 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14009 | if self.xid != other.xid: return False |
| 14010 | if self.port != other.port: return False |
| 14011 | return True |
| 14012 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14013 | def pretty_print(self, q): |
| 14014 | q.text("queue_get_config_request {") |
| 14015 | with q.group(): |
| 14016 | with q.indent(2): |
| 14017 | q.breakable() |
| 14018 | q.text("xid = "); |
| 14019 | if self.xid != None: |
| 14020 | q.text("%#x" % self.xid) |
| 14021 | else: |
| 14022 | q.text('None') |
| 14023 | q.text(","); q.breakable() |
| 14024 | q.text("port = "); |
| 14025 | q.text(util.pretty_port(self.port)) |
| 14026 | q.breakable() |
| 14027 | q.text('}') |
| 14028 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14029 | message.subtypes[22] = queue_get_config_request |
| 14030 | |
| 14031 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14032 | version = 4 |
| 14033 | type = 1 |
| 14034 | err_type = 9 |
| 14035 | |
| 14036 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14037 | if xid != None: |
| 14038 | self.xid = xid |
| 14039 | else: |
| 14040 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14041 | if code != None: |
| 14042 | self.code = code |
| 14043 | else: |
| 14044 | self.code = 0 |
| 14045 | if data != None: |
| 14046 | self.data = data |
| 14047 | else: |
| 14048 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14049 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14050 | |
| 14051 | def pack(self): |
| 14052 | packed = [] |
| 14053 | packed.append(struct.pack("!B", self.version)) |
| 14054 | packed.append(struct.pack("!B", self.type)) |
| 14055 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14056 | packed.append(struct.pack("!L", self.xid)) |
| 14057 | packed.append(struct.pack("!H", self.err_type)) |
| 14058 | packed.append(struct.pack("!H", self.code)) |
| 14059 | packed.append(self.data) |
| 14060 | length = sum([len(x) for x in packed]) |
| 14061 | packed[2] = struct.pack("!H", length) |
| 14062 | return ''.join(packed) |
| 14063 | |
| 14064 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14065 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14066 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14067 | _version = reader.read("!B")[0] |
| 14068 | assert(_version == 4) |
| 14069 | _type = reader.read("!B")[0] |
| 14070 | assert(_type == 1) |
| 14071 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14072 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14073 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14074 | obj.xid = reader.read("!L")[0] |
| 14075 | _err_type = reader.read("!H")[0] |
| 14076 | assert(_err_type == 9) |
| 14077 | obj.code = reader.read("!H")[0] |
| 14078 | obj.data = str(reader.read_all()) |
| 14079 | return obj |
| 14080 | |
| 14081 | def __eq__(self, other): |
| 14082 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14083 | if self.xid != other.xid: return False |
| 14084 | if self.code != other.code: return False |
| 14085 | if self.data != other.data: return False |
| 14086 | return True |
| 14087 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14088 | def pretty_print(self, q): |
| 14089 | q.text("queue_op_failed_error_msg {") |
| 14090 | with q.group(): |
| 14091 | with q.indent(2): |
| 14092 | q.breakable() |
| 14093 | q.text("xid = "); |
| 14094 | if self.xid != None: |
| 14095 | q.text("%#x" % self.xid) |
| 14096 | else: |
| 14097 | q.text('None') |
| 14098 | q.text(","); q.breakable() |
| 14099 | q.text("code = "); |
| 14100 | q.text("%#x" % self.code) |
| 14101 | q.text(","); q.breakable() |
| 14102 | q.text("data = "); |
| 14103 | q.pp(self.data) |
| 14104 | q.breakable() |
| 14105 | q.text('}') |
| 14106 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14107 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 14108 | |
| 14109 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14110 | version = 4 |
| 14111 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14112 | stats_type = 5 |
| 14113 | |
| 14114 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14115 | if xid != None: |
| 14116 | self.xid = xid |
| 14117 | else: |
| 14118 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14119 | if flags != None: |
| 14120 | self.flags = flags |
| 14121 | else: |
| 14122 | self.flags = 0 |
| 14123 | if entries != None: |
| 14124 | self.entries = entries |
| 14125 | else: |
| 14126 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14127 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14128 | |
| 14129 | def pack(self): |
| 14130 | packed = [] |
| 14131 | packed.append(struct.pack("!B", self.version)) |
| 14132 | packed.append(struct.pack("!B", self.type)) |
| 14133 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14134 | packed.append(struct.pack("!L", self.xid)) |
| 14135 | packed.append(struct.pack("!H", self.stats_type)) |
| 14136 | packed.append(struct.pack("!H", self.flags)) |
| 14137 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14138 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14139 | length = sum([len(x) for x in packed]) |
| 14140 | packed[2] = struct.pack("!H", length) |
| 14141 | return ''.join(packed) |
| 14142 | |
| 14143 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14144 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14145 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14146 | _version = reader.read("!B")[0] |
| 14147 | assert(_version == 4) |
| 14148 | _type = reader.read("!B")[0] |
| 14149 | assert(_type == 19) |
| 14150 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14151 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14152 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14153 | obj.xid = reader.read("!L")[0] |
| 14154 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14155 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14156 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14157 | reader.skip(4) |
| 14158 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 14159 | return obj |
| 14160 | |
| 14161 | def __eq__(self, other): |
| 14162 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14163 | if self.xid != other.xid: return False |
| 14164 | if self.flags != other.flags: return False |
| 14165 | if self.entries != other.entries: return False |
| 14166 | return True |
| 14167 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14168 | def pretty_print(self, q): |
| 14169 | q.text("queue_stats_reply {") |
| 14170 | with q.group(): |
| 14171 | with q.indent(2): |
| 14172 | q.breakable() |
| 14173 | q.text("xid = "); |
| 14174 | if self.xid != None: |
| 14175 | q.text("%#x" % self.xid) |
| 14176 | else: |
| 14177 | q.text('None') |
| 14178 | q.text(","); q.breakable() |
| 14179 | q.text("flags = "); |
| 14180 | q.text("%#x" % self.flags) |
| 14181 | q.text(","); q.breakable() |
| 14182 | q.text("entries = "); |
| 14183 | q.pp(self.entries) |
| 14184 | q.breakable() |
| 14185 | q.text('}') |
| 14186 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14187 | stats_reply.subtypes[5] = queue_stats_reply |
| 14188 | |
| 14189 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14190 | version = 4 |
| 14191 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14192 | stats_type = 5 |
| 14193 | |
| 14194 | 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] | 14195 | if xid != None: |
| 14196 | self.xid = xid |
| 14197 | else: |
| 14198 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14199 | if flags != None: |
| 14200 | self.flags = flags |
| 14201 | else: |
| 14202 | self.flags = 0 |
| 14203 | if port_no != None: |
| 14204 | self.port_no = port_no |
| 14205 | else: |
| 14206 | self.port_no = 0 |
| 14207 | if queue_id != None: |
| 14208 | self.queue_id = queue_id |
| 14209 | else: |
| 14210 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14211 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14212 | |
| 14213 | def pack(self): |
| 14214 | packed = [] |
| 14215 | packed.append(struct.pack("!B", self.version)) |
| 14216 | packed.append(struct.pack("!B", self.type)) |
| 14217 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14218 | packed.append(struct.pack("!L", self.xid)) |
| 14219 | packed.append(struct.pack("!H", self.stats_type)) |
| 14220 | packed.append(struct.pack("!H", self.flags)) |
| 14221 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14222 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14223 | packed.append(struct.pack("!L", self.queue_id)) |
| 14224 | length = sum([len(x) for x in packed]) |
| 14225 | packed[2] = struct.pack("!H", length) |
| 14226 | return ''.join(packed) |
| 14227 | |
| 14228 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14229 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14230 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14231 | _version = reader.read("!B")[0] |
| 14232 | assert(_version == 4) |
| 14233 | _type = reader.read("!B")[0] |
| 14234 | assert(_type == 18) |
| 14235 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14236 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14237 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14238 | obj.xid = reader.read("!L")[0] |
| 14239 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14240 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14241 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14242 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14243 | obj.port_no = util.unpack_port_no(reader) |
| 14244 | obj.queue_id = reader.read("!L")[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.port_no != other.port_no: return False |
| 14252 | if self.queue_id != other.queue_id: return False |
| 14253 | return True |
| 14254 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14255 | def pretty_print(self, q): |
| 14256 | q.text("queue_stats_request {") |
| 14257 | with q.group(): |
| 14258 | with q.indent(2): |
| 14259 | q.breakable() |
| 14260 | q.text("xid = "); |
| 14261 | if self.xid != None: |
| 14262 | q.text("%#x" % self.xid) |
| 14263 | else: |
| 14264 | q.text('None') |
| 14265 | q.text(","); q.breakable() |
| 14266 | q.text("flags = "); |
| 14267 | q.text("%#x" % self.flags) |
| 14268 | q.text(","); q.breakable() |
| 14269 | q.text("port_no = "); |
| 14270 | q.text(util.pretty_port(self.port_no)) |
| 14271 | q.text(","); q.breakable() |
| 14272 | q.text("queue_id = "); |
| 14273 | q.text("%#x" % self.queue_id) |
| 14274 | q.breakable() |
| 14275 | q.text('}') |
| 14276 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14277 | stats_request.subtypes[5] = queue_stats_request |
| 14278 | |
| 14279 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14280 | version = 4 |
| 14281 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14282 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14283 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14284 | if xid != None: |
| 14285 | self.xid = xid |
| 14286 | else: |
| 14287 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14288 | if role != None: |
| 14289 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14290 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14291 | self.role = 0 |
| 14292 | if generation_id != None: |
| 14293 | self.generation_id = generation_id |
| 14294 | else: |
| 14295 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14296 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14297 | |
| 14298 | def pack(self): |
| 14299 | packed = [] |
| 14300 | packed.append(struct.pack("!B", self.version)) |
| 14301 | packed.append(struct.pack("!B", self.type)) |
| 14302 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14303 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14304 | packed.append(struct.pack("!L", self.role)) |
| 14305 | packed.append('\x00' * 4) |
| 14306 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14307 | length = sum([len(x) for x in packed]) |
| 14308 | packed[2] = struct.pack("!H", length) |
| 14309 | return ''.join(packed) |
| 14310 | |
| 14311 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14312 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14313 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14314 | _version = reader.read("!B")[0] |
| 14315 | assert(_version == 4) |
| 14316 | _type = reader.read("!B")[0] |
| 14317 | assert(_type == 25) |
| 14318 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14319 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14320 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14321 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14322 | obj.role = reader.read("!L")[0] |
| 14323 | reader.skip(4) |
| 14324 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14325 | return obj |
| 14326 | |
| 14327 | def __eq__(self, other): |
| 14328 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14329 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14330 | if self.role != other.role: return False |
| 14331 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14332 | return True |
| 14333 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14334 | def pretty_print(self, q): |
| 14335 | q.text("role_reply {") |
| 14336 | with q.group(): |
| 14337 | with q.indent(2): |
| 14338 | q.breakable() |
| 14339 | q.text("xid = "); |
| 14340 | if self.xid != None: |
| 14341 | q.text("%#x" % self.xid) |
| 14342 | else: |
| 14343 | q.text('None') |
| 14344 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14345 | q.text("role = "); |
| 14346 | q.text("%#x" % self.role) |
| 14347 | q.text(","); q.breakable() |
| 14348 | q.text("generation_id = "); |
| 14349 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14350 | q.breakable() |
| 14351 | q.text('}') |
| 14352 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14353 | message.subtypes[25] = role_reply |
| 14354 | |
| 14355 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14356 | version = 4 |
| 14357 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14358 | |
| 14359 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14360 | if xid != None: |
| 14361 | self.xid = xid |
| 14362 | else: |
| 14363 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14364 | if role != None: |
| 14365 | self.role = role |
| 14366 | else: |
| 14367 | self.role = 0 |
| 14368 | if generation_id != None: |
| 14369 | self.generation_id = generation_id |
| 14370 | else: |
| 14371 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14372 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14373 | |
| 14374 | def pack(self): |
| 14375 | packed = [] |
| 14376 | packed.append(struct.pack("!B", self.version)) |
| 14377 | packed.append(struct.pack("!B", self.type)) |
| 14378 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14379 | packed.append(struct.pack("!L", self.xid)) |
| 14380 | packed.append(struct.pack("!L", self.role)) |
| 14381 | packed.append('\x00' * 4) |
| 14382 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14383 | length = sum([len(x) for x in packed]) |
| 14384 | packed[2] = struct.pack("!H", length) |
| 14385 | return ''.join(packed) |
| 14386 | |
| 14387 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14388 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14389 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14390 | _version = reader.read("!B")[0] |
| 14391 | assert(_version == 4) |
| 14392 | _type = reader.read("!B")[0] |
| 14393 | assert(_type == 24) |
| 14394 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14395 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14396 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14397 | obj.xid = reader.read("!L")[0] |
| 14398 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14399 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14400 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14401 | return obj |
| 14402 | |
| 14403 | def __eq__(self, other): |
| 14404 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14405 | if self.xid != other.xid: return False |
| 14406 | if self.role != other.role: return False |
| 14407 | if self.generation_id != other.generation_id: return False |
| 14408 | return True |
| 14409 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14410 | def pretty_print(self, q): |
| 14411 | q.text("role_request {") |
| 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("role = "); |
| 14422 | q.text("%#x" % self.role) |
| 14423 | q.text(","); q.breakable() |
| 14424 | q.text("generation_id = "); |
| 14425 | q.text("%#x" % self.generation_id) |
| 14426 | q.breakable() |
| 14427 | q.text('}') |
| 14428 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14429 | message.subtypes[24] = role_request |
| 14430 | |
| 14431 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14432 | version = 4 |
| 14433 | type = 1 |
| 14434 | err_type = 11 |
| 14435 | |
| 14436 | def __init__(self, xid=None, code=None, data=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 | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14441 | if code != None: |
| 14442 | self.code = code |
| 14443 | else: |
| 14444 | self.code = 0 |
| 14445 | if data != None: |
| 14446 | self.data = data |
| 14447 | else: |
| 14448 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14449 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -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.err_type)) |
| 14458 | packed.append(struct.pack("!H", self.code)) |
| 14459 | packed.append(self.data) |
| 14460 | length = sum([len(x) for x in packed]) |
| 14461 | packed[2] = struct.pack("!H", length) |
| 14462 | return ''.join(packed) |
| 14463 | |
| 14464 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14465 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14466 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14467 | _version = reader.read("!B")[0] |
| 14468 | assert(_version == 4) |
| 14469 | _type = reader.read("!B")[0] |
| 14470 | assert(_type == 1) |
| 14471 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14472 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14473 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14474 | obj.xid = reader.read("!L")[0] |
| 14475 | _err_type = reader.read("!H")[0] |
| 14476 | assert(_err_type == 11) |
| 14477 | obj.code = reader.read("!H")[0] |
| 14478 | obj.data = str(reader.read_all()) |
| 14479 | return obj |
| 14480 | |
| 14481 | def __eq__(self, other): |
| 14482 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14483 | if self.xid != other.xid: return False |
| 14484 | if self.code != other.code: return False |
| 14485 | if self.data != other.data: return False |
| 14486 | return True |
| 14487 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14488 | def pretty_print(self, q): |
| 14489 | q.text("role_request_failed_error_msg {") |
| 14490 | with q.group(): |
| 14491 | with q.indent(2): |
| 14492 | q.breakable() |
| 14493 | q.text("xid = "); |
| 14494 | if self.xid != None: |
| 14495 | q.text("%#x" % self.xid) |
| 14496 | else: |
| 14497 | q.text('None') |
| 14498 | q.text(","); q.breakable() |
| 14499 | q.text("code = "); |
| 14500 | q.text("%#x" % self.code) |
| 14501 | q.text(","); q.breakable() |
| 14502 | q.text("data = "); |
| 14503 | q.pp(self.data) |
| 14504 | q.breakable() |
| 14505 | q.text('}') |
| 14506 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14507 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 14508 | |
| 14509 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14510 | version = 4 |
| 14511 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14512 | |
| 14513 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14514 | if xid != None: |
| 14515 | self.xid = xid |
| 14516 | else: |
| 14517 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14518 | if flags != None: |
| 14519 | self.flags = flags |
| 14520 | else: |
| 14521 | self.flags = 0 |
| 14522 | if miss_send_len != None: |
| 14523 | self.miss_send_len = miss_send_len |
| 14524 | else: |
| 14525 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14526 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14527 | |
| 14528 | def pack(self): |
| 14529 | packed = [] |
| 14530 | packed.append(struct.pack("!B", self.version)) |
| 14531 | packed.append(struct.pack("!B", self.type)) |
| 14532 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14533 | packed.append(struct.pack("!L", self.xid)) |
| 14534 | packed.append(struct.pack("!H", self.flags)) |
| 14535 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 14536 | length = sum([len(x) for x in packed]) |
| 14537 | packed[2] = struct.pack("!H", length) |
| 14538 | return ''.join(packed) |
| 14539 | |
| 14540 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14541 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14542 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14543 | _version = reader.read("!B")[0] |
| 14544 | assert(_version == 4) |
| 14545 | _type = reader.read("!B")[0] |
| 14546 | assert(_type == 9) |
| 14547 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14548 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14549 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14550 | obj.xid = reader.read("!L")[0] |
| 14551 | obj.flags = reader.read("!H")[0] |
| 14552 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14553 | return obj |
| 14554 | |
| 14555 | def __eq__(self, other): |
| 14556 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14557 | if self.xid != other.xid: return False |
| 14558 | if self.flags != other.flags: return False |
| 14559 | if self.miss_send_len != other.miss_send_len: return False |
| 14560 | return True |
| 14561 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14562 | def pretty_print(self, q): |
| 14563 | q.text("set_config {") |
| 14564 | with q.group(): |
| 14565 | with q.indent(2): |
| 14566 | q.breakable() |
| 14567 | q.text("xid = "); |
| 14568 | if self.xid != None: |
| 14569 | q.text("%#x" % self.xid) |
| 14570 | else: |
| 14571 | q.text('None') |
| 14572 | q.text(","); q.breakable() |
| 14573 | q.text("flags = "); |
| 14574 | q.text("%#x" % self.flags) |
| 14575 | q.text(","); q.breakable() |
| 14576 | q.text("miss_send_len = "); |
| 14577 | q.text("%#x" % self.miss_send_len) |
| 14578 | q.breakable() |
| 14579 | q.text('}') |
| 14580 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14581 | message.subtypes[9] = set_config |
| 14582 | |
| 14583 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14584 | version = 4 |
| 14585 | type = 1 |
| 14586 | err_type = 10 |
| 14587 | |
| 14588 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14589 | if xid != None: |
| 14590 | self.xid = xid |
| 14591 | else: |
| 14592 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14593 | if code != None: |
| 14594 | self.code = code |
| 14595 | else: |
| 14596 | self.code = 0 |
| 14597 | if data != None: |
| 14598 | self.data = data |
| 14599 | else: |
| 14600 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14601 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14602 | |
| 14603 | def pack(self): |
| 14604 | packed = [] |
| 14605 | packed.append(struct.pack("!B", self.version)) |
| 14606 | packed.append(struct.pack("!B", self.type)) |
| 14607 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14608 | packed.append(struct.pack("!L", self.xid)) |
| 14609 | packed.append(struct.pack("!H", self.err_type)) |
| 14610 | packed.append(struct.pack("!H", self.code)) |
| 14611 | packed.append(self.data) |
| 14612 | length = sum([len(x) for x in packed]) |
| 14613 | packed[2] = struct.pack("!H", length) |
| 14614 | return ''.join(packed) |
| 14615 | |
| 14616 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14617 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14618 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14619 | _version = reader.read("!B")[0] |
| 14620 | assert(_version == 4) |
| 14621 | _type = reader.read("!B")[0] |
| 14622 | assert(_type == 1) |
| 14623 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14624 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14625 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14626 | obj.xid = reader.read("!L")[0] |
| 14627 | _err_type = reader.read("!H")[0] |
| 14628 | assert(_err_type == 10) |
| 14629 | obj.code = reader.read("!H")[0] |
| 14630 | obj.data = str(reader.read_all()) |
| 14631 | return obj |
| 14632 | |
| 14633 | def __eq__(self, other): |
| 14634 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14635 | if self.xid != other.xid: return False |
| 14636 | if self.code != other.code: return False |
| 14637 | if self.data != other.data: return False |
| 14638 | return True |
| 14639 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14640 | def pretty_print(self, q): |
| 14641 | q.text("switch_config_failed_error_msg {") |
| 14642 | with q.group(): |
| 14643 | with q.indent(2): |
| 14644 | q.breakable() |
| 14645 | q.text("xid = "); |
| 14646 | if self.xid != None: |
| 14647 | q.text("%#x" % self.xid) |
| 14648 | else: |
| 14649 | q.text('None') |
| 14650 | q.text(","); q.breakable() |
| 14651 | q.text("code = "); |
| 14652 | q.text("%#x" % self.code) |
| 14653 | q.text(","); q.breakable() |
| 14654 | q.text("data = "); |
| 14655 | q.pp(self.data) |
| 14656 | q.breakable() |
| 14657 | q.text('}') |
| 14658 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14659 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 14660 | |
| 14661 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14662 | version = 4 |
| 14663 | type = 1 |
| 14664 | err_type = 13 |
| 14665 | |
| 14666 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14667 | if xid != None: |
| 14668 | self.xid = xid |
| 14669 | else: |
| 14670 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14671 | if code != None: |
| 14672 | self.code = code |
| 14673 | else: |
| 14674 | self.code = 0 |
| 14675 | if data != None: |
| 14676 | self.data = data |
| 14677 | else: |
| 14678 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14679 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14680 | |
| 14681 | def pack(self): |
| 14682 | packed = [] |
| 14683 | packed.append(struct.pack("!B", self.version)) |
| 14684 | packed.append(struct.pack("!B", self.type)) |
| 14685 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14686 | packed.append(struct.pack("!L", self.xid)) |
| 14687 | packed.append(struct.pack("!H", self.err_type)) |
| 14688 | packed.append(struct.pack("!H", self.code)) |
| 14689 | packed.append(self.data) |
| 14690 | length = sum([len(x) for x in packed]) |
| 14691 | packed[2] = struct.pack("!H", length) |
| 14692 | return ''.join(packed) |
| 14693 | |
| 14694 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14695 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14696 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14697 | _version = reader.read("!B")[0] |
| 14698 | assert(_version == 4) |
| 14699 | _type = reader.read("!B")[0] |
| 14700 | assert(_type == 1) |
| 14701 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14702 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14703 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14704 | obj.xid = reader.read("!L")[0] |
| 14705 | _err_type = reader.read("!H")[0] |
| 14706 | assert(_err_type == 13) |
| 14707 | obj.code = reader.read("!H")[0] |
| 14708 | obj.data = str(reader.read_all()) |
| 14709 | return obj |
| 14710 | |
| 14711 | def __eq__(self, other): |
| 14712 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14713 | if self.xid != other.xid: return False |
| 14714 | if self.code != other.code: return False |
| 14715 | if self.data != other.data: return False |
| 14716 | return True |
| 14717 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14718 | def pretty_print(self, q): |
| 14719 | q.text("table_features_failed_error_msg {") |
| 14720 | with q.group(): |
| 14721 | with q.indent(2): |
| 14722 | q.breakable() |
| 14723 | q.text("xid = "); |
| 14724 | if self.xid != None: |
| 14725 | q.text("%#x" % self.xid) |
| 14726 | else: |
| 14727 | q.text('None') |
| 14728 | q.text(","); q.breakable() |
| 14729 | q.text("code = "); |
| 14730 | q.text("%#x" % self.code) |
| 14731 | q.text(","); q.breakable() |
| 14732 | q.text("data = "); |
| 14733 | q.pp(self.data) |
| 14734 | q.breakable() |
| 14735 | q.text('}') |
| 14736 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14737 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 14738 | |
| 14739 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14740 | version = 4 |
| 14741 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14742 | stats_type = 12 |
| 14743 | |
| 14744 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14745 | if xid != None: |
| 14746 | self.xid = xid |
| 14747 | else: |
| 14748 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14749 | if flags != None: |
| 14750 | self.flags = flags |
| 14751 | else: |
| 14752 | self.flags = 0 |
| 14753 | if entries != None: |
| 14754 | self.entries = entries |
| 14755 | else: |
| 14756 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14757 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14758 | |
| 14759 | def pack(self): |
| 14760 | packed = [] |
| 14761 | packed.append(struct.pack("!B", self.version)) |
| 14762 | packed.append(struct.pack("!B", self.type)) |
| 14763 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14764 | packed.append(struct.pack("!L", self.xid)) |
| 14765 | packed.append(struct.pack("!H", self.stats_type)) |
| 14766 | packed.append(struct.pack("!H", self.flags)) |
| 14767 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14768 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14769 | length = sum([len(x) for x in packed]) |
| 14770 | packed[2] = struct.pack("!H", length) |
| 14771 | return ''.join(packed) |
| 14772 | |
| 14773 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14774 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14775 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14776 | _version = reader.read("!B")[0] |
| 14777 | assert(_version == 4) |
| 14778 | _type = reader.read("!B")[0] |
| 14779 | assert(_type == 19) |
| 14780 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14781 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14782 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14783 | obj.xid = reader.read("!L")[0] |
| 14784 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14785 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14786 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14787 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14788 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14789 | return obj |
| 14790 | |
| 14791 | def __eq__(self, other): |
| 14792 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14793 | if self.xid != other.xid: return False |
| 14794 | if self.flags != other.flags: return False |
| 14795 | if self.entries != other.entries: return False |
| 14796 | return True |
| 14797 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14798 | def pretty_print(self, q): |
| 14799 | q.text("table_features_stats_reply {") |
| 14800 | with q.group(): |
| 14801 | with q.indent(2): |
| 14802 | q.breakable() |
| 14803 | q.text("xid = "); |
| 14804 | if self.xid != None: |
| 14805 | q.text("%#x" % self.xid) |
| 14806 | else: |
| 14807 | q.text('None') |
| 14808 | q.text(","); q.breakable() |
| 14809 | q.text("flags = "); |
| 14810 | q.text("%#x" % self.flags) |
| 14811 | q.text(","); q.breakable() |
| 14812 | q.text("entries = "); |
| 14813 | q.pp(self.entries) |
| 14814 | q.breakable() |
| 14815 | q.text('}') |
| 14816 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14817 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14818 | |
| 14819 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14820 | version = 4 |
| 14821 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14822 | stats_type = 12 |
| 14823 | |
| 14824 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14825 | if xid != None: |
| 14826 | self.xid = xid |
| 14827 | else: |
| 14828 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14829 | if flags != None: |
| 14830 | self.flags = flags |
| 14831 | else: |
| 14832 | self.flags = 0 |
| 14833 | if entries != None: |
| 14834 | self.entries = entries |
| 14835 | else: |
| 14836 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14837 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14838 | |
| 14839 | def pack(self): |
| 14840 | packed = [] |
| 14841 | packed.append(struct.pack("!B", self.version)) |
| 14842 | packed.append(struct.pack("!B", self.type)) |
| 14843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14844 | packed.append(struct.pack("!L", self.xid)) |
| 14845 | packed.append(struct.pack("!H", self.stats_type)) |
| 14846 | packed.append(struct.pack("!H", self.flags)) |
| 14847 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14848 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14849 | length = sum([len(x) for x in packed]) |
| 14850 | packed[2] = struct.pack("!H", length) |
| 14851 | return ''.join(packed) |
| 14852 | |
| 14853 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14854 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14855 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14856 | _version = reader.read("!B")[0] |
| 14857 | assert(_version == 4) |
| 14858 | _type = reader.read("!B")[0] |
| 14859 | assert(_type == 18) |
| 14860 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14861 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14862 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14863 | obj.xid = reader.read("!L")[0] |
| 14864 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14865 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14866 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14867 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14868 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 | if self.entries != other.entries: return False |
| 14876 | return True |
| 14877 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14878 | def pretty_print(self, q): |
| 14879 | q.text("table_features_stats_request {") |
| 14880 | with q.group(): |
| 14881 | with q.indent(2): |
| 14882 | q.breakable() |
| 14883 | q.text("xid = "); |
| 14884 | if self.xid != None: |
| 14885 | q.text("%#x" % self.xid) |
| 14886 | else: |
| 14887 | q.text('None') |
| 14888 | q.text(","); q.breakable() |
| 14889 | q.text("flags = "); |
| 14890 | q.text("%#x" % self.flags) |
| 14891 | q.text(","); q.breakable() |
| 14892 | q.text("entries = "); |
| 14893 | q.pp(self.entries) |
| 14894 | q.breakable() |
| 14895 | q.text('}') |
| 14896 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14897 | stats_request.subtypes[12] = table_features_stats_request |
| 14898 | |
| 14899 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14900 | version = 4 |
| 14901 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14902 | |
| 14903 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14904 | if xid != None: |
| 14905 | self.xid = xid |
| 14906 | else: |
| 14907 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14908 | if table_id != None: |
| 14909 | self.table_id = table_id |
| 14910 | else: |
| 14911 | self.table_id = 0 |
| 14912 | if config != None: |
| 14913 | self.config = config |
| 14914 | else: |
| 14915 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14916 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14917 | |
| 14918 | def pack(self): |
| 14919 | packed = [] |
| 14920 | packed.append(struct.pack("!B", self.version)) |
| 14921 | packed.append(struct.pack("!B", self.type)) |
| 14922 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14923 | packed.append(struct.pack("!L", self.xid)) |
| 14924 | packed.append(struct.pack("!B", self.table_id)) |
| 14925 | packed.append('\x00' * 3) |
| 14926 | packed.append(struct.pack("!L", self.config)) |
| 14927 | length = sum([len(x) for x in packed]) |
| 14928 | packed[2] = struct.pack("!H", length) |
| 14929 | return ''.join(packed) |
| 14930 | |
| 14931 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14932 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14933 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14934 | _version = reader.read("!B")[0] |
| 14935 | assert(_version == 4) |
| 14936 | _type = reader.read("!B")[0] |
| 14937 | assert(_type == 17) |
| 14938 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14939 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14940 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14941 | obj.xid = reader.read("!L")[0] |
| 14942 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14943 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14944 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14945 | return obj |
| 14946 | |
| 14947 | def __eq__(self, other): |
| 14948 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14949 | if self.xid != other.xid: return False |
| 14950 | if self.table_id != other.table_id: return False |
| 14951 | if self.config != other.config: return False |
| 14952 | return True |
| 14953 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14954 | def pretty_print(self, q): |
| 14955 | q.text("table_mod {") |
| 14956 | with q.group(): |
| 14957 | with q.indent(2): |
| 14958 | q.breakable() |
| 14959 | q.text("xid = "); |
| 14960 | if self.xid != None: |
| 14961 | q.text("%#x" % self.xid) |
| 14962 | else: |
| 14963 | q.text('None') |
| 14964 | q.text(","); q.breakable() |
| 14965 | q.text("table_id = "); |
| 14966 | q.text("%#x" % self.table_id) |
| 14967 | q.text(","); q.breakable() |
| 14968 | q.text("config = "); |
| 14969 | q.text("%#x" % self.config) |
| 14970 | q.breakable() |
| 14971 | q.text('}') |
| 14972 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14973 | message.subtypes[17] = table_mod |
| 14974 | |
| 14975 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14976 | version = 4 |
| 14977 | type = 1 |
| 14978 | err_type = 8 |
| 14979 | |
| 14980 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14981 | if xid != None: |
| 14982 | self.xid = xid |
| 14983 | else: |
| 14984 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14985 | if code != None: |
| 14986 | self.code = code |
| 14987 | else: |
| 14988 | self.code = 0 |
| 14989 | if data != None: |
| 14990 | self.data = data |
| 14991 | else: |
| 14992 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14993 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14994 | |
| 14995 | def pack(self): |
| 14996 | packed = [] |
| 14997 | packed.append(struct.pack("!B", self.version)) |
| 14998 | packed.append(struct.pack("!B", self.type)) |
| 14999 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15000 | packed.append(struct.pack("!L", self.xid)) |
| 15001 | packed.append(struct.pack("!H", self.err_type)) |
| 15002 | packed.append(struct.pack("!H", self.code)) |
| 15003 | packed.append(self.data) |
| 15004 | length = sum([len(x) for x in packed]) |
| 15005 | packed[2] = struct.pack("!H", length) |
| 15006 | return ''.join(packed) |
| 15007 | |
| 15008 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15009 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15010 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15011 | _version = reader.read("!B")[0] |
| 15012 | assert(_version == 4) |
| 15013 | _type = reader.read("!B")[0] |
| 15014 | assert(_type == 1) |
| 15015 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15016 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15017 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15018 | obj.xid = reader.read("!L")[0] |
| 15019 | _err_type = reader.read("!H")[0] |
| 15020 | assert(_err_type == 8) |
| 15021 | obj.code = reader.read("!H")[0] |
| 15022 | obj.data = str(reader.read_all()) |
| 15023 | return obj |
| 15024 | |
| 15025 | def __eq__(self, other): |
| 15026 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15027 | if self.xid != other.xid: return False |
| 15028 | if self.code != other.code: return False |
| 15029 | if self.data != other.data: return False |
| 15030 | return True |
| 15031 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15032 | def pretty_print(self, q): |
| 15033 | q.text("table_mod_failed_error_msg {") |
| 15034 | with q.group(): |
| 15035 | with q.indent(2): |
| 15036 | q.breakable() |
| 15037 | q.text("xid = "); |
| 15038 | if self.xid != None: |
| 15039 | q.text("%#x" % self.xid) |
| 15040 | else: |
| 15041 | q.text('None') |
| 15042 | q.text(","); q.breakable() |
| 15043 | q.text("code = "); |
| 15044 | q.text("%#x" % self.code) |
| 15045 | q.text(","); q.breakable() |
| 15046 | q.text("data = "); |
| 15047 | q.pp(self.data) |
| 15048 | q.breakable() |
| 15049 | q.text('}') |
| 15050 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15051 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 15052 | |
| 15053 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15054 | version = 4 |
| 15055 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15056 | stats_type = 3 |
| 15057 | |
| 15058 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15059 | if xid != None: |
| 15060 | self.xid = xid |
| 15061 | else: |
| 15062 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15063 | if flags != None: |
| 15064 | self.flags = flags |
| 15065 | else: |
| 15066 | self.flags = 0 |
| 15067 | if entries != None: |
| 15068 | self.entries = entries |
| 15069 | else: |
| 15070 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15071 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15072 | |
| 15073 | def pack(self): |
| 15074 | packed = [] |
| 15075 | packed.append(struct.pack("!B", self.version)) |
| 15076 | packed.append(struct.pack("!B", self.type)) |
| 15077 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15078 | packed.append(struct.pack("!L", self.xid)) |
| 15079 | packed.append(struct.pack("!H", self.stats_type)) |
| 15080 | packed.append(struct.pack("!H", self.flags)) |
| 15081 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15082 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15083 | length = sum([len(x) for x in packed]) |
| 15084 | packed[2] = struct.pack("!H", length) |
| 15085 | return ''.join(packed) |
| 15086 | |
| 15087 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15088 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15089 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15090 | _version = reader.read("!B")[0] |
| 15091 | assert(_version == 4) |
| 15092 | _type = reader.read("!B")[0] |
| 15093 | assert(_type == 19) |
| 15094 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15095 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15096 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15097 | obj.xid = reader.read("!L")[0] |
| 15098 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15099 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15100 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15101 | reader.skip(4) |
| 15102 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 15103 | return obj |
| 15104 | |
| 15105 | def __eq__(self, other): |
| 15106 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15107 | if self.xid != other.xid: return False |
| 15108 | if self.flags != other.flags: return False |
| 15109 | if self.entries != other.entries: return False |
| 15110 | return True |
| 15111 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15112 | def pretty_print(self, q): |
| 15113 | q.text("table_stats_reply {") |
| 15114 | with q.group(): |
| 15115 | with q.indent(2): |
| 15116 | q.breakable() |
| 15117 | q.text("xid = "); |
| 15118 | if self.xid != None: |
| 15119 | q.text("%#x" % self.xid) |
| 15120 | else: |
| 15121 | q.text('None') |
| 15122 | q.text(","); q.breakable() |
| 15123 | q.text("flags = "); |
| 15124 | q.text("%#x" % self.flags) |
| 15125 | q.text(","); q.breakable() |
| 15126 | q.text("entries = "); |
| 15127 | q.pp(self.entries) |
| 15128 | q.breakable() |
| 15129 | q.text('}') |
| 15130 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15131 | stats_reply.subtypes[3] = table_stats_reply |
| 15132 | |
| 15133 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15134 | version = 4 |
| 15135 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15136 | stats_type = 3 |
| 15137 | |
| 15138 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15139 | if xid != None: |
| 15140 | self.xid = xid |
| 15141 | else: |
| 15142 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15143 | if flags != None: |
| 15144 | self.flags = flags |
| 15145 | else: |
| 15146 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15147 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15148 | |
| 15149 | def pack(self): |
| 15150 | packed = [] |
| 15151 | packed.append(struct.pack("!B", self.version)) |
| 15152 | packed.append(struct.pack("!B", self.type)) |
| 15153 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15154 | packed.append(struct.pack("!L", self.xid)) |
| 15155 | packed.append(struct.pack("!H", self.stats_type)) |
| 15156 | packed.append(struct.pack("!H", self.flags)) |
| 15157 | packed.append('\x00' * 4) |
| 15158 | length = sum([len(x) for x in packed]) |
| 15159 | packed[2] = struct.pack("!H", length) |
| 15160 | return ''.join(packed) |
| 15161 | |
| 15162 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15163 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15164 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15165 | _version = reader.read("!B")[0] |
| 15166 | assert(_version == 4) |
| 15167 | _type = reader.read("!B")[0] |
| 15168 | assert(_type == 18) |
| 15169 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15170 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15171 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15172 | obj.xid = reader.read("!L")[0] |
| 15173 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15174 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15175 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15176 | reader.skip(4) |
| 15177 | return obj |
| 15178 | |
| 15179 | def __eq__(self, other): |
| 15180 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15181 | if self.xid != other.xid: return False |
| 15182 | if self.flags != other.flags: return False |
| 15183 | return True |
| 15184 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15185 | def pretty_print(self, q): |
| 15186 | q.text("table_stats_request {") |
| 15187 | with q.group(): |
| 15188 | with q.indent(2): |
| 15189 | q.breakable() |
| 15190 | q.text("xid = "); |
| 15191 | if self.xid != None: |
| 15192 | q.text("%#x" % self.xid) |
| 15193 | else: |
| 15194 | q.text('None') |
| 15195 | q.text(","); q.breakable() |
| 15196 | q.text("flags = "); |
| 15197 | q.text("%#x" % self.flags) |
| 15198 | q.breakable() |
| 15199 | q.text('}') |
| 15200 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15201 | stats_request.subtypes[3] = table_stats_request |
| 15202 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15203 | |
| 15204 | def parse_header(buf): |
| 15205 | if len(buf) < 8: |
| 15206 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 15207 | return struct.unpack_from("!BBHL", buf) |
| 15208 | |
| 15209 | def parse_message(buf): |
| 15210 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 15211 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 15212 | 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] | 15213 | if len(buf) != msg_len: |
| 15214 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15215 | return message.unpack(loxi.generic_util.OFReader(buf)) |