Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13 | import action |
| 14 | import instruction |
| 15 | import oxm |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 16 | import util |
| 17 | import loxi.generic_util |
| 18 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 19 | class message(loxi.OFObject): |
| 20 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 21 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 22 | version = 3 |
| 23 | |
| 24 | def __init__(self, type=None, xid=None): |
| 25 | if type != None: |
| 26 | self.type = type |
| 27 | else: |
| 28 | self.type = 0 |
| 29 | if xid != None: |
| 30 | self.xid = xid |
| 31 | else: |
| 32 | self.xid = None |
| 33 | return |
| 34 | |
| 35 | def pack(self): |
| 36 | packed = [] |
| 37 | packed.append(struct.pack("!B", self.version)) |
| 38 | packed.append(struct.pack("!B", self.type)) |
| 39 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 40 | packed.append(struct.pack("!L", self.xid)) |
| 41 | length = sum([len(x) for x in packed]) |
| 42 | packed[2] = struct.pack("!H", length) |
| 43 | return ''.join(packed) |
| 44 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 45 | @staticmethod |
| 46 | def unpack(reader): |
| 47 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 48 | subclass = message.subtypes.get(subtype) |
| 49 | if subclass: |
| 50 | return subclass.unpack(reader) |
| 51 | |
| 52 | obj = message() |
| 53 | _version = reader.read("!B")[0] |
| 54 | assert(_version == 3) |
| 55 | obj.type = reader.read("!B")[0] |
| 56 | _length = reader.read("!H")[0] |
| 57 | orig_reader = reader |
| 58 | reader = orig_reader.slice(_length - (2 + 2)) |
| 59 | obj.xid = reader.read("!L")[0] |
| 60 | return obj |
| 61 | |
| 62 | def __eq__(self, other): |
| 63 | if type(self) != type(other): return False |
| 64 | if self.type != other.type: return False |
| 65 | if self.xid != other.xid: return False |
| 66 | return True |
| 67 | |
| 68 | def pretty_print(self, q): |
| 69 | q.text("message {") |
| 70 | with q.group(): |
| 71 | with q.indent(2): |
| 72 | q.breakable() |
| 73 | q.text("xid = "); |
| 74 | if self.xid != None: |
| 75 | q.text("%#x" % self.xid) |
| 76 | else: |
| 77 | q.text('None') |
| 78 | q.breakable() |
| 79 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 80 | |
| 81 | |
| 82 | class stats_reply(message): |
| 83 | subtypes = {} |
| 84 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 85 | version = 3 |
| 86 | type = 19 |
| 87 | |
| 88 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 89 | if xid != None: |
| 90 | self.xid = xid |
| 91 | else: |
| 92 | self.xid = None |
| 93 | if stats_type != None: |
| 94 | self.stats_type = stats_type |
| 95 | else: |
| 96 | self.stats_type = 0 |
| 97 | if flags != None: |
| 98 | self.flags = flags |
| 99 | else: |
| 100 | self.flags = 0 |
| 101 | return |
| 102 | |
| 103 | def pack(self): |
| 104 | packed = [] |
| 105 | packed.append(struct.pack("!B", self.version)) |
| 106 | packed.append(struct.pack("!B", self.type)) |
| 107 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 108 | packed.append(struct.pack("!L", self.xid)) |
| 109 | packed.append(struct.pack("!H", self.stats_type)) |
| 110 | packed.append(struct.pack("!H", self.flags)) |
| 111 | packed.append('\x00' * 4) |
| 112 | length = sum([len(x) for x in packed]) |
| 113 | packed[2] = struct.pack("!H", length) |
| 114 | return ''.join(packed) |
| 115 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 116 | @staticmethod |
| 117 | def unpack(reader): |
| 118 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 119 | subclass = stats_reply.subtypes.get(subtype) |
| 120 | if subclass: |
| 121 | return subclass.unpack(reader) |
| 122 | |
| 123 | obj = stats_reply() |
| 124 | _version = reader.read("!B")[0] |
| 125 | assert(_version == 3) |
| 126 | _type = reader.read("!B")[0] |
| 127 | assert(_type == 19) |
| 128 | _length = reader.read("!H")[0] |
| 129 | orig_reader = reader |
| 130 | reader = orig_reader.slice(_length - (2 + 2)) |
| 131 | obj.xid = reader.read("!L")[0] |
| 132 | obj.stats_type = reader.read("!H")[0] |
| 133 | obj.flags = reader.read("!H")[0] |
| 134 | reader.skip(4) |
| 135 | return obj |
| 136 | |
| 137 | def __eq__(self, other): |
| 138 | if type(self) != type(other): return False |
| 139 | if self.xid != other.xid: return False |
| 140 | if self.stats_type != other.stats_type: return False |
| 141 | if self.flags != other.flags: return False |
| 142 | return True |
| 143 | |
| 144 | def pretty_print(self, q): |
| 145 | q.text("stats_reply {") |
| 146 | with q.group(): |
| 147 | with q.indent(2): |
| 148 | q.breakable() |
| 149 | q.text("xid = "); |
| 150 | if self.xid != None: |
| 151 | q.text("%#x" % self.xid) |
| 152 | else: |
| 153 | q.text('None') |
| 154 | q.text(","); q.breakable() |
| 155 | q.text("flags = "); |
| 156 | q.text("%#x" % self.flags) |
| 157 | q.breakable() |
| 158 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 159 | |
| 160 | message.subtypes[19] = stats_reply |
| 161 | |
| 162 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 163 | version = 3 |
| 164 | type = 19 |
| 165 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 166 | |
| 167 | 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] | 168 | if xid != None: |
| 169 | self.xid = xid |
| 170 | else: |
| 171 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 172 | if flags != None: |
| 173 | self.flags = flags |
| 174 | else: |
| 175 | self.flags = 0 |
| 176 | if packet_count != None: |
| 177 | self.packet_count = packet_count |
| 178 | else: |
| 179 | self.packet_count = 0 |
| 180 | if byte_count != None: |
| 181 | self.byte_count = byte_count |
| 182 | else: |
| 183 | self.byte_count = 0 |
| 184 | if flow_count != None: |
| 185 | self.flow_count = flow_count |
| 186 | else: |
| 187 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 188 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 189 | |
| 190 | def pack(self): |
| 191 | packed = [] |
| 192 | packed.append(struct.pack("!B", self.version)) |
| 193 | packed.append(struct.pack("!B", self.type)) |
| 194 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 195 | packed.append(struct.pack("!L", self.xid)) |
| 196 | packed.append(struct.pack("!H", self.stats_type)) |
| 197 | packed.append(struct.pack("!H", self.flags)) |
| 198 | packed.append('\x00' * 4) |
| 199 | packed.append(struct.pack("!Q", self.packet_count)) |
| 200 | packed.append(struct.pack("!Q", self.byte_count)) |
| 201 | packed.append(struct.pack("!L", self.flow_count)) |
| 202 | packed.append('\x00' * 4) |
| 203 | length = sum([len(x) for x in packed]) |
| 204 | packed[2] = struct.pack("!H", length) |
| 205 | return ''.join(packed) |
| 206 | |
| 207 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 208 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 209 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 210 | _version = reader.read("!B")[0] |
| 211 | assert(_version == 3) |
| 212 | _type = reader.read("!B")[0] |
| 213 | assert(_type == 19) |
| 214 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 215 | orig_reader = reader |
| 216 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 217 | obj.xid = reader.read("!L")[0] |
| 218 | _stats_type = reader.read("!H")[0] |
| 219 | assert(_stats_type == 2) |
| 220 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 221 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 222 | obj.packet_count = reader.read("!Q")[0] |
| 223 | obj.byte_count = reader.read("!Q")[0] |
| 224 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 225 | reader.skip(4) |
| 226 | return obj |
| 227 | |
| 228 | def __eq__(self, other): |
| 229 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 230 | if self.xid != other.xid: return False |
| 231 | if self.flags != other.flags: return False |
| 232 | if self.packet_count != other.packet_count: return False |
| 233 | if self.byte_count != other.byte_count: return False |
| 234 | if self.flow_count != other.flow_count: return False |
| 235 | return True |
| 236 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 237 | def pretty_print(self, q): |
| 238 | q.text("aggregate_stats_reply {") |
| 239 | with q.group(): |
| 240 | with q.indent(2): |
| 241 | q.breakable() |
| 242 | q.text("xid = "); |
| 243 | if self.xid != None: |
| 244 | q.text("%#x" % self.xid) |
| 245 | else: |
| 246 | q.text('None') |
| 247 | q.text(","); q.breakable() |
| 248 | q.text("flags = "); |
| 249 | q.text("%#x" % self.flags) |
| 250 | q.text(","); q.breakable() |
| 251 | q.text("packet_count = "); |
| 252 | q.text("%#x" % self.packet_count) |
| 253 | q.text(","); q.breakable() |
| 254 | q.text("byte_count = "); |
| 255 | q.text("%#x" % self.byte_count) |
| 256 | q.text(","); q.breakable() |
| 257 | q.text("flow_count = "); |
| 258 | q.text("%#x" % self.flow_count) |
| 259 | q.breakable() |
| 260 | q.text('}') |
| 261 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 262 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 263 | |
| 264 | class stats_request(message): |
| 265 | subtypes = {} |
| 266 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 267 | version = 3 |
| 268 | type = 18 |
| 269 | |
| 270 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 271 | if xid != None: |
| 272 | self.xid = xid |
| 273 | else: |
| 274 | self.xid = None |
| 275 | if stats_type != None: |
| 276 | self.stats_type = stats_type |
| 277 | else: |
| 278 | self.stats_type = 0 |
| 279 | if flags != None: |
| 280 | self.flags = flags |
| 281 | else: |
| 282 | self.flags = 0 |
| 283 | return |
| 284 | |
| 285 | def pack(self): |
| 286 | packed = [] |
| 287 | packed.append(struct.pack("!B", self.version)) |
| 288 | packed.append(struct.pack("!B", self.type)) |
| 289 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 290 | packed.append(struct.pack("!L", self.xid)) |
| 291 | packed.append(struct.pack("!H", self.stats_type)) |
| 292 | packed.append(struct.pack("!H", self.flags)) |
| 293 | packed.append('\x00' * 4) |
| 294 | length = sum([len(x) for x in packed]) |
| 295 | packed[2] = struct.pack("!H", length) |
| 296 | return ''.join(packed) |
| 297 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 298 | @staticmethod |
| 299 | def unpack(reader): |
| 300 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 301 | subclass = stats_request.subtypes.get(subtype) |
| 302 | if subclass: |
| 303 | return subclass.unpack(reader) |
| 304 | |
| 305 | obj = stats_request() |
| 306 | _version = reader.read("!B")[0] |
| 307 | assert(_version == 3) |
| 308 | _type = reader.read("!B")[0] |
| 309 | assert(_type == 18) |
| 310 | _length = reader.read("!H")[0] |
| 311 | orig_reader = reader |
| 312 | reader = orig_reader.slice(_length - (2 + 2)) |
| 313 | obj.xid = reader.read("!L")[0] |
| 314 | obj.stats_type = reader.read("!H")[0] |
| 315 | obj.flags = reader.read("!H")[0] |
| 316 | reader.skip(4) |
| 317 | return obj |
| 318 | |
| 319 | def __eq__(self, other): |
| 320 | if type(self) != type(other): return False |
| 321 | if self.xid != other.xid: return False |
| 322 | if self.stats_type != other.stats_type: return False |
| 323 | if self.flags != other.flags: return False |
| 324 | return True |
| 325 | |
| 326 | def pretty_print(self, q): |
| 327 | q.text("stats_request {") |
| 328 | with q.group(): |
| 329 | with q.indent(2): |
| 330 | q.breakable() |
| 331 | q.text("xid = "); |
| 332 | if self.xid != None: |
| 333 | q.text("%#x" % self.xid) |
| 334 | else: |
| 335 | q.text('None') |
| 336 | q.text(","); q.breakable() |
| 337 | q.text("flags = "); |
| 338 | q.text("%#x" % self.flags) |
| 339 | q.breakable() |
| 340 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 341 | |
| 342 | message.subtypes[18] = stats_request |
| 343 | |
| 344 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 345 | version = 3 |
| 346 | type = 18 |
| 347 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 348 | |
| 349 | 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] | 350 | if xid != None: |
| 351 | self.xid = xid |
| 352 | else: |
| 353 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 354 | if flags != None: |
| 355 | self.flags = flags |
| 356 | else: |
| 357 | self.flags = 0 |
| 358 | if table_id != None: |
| 359 | self.table_id = table_id |
| 360 | else: |
| 361 | self.table_id = 0 |
| 362 | if out_port != None: |
| 363 | self.out_port = out_port |
| 364 | else: |
| 365 | self.out_port = 0 |
| 366 | if out_group != None: |
| 367 | self.out_group = out_group |
| 368 | else: |
| 369 | self.out_group = 0 |
| 370 | if cookie != None: |
| 371 | self.cookie = cookie |
| 372 | else: |
| 373 | self.cookie = 0 |
| 374 | if cookie_mask != None: |
| 375 | self.cookie_mask = cookie_mask |
| 376 | else: |
| 377 | self.cookie_mask = 0 |
| 378 | if match != None: |
| 379 | self.match = match |
| 380 | else: |
| 381 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 382 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 383 | |
| 384 | def pack(self): |
| 385 | packed = [] |
| 386 | packed.append(struct.pack("!B", self.version)) |
| 387 | packed.append(struct.pack("!B", self.type)) |
| 388 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 389 | packed.append(struct.pack("!L", self.xid)) |
| 390 | packed.append(struct.pack("!H", self.stats_type)) |
| 391 | packed.append(struct.pack("!H", self.flags)) |
| 392 | packed.append('\x00' * 4) |
| 393 | packed.append(struct.pack("!B", self.table_id)) |
| 394 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 395 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 396 | packed.append(struct.pack("!L", self.out_group)) |
| 397 | packed.append('\x00' * 4) |
| 398 | packed.append(struct.pack("!Q", self.cookie)) |
| 399 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 400 | packed.append(self.match.pack()) |
| 401 | length = sum([len(x) for x in packed]) |
| 402 | packed[2] = struct.pack("!H", length) |
| 403 | return ''.join(packed) |
| 404 | |
| 405 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 406 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 407 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 408 | _version = reader.read("!B")[0] |
| 409 | assert(_version == 3) |
| 410 | _type = reader.read("!B")[0] |
| 411 | assert(_type == 18) |
| 412 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 413 | orig_reader = reader |
| 414 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 415 | obj.xid = reader.read("!L")[0] |
| 416 | _stats_type = reader.read("!H")[0] |
| 417 | assert(_stats_type == 2) |
| 418 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 419 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 420 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 421 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 422 | obj.out_port = util.unpack_port_no(reader) |
| 423 | obj.out_group = reader.read("!L")[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.cookie = reader.read("!Q")[0] |
| 426 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 427 | obj.match = common.match.unpack(reader) |
| 428 | return obj |
| 429 | |
| 430 | def __eq__(self, other): |
| 431 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 432 | if self.xid != other.xid: return False |
| 433 | if self.flags != other.flags: return False |
| 434 | if self.table_id != other.table_id: return False |
| 435 | if self.out_port != other.out_port: return False |
| 436 | if self.out_group != other.out_group: return False |
| 437 | if self.cookie != other.cookie: return False |
| 438 | if self.cookie_mask != other.cookie_mask: return False |
| 439 | if self.match != other.match: return False |
| 440 | return True |
| 441 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 442 | def pretty_print(self, q): |
| 443 | q.text("aggregate_stats_request {") |
| 444 | with q.group(): |
| 445 | with q.indent(2): |
| 446 | q.breakable() |
| 447 | q.text("xid = "); |
| 448 | if self.xid != None: |
| 449 | q.text("%#x" % self.xid) |
| 450 | else: |
| 451 | q.text('None') |
| 452 | q.text(","); q.breakable() |
| 453 | q.text("flags = "); |
| 454 | q.text("%#x" % self.flags) |
| 455 | q.text(","); q.breakable() |
| 456 | q.text("table_id = "); |
| 457 | q.text("%#x" % self.table_id) |
| 458 | q.text(","); q.breakable() |
| 459 | q.text("out_port = "); |
| 460 | q.text(util.pretty_port(self.out_port)) |
| 461 | q.text(","); q.breakable() |
| 462 | q.text("out_group = "); |
| 463 | q.text("%#x" % self.out_group) |
| 464 | q.text(","); q.breakable() |
| 465 | q.text("cookie = "); |
| 466 | q.text("%#x" % self.cookie) |
| 467 | q.text(","); q.breakable() |
| 468 | q.text("cookie_mask = "); |
| 469 | q.text("%#x" % self.cookie_mask) |
| 470 | q.text(","); q.breakable() |
| 471 | q.text("match = "); |
| 472 | q.pp(self.match) |
| 473 | q.breakable() |
| 474 | q.text('}') |
| 475 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 476 | stats_request.subtypes[2] = aggregate_stats_request |
| 477 | |
| 478 | class error_msg(message): |
| 479 | subtypes = {} |
| 480 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 481 | version = 3 |
| 482 | type = 1 |
| 483 | |
| 484 | def __init__(self, xid=None, err_type=None): |
| 485 | if xid != None: |
| 486 | self.xid = xid |
| 487 | else: |
| 488 | self.xid = None |
| 489 | if err_type != None: |
| 490 | self.err_type = err_type |
| 491 | else: |
| 492 | self.err_type = 0 |
| 493 | return |
| 494 | |
| 495 | def pack(self): |
| 496 | packed = [] |
| 497 | packed.append(struct.pack("!B", self.version)) |
| 498 | packed.append(struct.pack("!B", self.type)) |
| 499 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 500 | packed.append(struct.pack("!L", self.xid)) |
| 501 | packed.append(struct.pack("!H", self.err_type)) |
| 502 | length = sum([len(x) for x in packed]) |
| 503 | packed[2] = struct.pack("!H", length) |
| 504 | return ''.join(packed) |
| 505 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 506 | @staticmethod |
| 507 | def unpack(reader): |
| 508 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 509 | subclass = error_msg.subtypes.get(subtype) |
| 510 | if subclass: |
| 511 | return subclass.unpack(reader) |
| 512 | |
| 513 | obj = error_msg() |
| 514 | _version = reader.read("!B")[0] |
| 515 | assert(_version == 3) |
| 516 | _type = reader.read("!B")[0] |
| 517 | assert(_type == 1) |
| 518 | _length = reader.read("!H")[0] |
| 519 | orig_reader = reader |
| 520 | reader = orig_reader.slice(_length - (2 + 2)) |
| 521 | obj.xid = reader.read("!L")[0] |
| 522 | obj.err_type = reader.read("!H")[0] |
| 523 | return obj |
| 524 | |
| 525 | def __eq__(self, other): |
| 526 | if type(self) != type(other): return False |
| 527 | if self.xid != other.xid: return False |
| 528 | if self.err_type != other.err_type: return False |
| 529 | return True |
| 530 | |
| 531 | def pretty_print(self, q): |
| 532 | q.text("error_msg {") |
| 533 | with q.group(): |
| 534 | with q.indent(2): |
| 535 | q.breakable() |
| 536 | q.text("xid = "); |
| 537 | if self.xid != None: |
| 538 | q.text("%#x" % self.xid) |
| 539 | else: |
| 540 | q.text('None') |
| 541 | q.breakable() |
| 542 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 543 | |
| 544 | message.subtypes[1] = error_msg |
| 545 | |
| 546 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 547 | version = 3 |
| 548 | type = 1 |
| 549 | err_type = 2 |
| 550 | |
| 551 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 552 | if xid != None: |
| 553 | self.xid = xid |
| 554 | else: |
| 555 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 556 | if code != None: |
| 557 | self.code = code |
| 558 | else: |
| 559 | self.code = 0 |
| 560 | if data != None: |
| 561 | self.data = data |
| 562 | else: |
| 563 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 564 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 565 | |
| 566 | def pack(self): |
| 567 | packed = [] |
| 568 | packed.append(struct.pack("!B", self.version)) |
| 569 | packed.append(struct.pack("!B", self.type)) |
| 570 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 571 | packed.append(struct.pack("!L", self.xid)) |
| 572 | packed.append(struct.pack("!H", self.err_type)) |
| 573 | packed.append(struct.pack("!H", self.code)) |
| 574 | packed.append(self.data) |
| 575 | length = sum([len(x) for x in packed]) |
| 576 | packed[2] = struct.pack("!H", length) |
| 577 | return ''.join(packed) |
| 578 | |
| 579 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 580 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 581 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 582 | _version = reader.read("!B")[0] |
| 583 | assert(_version == 3) |
| 584 | _type = reader.read("!B")[0] |
| 585 | assert(_type == 1) |
| 586 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 587 | orig_reader = reader |
| 588 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 589 | obj.xid = reader.read("!L")[0] |
| 590 | _err_type = reader.read("!H")[0] |
| 591 | assert(_err_type == 2) |
| 592 | obj.code = reader.read("!H")[0] |
| 593 | obj.data = str(reader.read_all()) |
| 594 | return obj |
| 595 | |
| 596 | def __eq__(self, other): |
| 597 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 598 | if self.xid != other.xid: return False |
| 599 | if self.code != other.code: return False |
| 600 | if self.data != other.data: return False |
| 601 | return True |
| 602 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 603 | def pretty_print(self, q): |
| 604 | q.text("bad_action_error_msg {") |
| 605 | with q.group(): |
| 606 | with q.indent(2): |
| 607 | q.breakable() |
| 608 | q.text("xid = "); |
| 609 | if self.xid != None: |
| 610 | q.text("%#x" % self.xid) |
| 611 | else: |
| 612 | q.text('None') |
| 613 | q.text(","); q.breakable() |
| 614 | q.text("code = "); |
| 615 | q.text("%#x" % self.code) |
| 616 | q.text(","); q.breakable() |
| 617 | q.text("data = "); |
| 618 | q.pp(self.data) |
| 619 | q.breakable() |
| 620 | q.text('}') |
| 621 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 622 | error_msg.subtypes[2] = bad_action_error_msg |
| 623 | |
| 624 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 625 | version = 3 |
| 626 | type = 1 |
| 627 | err_type = 3 |
| 628 | |
| 629 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 630 | if xid != None: |
| 631 | self.xid = xid |
| 632 | else: |
| 633 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 634 | if code != None: |
| 635 | self.code = code |
| 636 | else: |
| 637 | self.code = 0 |
| 638 | if data != None: |
| 639 | self.data = data |
| 640 | else: |
| 641 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 642 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 643 | |
| 644 | def pack(self): |
| 645 | packed = [] |
| 646 | packed.append(struct.pack("!B", self.version)) |
| 647 | packed.append(struct.pack("!B", self.type)) |
| 648 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 649 | packed.append(struct.pack("!L", self.xid)) |
| 650 | packed.append(struct.pack("!H", self.err_type)) |
| 651 | packed.append(struct.pack("!H", self.code)) |
| 652 | packed.append(self.data) |
| 653 | length = sum([len(x) for x in packed]) |
| 654 | packed[2] = struct.pack("!H", length) |
| 655 | return ''.join(packed) |
| 656 | |
| 657 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 658 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 659 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 660 | _version = reader.read("!B")[0] |
| 661 | assert(_version == 3) |
| 662 | _type = reader.read("!B")[0] |
| 663 | assert(_type == 1) |
| 664 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 665 | orig_reader = reader |
| 666 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 667 | obj.xid = reader.read("!L")[0] |
| 668 | _err_type = reader.read("!H")[0] |
| 669 | assert(_err_type == 3) |
| 670 | obj.code = reader.read("!H")[0] |
| 671 | obj.data = str(reader.read_all()) |
| 672 | return obj |
| 673 | |
| 674 | def __eq__(self, other): |
| 675 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 676 | if self.xid != other.xid: return False |
| 677 | if self.code != other.code: return False |
| 678 | if self.data != other.data: return False |
| 679 | return True |
| 680 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 681 | def pretty_print(self, q): |
| 682 | q.text("bad_instruction_error_msg {") |
| 683 | with q.group(): |
| 684 | with q.indent(2): |
| 685 | q.breakable() |
| 686 | q.text("xid = "); |
| 687 | if self.xid != None: |
| 688 | q.text("%#x" % self.xid) |
| 689 | else: |
| 690 | q.text('None') |
| 691 | q.text(","); q.breakable() |
| 692 | q.text("code = "); |
| 693 | q.text("%#x" % self.code) |
| 694 | q.text(","); q.breakable() |
| 695 | q.text("data = "); |
| 696 | q.pp(self.data) |
| 697 | q.breakable() |
| 698 | q.text('}') |
| 699 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 700 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 701 | |
| 702 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 703 | version = 3 |
| 704 | type = 1 |
| 705 | err_type = 4 |
| 706 | |
| 707 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 708 | if xid != None: |
| 709 | self.xid = xid |
| 710 | else: |
| 711 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 712 | if code != None: |
| 713 | self.code = code |
| 714 | else: |
| 715 | self.code = 0 |
| 716 | if data != None: |
| 717 | self.data = data |
| 718 | else: |
| 719 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 720 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 721 | |
| 722 | def pack(self): |
| 723 | packed = [] |
| 724 | packed.append(struct.pack("!B", self.version)) |
| 725 | packed.append(struct.pack("!B", self.type)) |
| 726 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 727 | packed.append(struct.pack("!L", self.xid)) |
| 728 | packed.append(struct.pack("!H", self.err_type)) |
| 729 | packed.append(struct.pack("!H", self.code)) |
| 730 | packed.append(self.data) |
| 731 | length = sum([len(x) for x in packed]) |
| 732 | packed[2] = struct.pack("!H", length) |
| 733 | return ''.join(packed) |
| 734 | |
| 735 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 736 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 737 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 738 | _version = reader.read("!B")[0] |
| 739 | assert(_version == 3) |
| 740 | _type = reader.read("!B")[0] |
| 741 | assert(_type == 1) |
| 742 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 743 | orig_reader = reader |
| 744 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 745 | obj.xid = reader.read("!L")[0] |
| 746 | _err_type = reader.read("!H")[0] |
| 747 | assert(_err_type == 4) |
| 748 | obj.code = reader.read("!H")[0] |
| 749 | obj.data = str(reader.read_all()) |
| 750 | return obj |
| 751 | |
| 752 | def __eq__(self, other): |
| 753 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 754 | if self.xid != other.xid: return False |
| 755 | if self.code != other.code: return False |
| 756 | if self.data != other.data: return False |
| 757 | return True |
| 758 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 759 | def pretty_print(self, q): |
| 760 | q.text("bad_match_error_msg {") |
| 761 | with q.group(): |
| 762 | with q.indent(2): |
| 763 | q.breakable() |
| 764 | q.text("xid = "); |
| 765 | if self.xid != None: |
| 766 | q.text("%#x" % self.xid) |
| 767 | else: |
| 768 | q.text('None') |
| 769 | q.text(","); q.breakable() |
| 770 | q.text("code = "); |
| 771 | q.text("%#x" % self.code) |
| 772 | q.text(","); q.breakable() |
| 773 | q.text("data = "); |
| 774 | q.pp(self.data) |
| 775 | q.breakable() |
| 776 | q.text('}') |
| 777 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 778 | error_msg.subtypes[4] = bad_match_error_msg |
| 779 | |
| 780 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 781 | version = 3 |
| 782 | type = 1 |
| 783 | err_type = 1 |
| 784 | |
| 785 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 786 | if xid != None: |
| 787 | self.xid = xid |
| 788 | else: |
| 789 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 790 | if code != None: |
| 791 | self.code = code |
| 792 | else: |
| 793 | self.code = 0 |
| 794 | if data != None: |
| 795 | self.data = data |
| 796 | else: |
| 797 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 798 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 799 | |
| 800 | def pack(self): |
| 801 | packed = [] |
| 802 | packed.append(struct.pack("!B", self.version)) |
| 803 | packed.append(struct.pack("!B", self.type)) |
| 804 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 805 | packed.append(struct.pack("!L", self.xid)) |
| 806 | packed.append(struct.pack("!H", self.err_type)) |
| 807 | packed.append(struct.pack("!H", self.code)) |
| 808 | packed.append(self.data) |
| 809 | length = sum([len(x) for x in packed]) |
| 810 | packed[2] = struct.pack("!H", length) |
| 811 | return ''.join(packed) |
| 812 | |
| 813 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 814 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 815 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 816 | _version = reader.read("!B")[0] |
| 817 | assert(_version == 3) |
| 818 | _type = reader.read("!B")[0] |
| 819 | assert(_type == 1) |
| 820 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 821 | orig_reader = reader |
| 822 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 823 | obj.xid = reader.read("!L")[0] |
| 824 | _err_type = reader.read("!H")[0] |
| 825 | assert(_err_type == 1) |
| 826 | obj.code = reader.read("!H")[0] |
| 827 | obj.data = str(reader.read_all()) |
| 828 | return obj |
| 829 | |
| 830 | def __eq__(self, other): |
| 831 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 832 | if self.xid != other.xid: return False |
| 833 | if self.code != other.code: return False |
| 834 | if self.data != other.data: return False |
| 835 | return True |
| 836 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 837 | def pretty_print(self, q): |
| 838 | q.text("bad_request_error_msg {") |
| 839 | with q.group(): |
| 840 | with q.indent(2): |
| 841 | q.breakable() |
| 842 | q.text("xid = "); |
| 843 | if self.xid != None: |
| 844 | q.text("%#x" % self.xid) |
| 845 | else: |
| 846 | q.text('None') |
| 847 | q.text(","); q.breakable() |
| 848 | q.text("code = "); |
| 849 | q.text("%#x" % self.code) |
| 850 | q.text(","); q.breakable() |
| 851 | q.text("data = "); |
| 852 | q.pp(self.data) |
| 853 | q.breakable() |
| 854 | q.text('}') |
| 855 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 856 | error_msg.subtypes[1] = bad_request_error_msg |
| 857 | |
| 858 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 859 | version = 3 |
| 860 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 861 | |
| 862 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 863 | if xid != None: |
| 864 | self.xid = xid |
| 865 | else: |
| 866 | self.xid = None |
| 867 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 868 | |
| 869 | def pack(self): |
| 870 | packed = [] |
| 871 | packed.append(struct.pack("!B", self.version)) |
| 872 | packed.append(struct.pack("!B", self.type)) |
| 873 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 874 | packed.append(struct.pack("!L", self.xid)) |
| 875 | length = sum([len(x) for x in packed]) |
| 876 | packed[2] = struct.pack("!H", length) |
| 877 | return ''.join(packed) |
| 878 | |
| 879 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 880 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 881 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 882 | _version = reader.read("!B")[0] |
| 883 | assert(_version == 3) |
| 884 | _type = reader.read("!B")[0] |
| 885 | assert(_type == 21) |
| 886 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 887 | orig_reader = reader |
| 888 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 889 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 890 | return obj |
| 891 | |
| 892 | def __eq__(self, other): |
| 893 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 894 | if self.xid != other.xid: return False |
| 895 | return True |
| 896 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 897 | def pretty_print(self, q): |
| 898 | q.text("barrier_reply {") |
| 899 | with q.group(): |
| 900 | with q.indent(2): |
| 901 | q.breakable() |
| 902 | q.text("xid = "); |
| 903 | if self.xid != None: |
| 904 | q.text("%#x" % self.xid) |
| 905 | else: |
| 906 | q.text('None') |
| 907 | q.breakable() |
| 908 | q.text('}') |
| 909 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 910 | message.subtypes[21] = barrier_reply |
| 911 | |
| 912 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 913 | version = 3 |
| 914 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 915 | |
| 916 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 917 | if xid != None: |
| 918 | self.xid = xid |
| 919 | else: |
| 920 | self.xid = None |
| 921 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 922 | |
| 923 | def pack(self): |
| 924 | packed = [] |
| 925 | packed.append(struct.pack("!B", self.version)) |
| 926 | packed.append(struct.pack("!B", self.type)) |
| 927 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 928 | packed.append(struct.pack("!L", self.xid)) |
| 929 | length = sum([len(x) for x in packed]) |
| 930 | packed[2] = struct.pack("!H", length) |
| 931 | return ''.join(packed) |
| 932 | |
| 933 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 934 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 935 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 936 | _version = reader.read("!B")[0] |
| 937 | assert(_version == 3) |
| 938 | _type = reader.read("!B")[0] |
| 939 | assert(_type == 20) |
| 940 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 941 | orig_reader = reader |
| 942 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 943 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 944 | return obj |
| 945 | |
| 946 | def __eq__(self, other): |
| 947 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 948 | if self.xid != other.xid: return False |
| 949 | return True |
| 950 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 951 | def pretty_print(self, q): |
| 952 | q.text("barrier_request {") |
| 953 | with q.group(): |
| 954 | with q.indent(2): |
| 955 | q.breakable() |
| 956 | q.text("xid = "); |
| 957 | if self.xid != None: |
| 958 | q.text("%#x" % self.xid) |
| 959 | else: |
| 960 | q.text('None') |
| 961 | q.breakable() |
| 962 | q.text('}') |
| 963 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 964 | message.subtypes[20] = barrier_request |
| 965 | |
| 966 | class experimenter(message): |
| 967 | subtypes = {} |
| 968 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 969 | version = 3 |
| 970 | type = 4 |
| 971 | |
| 972 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 973 | if xid != None: |
| 974 | self.xid = xid |
| 975 | else: |
| 976 | self.xid = None |
| 977 | if experimenter != None: |
| 978 | self.experimenter = experimenter |
| 979 | else: |
| 980 | self.experimenter = 0 |
| 981 | if subtype != None: |
| 982 | self.subtype = subtype |
| 983 | else: |
| 984 | self.subtype = 0 |
| 985 | if data != None: |
| 986 | self.data = data |
| 987 | else: |
| 988 | self.data = '' |
| 989 | return |
| 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("!L", self.experimenter)) |
| 998 | packed.append(struct.pack("!L", self.subtype)) |
| 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 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1004 | @staticmethod |
| 1005 | def unpack(reader): |
| 1006 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1007 | subclass = experimenter.subtypes.get(subtype) |
| 1008 | if subclass: |
| 1009 | return subclass.unpack(reader) |
| 1010 | |
| 1011 | obj = experimenter() |
| 1012 | _version = reader.read("!B")[0] |
| 1013 | assert(_version == 3) |
| 1014 | _type = reader.read("!B")[0] |
| 1015 | assert(_type == 4) |
| 1016 | _length = reader.read("!H")[0] |
| 1017 | orig_reader = reader |
| 1018 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1019 | obj.xid = reader.read("!L")[0] |
| 1020 | obj.experimenter = reader.read("!L")[0] |
| 1021 | obj.subtype = reader.read("!L")[0] |
| 1022 | obj.data = str(reader.read_all()) |
| 1023 | return obj |
| 1024 | |
| 1025 | def __eq__(self, other): |
| 1026 | if type(self) != type(other): return False |
| 1027 | if self.xid != other.xid: return False |
| 1028 | if self.experimenter != other.experimenter: return False |
| 1029 | if self.subtype != other.subtype: return False |
| 1030 | if self.data != other.data: return False |
| 1031 | return True |
| 1032 | |
| 1033 | def pretty_print(self, q): |
| 1034 | q.text("experimenter {") |
| 1035 | with q.group(): |
| 1036 | with q.indent(2): |
| 1037 | q.breakable() |
| 1038 | q.text("xid = "); |
| 1039 | if self.xid != None: |
| 1040 | q.text("%#x" % self.xid) |
| 1041 | else: |
| 1042 | q.text('None') |
| 1043 | q.text(","); q.breakable() |
| 1044 | q.text("subtype = "); |
| 1045 | q.text("%#x" % self.subtype) |
| 1046 | q.text(","); q.breakable() |
| 1047 | q.text("data = "); |
| 1048 | q.pp(self.data) |
| 1049 | q.breakable() |
| 1050 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1051 | |
| 1052 | message.subtypes[4] = experimenter |
| 1053 | |
| 1054 | class bsn_header(experimenter): |
| 1055 | subtypes = {} |
| 1056 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1057 | version = 3 |
| 1058 | type = 4 |
| 1059 | experimenter = 6035143 |
| 1060 | |
| 1061 | def __init__(self, xid=None, subtype=None): |
| 1062 | if xid != None: |
| 1063 | self.xid = xid |
| 1064 | else: |
| 1065 | self.xid = None |
| 1066 | if subtype != None: |
| 1067 | self.subtype = subtype |
| 1068 | else: |
| 1069 | self.subtype = 0 |
| 1070 | return |
| 1071 | |
| 1072 | def pack(self): |
| 1073 | packed = [] |
| 1074 | packed.append(struct.pack("!B", self.version)) |
| 1075 | packed.append(struct.pack("!B", self.type)) |
| 1076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1077 | packed.append(struct.pack("!L", self.xid)) |
| 1078 | packed.append(struct.pack("!L", self.experimenter)) |
| 1079 | packed.append(struct.pack("!L", self.subtype)) |
| 1080 | length = sum([len(x) for x in packed]) |
| 1081 | packed[2] = struct.pack("!H", length) |
| 1082 | return ''.join(packed) |
| 1083 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1084 | @staticmethod |
| 1085 | def unpack(reader): |
| 1086 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1087 | subclass = bsn_header.subtypes.get(subtype) |
| 1088 | if subclass: |
| 1089 | return subclass.unpack(reader) |
| 1090 | |
| 1091 | obj = bsn_header() |
| 1092 | _version = reader.read("!B")[0] |
| 1093 | assert(_version == 3) |
| 1094 | _type = reader.read("!B")[0] |
| 1095 | assert(_type == 4) |
| 1096 | _length = reader.read("!H")[0] |
| 1097 | orig_reader = reader |
| 1098 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1099 | obj.xid = reader.read("!L")[0] |
| 1100 | _experimenter = reader.read("!L")[0] |
| 1101 | assert(_experimenter == 6035143) |
| 1102 | obj.subtype = reader.read("!L")[0] |
| 1103 | return obj |
| 1104 | |
| 1105 | def __eq__(self, other): |
| 1106 | if type(self) != type(other): return False |
| 1107 | if self.xid != other.xid: return False |
| 1108 | if self.subtype != other.subtype: return False |
| 1109 | return True |
| 1110 | |
| 1111 | def pretty_print(self, q): |
| 1112 | q.text("bsn_header {") |
| 1113 | with q.group(): |
| 1114 | with q.indent(2): |
| 1115 | q.breakable() |
| 1116 | q.text("xid = "); |
| 1117 | if self.xid != None: |
| 1118 | q.text("%#x" % self.xid) |
| 1119 | else: |
| 1120 | q.text('None') |
| 1121 | q.breakable() |
| 1122 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1123 | |
| 1124 | experimenter.subtypes[6035143] = bsn_header |
| 1125 | |
| 1126 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1127 | version = 3 |
| 1128 | type = 4 |
| 1129 | experimenter = 6035143 |
| 1130 | subtype = 22 |
| 1131 | |
| 1132 | def __init__(self, xid=None, status=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 |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1137 | if status != None: |
| 1138 | self.status = status |
| 1139 | else: |
| 1140 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1141 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1142 | |
| 1143 | def pack(self): |
| 1144 | packed = [] |
| 1145 | packed.append(struct.pack("!B", self.version)) |
| 1146 | packed.append(struct.pack("!B", self.type)) |
| 1147 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1148 | packed.append(struct.pack("!L", self.xid)) |
| 1149 | packed.append(struct.pack("!L", self.experimenter)) |
| 1150 | packed.append(struct.pack("!L", self.subtype)) |
| 1151 | packed.append(struct.pack("!L", self.status)) |
| 1152 | length = sum([len(x) for x in packed]) |
| 1153 | packed[2] = struct.pack("!H", length) |
| 1154 | return ''.join(packed) |
| 1155 | |
| 1156 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1157 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1158 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1159 | _version = reader.read("!B")[0] |
| 1160 | assert(_version == 3) |
| 1161 | _type = reader.read("!B")[0] |
| 1162 | assert(_type == 4) |
| 1163 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1164 | orig_reader = reader |
| 1165 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1166 | obj.xid = reader.read("!L")[0] |
| 1167 | _experimenter = reader.read("!L")[0] |
| 1168 | assert(_experimenter == 6035143) |
| 1169 | _subtype = reader.read("!L")[0] |
| 1170 | assert(_subtype == 22) |
| 1171 | obj.status = reader.read("!L")[0] |
| 1172 | return obj |
| 1173 | |
| 1174 | def __eq__(self, other): |
| 1175 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1176 | if self.xid != other.xid: return False |
| 1177 | if self.status != other.status: return False |
| 1178 | return True |
| 1179 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1180 | def pretty_print(self, q): |
| 1181 | q.text("bsn_bw_clear_data_reply {") |
| 1182 | with q.group(): |
| 1183 | with q.indent(2): |
| 1184 | q.breakable() |
| 1185 | q.text("xid = "); |
| 1186 | if self.xid != None: |
| 1187 | q.text("%#x" % self.xid) |
| 1188 | else: |
| 1189 | q.text('None') |
| 1190 | q.text(","); q.breakable() |
| 1191 | q.text("status = "); |
| 1192 | q.text("%#x" % self.status) |
| 1193 | q.breakable() |
| 1194 | q.text('}') |
| 1195 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1196 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1197 | |
| 1198 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1199 | version = 3 |
| 1200 | type = 4 |
| 1201 | experimenter = 6035143 |
| 1202 | subtype = 21 |
| 1203 | |
| 1204 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1205 | if xid != None: |
| 1206 | self.xid = xid |
| 1207 | else: |
| 1208 | self.xid = None |
| 1209 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1210 | |
| 1211 | def pack(self): |
| 1212 | packed = [] |
| 1213 | packed.append(struct.pack("!B", self.version)) |
| 1214 | packed.append(struct.pack("!B", self.type)) |
| 1215 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1216 | packed.append(struct.pack("!L", self.xid)) |
| 1217 | packed.append(struct.pack("!L", self.experimenter)) |
| 1218 | packed.append(struct.pack("!L", self.subtype)) |
| 1219 | length = sum([len(x) for x in packed]) |
| 1220 | packed[2] = struct.pack("!H", length) |
| 1221 | return ''.join(packed) |
| 1222 | |
| 1223 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1224 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1225 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1226 | _version = reader.read("!B")[0] |
| 1227 | assert(_version == 3) |
| 1228 | _type = reader.read("!B")[0] |
| 1229 | assert(_type == 4) |
| 1230 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1231 | orig_reader = reader |
| 1232 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1233 | obj.xid = reader.read("!L")[0] |
| 1234 | _experimenter = reader.read("!L")[0] |
| 1235 | assert(_experimenter == 6035143) |
| 1236 | _subtype = reader.read("!L")[0] |
| 1237 | assert(_subtype == 21) |
| 1238 | return obj |
| 1239 | |
| 1240 | def __eq__(self, other): |
| 1241 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1242 | if self.xid != other.xid: return False |
| 1243 | return True |
| 1244 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1245 | def pretty_print(self, q): |
| 1246 | q.text("bsn_bw_clear_data_request {") |
| 1247 | with q.group(): |
| 1248 | with q.indent(2): |
| 1249 | q.breakable() |
| 1250 | q.text("xid = "); |
| 1251 | if self.xid != None: |
| 1252 | q.text("%#x" % self.xid) |
| 1253 | else: |
| 1254 | q.text('None') |
| 1255 | q.breakable() |
| 1256 | q.text('}') |
| 1257 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1258 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1259 | |
| 1260 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1261 | version = 3 |
| 1262 | type = 4 |
| 1263 | experimenter = 6035143 |
| 1264 | subtype = 20 |
| 1265 | |
| 1266 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1267 | if xid != None: |
| 1268 | self.xid = xid |
| 1269 | else: |
| 1270 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1271 | if enabled != None: |
| 1272 | self.enabled = enabled |
| 1273 | else: |
| 1274 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1275 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1276 | |
| 1277 | def pack(self): |
| 1278 | packed = [] |
| 1279 | packed.append(struct.pack("!B", self.version)) |
| 1280 | packed.append(struct.pack("!B", self.type)) |
| 1281 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1282 | packed.append(struct.pack("!L", self.xid)) |
| 1283 | packed.append(struct.pack("!L", self.experimenter)) |
| 1284 | packed.append(struct.pack("!L", self.subtype)) |
| 1285 | packed.append(struct.pack("!L", self.enabled)) |
| 1286 | length = sum([len(x) for x in packed]) |
| 1287 | packed[2] = struct.pack("!H", length) |
| 1288 | return ''.join(packed) |
| 1289 | |
| 1290 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1291 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1292 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1293 | _version = reader.read("!B")[0] |
| 1294 | assert(_version == 3) |
| 1295 | _type = reader.read("!B")[0] |
| 1296 | assert(_type == 4) |
| 1297 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1298 | orig_reader = reader |
| 1299 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1300 | obj.xid = reader.read("!L")[0] |
| 1301 | _experimenter = reader.read("!L")[0] |
| 1302 | assert(_experimenter == 6035143) |
| 1303 | _subtype = reader.read("!L")[0] |
| 1304 | assert(_subtype == 20) |
| 1305 | obj.enabled = reader.read("!L")[0] |
| 1306 | return obj |
| 1307 | |
| 1308 | def __eq__(self, other): |
| 1309 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1310 | if self.xid != other.xid: return False |
| 1311 | if self.enabled != other.enabled: return False |
| 1312 | return True |
| 1313 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1314 | def pretty_print(self, q): |
| 1315 | q.text("bsn_bw_enable_get_reply {") |
| 1316 | with q.group(): |
| 1317 | with q.indent(2): |
| 1318 | q.breakable() |
| 1319 | q.text("xid = "); |
| 1320 | if self.xid != None: |
| 1321 | q.text("%#x" % self.xid) |
| 1322 | else: |
| 1323 | q.text('None') |
| 1324 | q.text(","); q.breakable() |
| 1325 | q.text("enabled = "); |
| 1326 | q.text("%#x" % self.enabled) |
| 1327 | q.breakable() |
| 1328 | q.text('}') |
| 1329 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1330 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1331 | |
| 1332 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1333 | version = 3 |
| 1334 | type = 4 |
| 1335 | experimenter = 6035143 |
| 1336 | subtype = 19 |
| 1337 | |
| 1338 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1339 | if xid != None: |
| 1340 | self.xid = xid |
| 1341 | else: |
| 1342 | self.xid = None |
| 1343 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1344 | |
| 1345 | def pack(self): |
| 1346 | packed = [] |
| 1347 | packed.append(struct.pack("!B", self.version)) |
| 1348 | packed.append(struct.pack("!B", self.type)) |
| 1349 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1350 | packed.append(struct.pack("!L", self.xid)) |
| 1351 | packed.append(struct.pack("!L", self.experimenter)) |
| 1352 | packed.append(struct.pack("!L", self.subtype)) |
| 1353 | length = sum([len(x) for x in packed]) |
| 1354 | packed[2] = struct.pack("!H", length) |
| 1355 | return ''.join(packed) |
| 1356 | |
| 1357 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1358 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1359 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1360 | _version = reader.read("!B")[0] |
| 1361 | assert(_version == 3) |
| 1362 | _type = reader.read("!B")[0] |
| 1363 | assert(_type == 4) |
| 1364 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1365 | orig_reader = reader |
| 1366 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1367 | obj.xid = reader.read("!L")[0] |
| 1368 | _experimenter = reader.read("!L")[0] |
| 1369 | assert(_experimenter == 6035143) |
| 1370 | _subtype = reader.read("!L")[0] |
| 1371 | assert(_subtype == 19) |
| 1372 | return obj |
| 1373 | |
| 1374 | def __eq__(self, other): |
| 1375 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1376 | if self.xid != other.xid: return False |
| 1377 | return True |
| 1378 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1379 | def pretty_print(self, q): |
| 1380 | q.text("bsn_bw_enable_get_request {") |
| 1381 | with q.group(): |
| 1382 | with q.indent(2): |
| 1383 | q.breakable() |
| 1384 | q.text("xid = "); |
| 1385 | if self.xid != None: |
| 1386 | q.text("%#x" % self.xid) |
| 1387 | else: |
| 1388 | q.text('None') |
| 1389 | q.breakable() |
| 1390 | q.text('}') |
| 1391 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1392 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1393 | |
| 1394 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1395 | version = 3 |
| 1396 | type = 4 |
| 1397 | experimenter = 6035143 |
| 1398 | subtype = 23 |
| 1399 | |
| 1400 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1401 | if xid != None: |
| 1402 | self.xid = xid |
| 1403 | else: |
| 1404 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1405 | if enable != None: |
| 1406 | self.enable = enable |
| 1407 | else: |
| 1408 | self.enable = 0 |
| 1409 | if status != None: |
| 1410 | self.status = status |
| 1411 | else: |
| 1412 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1413 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1414 | |
| 1415 | def pack(self): |
| 1416 | packed = [] |
| 1417 | packed.append(struct.pack("!B", self.version)) |
| 1418 | packed.append(struct.pack("!B", self.type)) |
| 1419 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1420 | packed.append(struct.pack("!L", self.xid)) |
| 1421 | packed.append(struct.pack("!L", self.experimenter)) |
| 1422 | packed.append(struct.pack("!L", self.subtype)) |
| 1423 | packed.append(struct.pack("!L", self.enable)) |
| 1424 | packed.append(struct.pack("!L", self.status)) |
| 1425 | length = sum([len(x) for x in packed]) |
| 1426 | packed[2] = struct.pack("!H", length) |
| 1427 | return ''.join(packed) |
| 1428 | |
| 1429 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1430 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1431 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1432 | _version = reader.read("!B")[0] |
| 1433 | assert(_version == 3) |
| 1434 | _type = reader.read("!B")[0] |
| 1435 | assert(_type == 4) |
| 1436 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1437 | orig_reader = reader |
| 1438 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1439 | obj.xid = reader.read("!L")[0] |
| 1440 | _experimenter = reader.read("!L")[0] |
| 1441 | assert(_experimenter == 6035143) |
| 1442 | _subtype = reader.read("!L")[0] |
| 1443 | assert(_subtype == 23) |
| 1444 | obj.enable = reader.read("!L")[0] |
| 1445 | obj.status = reader.read("!L")[0] |
| 1446 | return obj |
| 1447 | |
| 1448 | def __eq__(self, other): |
| 1449 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1450 | if self.xid != other.xid: return False |
| 1451 | if self.enable != other.enable: return False |
| 1452 | if self.status != other.status: return False |
| 1453 | return True |
| 1454 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1455 | def pretty_print(self, q): |
| 1456 | q.text("bsn_bw_enable_set_reply {") |
| 1457 | with q.group(): |
| 1458 | with q.indent(2): |
| 1459 | q.breakable() |
| 1460 | q.text("xid = "); |
| 1461 | if self.xid != None: |
| 1462 | q.text("%#x" % self.xid) |
| 1463 | else: |
| 1464 | q.text('None') |
| 1465 | q.text(","); q.breakable() |
| 1466 | q.text("enable = "); |
| 1467 | q.text("%#x" % self.enable) |
| 1468 | q.text(","); q.breakable() |
| 1469 | q.text("status = "); |
| 1470 | q.text("%#x" % self.status) |
| 1471 | q.breakable() |
| 1472 | q.text('}') |
| 1473 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1474 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1475 | |
| 1476 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1477 | version = 3 |
| 1478 | type = 4 |
| 1479 | experimenter = 6035143 |
| 1480 | subtype = 18 |
| 1481 | |
| 1482 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1483 | if xid != None: |
| 1484 | self.xid = xid |
| 1485 | else: |
| 1486 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1487 | if enable != None: |
| 1488 | self.enable = enable |
| 1489 | else: |
| 1490 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1491 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1492 | |
| 1493 | def pack(self): |
| 1494 | packed = [] |
| 1495 | packed.append(struct.pack("!B", self.version)) |
| 1496 | packed.append(struct.pack("!B", self.type)) |
| 1497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1498 | packed.append(struct.pack("!L", self.xid)) |
| 1499 | packed.append(struct.pack("!L", self.experimenter)) |
| 1500 | packed.append(struct.pack("!L", self.subtype)) |
| 1501 | packed.append(struct.pack("!L", self.enable)) |
| 1502 | length = sum([len(x) for x in packed]) |
| 1503 | packed[2] = struct.pack("!H", length) |
| 1504 | return ''.join(packed) |
| 1505 | |
| 1506 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1507 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1508 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1509 | _version = reader.read("!B")[0] |
| 1510 | assert(_version == 3) |
| 1511 | _type = reader.read("!B")[0] |
| 1512 | assert(_type == 4) |
| 1513 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1514 | orig_reader = reader |
| 1515 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1516 | obj.xid = reader.read("!L")[0] |
| 1517 | _experimenter = reader.read("!L")[0] |
| 1518 | assert(_experimenter == 6035143) |
| 1519 | _subtype = reader.read("!L")[0] |
| 1520 | assert(_subtype == 18) |
| 1521 | obj.enable = reader.read("!L")[0] |
| 1522 | return obj |
| 1523 | |
| 1524 | def __eq__(self, other): |
| 1525 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1526 | if self.xid != other.xid: return False |
| 1527 | if self.enable != other.enable: return False |
| 1528 | return True |
| 1529 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1530 | def pretty_print(self, q): |
| 1531 | q.text("bsn_bw_enable_set_request {") |
| 1532 | with q.group(): |
| 1533 | with q.indent(2): |
| 1534 | q.breakable() |
| 1535 | q.text("xid = "); |
| 1536 | if self.xid != None: |
| 1537 | q.text("%#x" % self.xid) |
| 1538 | else: |
| 1539 | q.text('None') |
| 1540 | q.text(","); q.breakable() |
| 1541 | q.text("enable = "); |
| 1542 | q.text("%#x" % self.enable) |
| 1543 | q.breakable() |
| 1544 | q.text('}') |
| 1545 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1546 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1547 | |
| 1548 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1549 | version = 3 |
| 1550 | type = 4 |
| 1551 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1552 | subtype = 10 |
| 1553 | |
| 1554 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1555 | if xid != None: |
| 1556 | self.xid = xid |
| 1557 | else: |
| 1558 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1559 | if interfaces != None: |
| 1560 | self.interfaces = interfaces |
| 1561 | else: |
| 1562 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1563 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1564 | |
| 1565 | def pack(self): |
| 1566 | packed = [] |
| 1567 | packed.append(struct.pack("!B", self.version)) |
| 1568 | packed.append(struct.pack("!B", self.type)) |
| 1569 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1570 | packed.append(struct.pack("!L", self.xid)) |
| 1571 | packed.append(struct.pack("!L", self.experimenter)) |
| 1572 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1573 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1574 | length = sum([len(x) for x in packed]) |
| 1575 | packed[2] = struct.pack("!H", length) |
| 1576 | return ''.join(packed) |
| 1577 | |
| 1578 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1579 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1580 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1581 | _version = reader.read("!B")[0] |
| 1582 | assert(_version == 3) |
| 1583 | _type = reader.read("!B")[0] |
| 1584 | assert(_type == 4) |
| 1585 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1586 | orig_reader = reader |
| 1587 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1588 | obj.xid = reader.read("!L")[0] |
| 1589 | _experimenter = reader.read("!L")[0] |
| 1590 | assert(_experimenter == 6035143) |
| 1591 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1592 | assert(_subtype == 10) |
| 1593 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 1594 | return obj |
| 1595 | |
| 1596 | def __eq__(self, other): |
| 1597 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1598 | if self.xid != other.xid: return False |
| 1599 | if self.interfaces != other.interfaces: return False |
| 1600 | return True |
| 1601 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1602 | def pretty_print(self, q): |
| 1603 | q.text("bsn_get_interfaces_reply {") |
| 1604 | with q.group(): |
| 1605 | with q.indent(2): |
| 1606 | q.breakable() |
| 1607 | q.text("xid = "); |
| 1608 | if self.xid != None: |
| 1609 | q.text("%#x" % self.xid) |
| 1610 | else: |
| 1611 | q.text('None') |
| 1612 | q.text(","); q.breakable() |
| 1613 | q.text("interfaces = "); |
| 1614 | q.pp(self.interfaces) |
| 1615 | q.breakable() |
| 1616 | q.text('}') |
| 1617 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1618 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1619 | |
| 1620 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1621 | version = 3 |
| 1622 | type = 4 |
| 1623 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1624 | subtype = 9 |
| 1625 | |
| 1626 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1627 | if xid != None: |
| 1628 | self.xid = xid |
| 1629 | else: |
| 1630 | self.xid = None |
| 1631 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1632 | |
| 1633 | def pack(self): |
| 1634 | packed = [] |
| 1635 | packed.append(struct.pack("!B", self.version)) |
| 1636 | packed.append(struct.pack("!B", self.type)) |
| 1637 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1638 | packed.append(struct.pack("!L", self.xid)) |
| 1639 | packed.append(struct.pack("!L", self.experimenter)) |
| 1640 | packed.append(struct.pack("!L", self.subtype)) |
| 1641 | length = sum([len(x) for x in packed]) |
| 1642 | packed[2] = struct.pack("!H", length) |
| 1643 | return ''.join(packed) |
| 1644 | |
| 1645 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1646 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1647 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1648 | _version = reader.read("!B")[0] |
| 1649 | assert(_version == 3) |
| 1650 | _type = reader.read("!B")[0] |
| 1651 | assert(_type == 4) |
| 1652 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1653 | orig_reader = reader |
| 1654 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1655 | obj.xid = reader.read("!L")[0] |
| 1656 | _experimenter = reader.read("!L")[0] |
| 1657 | assert(_experimenter == 6035143) |
| 1658 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1659 | assert(_subtype == 9) |
| 1660 | return obj |
| 1661 | |
| 1662 | def __eq__(self, other): |
| 1663 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1664 | if self.xid != other.xid: return False |
| 1665 | return True |
| 1666 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1667 | def pretty_print(self, q): |
| 1668 | q.text("bsn_get_interfaces_request {") |
| 1669 | with q.group(): |
| 1670 | with q.indent(2): |
| 1671 | q.breakable() |
| 1672 | q.text("xid = "); |
| 1673 | if self.xid != None: |
| 1674 | q.text("%#x" % self.xid) |
| 1675 | else: |
| 1676 | q.text('None') |
| 1677 | q.breakable() |
| 1678 | q.text('}') |
| 1679 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1680 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1681 | |
| 1682 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1683 | version = 3 |
| 1684 | type = 4 |
| 1685 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1686 | subtype = 5 |
| 1687 | |
| 1688 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1689 | if xid != None: |
| 1690 | self.xid = xid |
| 1691 | else: |
| 1692 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1693 | if report_mirror_ports != None: |
| 1694 | self.report_mirror_ports = report_mirror_ports |
| 1695 | else: |
| 1696 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1697 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1698 | |
| 1699 | def pack(self): |
| 1700 | packed = [] |
| 1701 | packed.append(struct.pack("!B", self.version)) |
| 1702 | packed.append(struct.pack("!B", self.type)) |
| 1703 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1704 | packed.append(struct.pack("!L", self.xid)) |
| 1705 | packed.append(struct.pack("!L", self.experimenter)) |
| 1706 | packed.append(struct.pack("!L", self.subtype)) |
| 1707 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1708 | packed.append('\x00' * 3) |
| 1709 | length = sum([len(x) for x in packed]) |
| 1710 | packed[2] = struct.pack("!H", length) |
| 1711 | return ''.join(packed) |
| 1712 | |
| 1713 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1714 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1715 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1716 | _version = reader.read("!B")[0] |
| 1717 | assert(_version == 3) |
| 1718 | _type = reader.read("!B")[0] |
| 1719 | assert(_type == 4) |
| 1720 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1721 | orig_reader = reader |
| 1722 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1723 | obj.xid = reader.read("!L")[0] |
| 1724 | _experimenter = reader.read("!L")[0] |
| 1725 | assert(_experimenter == 6035143) |
| 1726 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1727 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1728 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1729 | reader.skip(3) |
| 1730 | return obj |
| 1731 | |
| 1732 | def __eq__(self, other): |
| 1733 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1734 | if self.xid != other.xid: return False |
| 1735 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1736 | return True |
| 1737 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1738 | def pretty_print(self, q): |
| 1739 | q.text("bsn_get_mirroring_reply {") |
| 1740 | with q.group(): |
| 1741 | with q.indent(2): |
| 1742 | q.breakable() |
| 1743 | q.text("xid = "); |
| 1744 | if self.xid != None: |
| 1745 | q.text("%#x" % self.xid) |
| 1746 | else: |
| 1747 | q.text('None') |
| 1748 | q.text(","); q.breakable() |
| 1749 | q.text("report_mirror_ports = "); |
| 1750 | q.text("%#x" % self.report_mirror_ports) |
| 1751 | q.breakable() |
| 1752 | q.text('}') |
| 1753 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1754 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1755 | |
| 1756 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1757 | version = 3 |
| 1758 | type = 4 |
| 1759 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1760 | subtype = 4 |
| 1761 | |
| 1762 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1763 | if xid != None: |
| 1764 | self.xid = xid |
| 1765 | else: |
| 1766 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1767 | if report_mirror_ports != None: |
| 1768 | self.report_mirror_ports = report_mirror_ports |
| 1769 | else: |
| 1770 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1771 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1772 | |
| 1773 | def pack(self): |
| 1774 | packed = [] |
| 1775 | packed.append(struct.pack("!B", self.version)) |
| 1776 | packed.append(struct.pack("!B", self.type)) |
| 1777 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1778 | packed.append(struct.pack("!L", self.xid)) |
| 1779 | packed.append(struct.pack("!L", self.experimenter)) |
| 1780 | packed.append(struct.pack("!L", self.subtype)) |
| 1781 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1782 | packed.append('\x00' * 3) |
| 1783 | length = sum([len(x) for x in packed]) |
| 1784 | packed[2] = struct.pack("!H", length) |
| 1785 | return ''.join(packed) |
| 1786 | |
| 1787 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1788 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1789 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1790 | _version = reader.read("!B")[0] |
| 1791 | assert(_version == 3) |
| 1792 | _type = reader.read("!B")[0] |
| 1793 | assert(_type == 4) |
| 1794 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1795 | orig_reader = reader |
| 1796 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1797 | obj.xid = reader.read("!L")[0] |
| 1798 | _experimenter = reader.read("!L")[0] |
| 1799 | assert(_experimenter == 6035143) |
| 1800 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1801 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1802 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1803 | reader.skip(3) |
| 1804 | return obj |
| 1805 | |
| 1806 | def __eq__(self, other): |
| 1807 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1808 | if self.xid != other.xid: return False |
| 1809 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1810 | return True |
| 1811 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1812 | def pretty_print(self, q): |
| 1813 | q.text("bsn_get_mirroring_request {") |
| 1814 | with q.group(): |
| 1815 | with q.indent(2): |
| 1816 | q.breakable() |
| 1817 | q.text("xid = "); |
| 1818 | if self.xid != None: |
| 1819 | q.text("%#x" % self.xid) |
| 1820 | else: |
| 1821 | q.text('None') |
| 1822 | q.text(","); q.breakable() |
| 1823 | q.text("report_mirror_ports = "); |
| 1824 | q.text("%#x" % self.report_mirror_ports) |
| 1825 | q.breakable() |
| 1826 | q.text('}') |
| 1827 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1828 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 1829 | |
| 1830 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1831 | version = 3 |
| 1832 | type = 4 |
| 1833 | experimenter = 6035143 |
| 1834 | subtype = 34 |
| 1835 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1836 | 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] | 1837 | if xid != None: |
| 1838 | self.xid = xid |
| 1839 | else: |
| 1840 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1841 | if status != None: |
| 1842 | self.status = status |
| 1843 | else: |
| 1844 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1845 | if port_no != None: |
| 1846 | self.port_no = port_no |
| 1847 | else: |
| 1848 | self.port_no = 0 |
| 1849 | if slot_num != None: |
| 1850 | self.slot_num = slot_num |
| 1851 | else: |
| 1852 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1853 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1854 | |
| 1855 | def pack(self): |
| 1856 | packed = [] |
| 1857 | packed.append(struct.pack("!B", self.version)) |
| 1858 | packed.append(struct.pack("!B", self.type)) |
| 1859 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1860 | packed.append(struct.pack("!L", self.xid)) |
| 1861 | packed.append(struct.pack("!L", self.experimenter)) |
| 1862 | packed.append(struct.pack("!L", self.subtype)) |
| 1863 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1864 | packed.append(util.pack_port_no(self.port_no)) |
| 1865 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1866 | length = sum([len(x) for x in packed]) |
| 1867 | packed[2] = struct.pack("!H", length) |
| 1868 | return ''.join(packed) |
| 1869 | |
| 1870 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1871 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1872 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1873 | _version = reader.read("!B")[0] |
| 1874 | assert(_version == 3) |
| 1875 | _type = reader.read("!B")[0] |
| 1876 | assert(_type == 4) |
| 1877 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1878 | orig_reader = reader |
| 1879 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1880 | obj.xid = reader.read("!L")[0] |
| 1881 | _experimenter = reader.read("!L")[0] |
| 1882 | assert(_experimenter == 6035143) |
| 1883 | _subtype = reader.read("!L")[0] |
| 1884 | assert(_subtype == 34) |
| 1885 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1886 | obj.port_no = util.unpack_port_no(reader) |
| 1887 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1888 | return obj |
| 1889 | |
| 1890 | def __eq__(self, other): |
| 1891 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1892 | if self.xid != other.xid: return False |
| 1893 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1894 | if self.port_no != other.port_no: return False |
| 1895 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1896 | return True |
| 1897 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1898 | def pretty_print(self, q): |
| 1899 | q.text("bsn_pdu_rx_reply {") |
| 1900 | with q.group(): |
| 1901 | with q.indent(2): |
| 1902 | q.breakable() |
| 1903 | q.text("xid = "); |
| 1904 | if self.xid != None: |
| 1905 | q.text("%#x" % self.xid) |
| 1906 | else: |
| 1907 | q.text('None') |
| 1908 | q.text(","); q.breakable() |
| 1909 | q.text("status = "); |
| 1910 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1911 | q.text(","); q.breakable() |
| 1912 | q.text("port_no = "); |
| 1913 | q.text(util.pretty_port(self.port_no)) |
| 1914 | q.text(","); q.breakable() |
| 1915 | q.text("slot_num = "); |
| 1916 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1917 | q.breakable() |
| 1918 | q.text('}') |
| 1919 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1920 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 1921 | |
| 1922 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1923 | version = 3 |
| 1924 | type = 4 |
| 1925 | experimenter = 6035143 |
| 1926 | subtype = 33 |
| 1927 | |
| 1928 | 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] | 1929 | if xid != None: |
| 1930 | self.xid = xid |
| 1931 | else: |
| 1932 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1933 | if timeout_ms != None: |
| 1934 | self.timeout_ms = timeout_ms |
| 1935 | else: |
| 1936 | self.timeout_ms = 0 |
| 1937 | if port_no != None: |
| 1938 | self.port_no = port_no |
| 1939 | else: |
| 1940 | self.port_no = 0 |
| 1941 | if slot_num != None: |
| 1942 | self.slot_num = slot_num |
| 1943 | else: |
| 1944 | self.slot_num = 0 |
| 1945 | if data != None: |
| 1946 | self.data = data |
| 1947 | else: |
| 1948 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1949 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1950 | |
| 1951 | def pack(self): |
| 1952 | packed = [] |
| 1953 | packed.append(struct.pack("!B", self.version)) |
| 1954 | packed.append(struct.pack("!B", self.type)) |
| 1955 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1956 | packed.append(struct.pack("!L", self.xid)) |
| 1957 | packed.append(struct.pack("!L", self.experimenter)) |
| 1958 | packed.append(struct.pack("!L", self.subtype)) |
| 1959 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 1960 | packed.append(util.pack_port_no(self.port_no)) |
| 1961 | packed.append(struct.pack("!B", self.slot_num)) |
| 1962 | packed.append('\x00' * 3) |
| 1963 | packed.append(self.data) |
| 1964 | length = sum([len(x) for x in packed]) |
| 1965 | packed[2] = struct.pack("!H", length) |
| 1966 | return ''.join(packed) |
| 1967 | |
| 1968 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1969 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1970 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1971 | _version = reader.read("!B")[0] |
| 1972 | assert(_version == 3) |
| 1973 | _type = reader.read("!B")[0] |
| 1974 | assert(_type == 4) |
| 1975 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1976 | orig_reader = reader |
| 1977 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1978 | obj.xid = reader.read("!L")[0] |
| 1979 | _experimenter = reader.read("!L")[0] |
| 1980 | assert(_experimenter == 6035143) |
| 1981 | _subtype = reader.read("!L")[0] |
| 1982 | assert(_subtype == 33) |
| 1983 | obj.timeout_ms = reader.read("!L")[0] |
| 1984 | obj.port_no = util.unpack_port_no(reader) |
| 1985 | obj.slot_num = reader.read("!B")[0] |
| 1986 | reader.skip(3) |
| 1987 | obj.data = str(reader.read_all()) |
| 1988 | return obj |
| 1989 | |
| 1990 | def __eq__(self, other): |
| 1991 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1992 | if self.xid != other.xid: return False |
| 1993 | if self.timeout_ms != other.timeout_ms: return False |
| 1994 | if self.port_no != other.port_no: return False |
| 1995 | if self.slot_num != other.slot_num: return False |
| 1996 | if self.data != other.data: return False |
| 1997 | return True |
| 1998 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1999 | def pretty_print(self, q): |
| 2000 | q.text("bsn_pdu_rx_request {") |
| 2001 | with q.group(): |
| 2002 | with q.indent(2): |
| 2003 | q.breakable() |
| 2004 | q.text("xid = "); |
| 2005 | if self.xid != None: |
| 2006 | q.text("%#x" % self.xid) |
| 2007 | else: |
| 2008 | q.text('None') |
| 2009 | q.text(","); q.breakable() |
| 2010 | q.text("timeout_ms = "); |
| 2011 | q.text("%#x" % self.timeout_ms) |
| 2012 | q.text(","); q.breakable() |
| 2013 | q.text("port_no = "); |
| 2014 | q.text(util.pretty_port(self.port_no)) |
| 2015 | q.text(","); q.breakable() |
| 2016 | q.text("slot_num = "); |
| 2017 | q.text("%#x" % self.slot_num) |
| 2018 | q.text(","); q.breakable() |
| 2019 | q.text("data = "); |
| 2020 | q.pp(self.data) |
| 2021 | q.breakable() |
| 2022 | q.text('}') |
| 2023 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2024 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 2025 | |
| 2026 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2027 | version = 3 |
| 2028 | type = 4 |
| 2029 | experimenter = 6035143 |
| 2030 | subtype = 35 |
| 2031 | |
| 2032 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2033 | if xid != None: |
| 2034 | self.xid = xid |
| 2035 | else: |
| 2036 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2037 | if port_no != None: |
| 2038 | self.port_no = port_no |
| 2039 | else: |
| 2040 | self.port_no = 0 |
| 2041 | if slot_num != None: |
| 2042 | self.slot_num = slot_num |
| 2043 | else: |
| 2044 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2045 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2046 | |
| 2047 | def pack(self): |
| 2048 | packed = [] |
| 2049 | packed.append(struct.pack("!B", self.version)) |
| 2050 | packed.append(struct.pack("!B", self.type)) |
| 2051 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2052 | packed.append(struct.pack("!L", self.xid)) |
| 2053 | packed.append(struct.pack("!L", self.experimenter)) |
| 2054 | packed.append(struct.pack("!L", self.subtype)) |
| 2055 | packed.append(util.pack_port_no(self.port_no)) |
| 2056 | packed.append(struct.pack("!B", self.slot_num)) |
| 2057 | length = sum([len(x) for x in packed]) |
| 2058 | packed[2] = struct.pack("!H", length) |
| 2059 | return ''.join(packed) |
| 2060 | |
| 2061 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2062 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2063 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2064 | _version = reader.read("!B")[0] |
| 2065 | assert(_version == 3) |
| 2066 | _type = reader.read("!B")[0] |
| 2067 | assert(_type == 4) |
| 2068 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2069 | orig_reader = reader |
| 2070 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2071 | obj.xid = reader.read("!L")[0] |
| 2072 | _experimenter = reader.read("!L")[0] |
| 2073 | assert(_experimenter == 6035143) |
| 2074 | _subtype = reader.read("!L")[0] |
| 2075 | assert(_subtype == 35) |
| 2076 | obj.port_no = util.unpack_port_no(reader) |
| 2077 | obj.slot_num = reader.read("!B")[0] |
| 2078 | return obj |
| 2079 | |
| 2080 | def __eq__(self, other): |
| 2081 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2082 | if self.xid != other.xid: return False |
| 2083 | if self.port_no != other.port_no: return False |
| 2084 | if self.slot_num != other.slot_num: return False |
| 2085 | return True |
| 2086 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2087 | def pretty_print(self, q): |
| 2088 | q.text("bsn_pdu_rx_timeout {") |
| 2089 | with q.group(): |
| 2090 | with q.indent(2): |
| 2091 | q.breakable() |
| 2092 | q.text("xid = "); |
| 2093 | if self.xid != None: |
| 2094 | q.text("%#x" % self.xid) |
| 2095 | else: |
| 2096 | q.text('None') |
| 2097 | q.text(","); q.breakable() |
| 2098 | q.text("port_no = "); |
| 2099 | q.text(util.pretty_port(self.port_no)) |
| 2100 | q.text(","); q.breakable() |
| 2101 | q.text("slot_num = "); |
| 2102 | q.text("%#x" % self.slot_num) |
| 2103 | q.breakable() |
| 2104 | q.text('}') |
| 2105 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2106 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 2107 | |
| 2108 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2109 | version = 3 |
| 2110 | type = 4 |
| 2111 | experimenter = 6035143 |
| 2112 | subtype = 32 |
| 2113 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2114 | 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] | 2115 | if xid != None: |
| 2116 | self.xid = xid |
| 2117 | else: |
| 2118 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2119 | if status != None: |
| 2120 | self.status = status |
| 2121 | else: |
| 2122 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2123 | if port_no != None: |
| 2124 | self.port_no = port_no |
| 2125 | else: |
| 2126 | self.port_no = 0 |
| 2127 | if slot_num != None: |
| 2128 | self.slot_num = slot_num |
| 2129 | else: |
| 2130 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2131 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2132 | |
| 2133 | def pack(self): |
| 2134 | packed = [] |
| 2135 | packed.append(struct.pack("!B", self.version)) |
| 2136 | packed.append(struct.pack("!B", self.type)) |
| 2137 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2138 | packed.append(struct.pack("!L", self.xid)) |
| 2139 | packed.append(struct.pack("!L", self.experimenter)) |
| 2140 | packed.append(struct.pack("!L", self.subtype)) |
| 2141 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2142 | packed.append(util.pack_port_no(self.port_no)) |
| 2143 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2144 | length = sum([len(x) for x in packed]) |
| 2145 | packed[2] = struct.pack("!H", length) |
| 2146 | return ''.join(packed) |
| 2147 | |
| 2148 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2149 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2150 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2151 | _version = reader.read("!B")[0] |
| 2152 | assert(_version == 3) |
| 2153 | _type = reader.read("!B")[0] |
| 2154 | assert(_type == 4) |
| 2155 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2156 | orig_reader = reader |
| 2157 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2158 | obj.xid = reader.read("!L")[0] |
| 2159 | _experimenter = reader.read("!L")[0] |
| 2160 | assert(_experimenter == 6035143) |
| 2161 | _subtype = reader.read("!L")[0] |
| 2162 | assert(_subtype == 32) |
| 2163 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2164 | obj.port_no = util.unpack_port_no(reader) |
| 2165 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2166 | return obj |
| 2167 | |
| 2168 | def __eq__(self, other): |
| 2169 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2170 | if self.xid != other.xid: return False |
| 2171 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2172 | if self.port_no != other.port_no: return False |
| 2173 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2174 | return True |
| 2175 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2176 | def pretty_print(self, q): |
| 2177 | q.text("bsn_pdu_tx_reply {") |
| 2178 | with q.group(): |
| 2179 | with q.indent(2): |
| 2180 | q.breakable() |
| 2181 | q.text("xid = "); |
| 2182 | if self.xid != None: |
| 2183 | q.text("%#x" % self.xid) |
| 2184 | else: |
| 2185 | q.text('None') |
| 2186 | q.text(","); q.breakable() |
| 2187 | q.text("status = "); |
| 2188 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2189 | q.text(","); q.breakable() |
| 2190 | q.text("port_no = "); |
| 2191 | q.text(util.pretty_port(self.port_no)) |
| 2192 | q.text(","); q.breakable() |
| 2193 | q.text("slot_num = "); |
| 2194 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2195 | q.breakable() |
| 2196 | q.text('}') |
| 2197 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2198 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2199 | |
| 2200 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2201 | version = 3 |
| 2202 | type = 4 |
| 2203 | experimenter = 6035143 |
| 2204 | subtype = 31 |
| 2205 | |
| 2206 | 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] | 2207 | if xid != None: |
| 2208 | self.xid = xid |
| 2209 | else: |
| 2210 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2211 | if tx_interval_ms != None: |
| 2212 | self.tx_interval_ms = tx_interval_ms |
| 2213 | else: |
| 2214 | self.tx_interval_ms = 0 |
| 2215 | if port_no != None: |
| 2216 | self.port_no = port_no |
| 2217 | else: |
| 2218 | self.port_no = 0 |
| 2219 | if slot_num != None: |
| 2220 | self.slot_num = slot_num |
| 2221 | else: |
| 2222 | self.slot_num = 0 |
| 2223 | if data != None: |
| 2224 | self.data = data |
| 2225 | else: |
| 2226 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2227 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2228 | |
| 2229 | def pack(self): |
| 2230 | packed = [] |
| 2231 | packed.append(struct.pack("!B", self.version)) |
| 2232 | packed.append(struct.pack("!B", self.type)) |
| 2233 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2234 | packed.append(struct.pack("!L", self.xid)) |
| 2235 | packed.append(struct.pack("!L", self.experimenter)) |
| 2236 | packed.append(struct.pack("!L", self.subtype)) |
| 2237 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2238 | packed.append(util.pack_port_no(self.port_no)) |
| 2239 | packed.append(struct.pack("!B", self.slot_num)) |
| 2240 | packed.append('\x00' * 3) |
| 2241 | packed.append(self.data) |
| 2242 | length = sum([len(x) for x in packed]) |
| 2243 | packed[2] = struct.pack("!H", length) |
| 2244 | return ''.join(packed) |
| 2245 | |
| 2246 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2247 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2248 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2249 | _version = reader.read("!B")[0] |
| 2250 | assert(_version == 3) |
| 2251 | _type = reader.read("!B")[0] |
| 2252 | assert(_type == 4) |
| 2253 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2254 | orig_reader = reader |
| 2255 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2256 | obj.xid = reader.read("!L")[0] |
| 2257 | _experimenter = reader.read("!L")[0] |
| 2258 | assert(_experimenter == 6035143) |
| 2259 | _subtype = reader.read("!L")[0] |
| 2260 | assert(_subtype == 31) |
| 2261 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2262 | obj.port_no = util.unpack_port_no(reader) |
| 2263 | obj.slot_num = reader.read("!B")[0] |
| 2264 | reader.skip(3) |
| 2265 | obj.data = str(reader.read_all()) |
| 2266 | return obj |
| 2267 | |
| 2268 | def __eq__(self, other): |
| 2269 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2270 | if self.xid != other.xid: return False |
| 2271 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2272 | if self.port_no != other.port_no: return False |
| 2273 | if self.slot_num != other.slot_num: return False |
| 2274 | if self.data != other.data: return False |
| 2275 | return True |
| 2276 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2277 | def pretty_print(self, q): |
| 2278 | q.text("bsn_pdu_tx_request {") |
| 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("tx_interval_ms = "); |
| 2289 | q.text("%#x" % self.tx_interval_ms) |
| 2290 | q.text(","); q.breakable() |
| 2291 | q.text("port_no = "); |
| 2292 | q.text(util.pretty_port(self.port_no)) |
| 2293 | q.text(","); q.breakable() |
| 2294 | q.text("slot_num = "); |
| 2295 | q.text("%#x" % self.slot_num) |
| 2296 | q.text(","); q.breakable() |
| 2297 | q.text("data = "); |
| 2298 | q.pp(self.data) |
| 2299 | q.breakable() |
| 2300 | q.text('}') |
| 2301 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2302 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2303 | |
| 2304 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2305 | version = 3 |
| 2306 | type = 4 |
| 2307 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2308 | subtype = 3 |
| 2309 | |
| 2310 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2311 | if xid != None: |
| 2312 | self.xid = xid |
| 2313 | else: |
| 2314 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2315 | if report_mirror_ports != None: |
| 2316 | self.report_mirror_ports = report_mirror_ports |
| 2317 | else: |
| 2318 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2319 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2320 | |
| 2321 | def pack(self): |
| 2322 | packed = [] |
| 2323 | packed.append(struct.pack("!B", self.version)) |
| 2324 | packed.append(struct.pack("!B", self.type)) |
| 2325 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2326 | packed.append(struct.pack("!L", self.xid)) |
| 2327 | packed.append(struct.pack("!L", self.experimenter)) |
| 2328 | packed.append(struct.pack("!L", self.subtype)) |
| 2329 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 2330 | packed.append('\x00' * 3) |
| 2331 | length = sum([len(x) for x in packed]) |
| 2332 | packed[2] = struct.pack("!H", length) |
| 2333 | return ''.join(packed) |
| 2334 | |
| 2335 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2336 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2337 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2338 | _version = reader.read("!B")[0] |
| 2339 | assert(_version == 3) |
| 2340 | _type = reader.read("!B")[0] |
| 2341 | assert(_type == 4) |
| 2342 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2343 | orig_reader = reader |
| 2344 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2345 | obj.xid = reader.read("!L")[0] |
| 2346 | _experimenter = reader.read("!L")[0] |
| 2347 | assert(_experimenter == 6035143) |
| 2348 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2349 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2350 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2351 | reader.skip(3) |
| 2352 | return obj |
| 2353 | |
| 2354 | def __eq__(self, other): |
| 2355 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2356 | if self.xid != other.xid: return False |
| 2357 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 2358 | return True |
| 2359 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2360 | def pretty_print(self, q): |
| 2361 | q.text("bsn_set_mirroring {") |
| 2362 | with q.group(): |
| 2363 | with q.indent(2): |
| 2364 | q.breakable() |
| 2365 | q.text("xid = "); |
| 2366 | if self.xid != None: |
| 2367 | q.text("%#x" % self.xid) |
| 2368 | else: |
| 2369 | q.text('None') |
| 2370 | q.text(","); q.breakable() |
| 2371 | q.text("report_mirror_ports = "); |
| 2372 | q.text("%#x" % self.report_mirror_ports) |
| 2373 | q.breakable() |
| 2374 | q.text('}') |
| 2375 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2376 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2377 | |
| 2378 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2379 | version = 3 |
| 2380 | type = 4 |
| 2381 | experimenter = 6035143 |
| 2382 | subtype = 25 |
| 2383 | |
| 2384 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2385 | if xid != None: |
| 2386 | self.xid = xid |
| 2387 | else: |
| 2388 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2389 | if status != None: |
| 2390 | self.status = status |
| 2391 | else: |
| 2392 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2393 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2394 | |
| 2395 | def pack(self): |
| 2396 | packed = [] |
| 2397 | packed.append(struct.pack("!B", self.version)) |
| 2398 | packed.append(struct.pack("!B", self.type)) |
| 2399 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2400 | packed.append(struct.pack("!L", self.xid)) |
| 2401 | packed.append(struct.pack("!L", self.experimenter)) |
| 2402 | packed.append(struct.pack("!L", self.subtype)) |
| 2403 | packed.append(struct.pack("!L", self.status)) |
| 2404 | length = sum([len(x) for x in packed]) |
| 2405 | packed[2] = struct.pack("!H", length) |
| 2406 | return ''.join(packed) |
| 2407 | |
| 2408 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2409 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2410 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2411 | _version = reader.read("!B")[0] |
| 2412 | assert(_version == 3) |
| 2413 | _type = reader.read("!B")[0] |
| 2414 | assert(_type == 4) |
| 2415 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2416 | orig_reader = reader |
| 2417 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2418 | obj.xid = reader.read("!L")[0] |
| 2419 | _experimenter = reader.read("!L")[0] |
| 2420 | assert(_experimenter == 6035143) |
| 2421 | _subtype = reader.read("!L")[0] |
| 2422 | assert(_subtype == 25) |
| 2423 | obj.status = reader.read("!L")[0] |
| 2424 | return obj |
| 2425 | |
| 2426 | def __eq__(self, other): |
| 2427 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2428 | if self.xid != other.xid: return False |
| 2429 | if self.status != other.status: return False |
| 2430 | return True |
| 2431 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2432 | def pretty_print(self, q): |
| 2433 | q.text("bsn_set_pktin_suppression_reply {") |
| 2434 | with q.group(): |
| 2435 | with q.indent(2): |
| 2436 | q.breakable() |
| 2437 | q.text("xid = "); |
| 2438 | if self.xid != None: |
| 2439 | q.text("%#x" % self.xid) |
| 2440 | else: |
| 2441 | q.text('None') |
| 2442 | q.text(","); q.breakable() |
| 2443 | q.text("status = "); |
| 2444 | q.text("%#x" % self.status) |
| 2445 | q.breakable() |
| 2446 | q.text('}') |
| 2447 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2448 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2449 | |
| 2450 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2451 | version = 3 |
| 2452 | type = 4 |
| 2453 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2454 | subtype = 11 |
| 2455 | |
| 2456 | 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] | 2457 | if xid != None: |
| 2458 | self.xid = xid |
| 2459 | else: |
| 2460 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2461 | if enabled != None: |
| 2462 | self.enabled = enabled |
| 2463 | else: |
| 2464 | self.enabled = 0 |
| 2465 | if idle_timeout != None: |
| 2466 | self.idle_timeout = idle_timeout |
| 2467 | else: |
| 2468 | self.idle_timeout = 0 |
| 2469 | if hard_timeout != None: |
| 2470 | self.hard_timeout = hard_timeout |
| 2471 | else: |
| 2472 | self.hard_timeout = 0 |
| 2473 | if priority != None: |
| 2474 | self.priority = priority |
| 2475 | else: |
| 2476 | self.priority = 0 |
| 2477 | if cookie != None: |
| 2478 | self.cookie = cookie |
| 2479 | else: |
| 2480 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2481 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2482 | |
| 2483 | def pack(self): |
| 2484 | packed = [] |
| 2485 | packed.append(struct.pack("!B", self.version)) |
| 2486 | packed.append(struct.pack("!B", self.type)) |
| 2487 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2488 | packed.append(struct.pack("!L", self.xid)) |
| 2489 | packed.append(struct.pack("!L", self.experimenter)) |
| 2490 | packed.append(struct.pack("!L", self.subtype)) |
| 2491 | packed.append(struct.pack("!B", self.enabled)) |
| 2492 | packed.append('\x00' * 1) |
| 2493 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2494 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2495 | packed.append(struct.pack("!H", self.priority)) |
| 2496 | packed.append(struct.pack("!Q", self.cookie)) |
| 2497 | length = sum([len(x) for x in packed]) |
| 2498 | packed[2] = struct.pack("!H", length) |
| 2499 | return ''.join(packed) |
| 2500 | |
| 2501 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2502 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2503 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2504 | _version = reader.read("!B")[0] |
| 2505 | assert(_version == 3) |
| 2506 | _type = reader.read("!B")[0] |
| 2507 | assert(_type == 4) |
| 2508 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2509 | orig_reader = reader |
| 2510 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2511 | obj.xid = reader.read("!L")[0] |
| 2512 | _experimenter = reader.read("!L")[0] |
| 2513 | assert(_experimenter == 6035143) |
| 2514 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2515 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2516 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2517 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2518 | obj.idle_timeout = reader.read("!H")[0] |
| 2519 | obj.hard_timeout = reader.read("!H")[0] |
| 2520 | obj.priority = reader.read("!H")[0] |
| 2521 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2522 | return obj |
| 2523 | |
| 2524 | def __eq__(self, other): |
| 2525 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2526 | if self.xid != other.xid: return False |
| 2527 | if self.enabled != other.enabled: return False |
| 2528 | if self.idle_timeout != other.idle_timeout: return False |
| 2529 | if self.hard_timeout != other.hard_timeout: return False |
| 2530 | if self.priority != other.priority: return False |
| 2531 | if self.cookie != other.cookie: return False |
| 2532 | return True |
| 2533 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2534 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2535 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2536 | with q.group(): |
| 2537 | with q.indent(2): |
| 2538 | q.breakable() |
| 2539 | q.text("xid = "); |
| 2540 | if self.xid != None: |
| 2541 | q.text("%#x" % self.xid) |
| 2542 | else: |
| 2543 | q.text('None') |
| 2544 | q.text(","); q.breakable() |
| 2545 | q.text("enabled = "); |
| 2546 | q.text("%#x" % self.enabled) |
| 2547 | q.text(","); q.breakable() |
| 2548 | q.text("idle_timeout = "); |
| 2549 | q.text("%#x" % self.idle_timeout) |
| 2550 | q.text(","); q.breakable() |
| 2551 | q.text("hard_timeout = "); |
| 2552 | q.text("%#x" % self.hard_timeout) |
| 2553 | q.text(","); q.breakable() |
| 2554 | q.text("priority = "); |
| 2555 | q.text("%#x" % self.priority) |
| 2556 | q.text(","); q.breakable() |
| 2557 | q.text("cookie = "); |
| 2558 | q.text("%#x" % self.cookie) |
| 2559 | q.breakable() |
| 2560 | q.text('}') |
| 2561 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2562 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 2563 | |
| 2564 | class experimenter_stats_reply(stats_reply): |
| 2565 | subtypes = {} |
| 2566 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2567 | version = 3 |
| 2568 | type = 19 |
| 2569 | stats_type = 65535 |
| 2570 | |
| 2571 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None): |
| 2572 | if xid != None: |
| 2573 | self.xid = xid |
| 2574 | else: |
| 2575 | self.xid = None |
| 2576 | if flags != None: |
| 2577 | self.flags = flags |
| 2578 | else: |
| 2579 | self.flags = 0 |
| 2580 | if experimenter != None: |
| 2581 | self.experimenter = experimenter |
| 2582 | else: |
| 2583 | self.experimenter = 0 |
| 2584 | if subtype != None: |
| 2585 | self.subtype = subtype |
| 2586 | else: |
| 2587 | self.subtype = 0 |
| 2588 | if data != None: |
| 2589 | self.data = data |
| 2590 | else: |
| 2591 | self.data = '' |
| 2592 | return |
| 2593 | |
| 2594 | def pack(self): |
| 2595 | packed = [] |
| 2596 | packed.append(struct.pack("!B", self.version)) |
| 2597 | packed.append(struct.pack("!B", self.type)) |
| 2598 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2599 | packed.append(struct.pack("!L", self.xid)) |
| 2600 | packed.append(struct.pack("!H", self.stats_type)) |
| 2601 | packed.append(struct.pack("!H", self.flags)) |
| 2602 | packed.append('\x00' * 4) |
| 2603 | packed.append(struct.pack("!L", self.experimenter)) |
| 2604 | packed.append(struct.pack("!L", self.subtype)) |
| 2605 | packed.append(self.data) |
| 2606 | length = sum([len(x) for x in packed]) |
| 2607 | packed[2] = struct.pack("!H", length) |
| 2608 | return ''.join(packed) |
| 2609 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2610 | @staticmethod |
| 2611 | def unpack(reader): |
| 2612 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2613 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2614 | if subclass: |
| 2615 | return subclass.unpack(reader) |
| 2616 | |
| 2617 | obj = experimenter_stats_reply() |
| 2618 | _version = reader.read("!B")[0] |
| 2619 | assert(_version == 3) |
| 2620 | _type = reader.read("!B")[0] |
| 2621 | assert(_type == 19) |
| 2622 | _length = reader.read("!H")[0] |
| 2623 | orig_reader = reader |
| 2624 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2625 | obj.xid = reader.read("!L")[0] |
| 2626 | _stats_type = reader.read("!H")[0] |
| 2627 | assert(_stats_type == 65535) |
| 2628 | obj.flags = reader.read("!H")[0] |
| 2629 | reader.skip(4) |
| 2630 | obj.experimenter = reader.read("!L")[0] |
| 2631 | obj.subtype = reader.read("!L")[0] |
| 2632 | obj.data = str(reader.read_all()) |
| 2633 | return obj |
| 2634 | |
| 2635 | def __eq__(self, other): |
| 2636 | if type(self) != type(other): return False |
| 2637 | if self.xid != other.xid: return False |
| 2638 | if self.flags != other.flags: return False |
| 2639 | if self.experimenter != other.experimenter: return False |
| 2640 | if self.subtype != other.subtype: return False |
| 2641 | if self.data != other.data: return False |
| 2642 | return True |
| 2643 | |
| 2644 | def pretty_print(self, q): |
| 2645 | q.text("experimenter_stats_reply {") |
| 2646 | with q.group(): |
| 2647 | with q.indent(2): |
| 2648 | q.breakable() |
| 2649 | q.text("xid = "); |
| 2650 | if self.xid != None: |
| 2651 | q.text("%#x" % self.xid) |
| 2652 | else: |
| 2653 | q.text('None') |
| 2654 | q.text(","); q.breakable() |
| 2655 | q.text("flags = "); |
| 2656 | q.text("%#x" % self.flags) |
| 2657 | q.text(","); q.breakable() |
| 2658 | q.text("subtype = "); |
| 2659 | q.text("%#x" % self.subtype) |
| 2660 | q.text(","); q.breakable() |
| 2661 | q.text("data = "); |
| 2662 | q.pp(self.data) |
| 2663 | q.breakable() |
| 2664 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2665 | |
| 2666 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2667 | |
| 2668 | class bsn_stats_reply(experimenter_stats_reply): |
| 2669 | subtypes = {} |
| 2670 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2671 | version = 3 |
| 2672 | type = 19 |
| 2673 | stats_type = 65535 |
| 2674 | experimenter = 6035143 |
| 2675 | |
| 2676 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2677 | if xid != None: |
| 2678 | self.xid = xid |
| 2679 | else: |
| 2680 | self.xid = None |
| 2681 | if flags != None: |
| 2682 | self.flags = flags |
| 2683 | else: |
| 2684 | self.flags = 0 |
| 2685 | if subtype != None: |
| 2686 | self.subtype = subtype |
| 2687 | else: |
| 2688 | self.subtype = 0 |
| 2689 | return |
| 2690 | |
| 2691 | def pack(self): |
| 2692 | packed = [] |
| 2693 | packed.append(struct.pack("!B", self.version)) |
| 2694 | packed.append(struct.pack("!B", self.type)) |
| 2695 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2696 | packed.append(struct.pack("!L", self.xid)) |
| 2697 | packed.append(struct.pack("!H", self.stats_type)) |
| 2698 | packed.append(struct.pack("!H", self.flags)) |
| 2699 | packed.append('\x00' * 4) |
| 2700 | packed.append(struct.pack("!L", self.experimenter)) |
| 2701 | packed.append(struct.pack("!L", self.subtype)) |
| 2702 | length = sum([len(x) for x in packed]) |
| 2703 | packed[2] = struct.pack("!H", length) |
| 2704 | return ''.join(packed) |
| 2705 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2706 | @staticmethod |
| 2707 | def unpack(reader): |
| 2708 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2709 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2710 | if subclass: |
| 2711 | return subclass.unpack(reader) |
| 2712 | |
| 2713 | obj = bsn_stats_reply() |
| 2714 | _version = reader.read("!B")[0] |
| 2715 | assert(_version == 3) |
| 2716 | _type = reader.read("!B")[0] |
| 2717 | assert(_type == 19) |
| 2718 | _length = reader.read("!H")[0] |
| 2719 | orig_reader = reader |
| 2720 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2721 | obj.xid = reader.read("!L")[0] |
| 2722 | _stats_type = reader.read("!H")[0] |
| 2723 | assert(_stats_type == 65535) |
| 2724 | obj.flags = reader.read("!H")[0] |
| 2725 | reader.skip(4) |
| 2726 | _experimenter = reader.read("!L")[0] |
| 2727 | assert(_experimenter == 6035143) |
| 2728 | obj.subtype = reader.read("!L")[0] |
| 2729 | return obj |
| 2730 | |
| 2731 | def __eq__(self, other): |
| 2732 | if type(self) != type(other): return False |
| 2733 | if self.xid != other.xid: return False |
| 2734 | if self.flags != other.flags: return False |
| 2735 | if self.subtype != other.subtype: return False |
| 2736 | return True |
| 2737 | |
| 2738 | def pretty_print(self, q): |
| 2739 | q.text("bsn_stats_reply {") |
| 2740 | with q.group(): |
| 2741 | with q.indent(2): |
| 2742 | q.breakable() |
| 2743 | q.text("xid = "); |
| 2744 | if self.xid != None: |
| 2745 | q.text("%#x" % self.xid) |
| 2746 | else: |
| 2747 | q.text('None') |
| 2748 | q.text(","); q.breakable() |
| 2749 | q.text("flags = "); |
| 2750 | q.text("%#x" % self.flags) |
| 2751 | q.breakable() |
| 2752 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2753 | |
| 2754 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2755 | |
| 2756 | class experimenter_stats_request(stats_request): |
| 2757 | subtypes = {} |
| 2758 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2759 | version = 3 |
| 2760 | type = 18 |
| 2761 | stats_type = 65535 |
| 2762 | |
| 2763 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None): |
| 2764 | if xid != None: |
| 2765 | self.xid = xid |
| 2766 | else: |
| 2767 | self.xid = None |
| 2768 | if flags != None: |
| 2769 | self.flags = flags |
| 2770 | else: |
| 2771 | self.flags = 0 |
| 2772 | if experimenter != None: |
| 2773 | self.experimenter = experimenter |
| 2774 | else: |
| 2775 | self.experimenter = 0 |
| 2776 | if subtype != None: |
| 2777 | self.subtype = subtype |
| 2778 | else: |
| 2779 | self.subtype = 0 |
| 2780 | if data != None: |
| 2781 | self.data = data |
| 2782 | else: |
| 2783 | self.data = '' |
| 2784 | return |
| 2785 | |
| 2786 | def pack(self): |
| 2787 | packed = [] |
| 2788 | packed.append(struct.pack("!B", self.version)) |
| 2789 | packed.append(struct.pack("!B", self.type)) |
| 2790 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2791 | packed.append(struct.pack("!L", self.xid)) |
| 2792 | packed.append(struct.pack("!H", self.stats_type)) |
| 2793 | packed.append(struct.pack("!H", self.flags)) |
| 2794 | packed.append('\x00' * 4) |
| 2795 | packed.append(struct.pack("!L", self.experimenter)) |
| 2796 | packed.append(struct.pack("!L", self.subtype)) |
| 2797 | packed.append(self.data) |
| 2798 | length = sum([len(x) for x in packed]) |
| 2799 | packed[2] = struct.pack("!H", length) |
| 2800 | return ''.join(packed) |
| 2801 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2802 | @staticmethod |
| 2803 | def unpack(reader): |
| 2804 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2805 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2806 | if subclass: |
| 2807 | return subclass.unpack(reader) |
| 2808 | |
| 2809 | obj = experimenter_stats_request() |
| 2810 | _version = reader.read("!B")[0] |
| 2811 | assert(_version == 3) |
| 2812 | _type = reader.read("!B")[0] |
| 2813 | assert(_type == 18) |
| 2814 | _length = reader.read("!H")[0] |
| 2815 | orig_reader = reader |
| 2816 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2817 | obj.xid = reader.read("!L")[0] |
| 2818 | _stats_type = reader.read("!H")[0] |
| 2819 | assert(_stats_type == 65535) |
| 2820 | obj.flags = reader.read("!H")[0] |
| 2821 | reader.skip(4) |
| 2822 | obj.experimenter = reader.read("!L")[0] |
| 2823 | obj.subtype = reader.read("!L")[0] |
| 2824 | obj.data = str(reader.read_all()) |
| 2825 | return obj |
| 2826 | |
| 2827 | def __eq__(self, other): |
| 2828 | if type(self) != type(other): return False |
| 2829 | if self.xid != other.xid: return False |
| 2830 | if self.flags != other.flags: return False |
| 2831 | if self.experimenter != other.experimenter: return False |
| 2832 | if self.subtype != other.subtype: return False |
| 2833 | if self.data != other.data: return False |
| 2834 | return True |
| 2835 | |
| 2836 | def pretty_print(self, q): |
| 2837 | q.text("experimenter_stats_request {") |
| 2838 | with q.group(): |
| 2839 | with q.indent(2): |
| 2840 | q.breakable() |
| 2841 | q.text("xid = "); |
| 2842 | if self.xid != None: |
| 2843 | q.text("%#x" % self.xid) |
| 2844 | else: |
| 2845 | q.text('None') |
| 2846 | q.text(","); q.breakable() |
| 2847 | q.text("flags = "); |
| 2848 | q.text("%#x" % self.flags) |
| 2849 | q.text(","); q.breakable() |
| 2850 | q.text("subtype = "); |
| 2851 | q.text("%#x" % self.subtype) |
| 2852 | q.text(","); q.breakable() |
| 2853 | q.text("data = "); |
| 2854 | q.pp(self.data) |
| 2855 | q.breakable() |
| 2856 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2857 | |
| 2858 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2859 | |
| 2860 | class bsn_stats_request(experimenter_stats_request): |
| 2861 | subtypes = {} |
| 2862 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2863 | version = 3 |
| 2864 | type = 18 |
| 2865 | stats_type = 65535 |
| 2866 | experimenter = 6035143 |
| 2867 | |
| 2868 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2869 | if xid != None: |
| 2870 | self.xid = xid |
| 2871 | else: |
| 2872 | self.xid = None |
| 2873 | if flags != None: |
| 2874 | self.flags = flags |
| 2875 | else: |
| 2876 | self.flags = 0 |
| 2877 | if subtype != None: |
| 2878 | self.subtype = subtype |
| 2879 | else: |
| 2880 | self.subtype = 0 |
| 2881 | return |
| 2882 | |
| 2883 | def pack(self): |
| 2884 | packed = [] |
| 2885 | packed.append(struct.pack("!B", self.version)) |
| 2886 | packed.append(struct.pack("!B", self.type)) |
| 2887 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2888 | packed.append(struct.pack("!L", self.xid)) |
| 2889 | packed.append(struct.pack("!H", self.stats_type)) |
| 2890 | packed.append(struct.pack("!H", self.flags)) |
| 2891 | packed.append('\x00' * 4) |
| 2892 | packed.append(struct.pack("!L", self.experimenter)) |
| 2893 | packed.append(struct.pack("!L", self.subtype)) |
| 2894 | length = sum([len(x) for x in packed]) |
| 2895 | packed[2] = struct.pack("!H", length) |
| 2896 | return ''.join(packed) |
| 2897 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2898 | @staticmethod |
| 2899 | def unpack(reader): |
| 2900 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2901 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2902 | if subclass: |
| 2903 | return subclass.unpack(reader) |
| 2904 | |
| 2905 | obj = bsn_stats_request() |
| 2906 | _version = reader.read("!B")[0] |
| 2907 | assert(_version == 3) |
| 2908 | _type = reader.read("!B")[0] |
| 2909 | assert(_type == 18) |
| 2910 | _length = reader.read("!H")[0] |
| 2911 | orig_reader = reader |
| 2912 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2913 | obj.xid = reader.read("!L")[0] |
| 2914 | _stats_type = reader.read("!H")[0] |
| 2915 | assert(_stats_type == 65535) |
| 2916 | obj.flags = reader.read("!H")[0] |
| 2917 | reader.skip(4) |
| 2918 | _experimenter = reader.read("!L")[0] |
| 2919 | assert(_experimenter == 6035143) |
| 2920 | obj.subtype = reader.read("!L")[0] |
| 2921 | return obj |
| 2922 | |
| 2923 | def __eq__(self, other): |
| 2924 | if type(self) != type(other): return False |
| 2925 | if self.xid != other.xid: return False |
| 2926 | if self.flags != other.flags: return False |
| 2927 | if self.subtype != other.subtype: return False |
| 2928 | return True |
| 2929 | |
| 2930 | def pretty_print(self, q): |
| 2931 | q.text("bsn_stats_request {") |
| 2932 | with q.group(): |
| 2933 | with q.indent(2): |
| 2934 | q.breakable() |
| 2935 | q.text("xid = "); |
| 2936 | if self.xid != None: |
| 2937 | q.text("%#x" % self.xid) |
| 2938 | else: |
| 2939 | q.text('None') |
| 2940 | q.text(","); q.breakable() |
| 2941 | q.text("flags = "); |
| 2942 | q.text("%#x" % self.flags) |
| 2943 | q.breakable() |
| 2944 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2945 | |
| 2946 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2947 | |
| 2948 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2949 | version = 3 |
| 2950 | type = 4 |
| 2951 | experimenter = 6035143 |
| 2952 | subtype = 16 |
| 2953 | |
| 2954 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2955 | if xid != None: |
| 2956 | self.xid = xid |
| 2957 | else: |
| 2958 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2959 | if status != None: |
| 2960 | self.status = status |
| 2961 | else: |
| 2962 | self.status = 0 |
| 2963 | if vport_no != None: |
| 2964 | self.vport_no = vport_no |
| 2965 | else: |
| 2966 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2967 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2968 | |
| 2969 | def pack(self): |
| 2970 | packed = [] |
| 2971 | packed.append(struct.pack("!B", self.version)) |
| 2972 | packed.append(struct.pack("!B", self.type)) |
| 2973 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2974 | packed.append(struct.pack("!L", self.xid)) |
| 2975 | packed.append(struct.pack("!L", self.experimenter)) |
| 2976 | packed.append(struct.pack("!L", self.subtype)) |
| 2977 | packed.append(struct.pack("!L", self.status)) |
| 2978 | packed.append(struct.pack("!L", self.vport_no)) |
| 2979 | length = sum([len(x) for x in packed]) |
| 2980 | packed[2] = struct.pack("!H", length) |
| 2981 | return ''.join(packed) |
| 2982 | |
| 2983 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2984 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2985 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2986 | _version = reader.read("!B")[0] |
| 2987 | assert(_version == 3) |
| 2988 | _type = reader.read("!B")[0] |
| 2989 | assert(_type == 4) |
| 2990 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2991 | orig_reader = reader |
| 2992 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2993 | obj.xid = reader.read("!L")[0] |
| 2994 | _experimenter = reader.read("!L")[0] |
| 2995 | assert(_experimenter == 6035143) |
| 2996 | _subtype = reader.read("!L")[0] |
| 2997 | assert(_subtype == 16) |
| 2998 | obj.status = reader.read("!L")[0] |
| 2999 | obj.vport_no = reader.read("!L")[0] |
| 3000 | return obj |
| 3001 | |
| 3002 | def __eq__(self, other): |
| 3003 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3004 | if self.xid != other.xid: return False |
| 3005 | if self.status != other.status: return False |
| 3006 | if self.vport_no != other.vport_no: return False |
| 3007 | return True |
| 3008 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3009 | def pretty_print(self, q): |
| 3010 | q.text("bsn_virtual_port_create_reply {") |
| 3011 | with q.group(): |
| 3012 | with q.indent(2): |
| 3013 | q.breakable() |
| 3014 | q.text("xid = "); |
| 3015 | if self.xid != None: |
| 3016 | q.text("%#x" % self.xid) |
| 3017 | else: |
| 3018 | q.text('None') |
| 3019 | q.text(","); q.breakable() |
| 3020 | q.text("status = "); |
| 3021 | q.text("%#x" % self.status) |
| 3022 | q.text(","); q.breakable() |
| 3023 | q.text("vport_no = "); |
| 3024 | q.text("%#x" % self.vport_no) |
| 3025 | q.breakable() |
| 3026 | q.text('}') |
| 3027 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3028 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3029 | |
| 3030 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3031 | version = 3 |
| 3032 | type = 4 |
| 3033 | experimenter = 6035143 |
| 3034 | subtype = 15 |
| 3035 | |
| 3036 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3037 | if xid != None: |
| 3038 | self.xid = xid |
| 3039 | else: |
| 3040 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3041 | if vport != None: |
| 3042 | self.vport = vport |
| 3043 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3044 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3045 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3046 | |
| 3047 | def pack(self): |
| 3048 | packed = [] |
| 3049 | packed.append(struct.pack("!B", self.version)) |
| 3050 | packed.append(struct.pack("!B", self.type)) |
| 3051 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3052 | packed.append(struct.pack("!L", self.xid)) |
| 3053 | packed.append(struct.pack("!L", self.experimenter)) |
| 3054 | packed.append(struct.pack("!L", self.subtype)) |
| 3055 | packed.append(self.vport.pack()) |
| 3056 | length = sum([len(x) for x in packed]) |
| 3057 | packed[2] = struct.pack("!H", length) |
| 3058 | return ''.join(packed) |
| 3059 | |
| 3060 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3061 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3062 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3063 | _version = reader.read("!B")[0] |
| 3064 | assert(_version == 3) |
| 3065 | _type = reader.read("!B")[0] |
| 3066 | assert(_type == 4) |
| 3067 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3068 | orig_reader = reader |
| 3069 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3070 | obj.xid = reader.read("!L")[0] |
| 3071 | _experimenter = reader.read("!L")[0] |
| 3072 | assert(_experimenter == 6035143) |
| 3073 | _subtype = reader.read("!L")[0] |
| 3074 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3075 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3076 | return obj |
| 3077 | |
| 3078 | def __eq__(self, other): |
| 3079 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3080 | if self.xid != other.xid: return False |
| 3081 | if self.vport != other.vport: return False |
| 3082 | return True |
| 3083 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3084 | def pretty_print(self, q): |
| 3085 | q.text("bsn_virtual_port_create_request {") |
| 3086 | with q.group(): |
| 3087 | with q.indent(2): |
| 3088 | q.breakable() |
| 3089 | q.text("xid = "); |
| 3090 | if self.xid != None: |
| 3091 | q.text("%#x" % self.xid) |
| 3092 | else: |
| 3093 | q.text('None') |
| 3094 | q.text(","); q.breakable() |
| 3095 | q.text("vport = "); |
| 3096 | q.pp(self.vport) |
| 3097 | q.breakable() |
| 3098 | q.text('}') |
| 3099 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3100 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3101 | |
| 3102 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3103 | version = 3 |
| 3104 | type = 4 |
| 3105 | experimenter = 6035143 |
| 3106 | subtype = 26 |
| 3107 | |
| 3108 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3109 | if xid != None: |
| 3110 | self.xid = xid |
| 3111 | else: |
| 3112 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3113 | if status != None: |
| 3114 | self.status = status |
| 3115 | else: |
| 3116 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3117 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3118 | |
| 3119 | def pack(self): |
| 3120 | packed = [] |
| 3121 | packed.append(struct.pack("!B", self.version)) |
| 3122 | packed.append(struct.pack("!B", self.type)) |
| 3123 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3124 | packed.append(struct.pack("!L", self.xid)) |
| 3125 | packed.append(struct.pack("!L", self.experimenter)) |
| 3126 | packed.append(struct.pack("!L", self.subtype)) |
| 3127 | packed.append(struct.pack("!L", self.status)) |
| 3128 | length = sum([len(x) for x in packed]) |
| 3129 | packed[2] = struct.pack("!H", length) |
| 3130 | return ''.join(packed) |
| 3131 | |
| 3132 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3133 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3134 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3135 | _version = reader.read("!B")[0] |
| 3136 | assert(_version == 3) |
| 3137 | _type = reader.read("!B")[0] |
| 3138 | assert(_type == 4) |
| 3139 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3140 | orig_reader = reader |
| 3141 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3142 | obj.xid = reader.read("!L")[0] |
| 3143 | _experimenter = reader.read("!L")[0] |
| 3144 | assert(_experimenter == 6035143) |
| 3145 | _subtype = reader.read("!L")[0] |
| 3146 | assert(_subtype == 26) |
| 3147 | obj.status = reader.read("!L")[0] |
| 3148 | return obj |
| 3149 | |
| 3150 | def __eq__(self, other): |
| 3151 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3152 | if self.xid != other.xid: return False |
| 3153 | if self.status != other.status: return False |
| 3154 | return True |
| 3155 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3156 | def pretty_print(self, q): |
| 3157 | q.text("bsn_virtual_port_remove_reply {") |
| 3158 | with q.group(): |
| 3159 | with q.indent(2): |
| 3160 | q.breakable() |
| 3161 | q.text("xid = "); |
| 3162 | if self.xid != None: |
| 3163 | q.text("%#x" % self.xid) |
| 3164 | else: |
| 3165 | q.text('None') |
| 3166 | q.text(","); q.breakable() |
| 3167 | q.text("status = "); |
| 3168 | q.text("%#x" % self.status) |
| 3169 | q.breakable() |
| 3170 | q.text('}') |
| 3171 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3172 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3173 | |
| 3174 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3175 | version = 3 |
| 3176 | type = 4 |
| 3177 | experimenter = 6035143 |
| 3178 | subtype = 17 |
| 3179 | |
| 3180 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3181 | if xid != None: |
| 3182 | self.xid = xid |
| 3183 | else: |
| 3184 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3185 | if vport_no != None: |
| 3186 | self.vport_no = vport_no |
| 3187 | else: |
| 3188 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3189 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3190 | |
| 3191 | def pack(self): |
| 3192 | packed = [] |
| 3193 | packed.append(struct.pack("!B", self.version)) |
| 3194 | packed.append(struct.pack("!B", self.type)) |
| 3195 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3196 | packed.append(struct.pack("!L", self.xid)) |
| 3197 | packed.append(struct.pack("!L", self.experimenter)) |
| 3198 | packed.append(struct.pack("!L", self.subtype)) |
| 3199 | packed.append(struct.pack("!L", self.vport_no)) |
| 3200 | length = sum([len(x) for x in packed]) |
| 3201 | packed[2] = struct.pack("!H", length) |
| 3202 | return ''.join(packed) |
| 3203 | |
| 3204 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3205 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3206 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3207 | _version = reader.read("!B")[0] |
| 3208 | assert(_version == 3) |
| 3209 | _type = reader.read("!B")[0] |
| 3210 | assert(_type == 4) |
| 3211 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3212 | orig_reader = reader |
| 3213 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3214 | obj.xid = reader.read("!L")[0] |
| 3215 | _experimenter = reader.read("!L")[0] |
| 3216 | assert(_experimenter == 6035143) |
| 3217 | _subtype = reader.read("!L")[0] |
| 3218 | assert(_subtype == 17) |
| 3219 | obj.vport_no = reader.read("!L")[0] |
| 3220 | return obj |
| 3221 | |
| 3222 | def __eq__(self, other): |
| 3223 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3224 | if self.xid != other.xid: return False |
| 3225 | if self.vport_no != other.vport_no: return False |
| 3226 | return True |
| 3227 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3228 | def pretty_print(self, q): |
| 3229 | q.text("bsn_virtual_port_remove_request {") |
| 3230 | with q.group(): |
| 3231 | with q.indent(2): |
| 3232 | q.breakable() |
| 3233 | q.text("xid = "); |
| 3234 | if self.xid != None: |
| 3235 | q.text("%#x" % self.xid) |
| 3236 | else: |
| 3237 | q.text('None') |
| 3238 | q.text(","); q.breakable() |
| 3239 | q.text("vport_no = "); |
| 3240 | q.text("%#x" % self.vport_no) |
| 3241 | q.breakable() |
| 3242 | q.text('}') |
| 3243 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3244 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3245 | |
| 3246 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3247 | version = 3 |
| 3248 | type = 19 |
| 3249 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3250 | |
| 3251 | 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] | 3252 | if xid != None: |
| 3253 | self.xid = xid |
| 3254 | else: |
| 3255 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3256 | if flags != None: |
| 3257 | self.flags = flags |
| 3258 | else: |
| 3259 | self.flags = 0 |
| 3260 | if mfr_desc != None: |
| 3261 | self.mfr_desc = mfr_desc |
| 3262 | else: |
| 3263 | self.mfr_desc = "" |
| 3264 | if hw_desc != None: |
| 3265 | self.hw_desc = hw_desc |
| 3266 | else: |
| 3267 | self.hw_desc = "" |
| 3268 | if sw_desc != None: |
| 3269 | self.sw_desc = sw_desc |
| 3270 | else: |
| 3271 | self.sw_desc = "" |
| 3272 | if serial_num != None: |
| 3273 | self.serial_num = serial_num |
| 3274 | else: |
| 3275 | self.serial_num = "" |
| 3276 | if dp_desc != None: |
| 3277 | self.dp_desc = dp_desc |
| 3278 | else: |
| 3279 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3280 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3281 | |
| 3282 | def pack(self): |
| 3283 | packed = [] |
| 3284 | packed.append(struct.pack("!B", self.version)) |
| 3285 | packed.append(struct.pack("!B", self.type)) |
| 3286 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3287 | packed.append(struct.pack("!L", self.xid)) |
| 3288 | packed.append(struct.pack("!H", self.stats_type)) |
| 3289 | packed.append(struct.pack("!H", self.flags)) |
| 3290 | packed.append('\x00' * 4) |
| 3291 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 3292 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 3293 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 3294 | packed.append(struct.pack("!32s", self.serial_num)) |
| 3295 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 3296 | length = sum([len(x) for x in packed]) |
| 3297 | packed[2] = struct.pack("!H", length) |
| 3298 | return ''.join(packed) |
| 3299 | |
| 3300 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3301 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3302 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3303 | _version = reader.read("!B")[0] |
| 3304 | assert(_version == 3) |
| 3305 | _type = reader.read("!B")[0] |
| 3306 | assert(_type == 19) |
| 3307 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3308 | orig_reader = reader |
| 3309 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3310 | obj.xid = reader.read("!L")[0] |
| 3311 | _stats_type = reader.read("!H")[0] |
| 3312 | assert(_stats_type == 0) |
| 3313 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3314 | reader.skip(4) |
| 3315 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3316 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3317 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3318 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 3319 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3320 | return obj |
| 3321 | |
| 3322 | def __eq__(self, other): |
| 3323 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3324 | if self.xid != other.xid: return False |
| 3325 | if self.flags != other.flags: return False |
| 3326 | if self.mfr_desc != other.mfr_desc: return False |
| 3327 | if self.hw_desc != other.hw_desc: return False |
| 3328 | if self.sw_desc != other.sw_desc: return False |
| 3329 | if self.serial_num != other.serial_num: return False |
| 3330 | if self.dp_desc != other.dp_desc: return False |
| 3331 | return True |
| 3332 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3333 | def pretty_print(self, q): |
| 3334 | q.text("desc_stats_reply {") |
| 3335 | with q.group(): |
| 3336 | with q.indent(2): |
| 3337 | q.breakable() |
| 3338 | q.text("xid = "); |
| 3339 | if self.xid != None: |
| 3340 | q.text("%#x" % self.xid) |
| 3341 | else: |
| 3342 | q.text('None') |
| 3343 | q.text(","); q.breakable() |
| 3344 | q.text("flags = "); |
| 3345 | q.text("%#x" % self.flags) |
| 3346 | q.text(","); q.breakable() |
| 3347 | q.text("mfr_desc = "); |
| 3348 | q.pp(self.mfr_desc) |
| 3349 | q.text(","); q.breakable() |
| 3350 | q.text("hw_desc = "); |
| 3351 | q.pp(self.hw_desc) |
| 3352 | q.text(","); q.breakable() |
| 3353 | q.text("sw_desc = "); |
| 3354 | q.pp(self.sw_desc) |
| 3355 | q.text(","); q.breakable() |
| 3356 | q.text("serial_num = "); |
| 3357 | q.pp(self.serial_num) |
| 3358 | q.text(","); q.breakable() |
| 3359 | q.text("dp_desc = "); |
| 3360 | q.pp(self.dp_desc) |
| 3361 | q.breakable() |
| 3362 | q.text('}') |
| 3363 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3364 | stats_reply.subtypes[0] = desc_stats_reply |
| 3365 | |
| 3366 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3367 | version = 3 |
| 3368 | type = 18 |
| 3369 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3370 | |
| 3371 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3372 | if xid != None: |
| 3373 | self.xid = xid |
| 3374 | else: |
| 3375 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3376 | if flags != None: |
| 3377 | self.flags = flags |
| 3378 | else: |
| 3379 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3380 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3381 | |
| 3382 | def pack(self): |
| 3383 | packed = [] |
| 3384 | packed.append(struct.pack("!B", self.version)) |
| 3385 | packed.append(struct.pack("!B", self.type)) |
| 3386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3387 | packed.append(struct.pack("!L", self.xid)) |
| 3388 | packed.append(struct.pack("!H", self.stats_type)) |
| 3389 | packed.append(struct.pack("!H", self.flags)) |
| 3390 | packed.append('\x00' * 4) |
| 3391 | length = sum([len(x) for x in packed]) |
| 3392 | packed[2] = struct.pack("!H", length) |
| 3393 | return ''.join(packed) |
| 3394 | |
| 3395 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3396 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3397 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3398 | _version = reader.read("!B")[0] |
| 3399 | assert(_version == 3) |
| 3400 | _type = reader.read("!B")[0] |
| 3401 | assert(_type == 18) |
| 3402 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3403 | orig_reader = reader |
| 3404 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3405 | obj.xid = reader.read("!L")[0] |
| 3406 | _stats_type = reader.read("!H")[0] |
| 3407 | assert(_stats_type == 0) |
| 3408 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3409 | reader.skip(4) |
| 3410 | return obj |
| 3411 | |
| 3412 | def __eq__(self, other): |
| 3413 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3414 | if self.xid != other.xid: return False |
| 3415 | if self.flags != other.flags: return False |
| 3416 | return True |
| 3417 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3418 | def pretty_print(self, q): |
| 3419 | q.text("desc_stats_request {") |
| 3420 | with q.group(): |
| 3421 | with q.indent(2): |
| 3422 | q.breakable() |
| 3423 | q.text("xid = "); |
| 3424 | if self.xid != None: |
| 3425 | q.text("%#x" % self.xid) |
| 3426 | else: |
| 3427 | q.text('None') |
| 3428 | q.text(","); q.breakable() |
| 3429 | q.text("flags = "); |
| 3430 | q.text("%#x" % self.flags) |
| 3431 | q.breakable() |
| 3432 | q.text('}') |
| 3433 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3434 | stats_request.subtypes[0] = desc_stats_request |
| 3435 | |
| 3436 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3437 | version = 3 |
| 3438 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3439 | |
| 3440 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3441 | if xid != None: |
| 3442 | self.xid = xid |
| 3443 | else: |
| 3444 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3445 | if data != None: |
| 3446 | self.data = data |
| 3447 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3448 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3449 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3450 | |
| 3451 | def pack(self): |
| 3452 | packed = [] |
| 3453 | packed.append(struct.pack("!B", self.version)) |
| 3454 | packed.append(struct.pack("!B", self.type)) |
| 3455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3456 | packed.append(struct.pack("!L", self.xid)) |
| 3457 | packed.append(self.data) |
| 3458 | length = sum([len(x) for x in packed]) |
| 3459 | packed[2] = struct.pack("!H", length) |
| 3460 | return ''.join(packed) |
| 3461 | |
| 3462 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3463 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3464 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3465 | _version = reader.read("!B")[0] |
| 3466 | assert(_version == 3) |
| 3467 | _type = reader.read("!B")[0] |
| 3468 | assert(_type == 3) |
| 3469 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3470 | orig_reader = reader |
| 3471 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3472 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3473 | obj.data = str(reader.read_all()) |
| 3474 | return obj |
| 3475 | |
| 3476 | def __eq__(self, other): |
| 3477 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3478 | if self.xid != other.xid: return False |
| 3479 | if self.data != other.data: return False |
| 3480 | return True |
| 3481 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3482 | def pretty_print(self, q): |
| 3483 | q.text("echo_reply {") |
| 3484 | with q.group(): |
| 3485 | with q.indent(2): |
| 3486 | q.breakable() |
| 3487 | q.text("xid = "); |
| 3488 | if self.xid != None: |
| 3489 | q.text("%#x" % self.xid) |
| 3490 | else: |
| 3491 | q.text('None') |
| 3492 | q.text(","); q.breakable() |
| 3493 | q.text("data = "); |
| 3494 | q.pp(self.data) |
| 3495 | q.breakable() |
| 3496 | q.text('}') |
| 3497 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3498 | message.subtypes[3] = echo_reply |
| 3499 | |
| 3500 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3501 | version = 3 |
| 3502 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3503 | |
| 3504 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3505 | if xid != None: |
| 3506 | self.xid = xid |
| 3507 | else: |
| 3508 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3509 | if data != None: |
| 3510 | self.data = data |
| 3511 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3512 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3513 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3514 | |
| 3515 | def pack(self): |
| 3516 | packed = [] |
| 3517 | packed.append(struct.pack("!B", self.version)) |
| 3518 | packed.append(struct.pack("!B", self.type)) |
| 3519 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3520 | packed.append(struct.pack("!L", self.xid)) |
| 3521 | packed.append(self.data) |
| 3522 | length = sum([len(x) for x in packed]) |
| 3523 | packed[2] = struct.pack("!H", length) |
| 3524 | return ''.join(packed) |
| 3525 | |
| 3526 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3527 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3528 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3529 | _version = reader.read("!B")[0] |
| 3530 | assert(_version == 3) |
| 3531 | _type = reader.read("!B")[0] |
| 3532 | assert(_type == 2) |
| 3533 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3534 | orig_reader = reader |
| 3535 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3536 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3537 | obj.data = str(reader.read_all()) |
| 3538 | return obj |
| 3539 | |
| 3540 | def __eq__(self, other): |
| 3541 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3542 | if self.xid != other.xid: return False |
| 3543 | if self.data != other.data: return False |
| 3544 | return True |
| 3545 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3546 | def pretty_print(self, q): |
| 3547 | q.text("echo_request {") |
| 3548 | with q.group(): |
| 3549 | with q.indent(2): |
| 3550 | q.breakable() |
| 3551 | q.text("xid = "); |
| 3552 | if self.xid != None: |
| 3553 | q.text("%#x" % self.xid) |
| 3554 | else: |
| 3555 | q.text('None') |
| 3556 | q.text(","); q.breakable() |
| 3557 | q.text("data = "); |
| 3558 | q.pp(self.data) |
| 3559 | q.breakable() |
| 3560 | q.text('}') |
| 3561 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3562 | message.subtypes[2] = echo_request |
| 3563 | |
| 3564 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3565 | version = 3 |
| 3566 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3567 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3568 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3569 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3570 | if xid != None: |
| 3571 | self.xid = xid |
| 3572 | else: |
| 3573 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3574 | if subtype != None: |
| 3575 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3576 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3577 | self.subtype = 0 |
| 3578 | if experimenter != None: |
| 3579 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3580 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3581 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3582 | if data != None: |
| 3583 | self.data = data |
| 3584 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3585 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3586 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3587 | |
| 3588 | def pack(self): |
| 3589 | packed = [] |
| 3590 | packed.append(struct.pack("!B", self.version)) |
| 3591 | packed.append(struct.pack("!B", self.type)) |
| 3592 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3593 | packed.append(struct.pack("!L", self.xid)) |
| 3594 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3595 | packed.append(struct.pack("!H", self.subtype)) |
| 3596 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3597 | packed.append(self.data) |
| 3598 | length = sum([len(x) for x in packed]) |
| 3599 | packed[2] = struct.pack("!H", length) |
| 3600 | return ''.join(packed) |
| 3601 | |
| 3602 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3603 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3604 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3605 | _version = reader.read("!B")[0] |
| 3606 | assert(_version == 3) |
| 3607 | _type = reader.read("!B")[0] |
| 3608 | assert(_type == 1) |
| 3609 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3610 | orig_reader = reader |
| 3611 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3612 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3613 | _err_type = reader.read("!H")[0] |
| 3614 | assert(_err_type == 65535) |
| 3615 | obj.subtype = reader.read("!H")[0] |
| 3616 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3617 | obj.data = str(reader.read_all()) |
| 3618 | return obj |
| 3619 | |
| 3620 | def __eq__(self, other): |
| 3621 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3622 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3623 | if self.subtype != other.subtype: return False |
| 3624 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3625 | if self.data != other.data: return False |
| 3626 | return True |
| 3627 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3628 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3629 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3630 | with q.group(): |
| 3631 | with q.indent(2): |
| 3632 | q.breakable() |
| 3633 | q.text("xid = "); |
| 3634 | if self.xid != None: |
| 3635 | q.text("%#x" % self.xid) |
| 3636 | else: |
| 3637 | q.text('None') |
| 3638 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3639 | q.text("subtype = "); |
| 3640 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3641 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3642 | q.text("experimenter = "); |
| 3643 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3644 | q.text(","); q.breakable() |
| 3645 | q.text("data = "); |
| 3646 | q.pp(self.data) |
| 3647 | q.breakable() |
| 3648 | q.text('}') |
| 3649 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3650 | error_msg.subtypes[65535] = experimenter_error_msg |
| 3651 | |
| 3652 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3653 | version = 3 |
| 3654 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3655 | |
| 3656 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3657 | if xid != None: |
| 3658 | self.xid = xid |
| 3659 | else: |
| 3660 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3661 | if datapath_id != None: |
| 3662 | self.datapath_id = datapath_id |
| 3663 | else: |
| 3664 | self.datapath_id = 0 |
| 3665 | if n_buffers != None: |
| 3666 | self.n_buffers = n_buffers |
| 3667 | else: |
| 3668 | self.n_buffers = 0 |
| 3669 | if n_tables != None: |
| 3670 | self.n_tables = n_tables |
| 3671 | else: |
| 3672 | self.n_tables = 0 |
| 3673 | if capabilities != None: |
| 3674 | self.capabilities = capabilities |
| 3675 | else: |
| 3676 | self.capabilities = 0 |
| 3677 | if reserved != None: |
| 3678 | self.reserved = reserved |
| 3679 | else: |
| 3680 | self.reserved = 0 |
| 3681 | if ports != None: |
| 3682 | self.ports = ports |
| 3683 | else: |
| 3684 | self.ports = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3685 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3686 | |
| 3687 | def pack(self): |
| 3688 | packed = [] |
| 3689 | packed.append(struct.pack("!B", self.version)) |
| 3690 | packed.append(struct.pack("!B", self.type)) |
| 3691 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3692 | packed.append(struct.pack("!L", self.xid)) |
| 3693 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 3694 | packed.append(struct.pack("!L", self.n_buffers)) |
| 3695 | packed.append(struct.pack("!B", self.n_tables)) |
| 3696 | packed.append('\x00' * 3) |
| 3697 | packed.append(struct.pack("!L", self.capabilities)) |
| 3698 | packed.append(struct.pack("!L", self.reserved)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3699 | packed.append(loxi.generic_util.pack_list(self.ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3700 | length = sum([len(x) for x in packed]) |
| 3701 | packed[2] = struct.pack("!H", length) |
| 3702 | return ''.join(packed) |
| 3703 | |
| 3704 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3705 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3706 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3707 | _version = reader.read("!B")[0] |
| 3708 | assert(_version == 3) |
| 3709 | _type = reader.read("!B")[0] |
| 3710 | assert(_type == 6) |
| 3711 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3712 | orig_reader = reader |
| 3713 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3714 | obj.xid = reader.read("!L")[0] |
| 3715 | obj.datapath_id = reader.read("!Q")[0] |
| 3716 | obj.n_buffers = reader.read("!L")[0] |
| 3717 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3718 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3719 | obj.capabilities = reader.read("!L")[0] |
| 3720 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3721 | obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 3722 | return obj |
| 3723 | |
| 3724 | def __eq__(self, other): |
| 3725 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3726 | if self.xid != other.xid: return False |
| 3727 | if self.datapath_id != other.datapath_id: return False |
| 3728 | if self.n_buffers != other.n_buffers: return False |
| 3729 | if self.n_tables != other.n_tables: return False |
| 3730 | if self.capabilities != other.capabilities: return False |
| 3731 | if self.reserved != other.reserved: return False |
| 3732 | if self.ports != other.ports: return False |
| 3733 | return True |
| 3734 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3735 | def pretty_print(self, q): |
| 3736 | q.text("features_reply {") |
| 3737 | with q.group(): |
| 3738 | with q.indent(2): |
| 3739 | q.breakable() |
| 3740 | q.text("xid = "); |
| 3741 | if self.xid != None: |
| 3742 | q.text("%#x" % self.xid) |
| 3743 | else: |
| 3744 | q.text('None') |
| 3745 | q.text(","); q.breakable() |
| 3746 | q.text("datapath_id = "); |
| 3747 | q.text("%#x" % self.datapath_id) |
| 3748 | q.text(","); q.breakable() |
| 3749 | q.text("n_buffers = "); |
| 3750 | q.text("%#x" % self.n_buffers) |
| 3751 | q.text(","); q.breakable() |
| 3752 | q.text("n_tables = "); |
| 3753 | q.text("%#x" % self.n_tables) |
| 3754 | q.text(","); q.breakable() |
| 3755 | q.text("capabilities = "); |
| 3756 | q.text("%#x" % self.capabilities) |
| 3757 | q.text(","); q.breakable() |
| 3758 | q.text("reserved = "); |
| 3759 | q.text("%#x" % self.reserved) |
| 3760 | q.text(","); q.breakable() |
| 3761 | q.text("ports = "); |
| 3762 | q.pp(self.ports) |
| 3763 | q.breakable() |
| 3764 | q.text('}') |
| 3765 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3766 | message.subtypes[6] = features_reply |
| 3767 | |
| 3768 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3769 | version = 3 |
| 3770 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3771 | |
| 3772 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3773 | if xid != None: |
| 3774 | self.xid = xid |
| 3775 | else: |
| 3776 | self.xid = None |
| 3777 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3778 | |
| 3779 | def pack(self): |
| 3780 | packed = [] |
| 3781 | packed.append(struct.pack("!B", self.version)) |
| 3782 | packed.append(struct.pack("!B", self.type)) |
| 3783 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3784 | packed.append(struct.pack("!L", self.xid)) |
| 3785 | length = sum([len(x) for x in packed]) |
| 3786 | packed[2] = struct.pack("!H", length) |
| 3787 | return ''.join(packed) |
| 3788 | |
| 3789 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3790 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3791 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3792 | _version = reader.read("!B")[0] |
| 3793 | assert(_version == 3) |
| 3794 | _type = reader.read("!B")[0] |
| 3795 | assert(_type == 5) |
| 3796 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3797 | orig_reader = reader |
| 3798 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3799 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3800 | return obj |
| 3801 | |
| 3802 | def __eq__(self, other): |
| 3803 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3804 | if self.xid != other.xid: return False |
| 3805 | return True |
| 3806 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3807 | def pretty_print(self, q): |
| 3808 | q.text("features_request {") |
| 3809 | with q.group(): |
| 3810 | with q.indent(2): |
| 3811 | q.breakable() |
| 3812 | q.text("xid = "); |
| 3813 | if self.xid != None: |
| 3814 | q.text("%#x" % self.xid) |
| 3815 | else: |
| 3816 | q.text('None') |
| 3817 | q.breakable() |
| 3818 | q.text('}') |
| 3819 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3820 | message.subtypes[5] = features_request |
| 3821 | |
| 3822 | class flow_mod(message): |
| 3823 | subtypes = {} |
| 3824 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3825 | version = 3 |
| 3826 | type = 14 |
| 3827 | |
| 3828 | 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): |
| 3829 | if xid != None: |
| 3830 | self.xid = xid |
| 3831 | else: |
| 3832 | self.xid = None |
| 3833 | if cookie != None: |
| 3834 | self.cookie = cookie |
| 3835 | else: |
| 3836 | self.cookie = 0 |
| 3837 | if cookie_mask != None: |
| 3838 | self.cookie_mask = cookie_mask |
| 3839 | else: |
| 3840 | self.cookie_mask = 0 |
| 3841 | if table_id != None: |
| 3842 | self.table_id = table_id |
| 3843 | else: |
| 3844 | self.table_id = 0 |
| 3845 | if _command != None: |
| 3846 | self._command = _command |
| 3847 | else: |
| 3848 | self._command = 0 |
| 3849 | if idle_timeout != None: |
| 3850 | self.idle_timeout = idle_timeout |
| 3851 | else: |
| 3852 | self.idle_timeout = 0 |
| 3853 | if hard_timeout != None: |
| 3854 | self.hard_timeout = hard_timeout |
| 3855 | else: |
| 3856 | self.hard_timeout = 0 |
| 3857 | if priority != None: |
| 3858 | self.priority = priority |
| 3859 | else: |
| 3860 | self.priority = 0 |
| 3861 | if buffer_id != None: |
| 3862 | self.buffer_id = buffer_id |
| 3863 | else: |
| 3864 | self.buffer_id = 0 |
| 3865 | if out_port != None: |
| 3866 | self.out_port = out_port |
| 3867 | else: |
| 3868 | self.out_port = 0 |
| 3869 | if out_group != None: |
| 3870 | self.out_group = out_group |
| 3871 | else: |
| 3872 | self.out_group = 0 |
| 3873 | if flags != None: |
| 3874 | self.flags = flags |
| 3875 | else: |
| 3876 | self.flags = 0 |
| 3877 | if match != None: |
| 3878 | self.match = match |
| 3879 | else: |
| 3880 | self.match = common.match() |
| 3881 | if instructions != None: |
| 3882 | self.instructions = instructions |
| 3883 | else: |
| 3884 | self.instructions = [] |
| 3885 | return |
| 3886 | |
| 3887 | def pack(self): |
| 3888 | packed = [] |
| 3889 | packed.append(struct.pack("!B", self.version)) |
| 3890 | packed.append(struct.pack("!B", self.type)) |
| 3891 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3892 | packed.append(struct.pack("!L", self.xid)) |
| 3893 | packed.append(struct.pack("!Q", self.cookie)) |
| 3894 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3895 | packed.append(struct.pack("!B", self.table_id)) |
| 3896 | packed.append(util.pack_fm_cmd(self._command)) |
| 3897 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3898 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3899 | packed.append(struct.pack("!H", self.priority)) |
| 3900 | packed.append(struct.pack("!L", self.buffer_id)) |
| 3901 | packed.append(util.pack_port_no(self.out_port)) |
| 3902 | packed.append(struct.pack("!L", self.out_group)) |
| 3903 | packed.append(struct.pack("!H", self.flags)) |
| 3904 | packed.append('\x00' * 2) |
| 3905 | packed.append(self.match.pack()) |
| 3906 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 3907 | length = sum([len(x) for x in packed]) |
| 3908 | packed[2] = struct.pack("!H", length) |
| 3909 | return ''.join(packed) |
| 3910 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3911 | @staticmethod |
| 3912 | def unpack(reader): |
| 3913 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3914 | subclass = flow_mod.subtypes.get(subtype) |
| 3915 | if subclass: |
| 3916 | return subclass.unpack(reader) |
| 3917 | |
| 3918 | obj = flow_mod() |
| 3919 | _version = reader.read("!B")[0] |
| 3920 | assert(_version == 3) |
| 3921 | _type = reader.read("!B")[0] |
| 3922 | assert(_type == 14) |
| 3923 | _length = reader.read("!H")[0] |
| 3924 | orig_reader = reader |
| 3925 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3926 | obj.xid = reader.read("!L")[0] |
| 3927 | obj.cookie = reader.read("!Q")[0] |
| 3928 | obj.cookie_mask = reader.read("!Q")[0] |
| 3929 | obj.table_id = reader.read("!B")[0] |
| 3930 | obj._command = util.unpack_fm_cmd(reader) |
| 3931 | obj.idle_timeout = reader.read("!H")[0] |
| 3932 | obj.hard_timeout = reader.read("!H")[0] |
| 3933 | obj.priority = reader.read("!H")[0] |
| 3934 | obj.buffer_id = reader.read("!L")[0] |
| 3935 | obj.out_port = util.unpack_port_no(reader) |
| 3936 | obj.out_group = reader.read("!L")[0] |
| 3937 | obj.flags = reader.read("!H")[0] |
| 3938 | reader.skip(2) |
| 3939 | obj.match = common.match.unpack(reader) |
| 3940 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
| 3941 | return obj |
| 3942 | |
| 3943 | def __eq__(self, other): |
| 3944 | if type(self) != type(other): return False |
| 3945 | if self.xid != other.xid: return False |
| 3946 | if self.cookie != other.cookie: return False |
| 3947 | if self.cookie_mask != other.cookie_mask: return False |
| 3948 | if self.table_id != other.table_id: return False |
| 3949 | if self._command != other._command: return False |
| 3950 | if self.idle_timeout != other.idle_timeout: return False |
| 3951 | if self.hard_timeout != other.hard_timeout: return False |
| 3952 | if self.priority != other.priority: return False |
| 3953 | if self.buffer_id != other.buffer_id: return False |
| 3954 | if self.out_port != other.out_port: return False |
| 3955 | if self.out_group != other.out_group: return False |
| 3956 | if self.flags != other.flags: return False |
| 3957 | if self.match != other.match: return False |
| 3958 | if self.instructions != other.instructions: return False |
| 3959 | return True |
| 3960 | |
| 3961 | def pretty_print(self, q): |
| 3962 | q.text("flow_mod {") |
| 3963 | with q.group(): |
| 3964 | with q.indent(2): |
| 3965 | q.breakable() |
| 3966 | q.text("xid = "); |
| 3967 | if self.xid != None: |
| 3968 | q.text("%#x" % self.xid) |
| 3969 | else: |
| 3970 | q.text('None') |
| 3971 | q.text(","); q.breakable() |
| 3972 | q.text("cookie = "); |
| 3973 | q.text("%#x" % self.cookie) |
| 3974 | q.text(","); q.breakable() |
| 3975 | q.text("cookie_mask = "); |
| 3976 | q.text("%#x" % self.cookie_mask) |
| 3977 | q.text(","); q.breakable() |
| 3978 | q.text("table_id = "); |
| 3979 | q.text("%#x" % self.table_id) |
| 3980 | q.text(","); q.breakable() |
| 3981 | q.text("idle_timeout = "); |
| 3982 | q.text("%#x" % self.idle_timeout) |
| 3983 | q.text(","); q.breakable() |
| 3984 | q.text("hard_timeout = "); |
| 3985 | q.text("%#x" % self.hard_timeout) |
| 3986 | q.text(","); q.breakable() |
| 3987 | q.text("priority = "); |
| 3988 | q.text("%#x" % self.priority) |
| 3989 | q.text(","); q.breakable() |
| 3990 | q.text("buffer_id = "); |
| 3991 | q.text("%#x" % self.buffer_id) |
| 3992 | q.text(","); q.breakable() |
| 3993 | q.text("out_port = "); |
| 3994 | q.text(util.pretty_port(self.out_port)) |
| 3995 | q.text(","); q.breakable() |
| 3996 | q.text("out_group = "); |
| 3997 | q.text("%#x" % self.out_group) |
| 3998 | q.text(","); q.breakable() |
| 3999 | q.text("flags = "); |
| 4000 | q.text("%#x" % self.flags) |
| 4001 | q.text(","); q.breakable() |
| 4002 | q.text("match = "); |
| 4003 | q.pp(self.match) |
| 4004 | q.text(","); q.breakable() |
| 4005 | q.text("instructions = "); |
| 4006 | q.pp(self.instructions) |
| 4007 | q.breakable() |
| 4008 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4009 | |
| 4010 | message.subtypes[14] = flow_mod |
| 4011 | |
| 4012 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4013 | version = 3 |
| 4014 | type = 14 |
| 4015 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4016 | |
| 4017 | 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] | 4018 | if xid != None: |
| 4019 | self.xid = xid |
| 4020 | else: |
| 4021 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4022 | if cookie != None: |
| 4023 | self.cookie = cookie |
| 4024 | else: |
| 4025 | self.cookie = 0 |
| 4026 | if cookie_mask != None: |
| 4027 | self.cookie_mask = cookie_mask |
| 4028 | else: |
| 4029 | self.cookie_mask = 0 |
| 4030 | if table_id != None: |
| 4031 | self.table_id = table_id |
| 4032 | else: |
| 4033 | self.table_id = 0 |
| 4034 | if idle_timeout != None: |
| 4035 | self.idle_timeout = idle_timeout |
| 4036 | else: |
| 4037 | self.idle_timeout = 0 |
| 4038 | if hard_timeout != None: |
| 4039 | self.hard_timeout = hard_timeout |
| 4040 | else: |
| 4041 | self.hard_timeout = 0 |
| 4042 | if priority != None: |
| 4043 | self.priority = priority |
| 4044 | else: |
| 4045 | self.priority = 0 |
| 4046 | if buffer_id != None: |
| 4047 | self.buffer_id = buffer_id |
| 4048 | else: |
| 4049 | self.buffer_id = 0 |
| 4050 | if out_port != None: |
| 4051 | self.out_port = out_port |
| 4052 | else: |
| 4053 | self.out_port = 0 |
| 4054 | if out_group != None: |
| 4055 | self.out_group = out_group |
| 4056 | else: |
| 4057 | self.out_group = 0 |
| 4058 | if flags != None: |
| 4059 | self.flags = flags |
| 4060 | else: |
| 4061 | self.flags = 0 |
| 4062 | if match != None: |
| 4063 | self.match = match |
| 4064 | else: |
| 4065 | self.match = common.match() |
| 4066 | if instructions != None: |
| 4067 | self.instructions = instructions |
| 4068 | else: |
| 4069 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4070 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4071 | |
| 4072 | def pack(self): |
| 4073 | packed = [] |
| 4074 | packed.append(struct.pack("!B", self.version)) |
| 4075 | packed.append(struct.pack("!B", self.type)) |
| 4076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4077 | packed.append(struct.pack("!L", self.xid)) |
| 4078 | packed.append(struct.pack("!Q", self.cookie)) |
| 4079 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4080 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4081 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4082 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4083 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4084 | packed.append(struct.pack("!H", self.priority)) |
| 4085 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4086 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4087 | packed.append(struct.pack("!L", self.out_group)) |
| 4088 | packed.append(struct.pack("!H", self.flags)) |
| 4089 | packed.append('\x00' * 2) |
| 4090 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4091 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4092 | length = sum([len(x) for x in packed]) |
| 4093 | packed[2] = struct.pack("!H", length) |
| 4094 | return ''.join(packed) |
| 4095 | |
| 4096 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4097 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4098 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4099 | _version = reader.read("!B")[0] |
| 4100 | assert(_version == 3) |
| 4101 | _type = reader.read("!B")[0] |
| 4102 | assert(_type == 14) |
| 4103 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4104 | orig_reader = reader |
| 4105 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4106 | obj.xid = reader.read("!L")[0] |
| 4107 | obj.cookie = reader.read("!Q")[0] |
| 4108 | obj.cookie_mask = reader.read("!Q")[0] |
| 4109 | obj.table_id = reader.read("!B")[0] |
| 4110 | __command = util.unpack_fm_cmd(reader) |
| 4111 | assert(__command == 0) |
| 4112 | obj.idle_timeout = reader.read("!H")[0] |
| 4113 | obj.hard_timeout = reader.read("!H")[0] |
| 4114 | obj.priority = reader.read("!H")[0] |
| 4115 | obj.buffer_id = reader.read("!L")[0] |
| 4116 | obj.out_port = util.unpack_port_no(reader) |
| 4117 | obj.out_group = reader.read("!L")[0] |
| 4118 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4119 | reader.skip(2) |
| 4120 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4121 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4122 | return obj |
| 4123 | |
| 4124 | def __eq__(self, other): |
| 4125 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4126 | if self.xid != other.xid: return False |
| 4127 | if self.cookie != other.cookie: return False |
| 4128 | if self.cookie_mask != other.cookie_mask: return False |
| 4129 | if self.table_id != other.table_id: return False |
| 4130 | if self.idle_timeout != other.idle_timeout: return False |
| 4131 | if self.hard_timeout != other.hard_timeout: return False |
| 4132 | if self.priority != other.priority: return False |
| 4133 | if self.buffer_id != other.buffer_id: return False |
| 4134 | if self.out_port != other.out_port: return False |
| 4135 | if self.out_group != other.out_group: return False |
| 4136 | if self.flags != other.flags: return False |
| 4137 | if self.match != other.match: return False |
| 4138 | if self.instructions != other.instructions: return False |
| 4139 | return True |
| 4140 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4141 | def pretty_print(self, q): |
| 4142 | q.text("flow_add {") |
| 4143 | with q.group(): |
| 4144 | with q.indent(2): |
| 4145 | q.breakable() |
| 4146 | q.text("xid = "); |
| 4147 | if self.xid != None: |
| 4148 | q.text("%#x" % self.xid) |
| 4149 | else: |
| 4150 | q.text('None') |
| 4151 | q.text(","); q.breakable() |
| 4152 | q.text("cookie = "); |
| 4153 | q.text("%#x" % self.cookie) |
| 4154 | q.text(","); q.breakable() |
| 4155 | q.text("cookie_mask = "); |
| 4156 | q.text("%#x" % self.cookie_mask) |
| 4157 | q.text(","); q.breakable() |
| 4158 | q.text("table_id = "); |
| 4159 | q.text("%#x" % self.table_id) |
| 4160 | q.text(","); q.breakable() |
| 4161 | q.text("idle_timeout = "); |
| 4162 | q.text("%#x" % self.idle_timeout) |
| 4163 | q.text(","); q.breakable() |
| 4164 | q.text("hard_timeout = "); |
| 4165 | q.text("%#x" % self.hard_timeout) |
| 4166 | q.text(","); q.breakable() |
| 4167 | q.text("priority = "); |
| 4168 | q.text("%#x" % self.priority) |
| 4169 | q.text(","); q.breakable() |
| 4170 | q.text("buffer_id = "); |
| 4171 | q.text("%#x" % self.buffer_id) |
| 4172 | q.text(","); q.breakable() |
| 4173 | q.text("out_port = "); |
| 4174 | q.text(util.pretty_port(self.out_port)) |
| 4175 | q.text(","); q.breakable() |
| 4176 | q.text("out_group = "); |
| 4177 | q.text("%#x" % self.out_group) |
| 4178 | q.text(","); q.breakable() |
| 4179 | q.text("flags = "); |
| 4180 | q.text("%#x" % self.flags) |
| 4181 | q.text(","); q.breakable() |
| 4182 | q.text("match = "); |
| 4183 | q.pp(self.match) |
| 4184 | q.text(","); q.breakable() |
| 4185 | q.text("instructions = "); |
| 4186 | q.pp(self.instructions) |
| 4187 | q.breakable() |
| 4188 | q.text('}') |
| 4189 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4190 | flow_mod.subtypes[0] = flow_add |
| 4191 | |
| 4192 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4193 | version = 3 |
| 4194 | type = 14 |
| 4195 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4196 | |
| 4197 | 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] | 4198 | if xid != None: |
| 4199 | self.xid = xid |
| 4200 | else: |
| 4201 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4202 | if cookie != None: |
| 4203 | self.cookie = cookie |
| 4204 | else: |
| 4205 | self.cookie = 0 |
| 4206 | if cookie_mask != None: |
| 4207 | self.cookie_mask = cookie_mask |
| 4208 | else: |
| 4209 | self.cookie_mask = 0 |
| 4210 | if table_id != None: |
| 4211 | self.table_id = table_id |
| 4212 | else: |
| 4213 | self.table_id = 0 |
| 4214 | if idle_timeout != None: |
| 4215 | self.idle_timeout = idle_timeout |
| 4216 | else: |
| 4217 | self.idle_timeout = 0 |
| 4218 | if hard_timeout != None: |
| 4219 | self.hard_timeout = hard_timeout |
| 4220 | else: |
| 4221 | self.hard_timeout = 0 |
| 4222 | if priority != None: |
| 4223 | self.priority = priority |
| 4224 | else: |
| 4225 | self.priority = 0 |
| 4226 | if buffer_id != None: |
| 4227 | self.buffer_id = buffer_id |
| 4228 | else: |
| 4229 | self.buffer_id = 0 |
| 4230 | if out_port != None: |
| 4231 | self.out_port = out_port |
| 4232 | else: |
| 4233 | self.out_port = 0 |
| 4234 | if out_group != None: |
| 4235 | self.out_group = out_group |
| 4236 | else: |
| 4237 | self.out_group = 0 |
| 4238 | if flags != None: |
| 4239 | self.flags = flags |
| 4240 | else: |
| 4241 | self.flags = 0 |
| 4242 | if match != None: |
| 4243 | self.match = match |
| 4244 | else: |
| 4245 | self.match = common.match() |
| 4246 | if instructions != None: |
| 4247 | self.instructions = instructions |
| 4248 | else: |
| 4249 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4250 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4251 | |
| 4252 | def pack(self): |
| 4253 | packed = [] |
| 4254 | packed.append(struct.pack("!B", self.version)) |
| 4255 | packed.append(struct.pack("!B", self.type)) |
| 4256 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4257 | packed.append(struct.pack("!L", self.xid)) |
| 4258 | packed.append(struct.pack("!Q", self.cookie)) |
| 4259 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4260 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4261 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4262 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4263 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4264 | packed.append(struct.pack("!H", self.priority)) |
| 4265 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4266 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4267 | packed.append(struct.pack("!L", self.out_group)) |
| 4268 | packed.append(struct.pack("!H", self.flags)) |
| 4269 | packed.append('\x00' * 2) |
| 4270 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4271 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4272 | length = sum([len(x) for x in packed]) |
| 4273 | packed[2] = struct.pack("!H", length) |
| 4274 | return ''.join(packed) |
| 4275 | |
| 4276 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4277 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4278 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4279 | _version = reader.read("!B")[0] |
| 4280 | assert(_version == 3) |
| 4281 | _type = reader.read("!B")[0] |
| 4282 | assert(_type == 14) |
| 4283 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4284 | orig_reader = reader |
| 4285 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4286 | obj.xid = reader.read("!L")[0] |
| 4287 | obj.cookie = reader.read("!Q")[0] |
| 4288 | obj.cookie_mask = reader.read("!Q")[0] |
| 4289 | obj.table_id = reader.read("!B")[0] |
| 4290 | __command = util.unpack_fm_cmd(reader) |
| 4291 | assert(__command == 3) |
| 4292 | obj.idle_timeout = reader.read("!H")[0] |
| 4293 | obj.hard_timeout = reader.read("!H")[0] |
| 4294 | obj.priority = reader.read("!H")[0] |
| 4295 | obj.buffer_id = reader.read("!L")[0] |
| 4296 | obj.out_port = util.unpack_port_no(reader) |
| 4297 | obj.out_group = reader.read("!L")[0] |
| 4298 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4299 | reader.skip(2) |
| 4300 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4301 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4302 | return obj |
| 4303 | |
| 4304 | def __eq__(self, other): |
| 4305 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4306 | if self.xid != other.xid: return False |
| 4307 | if self.cookie != other.cookie: return False |
| 4308 | if self.cookie_mask != other.cookie_mask: return False |
| 4309 | if self.table_id != other.table_id: return False |
| 4310 | if self.idle_timeout != other.idle_timeout: return False |
| 4311 | if self.hard_timeout != other.hard_timeout: return False |
| 4312 | if self.priority != other.priority: return False |
| 4313 | if self.buffer_id != other.buffer_id: return False |
| 4314 | if self.out_port != other.out_port: return False |
| 4315 | if self.out_group != other.out_group: return False |
| 4316 | if self.flags != other.flags: return False |
| 4317 | if self.match != other.match: return False |
| 4318 | if self.instructions != other.instructions: return False |
| 4319 | return True |
| 4320 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4321 | def pretty_print(self, q): |
| 4322 | q.text("flow_delete {") |
| 4323 | with q.group(): |
| 4324 | with q.indent(2): |
| 4325 | q.breakable() |
| 4326 | q.text("xid = "); |
| 4327 | if self.xid != None: |
| 4328 | q.text("%#x" % self.xid) |
| 4329 | else: |
| 4330 | q.text('None') |
| 4331 | q.text(","); q.breakable() |
| 4332 | q.text("cookie = "); |
| 4333 | q.text("%#x" % self.cookie) |
| 4334 | q.text(","); q.breakable() |
| 4335 | q.text("cookie_mask = "); |
| 4336 | q.text("%#x" % self.cookie_mask) |
| 4337 | q.text(","); q.breakable() |
| 4338 | q.text("table_id = "); |
| 4339 | q.text("%#x" % self.table_id) |
| 4340 | q.text(","); q.breakable() |
| 4341 | q.text("idle_timeout = "); |
| 4342 | q.text("%#x" % self.idle_timeout) |
| 4343 | q.text(","); q.breakable() |
| 4344 | q.text("hard_timeout = "); |
| 4345 | q.text("%#x" % self.hard_timeout) |
| 4346 | q.text(","); q.breakable() |
| 4347 | q.text("priority = "); |
| 4348 | q.text("%#x" % self.priority) |
| 4349 | q.text(","); q.breakable() |
| 4350 | q.text("buffer_id = "); |
| 4351 | q.text("%#x" % self.buffer_id) |
| 4352 | q.text(","); q.breakable() |
| 4353 | q.text("out_port = "); |
| 4354 | q.text(util.pretty_port(self.out_port)) |
| 4355 | q.text(","); q.breakable() |
| 4356 | q.text("out_group = "); |
| 4357 | q.text("%#x" % self.out_group) |
| 4358 | q.text(","); q.breakable() |
| 4359 | q.text("flags = "); |
| 4360 | q.text("%#x" % self.flags) |
| 4361 | q.text(","); q.breakable() |
| 4362 | q.text("match = "); |
| 4363 | q.pp(self.match) |
| 4364 | q.text(","); q.breakable() |
| 4365 | q.text("instructions = "); |
| 4366 | q.pp(self.instructions) |
| 4367 | q.breakable() |
| 4368 | q.text('}') |
| 4369 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4370 | flow_mod.subtypes[3] = flow_delete |
| 4371 | |
| 4372 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4373 | version = 3 |
| 4374 | type = 14 |
| 4375 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4376 | |
| 4377 | 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] | 4378 | if xid != None: |
| 4379 | self.xid = xid |
| 4380 | else: |
| 4381 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4382 | if cookie != None: |
| 4383 | self.cookie = cookie |
| 4384 | else: |
| 4385 | self.cookie = 0 |
| 4386 | if cookie_mask != None: |
| 4387 | self.cookie_mask = cookie_mask |
| 4388 | else: |
| 4389 | self.cookie_mask = 0 |
| 4390 | if table_id != None: |
| 4391 | self.table_id = table_id |
| 4392 | else: |
| 4393 | self.table_id = 0 |
| 4394 | if idle_timeout != None: |
| 4395 | self.idle_timeout = idle_timeout |
| 4396 | else: |
| 4397 | self.idle_timeout = 0 |
| 4398 | if hard_timeout != None: |
| 4399 | self.hard_timeout = hard_timeout |
| 4400 | else: |
| 4401 | self.hard_timeout = 0 |
| 4402 | if priority != None: |
| 4403 | self.priority = priority |
| 4404 | else: |
| 4405 | self.priority = 0 |
| 4406 | if buffer_id != None: |
| 4407 | self.buffer_id = buffer_id |
| 4408 | else: |
| 4409 | self.buffer_id = 0 |
| 4410 | if out_port != None: |
| 4411 | self.out_port = out_port |
| 4412 | else: |
| 4413 | self.out_port = 0 |
| 4414 | if out_group != None: |
| 4415 | self.out_group = out_group |
| 4416 | else: |
| 4417 | self.out_group = 0 |
| 4418 | if flags != None: |
| 4419 | self.flags = flags |
| 4420 | else: |
| 4421 | self.flags = 0 |
| 4422 | if match != None: |
| 4423 | self.match = match |
| 4424 | else: |
| 4425 | self.match = common.match() |
| 4426 | if instructions != None: |
| 4427 | self.instructions = instructions |
| 4428 | else: |
| 4429 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4430 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4431 | |
| 4432 | def pack(self): |
| 4433 | packed = [] |
| 4434 | packed.append(struct.pack("!B", self.version)) |
| 4435 | packed.append(struct.pack("!B", self.type)) |
| 4436 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4437 | packed.append(struct.pack("!L", self.xid)) |
| 4438 | packed.append(struct.pack("!Q", self.cookie)) |
| 4439 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4440 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4441 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4442 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4443 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4444 | packed.append(struct.pack("!H", self.priority)) |
| 4445 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4446 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4447 | packed.append(struct.pack("!L", self.out_group)) |
| 4448 | packed.append(struct.pack("!H", self.flags)) |
| 4449 | packed.append('\x00' * 2) |
| 4450 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4451 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4452 | length = sum([len(x) for x in packed]) |
| 4453 | packed[2] = struct.pack("!H", length) |
| 4454 | return ''.join(packed) |
| 4455 | |
| 4456 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4457 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4458 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4459 | _version = reader.read("!B")[0] |
| 4460 | assert(_version == 3) |
| 4461 | _type = reader.read("!B")[0] |
| 4462 | assert(_type == 14) |
| 4463 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4464 | orig_reader = reader |
| 4465 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4466 | obj.xid = reader.read("!L")[0] |
| 4467 | obj.cookie = reader.read("!Q")[0] |
| 4468 | obj.cookie_mask = reader.read("!Q")[0] |
| 4469 | obj.table_id = reader.read("!B")[0] |
| 4470 | __command = util.unpack_fm_cmd(reader) |
| 4471 | assert(__command == 4) |
| 4472 | obj.idle_timeout = reader.read("!H")[0] |
| 4473 | obj.hard_timeout = reader.read("!H")[0] |
| 4474 | obj.priority = reader.read("!H")[0] |
| 4475 | obj.buffer_id = reader.read("!L")[0] |
| 4476 | obj.out_port = util.unpack_port_no(reader) |
| 4477 | obj.out_group = reader.read("!L")[0] |
| 4478 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4479 | reader.skip(2) |
| 4480 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4481 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4482 | return obj |
| 4483 | |
| 4484 | def __eq__(self, other): |
| 4485 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4486 | if self.xid != other.xid: return False |
| 4487 | if self.cookie != other.cookie: return False |
| 4488 | if self.cookie_mask != other.cookie_mask: return False |
| 4489 | if self.table_id != other.table_id: return False |
| 4490 | if self.idle_timeout != other.idle_timeout: return False |
| 4491 | if self.hard_timeout != other.hard_timeout: return False |
| 4492 | if self.priority != other.priority: return False |
| 4493 | if self.buffer_id != other.buffer_id: return False |
| 4494 | if self.out_port != other.out_port: return False |
| 4495 | if self.out_group != other.out_group: return False |
| 4496 | if self.flags != other.flags: return False |
| 4497 | if self.match != other.match: return False |
| 4498 | if self.instructions != other.instructions: return False |
| 4499 | return True |
| 4500 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4501 | def pretty_print(self, q): |
| 4502 | q.text("flow_delete_strict {") |
| 4503 | with q.group(): |
| 4504 | with q.indent(2): |
| 4505 | q.breakable() |
| 4506 | q.text("xid = "); |
| 4507 | if self.xid != None: |
| 4508 | q.text("%#x" % self.xid) |
| 4509 | else: |
| 4510 | q.text('None') |
| 4511 | q.text(","); q.breakable() |
| 4512 | q.text("cookie = "); |
| 4513 | q.text("%#x" % self.cookie) |
| 4514 | q.text(","); q.breakable() |
| 4515 | q.text("cookie_mask = "); |
| 4516 | q.text("%#x" % self.cookie_mask) |
| 4517 | q.text(","); q.breakable() |
| 4518 | q.text("table_id = "); |
| 4519 | q.text("%#x" % self.table_id) |
| 4520 | q.text(","); q.breakable() |
| 4521 | q.text("idle_timeout = "); |
| 4522 | q.text("%#x" % self.idle_timeout) |
| 4523 | q.text(","); q.breakable() |
| 4524 | q.text("hard_timeout = "); |
| 4525 | q.text("%#x" % self.hard_timeout) |
| 4526 | q.text(","); q.breakable() |
| 4527 | q.text("priority = "); |
| 4528 | q.text("%#x" % self.priority) |
| 4529 | q.text(","); q.breakable() |
| 4530 | q.text("buffer_id = "); |
| 4531 | q.text("%#x" % self.buffer_id) |
| 4532 | q.text(","); q.breakable() |
| 4533 | q.text("out_port = "); |
| 4534 | q.text(util.pretty_port(self.out_port)) |
| 4535 | q.text(","); q.breakable() |
| 4536 | q.text("out_group = "); |
| 4537 | q.text("%#x" % self.out_group) |
| 4538 | q.text(","); q.breakable() |
| 4539 | q.text("flags = "); |
| 4540 | q.text("%#x" % self.flags) |
| 4541 | q.text(","); q.breakable() |
| 4542 | q.text("match = "); |
| 4543 | q.pp(self.match) |
| 4544 | q.text(","); q.breakable() |
| 4545 | q.text("instructions = "); |
| 4546 | q.pp(self.instructions) |
| 4547 | q.breakable() |
| 4548 | q.text('}') |
| 4549 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4550 | flow_mod.subtypes[4] = flow_delete_strict |
| 4551 | |
| 4552 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4553 | version = 3 |
| 4554 | type = 1 |
| 4555 | err_type = 5 |
| 4556 | |
| 4557 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4558 | if xid != None: |
| 4559 | self.xid = xid |
| 4560 | else: |
| 4561 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4562 | if code != None: |
| 4563 | self.code = code |
| 4564 | else: |
| 4565 | self.code = 0 |
| 4566 | if data != None: |
| 4567 | self.data = data |
| 4568 | else: |
| 4569 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4570 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4571 | |
| 4572 | def pack(self): |
| 4573 | packed = [] |
| 4574 | packed.append(struct.pack("!B", self.version)) |
| 4575 | packed.append(struct.pack("!B", self.type)) |
| 4576 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4577 | packed.append(struct.pack("!L", self.xid)) |
| 4578 | packed.append(struct.pack("!H", self.err_type)) |
| 4579 | packed.append(struct.pack("!H", self.code)) |
| 4580 | packed.append(self.data) |
| 4581 | length = sum([len(x) for x in packed]) |
| 4582 | packed[2] = struct.pack("!H", length) |
| 4583 | return ''.join(packed) |
| 4584 | |
| 4585 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4586 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4587 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4588 | _version = reader.read("!B")[0] |
| 4589 | assert(_version == 3) |
| 4590 | _type = reader.read("!B")[0] |
| 4591 | assert(_type == 1) |
| 4592 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4593 | orig_reader = reader |
| 4594 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4595 | obj.xid = reader.read("!L")[0] |
| 4596 | _err_type = reader.read("!H")[0] |
| 4597 | assert(_err_type == 5) |
| 4598 | obj.code = reader.read("!H")[0] |
| 4599 | obj.data = str(reader.read_all()) |
| 4600 | return obj |
| 4601 | |
| 4602 | def __eq__(self, other): |
| 4603 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4604 | if self.xid != other.xid: return False |
| 4605 | if self.code != other.code: return False |
| 4606 | if self.data != other.data: return False |
| 4607 | return True |
| 4608 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4609 | def pretty_print(self, q): |
| 4610 | q.text("flow_mod_failed_error_msg {") |
| 4611 | with q.group(): |
| 4612 | with q.indent(2): |
| 4613 | q.breakable() |
| 4614 | q.text("xid = "); |
| 4615 | if self.xid != None: |
| 4616 | q.text("%#x" % self.xid) |
| 4617 | else: |
| 4618 | q.text('None') |
| 4619 | q.text(","); q.breakable() |
| 4620 | q.text("code = "); |
| 4621 | q.text("%#x" % self.code) |
| 4622 | q.text(","); q.breakable() |
| 4623 | q.text("data = "); |
| 4624 | q.pp(self.data) |
| 4625 | q.breakable() |
| 4626 | q.text('}') |
| 4627 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4628 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 4629 | |
| 4630 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4631 | version = 3 |
| 4632 | type = 14 |
| 4633 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4634 | |
| 4635 | 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] | 4636 | if xid != None: |
| 4637 | self.xid = xid |
| 4638 | else: |
| 4639 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4640 | if cookie != None: |
| 4641 | self.cookie = cookie |
| 4642 | else: |
| 4643 | self.cookie = 0 |
| 4644 | if cookie_mask != None: |
| 4645 | self.cookie_mask = cookie_mask |
| 4646 | else: |
| 4647 | self.cookie_mask = 0 |
| 4648 | if table_id != None: |
| 4649 | self.table_id = table_id |
| 4650 | else: |
| 4651 | self.table_id = 0 |
| 4652 | if idle_timeout != None: |
| 4653 | self.idle_timeout = idle_timeout |
| 4654 | else: |
| 4655 | self.idle_timeout = 0 |
| 4656 | if hard_timeout != None: |
| 4657 | self.hard_timeout = hard_timeout |
| 4658 | else: |
| 4659 | self.hard_timeout = 0 |
| 4660 | if priority != None: |
| 4661 | self.priority = priority |
| 4662 | else: |
| 4663 | self.priority = 0 |
| 4664 | if buffer_id != None: |
| 4665 | self.buffer_id = buffer_id |
| 4666 | else: |
| 4667 | self.buffer_id = 0 |
| 4668 | if out_port != None: |
| 4669 | self.out_port = out_port |
| 4670 | else: |
| 4671 | self.out_port = 0 |
| 4672 | if out_group != None: |
| 4673 | self.out_group = out_group |
| 4674 | else: |
| 4675 | self.out_group = 0 |
| 4676 | if flags != None: |
| 4677 | self.flags = flags |
| 4678 | else: |
| 4679 | self.flags = 0 |
| 4680 | if match != None: |
| 4681 | self.match = match |
| 4682 | else: |
| 4683 | self.match = common.match() |
| 4684 | if instructions != None: |
| 4685 | self.instructions = instructions |
| 4686 | else: |
| 4687 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4688 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4689 | |
| 4690 | def pack(self): |
| 4691 | packed = [] |
| 4692 | packed.append(struct.pack("!B", self.version)) |
| 4693 | packed.append(struct.pack("!B", self.type)) |
| 4694 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4695 | packed.append(struct.pack("!L", self.xid)) |
| 4696 | packed.append(struct.pack("!Q", self.cookie)) |
| 4697 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4698 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4699 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4700 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4701 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4702 | packed.append(struct.pack("!H", self.priority)) |
| 4703 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4704 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4705 | packed.append(struct.pack("!L", self.out_group)) |
| 4706 | packed.append(struct.pack("!H", self.flags)) |
| 4707 | packed.append('\x00' * 2) |
| 4708 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4709 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4710 | length = sum([len(x) for x in packed]) |
| 4711 | packed[2] = struct.pack("!H", length) |
| 4712 | return ''.join(packed) |
| 4713 | |
| 4714 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4715 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4716 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4717 | _version = reader.read("!B")[0] |
| 4718 | assert(_version == 3) |
| 4719 | _type = reader.read("!B")[0] |
| 4720 | assert(_type == 14) |
| 4721 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4722 | orig_reader = reader |
| 4723 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4724 | obj.xid = reader.read("!L")[0] |
| 4725 | obj.cookie = reader.read("!Q")[0] |
| 4726 | obj.cookie_mask = reader.read("!Q")[0] |
| 4727 | obj.table_id = reader.read("!B")[0] |
| 4728 | __command = util.unpack_fm_cmd(reader) |
| 4729 | assert(__command == 1) |
| 4730 | obj.idle_timeout = reader.read("!H")[0] |
| 4731 | obj.hard_timeout = reader.read("!H")[0] |
| 4732 | obj.priority = reader.read("!H")[0] |
| 4733 | obj.buffer_id = reader.read("!L")[0] |
| 4734 | obj.out_port = util.unpack_port_no(reader) |
| 4735 | obj.out_group = reader.read("!L")[0] |
| 4736 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4737 | reader.skip(2) |
| 4738 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4739 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4740 | return obj |
| 4741 | |
| 4742 | def __eq__(self, other): |
| 4743 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4744 | if self.xid != other.xid: return False |
| 4745 | if self.cookie != other.cookie: return False |
| 4746 | if self.cookie_mask != other.cookie_mask: return False |
| 4747 | if self.table_id != other.table_id: return False |
| 4748 | if self.idle_timeout != other.idle_timeout: return False |
| 4749 | if self.hard_timeout != other.hard_timeout: return False |
| 4750 | if self.priority != other.priority: return False |
| 4751 | if self.buffer_id != other.buffer_id: return False |
| 4752 | if self.out_port != other.out_port: return False |
| 4753 | if self.out_group != other.out_group: return False |
| 4754 | if self.flags != other.flags: return False |
| 4755 | if self.match != other.match: return False |
| 4756 | if self.instructions != other.instructions: return False |
| 4757 | return True |
| 4758 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4759 | def pretty_print(self, q): |
| 4760 | q.text("flow_modify {") |
| 4761 | with q.group(): |
| 4762 | with q.indent(2): |
| 4763 | q.breakable() |
| 4764 | q.text("xid = "); |
| 4765 | if self.xid != None: |
| 4766 | q.text("%#x" % self.xid) |
| 4767 | else: |
| 4768 | q.text('None') |
| 4769 | q.text(","); q.breakable() |
| 4770 | q.text("cookie = "); |
| 4771 | q.text("%#x" % self.cookie) |
| 4772 | q.text(","); q.breakable() |
| 4773 | q.text("cookie_mask = "); |
| 4774 | q.text("%#x" % self.cookie_mask) |
| 4775 | q.text(","); q.breakable() |
| 4776 | q.text("table_id = "); |
| 4777 | q.text("%#x" % self.table_id) |
| 4778 | q.text(","); q.breakable() |
| 4779 | q.text("idle_timeout = "); |
| 4780 | q.text("%#x" % self.idle_timeout) |
| 4781 | q.text(","); q.breakable() |
| 4782 | q.text("hard_timeout = "); |
| 4783 | q.text("%#x" % self.hard_timeout) |
| 4784 | q.text(","); q.breakable() |
| 4785 | q.text("priority = "); |
| 4786 | q.text("%#x" % self.priority) |
| 4787 | q.text(","); q.breakable() |
| 4788 | q.text("buffer_id = "); |
| 4789 | q.text("%#x" % self.buffer_id) |
| 4790 | q.text(","); q.breakable() |
| 4791 | q.text("out_port = "); |
| 4792 | q.text(util.pretty_port(self.out_port)) |
| 4793 | q.text(","); q.breakable() |
| 4794 | q.text("out_group = "); |
| 4795 | q.text("%#x" % self.out_group) |
| 4796 | q.text(","); q.breakable() |
| 4797 | q.text("flags = "); |
| 4798 | q.text("%#x" % self.flags) |
| 4799 | q.text(","); q.breakable() |
| 4800 | q.text("match = "); |
| 4801 | q.pp(self.match) |
| 4802 | q.text(","); q.breakable() |
| 4803 | q.text("instructions = "); |
| 4804 | q.pp(self.instructions) |
| 4805 | q.breakable() |
| 4806 | q.text('}') |
| 4807 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4808 | flow_mod.subtypes[1] = flow_modify |
| 4809 | |
| 4810 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4811 | version = 3 |
| 4812 | type = 14 |
| 4813 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4814 | |
| 4815 | 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] | 4816 | if xid != None: |
| 4817 | self.xid = xid |
| 4818 | else: |
| 4819 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4820 | if cookie != None: |
| 4821 | self.cookie = cookie |
| 4822 | else: |
| 4823 | self.cookie = 0 |
| 4824 | if cookie_mask != None: |
| 4825 | self.cookie_mask = cookie_mask |
| 4826 | else: |
| 4827 | self.cookie_mask = 0 |
| 4828 | if table_id != None: |
| 4829 | self.table_id = table_id |
| 4830 | else: |
| 4831 | self.table_id = 0 |
| 4832 | if idle_timeout != None: |
| 4833 | self.idle_timeout = idle_timeout |
| 4834 | else: |
| 4835 | self.idle_timeout = 0 |
| 4836 | if hard_timeout != None: |
| 4837 | self.hard_timeout = hard_timeout |
| 4838 | else: |
| 4839 | self.hard_timeout = 0 |
| 4840 | if priority != None: |
| 4841 | self.priority = priority |
| 4842 | else: |
| 4843 | self.priority = 0 |
| 4844 | if buffer_id != None: |
| 4845 | self.buffer_id = buffer_id |
| 4846 | else: |
| 4847 | self.buffer_id = 0 |
| 4848 | if out_port != None: |
| 4849 | self.out_port = out_port |
| 4850 | else: |
| 4851 | self.out_port = 0 |
| 4852 | if out_group != None: |
| 4853 | self.out_group = out_group |
| 4854 | else: |
| 4855 | self.out_group = 0 |
| 4856 | if flags != None: |
| 4857 | self.flags = flags |
| 4858 | else: |
| 4859 | self.flags = 0 |
| 4860 | if match != None: |
| 4861 | self.match = match |
| 4862 | else: |
| 4863 | self.match = common.match() |
| 4864 | if instructions != None: |
| 4865 | self.instructions = instructions |
| 4866 | else: |
| 4867 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4868 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4869 | |
| 4870 | def pack(self): |
| 4871 | packed = [] |
| 4872 | packed.append(struct.pack("!B", self.version)) |
| 4873 | packed.append(struct.pack("!B", self.type)) |
| 4874 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4875 | packed.append(struct.pack("!L", self.xid)) |
| 4876 | packed.append(struct.pack("!Q", self.cookie)) |
| 4877 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4878 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4879 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4880 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4881 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4882 | packed.append(struct.pack("!H", self.priority)) |
| 4883 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4884 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4885 | packed.append(struct.pack("!L", self.out_group)) |
| 4886 | packed.append(struct.pack("!H", self.flags)) |
| 4887 | packed.append('\x00' * 2) |
| 4888 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4889 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4890 | length = sum([len(x) for x in packed]) |
| 4891 | packed[2] = struct.pack("!H", length) |
| 4892 | return ''.join(packed) |
| 4893 | |
| 4894 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4895 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4896 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4897 | _version = reader.read("!B")[0] |
| 4898 | assert(_version == 3) |
| 4899 | _type = reader.read("!B")[0] |
| 4900 | assert(_type == 14) |
| 4901 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4902 | orig_reader = reader |
| 4903 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4904 | obj.xid = reader.read("!L")[0] |
| 4905 | obj.cookie = reader.read("!Q")[0] |
| 4906 | obj.cookie_mask = reader.read("!Q")[0] |
| 4907 | obj.table_id = reader.read("!B")[0] |
| 4908 | __command = util.unpack_fm_cmd(reader) |
| 4909 | assert(__command == 2) |
| 4910 | obj.idle_timeout = reader.read("!H")[0] |
| 4911 | obj.hard_timeout = reader.read("!H")[0] |
| 4912 | obj.priority = reader.read("!H")[0] |
| 4913 | obj.buffer_id = reader.read("!L")[0] |
| 4914 | obj.out_port = util.unpack_port_no(reader) |
| 4915 | obj.out_group = reader.read("!L")[0] |
| 4916 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4917 | reader.skip(2) |
| 4918 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4919 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4920 | return obj |
| 4921 | |
| 4922 | def __eq__(self, other): |
| 4923 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4924 | if self.xid != other.xid: return False |
| 4925 | if self.cookie != other.cookie: return False |
| 4926 | if self.cookie_mask != other.cookie_mask: return False |
| 4927 | if self.table_id != other.table_id: return False |
| 4928 | if self.idle_timeout != other.idle_timeout: return False |
| 4929 | if self.hard_timeout != other.hard_timeout: return False |
| 4930 | if self.priority != other.priority: return False |
| 4931 | if self.buffer_id != other.buffer_id: return False |
| 4932 | if self.out_port != other.out_port: return False |
| 4933 | if self.out_group != other.out_group: return False |
| 4934 | if self.flags != other.flags: return False |
| 4935 | if self.match != other.match: return False |
| 4936 | if self.instructions != other.instructions: return False |
| 4937 | return True |
| 4938 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4939 | def pretty_print(self, q): |
| 4940 | q.text("flow_modify_strict {") |
| 4941 | with q.group(): |
| 4942 | with q.indent(2): |
| 4943 | q.breakable() |
| 4944 | q.text("xid = "); |
| 4945 | if self.xid != None: |
| 4946 | q.text("%#x" % self.xid) |
| 4947 | else: |
| 4948 | q.text('None') |
| 4949 | q.text(","); q.breakable() |
| 4950 | q.text("cookie = "); |
| 4951 | q.text("%#x" % self.cookie) |
| 4952 | q.text(","); q.breakable() |
| 4953 | q.text("cookie_mask = "); |
| 4954 | q.text("%#x" % self.cookie_mask) |
| 4955 | q.text(","); q.breakable() |
| 4956 | q.text("table_id = "); |
| 4957 | q.text("%#x" % self.table_id) |
| 4958 | q.text(","); q.breakable() |
| 4959 | q.text("idle_timeout = "); |
| 4960 | q.text("%#x" % self.idle_timeout) |
| 4961 | q.text(","); q.breakable() |
| 4962 | q.text("hard_timeout = "); |
| 4963 | q.text("%#x" % self.hard_timeout) |
| 4964 | q.text(","); q.breakable() |
| 4965 | q.text("priority = "); |
| 4966 | q.text("%#x" % self.priority) |
| 4967 | q.text(","); q.breakable() |
| 4968 | q.text("buffer_id = "); |
| 4969 | q.text("%#x" % self.buffer_id) |
| 4970 | q.text(","); q.breakable() |
| 4971 | q.text("out_port = "); |
| 4972 | q.text(util.pretty_port(self.out_port)) |
| 4973 | q.text(","); q.breakable() |
| 4974 | q.text("out_group = "); |
| 4975 | q.text("%#x" % self.out_group) |
| 4976 | q.text(","); q.breakable() |
| 4977 | q.text("flags = "); |
| 4978 | q.text("%#x" % self.flags) |
| 4979 | q.text(","); q.breakable() |
| 4980 | q.text("match = "); |
| 4981 | q.pp(self.match) |
| 4982 | q.text(","); q.breakable() |
| 4983 | q.text("instructions = "); |
| 4984 | q.pp(self.instructions) |
| 4985 | q.breakable() |
| 4986 | q.text('}') |
| 4987 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4988 | flow_mod.subtypes[2] = flow_modify_strict |
| 4989 | |
| 4990 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4991 | version = 3 |
| 4992 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4993 | |
| 4994 | 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] | 4995 | if xid != None: |
| 4996 | self.xid = xid |
| 4997 | else: |
| 4998 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4999 | if cookie != None: |
| 5000 | self.cookie = cookie |
| 5001 | else: |
| 5002 | self.cookie = 0 |
| 5003 | if priority != None: |
| 5004 | self.priority = priority |
| 5005 | else: |
| 5006 | self.priority = 0 |
| 5007 | if reason != None: |
| 5008 | self.reason = reason |
| 5009 | else: |
| 5010 | self.reason = 0 |
| 5011 | if table_id != None: |
| 5012 | self.table_id = table_id |
| 5013 | else: |
| 5014 | self.table_id = 0 |
| 5015 | if duration_sec != None: |
| 5016 | self.duration_sec = duration_sec |
| 5017 | else: |
| 5018 | self.duration_sec = 0 |
| 5019 | if duration_nsec != None: |
| 5020 | self.duration_nsec = duration_nsec |
| 5021 | else: |
| 5022 | self.duration_nsec = 0 |
| 5023 | if idle_timeout != None: |
| 5024 | self.idle_timeout = idle_timeout |
| 5025 | else: |
| 5026 | self.idle_timeout = 0 |
| 5027 | if hard_timeout != None: |
| 5028 | self.hard_timeout = hard_timeout |
| 5029 | else: |
| 5030 | self.hard_timeout = 0 |
| 5031 | if packet_count != None: |
| 5032 | self.packet_count = packet_count |
| 5033 | else: |
| 5034 | self.packet_count = 0 |
| 5035 | if byte_count != None: |
| 5036 | self.byte_count = byte_count |
| 5037 | else: |
| 5038 | self.byte_count = 0 |
| 5039 | if match != None: |
| 5040 | self.match = match |
| 5041 | else: |
| 5042 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5043 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5044 | |
| 5045 | def pack(self): |
| 5046 | packed = [] |
| 5047 | packed.append(struct.pack("!B", self.version)) |
| 5048 | packed.append(struct.pack("!B", self.type)) |
| 5049 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5050 | packed.append(struct.pack("!L", self.xid)) |
| 5051 | packed.append(struct.pack("!Q", self.cookie)) |
| 5052 | packed.append(struct.pack("!H", self.priority)) |
| 5053 | packed.append(struct.pack("!B", self.reason)) |
| 5054 | packed.append(struct.pack("!B", self.table_id)) |
| 5055 | packed.append(struct.pack("!L", self.duration_sec)) |
| 5056 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 5057 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5058 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5059 | packed.append(struct.pack("!Q", self.packet_count)) |
| 5060 | packed.append(struct.pack("!Q", self.byte_count)) |
| 5061 | packed.append(self.match.pack()) |
| 5062 | length = sum([len(x) for x in packed]) |
| 5063 | packed[2] = struct.pack("!H", length) |
| 5064 | return ''.join(packed) |
| 5065 | |
| 5066 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5067 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5068 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5069 | _version = reader.read("!B")[0] |
| 5070 | assert(_version == 3) |
| 5071 | _type = reader.read("!B")[0] |
| 5072 | assert(_type == 11) |
| 5073 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5074 | orig_reader = reader |
| 5075 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5076 | obj.xid = reader.read("!L")[0] |
| 5077 | obj.cookie = reader.read("!Q")[0] |
| 5078 | obj.priority = reader.read("!H")[0] |
| 5079 | obj.reason = reader.read("!B")[0] |
| 5080 | obj.table_id = reader.read("!B")[0] |
| 5081 | obj.duration_sec = reader.read("!L")[0] |
| 5082 | obj.duration_nsec = reader.read("!L")[0] |
| 5083 | obj.idle_timeout = reader.read("!H")[0] |
| 5084 | obj.hard_timeout = reader.read("!H")[0] |
| 5085 | obj.packet_count = reader.read("!Q")[0] |
| 5086 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5087 | obj.match = common.match.unpack(reader) |
| 5088 | return obj |
| 5089 | |
| 5090 | def __eq__(self, other): |
| 5091 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5092 | if self.xid != other.xid: return False |
| 5093 | if self.cookie != other.cookie: return False |
| 5094 | if self.priority != other.priority: return False |
| 5095 | if self.reason != other.reason: return False |
| 5096 | if self.table_id != other.table_id: return False |
| 5097 | if self.duration_sec != other.duration_sec: return False |
| 5098 | if self.duration_nsec != other.duration_nsec: return False |
| 5099 | if self.idle_timeout != other.idle_timeout: return False |
| 5100 | if self.hard_timeout != other.hard_timeout: return False |
| 5101 | if self.packet_count != other.packet_count: return False |
| 5102 | if self.byte_count != other.byte_count: return False |
| 5103 | if self.match != other.match: return False |
| 5104 | return True |
| 5105 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5106 | def pretty_print(self, q): |
| 5107 | q.text("flow_removed {") |
| 5108 | with q.group(): |
| 5109 | with q.indent(2): |
| 5110 | q.breakable() |
| 5111 | q.text("xid = "); |
| 5112 | if self.xid != None: |
| 5113 | q.text("%#x" % self.xid) |
| 5114 | else: |
| 5115 | q.text('None') |
| 5116 | q.text(","); q.breakable() |
| 5117 | q.text("cookie = "); |
| 5118 | q.text("%#x" % self.cookie) |
| 5119 | q.text(","); q.breakable() |
| 5120 | q.text("priority = "); |
| 5121 | q.text("%#x" % self.priority) |
| 5122 | q.text(","); q.breakable() |
| 5123 | q.text("reason = "); |
| 5124 | q.text("%#x" % self.reason) |
| 5125 | q.text(","); q.breakable() |
| 5126 | q.text("table_id = "); |
| 5127 | q.text("%#x" % self.table_id) |
| 5128 | q.text(","); q.breakable() |
| 5129 | q.text("duration_sec = "); |
| 5130 | q.text("%#x" % self.duration_sec) |
| 5131 | q.text(","); q.breakable() |
| 5132 | q.text("duration_nsec = "); |
| 5133 | q.text("%#x" % self.duration_nsec) |
| 5134 | q.text(","); q.breakable() |
| 5135 | q.text("idle_timeout = "); |
| 5136 | q.text("%#x" % self.idle_timeout) |
| 5137 | q.text(","); q.breakable() |
| 5138 | q.text("hard_timeout = "); |
| 5139 | q.text("%#x" % self.hard_timeout) |
| 5140 | q.text(","); q.breakable() |
| 5141 | q.text("packet_count = "); |
| 5142 | q.text("%#x" % self.packet_count) |
| 5143 | q.text(","); q.breakable() |
| 5144 | q.text("byte_count = "); |
| 5145 | q.text("%#x" % self.byte_count) |
| 5146 | q.text(","); q.breakable() |
| 5147 | q.text("match = "); |
| 5148 | q.pp(self.match) |
| 5149 | q.breakable() |
| 5150 | q.text('}') |
| 5151 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5152 | message.subtypes[11] = flow_removed |
| 5153 | |
| 5154 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5155 | version = 3 |
| 5156 | type = 19 |
| 5157 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5158 | |
| 5159 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5160 | if xid != None: |
| 5161 | self.xid = xid |
| 5162 | else: |
| 5163 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5164 | if flags != None: |
| 5165 | self.flags = flags |
| 5166 | else: |
| 5167 | self.flags = 0 |
| 5168 | if entries != None: |
| 5169 | self.entries = entries |
| 5170 | else: |
| 5171 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5172 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5173 | |
| 5174 | def pack(self): |
| 5175 | packed = [] |
| 5176 | packed.append(struct.pack("!B", self.version)) |
| 5177 | packed.append(struct.pack("!B", self.type)) |
| 5178 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5179 | packed.append(struct.pack("!L", self.xid)) |
| 5180 | packed.append(struct.pack("!H", self.stats_type)) |
| 5181 | packed.append(struct.pack("!H", self.flags)) |
| 5182 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5183 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5184 | length = sum([len(x) for x in packed]) |
| 5185 | packed[2] = struct.pack("!H", length) |
| 5186 | return ''.join(packed) |
| 5187 | |
| 5188 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5189 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5190 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5191 | _version = reader.read("!B")[0] |
| 5192 | assert(_version == 3) |
| 5193 | _type = reader.read("!B")[0] |
| 5194 | assert(_type == 19) |
| 5195 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5196 | orig_reader = reader |
| 5197 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5198 | obj.xid = reader.read("!L")[0] |
| 5199 | _stats_type = reader.read("!H")[0] |
| 5200 | assert(_stats_type == 1) |
| 5201 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5202 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5203 | 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] | 5204 | return obj |
| 5205 | |
| 5206 | def __eq__(self, other): |
| 5207 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5208 | if self.xid != other.xid: return False |
| 5209 | if self.flags != other.flags: return False |
| 5210 | if self.entries != other.entries: return False |
| 5211 | return True |
| 5212 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5213 | def pretty_print(self, q): |
| 5214 | q.text("flow_stats_reply {") |
| 5215 | with q.group(): |
| 5216 | with q.indent(2): |
| 5217 | q.breakable() |
| 5218 | q.text("xid = "); |
| 5219 | if self.xid != None: |
| 5220 | q.text("%#x" % self.xid) |
| 5221 | else: |
| 5222 | q.text('None') |
| 5223 | q.text(","); q.breakable() |
| 5224 | q.text("flags = "); |
| 5225 | q.text("%#x" % self.flags) |
| 5226 | q.text(","); q.breakable() |
| 5227 | q.text("entries = "); |
| 5228 | q.pp(self.entries) |
| 5229 | q.breakable() |
| 5230 | q.text('}') |
| 5231 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5232 | stats_reply.subtypes[1] = flow_stats_reply |
| 5233 | |
| 5234 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5235 | version = 3 |
| 5236 | type = 18 |
| 5237 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5238 | |
| 5239 | 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] | 5240 | if xid != None: |
| 5241 | self.xid = xid |
| 5242 | else: |
| 5243 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5244 | if flags != None: |
| 5245 | self.flags = flags |
| 5246 | else: |
| 5247 | self.flags = 0 |
| 5248 | if table_id != None: |
| 5249 | self.table_id = table_id |
| 5250 | else: |
| 5251 | self.table_id = 0 |
| 5252 | if out_port != None: |
| 5253 | self.out_port = out_port |
| 5254 | else: |
| 5255 | self.out_port = 0 |
| 5256 | if out_group != None: |
| 5257 | self.out_group = out_group |
| 5258 | else: |
| 5259 | self.out_group = 0 |
| 5260 | if cookie != None: |
| 5261 | self.cookie = cookie |
| 5262 | else: |
| 5263 | self.cookie = 0 |
| 5264 | if cookie_mask != None: |
| 5265 | self.cookie_mask = cookie_mask |
| 5266 | else: |
| 5267 | self.cookie_mask = 0 |
| 5268 | if match != None: |
| 5269 | self.match = match |
| 5270 | else: |
| 5271 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5272 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5273 | |
| 5274 | def pack(self): |
| 5275 | packed = [] |
| 5276 | packed.append(struct.pack("!B", self.version)) |
| 5277 | packed.append(struct.pack("!B", self.type)) |
| 5278 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5279 | packed.append(struct.pack("!L", self.xid)) |
| 5280 | packed.append(struct.pack("!H", self.stats_type)) |
| 5281 | packed.append(struct.pack("!H", self.flags)) |
| 5282 | packed.append('\x00' * 4) |
| 5283 | packed.append(struct.pack("!B", self.table_id)) |
| 5284 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5285 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5286 | packed.append(struct.pack("!L", self.out_group)) |
| 5287 | packed.append('\x00' * 4) |
| 5288 | packed.append(struct.pack("!Q", self.cookie)) |
| 5289 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 5290 | packed.append(self.match.pack()) |
| 5291 | length = sum([len(x) for x in packed]) |
| 5292 | packed[2] = struct.pack("!H", length) |
| 5293 | return ''.join(packed) |
| 5294 | |
| 5295 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5296 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5297 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5298 | _version = reader.read("!B")[0] |
| 5299 | assert(_version == 3) |
| 5300 | _type = reader.read("!B")[0] |
| 5301 | assert(_type == 18) |
| 5302 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5303 | orig_reader = reader |
| 5304 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5305 | obj.xid = reader.read("!L")[0] |
| 5306 | _stats_type = reader.read("!H")[0] |
| 5307 | assert(_stats_type == 1) |
| 5308 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5309 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5310 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5311 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5312 | obj.out_port = util.unpack_port_no(reader) |
| 5313 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5314 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5315 | obj.cookie = reader.read("!Q")[0] |
| 5316 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5317 | obj.match = common.match.unpack(reader) |
| 5318 | return obj |
| 5319 | |
| 5320 | def __eq__(self, other): |
| 5321 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5322 | if self.xid != other.xid: return False |
| 5323 | if self.flags != other.flags: return False |
| 5324 | if self.table_id != other.table_id: return False |
| 5325 | if self.out_port != other.out_port: return False |
| 5326 | if self.out_group != other.out_group: return False |
| 5327 | if self.cookie != other.cookie: return False |
| 5328 | if self.cookie_mask != other.cookie_mask: return False |
| 5329 | if self.match != other.match: return False |
| 5330 | return True |
| 5331 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5332 | def pretty_print(self, q): |
| 5333 | q.text("flow_stats_request {") |
| 5334 | with q.group(): |
| 5335 | with q.indent(2): |
| 5336 | q.breakable() |
| 5337 | q.text("xid = "); |
| 5338 | if self.xid != None: |
| 5339 | q.text("%#x" % self.xid) |
| 5340 | else: |
| 5341 | q.text('None') |
| 5342 | q.text(","); q.breakable() |
| 5343 | q.text("flags = "); |
| 5344 | q.text("%#x" % self.flags) |
| 5345 | q.text(","); q.breakable() |
| 5346 | q.text("table_id = "); |
| 5347 | q.text("%#x" % self.table_id) |
| 5348 | q.text(","); q.breakable() |
| 5349 | q.text("out_port = "); |
| 5350 | q.text(util.pretty_port(self.out_port)) |
| 5351 | q.text(","); q.breakable() |
| 5352 | q.text("out_group = "); |
| 5353 | q.text("%#x" % self.out_group) |
| 5354 | q.text(","); q.breakable() |
| 5355 | q.text("cookie = "); |
| 5356 | q.text("%#x" % self.cookie) |
| 5357 | q.text(","); q.breakable() |
| 5358 | q.text("cookie_mask = "); |
| 5359 | q.text("%#x" % self.cookie_mask) |
| 5360 | q.text(","); q.breakable() |
| 5361 | q.text("match = "); |
| 5362 | q.pp(self.match) |
| 5363 | q.breakable() |
| 5364 | q.text('}') |
| 5365 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5366 | stats_request.subtypes[1] = flow_stats_request |
| 5367 | |
| 5368 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5369 | version = 3 |
| 5370 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5371 | |
| 5372 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5373 | if xid != None: |
| 5374 | self.xid = xid |
| 5375 | else: |
| 5376 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5377 | if flags != None: |
| 5378 | self.flags = flags |
| 5379 | else: |
| 5380 | self.flags = 0 |
| 5381 | if miss_send_len != None: |
| 5382 | self.miss_send_len = miss_send_len |
| 5383 | else: |
| 5384 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5385 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5386 | |
| 5387 | def pack(self): |
| 5388 | packed = [] |
| 5389 | packed.append(struct.pack("!B", self.version)) |
| 5390 | packed.append(struct.pack("!B", self.type)) |
| 5391 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5392 | packed.append(struct.pack("!L", self.xid)) |
| 5393 | packed.append(struct.pack("!H", self.flags)) |
| 5394 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 5395 | length = sum([len(x) for x in packed]) |
| 5396 | packed[2] = struct.pack("!H", length) |
| 5397 | return ''.join(packed) |
| 5398 | |
| 5399 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5400 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5401 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5402 | _version = reader.read("!B")[0] |
| 5403 | assert(_version == 3) |
| 5404 | _type = reader.read("!B")[0] |
| 5405 | assert(_type == 8) |
| 5406 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5407 | orig_reader = reader |
| 5408 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5409 | obj.xid = reader.read("!L")[0] |
| 5410 | obj.flags = reader.read("!H")[0] |
| 5411 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5412 | return obj |
| 5413 | |
| 5414 | def __eq__(self, other): |
| 5415 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5416 | if self.xid != other.xid: return False |
| 5417 | if self.flags != other.flags: return False |
| 5418 | if self.miss_send_len != other.miss_send_len: return False |
| 5419 | return True |
| 5420 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5421 | def pretty_print(self, q): |
| 5422 | q.text("get_config_reply {") |
| 5423 | with q.group(): |
| 5424 | with q.indent(2): |
| 5425 | q.breakable() |
| 5426 | q.text("xid = "); |
| 5427 | if self.xid != None: |
| 5428 | q.text("%#x" % self.xid) |
| 5429 | else: |
| 5430 | q.text('None') |
| 5431 | q.text(","); q.breakable() |
| 5432 | q.text("flags = "); |
| 5433 | q.text("%#x" % self.flags) |
| 5434 | q.text(","); q.breakable() |
| 5435 | q.text("miss_send_len = "); |
| 5436 | q.text("%#x" % self.miss_send_len) |
| 5437 | q.breakable() |
| 5438 | q.text('}') |
| 5439 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5440 | message.subtypes[8] = get_config_reply |
| 5441 | |
| 5442 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5443 | version = 3 |
| 5444 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5445 | |
| 5446 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5447 | if xid != None: |
| 5448 | self.xid = xid |
| 5449 | else: |
| 5450 | self.xid = None |
| 5451 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5452 | |
| 5453 | def pack(self): |
| 5454 | packed = [] |
| 5455 | packed.append(struct.pack("!B", self.version)) |
| 5456 | packed.append(struct.pack("!B", self.type)) |
| 5457 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5458 | packed.append(struct.pack("!L", self.xid)) |
| 5459 | length = sum([len(x) for x in packed]) |
| 5460 | packed[2] = struct.pack("!H", length) |
| 5461 | return ''.join(packed) |
| 5462 | |
| 5463 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5464 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5465 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5466 | _version = reader.read("!B")[0] |
| 5467 | assert(_version == 3) |
| 5468 | _type = reader.read("!B")[0] |
| 5469 | assert(_type == 7) |
| 5470 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5471 | orig_reader = reader |
| 5472 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5473 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5474 | return obj |
| 5475 | |
| 5476 | def __eq__(self, other): |
| 5477 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5478 | if self.xid != other.xid: return False |
| 5479 | return True |
| 5480 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5481 | def pretty_print(self, q): |
| 5482 | q.text("get_config_request {") |
| 5483 | with q.group(): |
| 5484 | with q.indent(2): |
| 5485 | q.breakable() |
| 5486 | q.text("xid = "); |
| 5487 | if self.xid != None: |
| 5488 | q.text("%#x" % self.xid) |
| 5489 | else: |
| 5490 | q.text('None') |
| 5491 | q.breakable() |
| 5492 | q.text('}') |
| 5493 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5494 | message.subtypes[7] = get_config_request |
| 5495 | |
| 5496 | class group_mod(message): |
| 5497 | subtypes = {} |
| 5498 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5499 | version = 3 |
| 5500 | type = 15 |
| 5501 | |
| 5502 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 5503 | if xid != None: |
| 5504 | self.xid = xid |
| 5505 | else: |
| 5506 | self.xid = None |
| 5507 | if command != None: |
| 5508 | self.command = command |
| 5509 | else: |
| 5510 | self.command = 0 |
| 5511 | if group_type != None: |
| 5512 | self.group_type = group_type |
| 5513 | else: |
| 5514 | self.group_type = 0 |
| 5515 | if group_id != None: |
| 5516 | self.group_id = group_id |
| 5517 | else: |
| 5518 | self.group_id = 0 |
| 5519 | if buckets != None: |
| 5520 | self.buckets = buckets |
| 5521 | else: |
| 5522 | self.buckets = [] |
| 5523 | return |
| 5524 | |
| 5525 | def pack(self): |
| 5526 | packed = [] |
| 5527 | packed.append(struct.pack("!B", self.version)) |
| 5528 | packed.append(struct.pack("!B", self.type)) |
| 5529 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5530 | packed.append(struct.pack("!L", self.xid)) |
| 5531 | packed.append(struct.pack("!H", self.command)) |
| 5532 | packed.append(struct.pack("!B", self.group_type)) |
| 5533 | packed.append('\x00' * 1) |
| 5534 | packed.append(struct.pack("!L", self.group_id)) |
| 5535 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 5536 | length = sum([len(x) for x in packed]) |
| 5537 | packed[2] = struct.pack("!H", length) |
| 5538 | return ''.join(packed) |
| 5539 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5540 | @staticmethod |
| 5541 | def unpack(reader): |
| 5542 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5543 | subclass = group_mod.subtypes.get(subtype) |
| 5544 | if subclass: |
| 5545 | return subclass.unpack(reader) |
| 5546 | |
| 5547 | obj = group_mod() |
| 5548 | _version = reader.read("!B")[0] |
| 5549 | assert(_version == 3) |
| 5550 | _type = reader.read("!B")[0] |
| 5551 | assert(_type == 15) |
| 5552 | _length = reader.read("!H")[0] |
| 5553 | orig_reader = reader |
| 5554 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5555 | obj.xid = reader.read("!L")[0] |
| 5556 | obj.command = reader.read("!H")[0] |
| 5557 | obj.group_type = reader.read("!B")[0] |
| 5558 | reader.skip(1) |
| 5559 | obj.group_id = reader.read("!L")[0] |
| 5560 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
| 5561 | return obj |
| 5562 | |
| 5563 | def __eq__(self, other): |
| 5564 | if type(self) != type(other): return False |
| 5565 | if self.xid != other.xid: return False |
| 5566 | if self.command != other.command: return False |
| 5567 | if self.group_type != other.group_type: return False |
| 5568 | if self.group_id != other.group_id: return False |
| 5569 | if self.buckets != other.buckets: return False |
| 5570 | return True |
| 5571 | |
| 5572 | def pretty_print(self, q): |
| 5573 | q.text("group_mod {") |
| 5574 | with q.group(): |
| 5575 | with q.indent(2): |
| 5576 | q.breakable() |
| 5577 | q.text("xid = "); |
| 5578 | if self.xid != None: |
| 5579 | q.text("%#x" % self.xid) |
| 5580 | else: |
| 5581 | q.text('None') |
| 5582 | q.text(","); q.breakable() |
| 5583 | q.text("group_type = "); |
| 5584 | q.text("%#x" % self.group_type) |
| 5585 | q.text(","); q.breakable() |
| 5586 | q.text("group_id = "); |
| 5587 | q.text("%#x" % self.group_id) |
| 5588 | q.text(","); q.breakable() |
| 5589 | q.text("buckets = "); |
| 5590 | q.pp(self.buckets) |
| 5591 | q.breakable() |
| 5592 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5593 | |
| 5594 | message.subtypes[15] = group_mod |
| 5595 | |
| 5596 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5597 | version = 3 |
| 5598 | type = 15 |
| 5599 | command = 0 |
| 5600 | |
| 5601 | 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] | 5602 | if xid != None: |
| 5603 | self.xid = xid |
| 5604 | else: |
| 5605 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5606 | if group_type != None: |
| 5607 | self.group_type = group_type |
| 5608 | else: |
| 5609 | self.group_type = 0 |
| 5610 | if group_id != None: |
| 5611 | self.group_id = group_id |
| 5612 | else: |
| 5613 | self.group_id = 0 |
| 5614 | if buckets != None: |
| 5615 | self.buckets = buckets |
| 5616 | else: |
| 5617 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5618 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5619 | |
| 5620 | def pack(self): |
| 5621 | packed = [] |
| 5622 | packed.append(struct.pack("!B", self.version)) |
| 5623 | packed.append(struct.pack("!B", self.type)) |
| 5624 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5625 | packed.append(struct.pack("!L", self.xid)) |
| 5626 | packed.append(struct.pack("!H", self.command)) |
| 5627 | packed.append(struct.pack("!B", self.group_type)) |
| 5628 | packed.append('\x00' * 1) |
| 5629 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5630 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5631 | length = sum([len(x) for x in packed]) |
| 5632 | packed[2] = struct.pack("!H", length) |
| 5633 | return ''.join(packed) |
| 5634 | |
| 5635 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5636 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5637 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5638 | _version = reader.read("!B")[0] |
| 5639 | assert(_version == 3) |
| 5640 | _type = reader.read("!B")[0] |
| 5641 | assert(_type == 15) |
| 5642 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5643 | orig_reader = reader |
| 5644 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5645 | obj.xid = reader.read("!L")[0] |
| 5646 | _command = reader.read("!H")[0] |
| 5647 | assert(_command == 0) |
| 5648 | obj.group_type = reader.read("!B")[0] |
| 5649 | reader.skip(1) |
| 5650 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5651 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5652 | return obj |
| 5653 | |
| 5654 | def __eq__(self, other): |
| 5655 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5656 | if self.xid != other.xid: return False |
| 5657 | if self.group_type != other.group_type: return False |
| 5658 | if self.group_id != other.group_id: return False |
| 5659 | if self.buckets != other.buckets: return False |
| 5660 | return True |
| 5661 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5662 | def pretty_print(self, q): |
| 5663 | q.text("group_add {") |
| 5664 | with q.group(): |
| 5665 | with q.indent(2): |
| 5666 | q.breakable() |
| 5667 | q.text("xid = "); |
| 5668 | if self.xid != None: |
| 5669 | q.text("%#x" % self.xid) |
| 5670 | else: |
| 5671 | q.text('None') |
| 5672 | q.text(","); q.breakable() |
| 5673 | q.text("group_type = "); |
| 5674 | q.text("%#x" % self.group_type) |
| 5675 | q.text(","); q.breakable() |
| 5676 | q.text("group_id = "); |
| 5677 | q.text("%#x" % self.group_id) |
| 5678 | q.text(","); q.breakable() |
| 5679 | q.text("buckets = "); |
| 5680 | q.pp(self.buckets) |
| 5681 | q.breakable() |
| 5682 | q.text('}') |
| 5683 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5684 | group_mod.subtypes[0] = group_add |
| 5685 | |
| 5686 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5687 | version = 3 |
| 5688 | type = 15 |
| 5689 | command = 2 |
| 5690 | |
| 5691 | 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] | 5692 | if xid != None: |
| 5693 | self.xid = xid |
| 5694 | else: |
| 5695 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5696 | if group_type != None: |
| 5697 | self.group_type = group_type |
| 5698 | else: |
| 5699 | self.group_type = 0 |
| 5700 | if group_id != None: |
| 5701 | self.group_id = group_id |
| 5702 | else: |
| 5703 | self.group_id = 0 |
| 5704 | if buckets != None: |
| 5705 | self.buckets = buckets |
| 5706 | else: |
| 5707 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5708 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5709 | |
| 5710 | def pack(self): |
| 5711 | packed = [] |
| 5712 | packed.append(struct.pack("!B", self.version)) |
| 5713 | packed.append(struct.pack("!B", self.type)) |
| 5714 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5715 | packed.append(struct.pack("!L", self.xid)) |
| 5716 | packed.append(struct.pack("!H", self.command)) |
| 5717 | packed.append(struct.pack("!B", self.group_type)) |
| 5718 | packed.append('\x00' * 1) |
| 5719 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5720 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5721 | length = sum([len(x) for x in packed]) |
| 5722 | packed[2] = struct.pack("!H", length) |
| 5723 | return ''.join(packed) |
| 5724 | |
| 5725 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5726 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5727 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5728 | _version = reader.read("!B")[0] |
| 5729 | assert(_version == 3) |
| 5730 | _type = reader.read("!B")[0] |
| 5731 | assert(_type == 15) |
| 5732 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5733 | orig_reader = reader |
| 5734 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5735 | obj.xid = reader.read("!L")[0] |
| 5736 | _command = reader.read("!H")[0] |
| 5737 | assert(_command == 2) |
| 5738 | obj.group_type = reader.read("!B")[0] |
| 5739 | reader.skip(1) |
| 5740 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5741 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5742 | return obj |
| 5743 | |
| 5744 | def __eq__(self, other): |
| 5745 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5746 | if self.xid != other.xid: return False |
| 5747 | if self.group_type != other.group_type: return False |
| 5748 | if self.group_id != other.group_id: return False |
| 5749 | if self.buckets != other.buckets: return False |
| 5750 | return True |
| 5751 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5752 | def pretty_print(self, q): |
| 5753 | q.text("group_delete {") |
| 5754 | with q.group(): |
| 5755 | with q.indent(2): |
| 5756 | q.breakable() |
| 5757 | q.text("xid = "); |
| 5758 | if self.xid != None: |
| 5759 | q.text("%#x" % self.xid) |
| 5760 | else: |
| 5761 | q.text('None') |
| 5762 | q.text(","); q.breakable() |
| 5763 | q.text("group_type = "); |
| 5764 | q.text("%#x" % self.group_type) |
| 5765 | q.text(","); q.breakable() |
| 5766 | q.text("group_id = "); |
| 5767 | q.text("%#x" % self.group_id) |
| 5768 | q.text(","); q.breakable() |
| 5769 | q.text("buckets = "); |
| 5770 | q.pp(self.buckets) |
| 5771 | q.breakable() |
| 5772 | q.text('}') |
| 5773 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5774 | group_mod.subtypes[2] = group_delete |
| 5775 | |
| 5776 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5777 | version = 3 |
| 5778 | type = 19 |
| 5779 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5780 | |
| 5781 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5782 | if xid != None: |
| 5783 | self.xid = xid |
| 5784 | else: |
| 5785 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5786 | if flags != None: |
| 5787 | self.flags = flags |
| 5788 | else: |
| 5789 | self.flags = 0 |
| 5790 | if entries != None: |
| 5791 | self.entries = entries |
| 5792 | else: |
| 5793 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5794 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5795 | |
| 5796 | def pack(self): |
| 5797 | packed = [] |
| 5798 | packed.append(struct.pack("!B", self.version)) |
| 5799 | packed.append(struct.pack("!B", self.type)) |
| 5800 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5801 | packed.append(struct.pack("!L", self.xid)) |
| 5802 | packed.append(struct.pack("!H", self.stats_type)) |
| 5803 | packed.append(struct.pack("!H", self.flags)) |
| 5804 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5805 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5806 | length = sum([len(x) for x in packed]) |
| 5807 | packed[2] = struct.pack("!H", length) |
| 5808 | return ''.join(packed) |
| 5809 | |
| 5810 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5811 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5812 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5813 | _version = reader.read("!B")[0] |
| 5814 | assert(_version == 3) |
| 5815 | _type = reader.read("!B")[0] |
| 5816 | assert(_type == 19) |
| 5817 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5818 | orig_reader = reader |
| 5819 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5820 | obj.xid = reader.read("!L")[0] |
| 5821 | _stats_type = reader.read("!H")[0] |
| 5822 | assert(_stats_type == 7) |
| 5823 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5824 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5825 | 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] | 5826 | return obj |
| 5827 | |
| 5828 | def __eq__(self, other): |
| 5829 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5830 | if self.xid != other.xid: return False |
| 5831 | if self.flags != other.flags: return False |
| 5832 | if self.entries != other.entries: return False |
| 5833 | return True |
| 5834 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5835 | def pretty_print(self, q): |
| 5836 | q.text("group_desc_stats_reply {") |
| 5837 | with q.group(): |
| 5838 | with q.indent(2): |
| 5839 | q.breakable() |
| 5840 | q.text("xid = "); |
| 5841 | if self.xid != None: |
| 5842 | q.text("%#x" % self.xid) |
| 5843 | else: |
| 5844 | q.text('None') |
| 5845 | q.text(","); q.breakable() |
| 5846 | q.text("flags = "); |
| 5847 | q.text("%#x" % self.flags) |
| 5848 | q.text(","); q.breakable() |
| 5849 | q.text("entries = "); |
| 5850 | q.pp(self.entries) |
| 5851 | q.breakable() |
| 5852 | q.text('}') |
| 5853 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5854 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 5855 | |
| 5856 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5857 | version = 3 |
| 5858 | type = 18 |
| 5859 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5860 | |
| 5861 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5862 | if xid != None: |
| 5863 | self.xid = xid |
| 5864 | else: |
| 5865 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5866 | if flags != None: |
| 5867 | self.flags = flags |
| 5868 | else: |
| 5869 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5870 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5871 | |
| 5872 | def pack(self): |
| 5873 | packed = [] |
| 5874 | packed.append(struct.pack("!B", self.version)) |
| 5875 | packed.append(struct.pack("!B", self.type)) |
| 5876 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5877 | packed.append(struct.pack("!L", self.xid)) |
| 5878 | packed.append(struct.pack("!H", self.stats_type)) |
| 5879 | packed.append(struct.pack("!H", self.flags)) |
| 5880 | packed.append('\x00' * 4) |
| 5881 | length = sum([len(x) for x in packed]) |
| 5882 | packed[2] = struct.pack("!H", length) |
| 5883 | return ''.join(packed) |
| 5884 | |
| 5885 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5886 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5887 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5888 | _version = reader.read("!B")[0] |
| 5889 | assert(_version == 3) |
| 5890 | _type = reader.read("!B")[0] |
| 5891 | assert(_type == 18) |
| 5892 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5893 | orig_reader = reader |
| 5894 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5895 | obj.xid = reader.read("!L")[0] |
| 5896 | _stats_type = reader.read("!H")[0] |
| 5897 | assert(_stats_type == 7) |
| 5898 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5899 | reader.skip(4) |
| 5900 | return obj |
| 5901 | |
| 5902 | def __eq__(self, other): |
| 5903 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5904 | if self.xid != other.xid: return False |
| 5905 | if self.flags != other.flags: return False |
| 5906 | return True |
| 5907 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5908 | def pretty_print(self, q): |
| 5909 | q.text("group_desc_stats_request {") |
| 5910 | with q.group(): |
| 5911 | with q.indent(2): |
| 5912 | q.breakable() |
| 5913 | q.text("xid = "); |
| 5914 | if self.xid != None: |
| 5915 | q.text("%#x" % self.xid) |
| 5916 | else: |
| 5917 | q.text('None') |
| 5918 | q.text(","); q.breakable() |
| 5919 | q.text("flags = "); |
| 5920 | q.text("%#x" % self.flags) |
| 5921 | q.breakable() |
| 5922 | q.text('}') |
| 5923 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5924 | stats_request.subtypes[7] = group_desc_stats_request |
| 5925 | |
| 5926 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5927 | version = 3 |
| 5928 | type = 19 |
| 5929 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5930 | |
| 5931 | 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] | 5932 | if xid != None: |
| 5933 | self.xid = xid |
| 5934 | else: |
| 5935 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5936 | if flags != None: |
| 5937 | self.flags = flags |
| 5938 | else: |
| 5939 | self.flags = 0 |
| 5940 | if types != None: |
| 5941 | self.types = types |
| 5942 | else: |
| 5943 | self.types = 0 |
| 5944 | if capabilities != None: |
| 5945 | self.capabilities = capabilities |
| 5946 | else: |
| 5947 | self.capabilities = 0 |
| 5948 | if max_groups_all != None: |
| 5949 | self.max_groups_all = max_groups_all |
| 5950 | else: |
| 5951 | self.max_groups_all = 0 |
| 5952 | if max_groups_select != None: |
| 5953 | self.max_groups_select = max_groups_select |
| 5954 | else: |
| 5955 | self.max_groups_select = 0 |
| 5956 | if max_groups_indirect != None: |
| 5957 | self.max_groups_indirect = max_groups_indirect |
| 5958 | else: |
| 5959 | self.max_groups_indirect = 0 |
| 5960 | if max_groups_ff != None: |
| 5961 | self.max_groups_ff = max_groups_ff |
| 5962 | else: |
| 5963 | self.max_groups_ff = 0 |
| 5964 | if actions_all != None: |
| 5965 | self.actions_all = actions_all |
| 5966 | else: |
| 5967 | self.actions_all = 0 |
| 5968 | if actions_select != None: |
| 5969 | self.actions_select = actions_select |
| 5970 | else: |
| 5971 | self.actions_select = 0 |
| 5972 | if actions_indirect != None: |
| 5973 | self.actions_indirect = actions_indirect |
| 5974 | else: |
| 5975 | self.actions_indirect = 0 |
| 5976 | if actions_ff != None: |
| 5977 | self.actions_ff = actions_ff |
| 5978 | else: |
| 5979 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5980 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5981 | |
| 5982 | def pack(self): |
| 5983 | packed = [] |
| 5984 | packed.append(struct.pack("!B", self.version)) |
| 5985 | packed.append(struct.pack("!B", self.type)) |
| 5986 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5987 | packed.append(struct.pack("!L", self.xid)) |
| 5988 | packed.append(struct.pack("!H", self.stats_type)) |
| 5989 | packed.append(struct.pack("!H", self.flags)) |
| 5990 | packed.append('\x00' * 4) |
| 5991 | packed.append(struct.pack("!L", self.types)) |
| 5992 | packed.append(struct.pack("!L", self.capabilities)) |
| 5993 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 5994 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 5995 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 5996 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 5997 | packed.append(struct.pack("!L", self.actions_all)) |
| 5998 | packed.append(struct.pack("!L", self.actions_select)) |
| 5999 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 6000 | packed.append(struct.pack("!L", self.actions_ff)) |
| 6001 | length = sum([len(x) for x in packed]) |
| 6002 | packed[2] = struct.pack("!H", length) |
| 6003 | return ''.join(packed) |
| 6004 | |
| 6005 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6006 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6007 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6008 | _version = reader.read("!B")[0] |
| 6009 | assert(_version == 3) |
| 6010 | _type = reader.read("!B")[0] |
| 6011 | assert(_type == 19) |
| 6012 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6013 | orig_reader = reader |
| 6014 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6015 | obj.xid = reader.read("!L")[0] |
| 6016 | _stats_type = reader.read("!H")[0] |
| 6017 | assert(_stats_type == 8) |
| 6018 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6019 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6020 | obj.types = reader.read("!L")[0] |
| 6021 | obj.capabilities = reader.read("!L")[0] |
| 6022 | obj.max_groups_all = reader.read("!L")[0] |
| 6023 | obj.max_groups_select = reader.read("!L")[0] |
| 6024 | obj.max_groups_indirect = reader.read("!L")[0] |
| 6025 | obj.max_groups_ff = reader.read("!L")[0] |
| 6026 | obj.actions_all = reader.read("!L")[0] |
| 6027 | obj.actions_select = reader.read("!L")[0] |
| 6028 | obj.actions_indirect = reader.read("!L")[0] |
| 6029 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6030 | return obj |
| 6031 | |
| 6032 | def __eq__(self, other): |
| 6033 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6034 | if self.xid != other.xid: return False |
| 6035 | if self.flags != other.flags: return False |
| 6036 | if self.types != other.types: return False |
| 6037 | if self.capabilities != other.capabilities: return False |
| 6038 | if self.max_groups_all != other.max_groups_all: return False |
| 6039 | if self.max_groups_select != other.max_groups_select: return False |
| 6040 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 6041 | if self.max_groups_ff != other.max_groups_ff: return False |
| 6042 | if self.actions_all != other.actions_all: return False |
| 6043 | if self.actions_select != other.actions_select: return False |
| 6044 | if self.actions_indirect != other.actions_indirect: return False |
| 6045 | if self.actions_ff != other.actions_ff: return False |
| 6046 | return True |
| 6047 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6048 | def pretty_print(self, q): |
| 6049 | q.text("group_features_stats_reply {") |
| 6050 | with q.group(): |
| 6051 | with q.indent(2): |
| 6052 | q.breakable() |
| 6053 | q.text("xid = "); |
| 6054 | if self.xid != None: |
| 6055 | q.text("%#x" % self.xid) |
| 6056 | else: |
| 6057 | q.text('None') |
| 6058 | q.text(","); q.breakable() |
| 6059 | q.text("flags = "); |
| 6060 | q.text("%#x" % self.flags) |
| 6061 | q.text(","); q.breakable() |
| 6062 | q.text("types = "); |
| 6063 | q.text("%#x" % self.types) |
| 6064 | q.text(","); q.breakable() |
| 6065 | q.text("capabilities = "); |
| 6066 | q.text("%#x" % self.capabilities) |
| 6067 | q.text(","); q.breakable() |
| 6068 | q.text("max_groups_all = "); |
| 6069 | q.text("%#x" % self.max_groups_all) |
| 6070 | q.text(","); q.breakable() |
| 6071 | q.text("max_groups_select = "); |
| 6072 | q.text("%#x" % self.max_groups_select) |
| 6073 | q.text(","); q.breakable() |
| 6074 | q.text("max_groups_indirect = "); |
| 6075 | q.text("%#x" % self.max_groups_indirect) |
| 6076 | q.text(","); q.breakable() |
| 6077 | q.text("max_groups_ff = "); |
| 6078 | q.text("%#x" % self.max_groups_ff) |
| 6079 | q.text(","); q.breakable() |
| 6080 | q.text("actions_all = "); |
| 6081 | q.text("%#x" % self.actions_all) |
| 6082 | q.text(","); q.breakable() |
| 6083 | q.text("actions_select = "); |
| 6084 | q.text("%#x" % self.actions_select) |
| 6085 | q.text(","); q.breakable() |
| 6086 | q.text("actions_indirect = "); |
| 6087 | q.text("%#x" % self.actions_indirect) |
| 6088 | q.text(","); q.breakable() |
| 6089 | q.text("actions_ff = "); |
| 6090 | q.text("%#x" % self.actions_ff) |
| 6091 | q.breakable() |
| 6092 | q.text('}') |
| 6093 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6094 | stats_reply.subtypes[8] = group_features_stats_reply |
| 6095 | |
| 6096 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6097 | version = 3 |
| 6098 | type = 18 |
| 6099 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6100 | |
| 6101 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6102 | if xid != None: |
| 6103 | self.xid = xid |
| 6104 | else: |
| 6105 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6106 | if flags != None: |
| 6107 | self.flags = flags |
| 6108 | else: |
| 6109 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6110 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6111 | |
| 6112 | def pack(self): |
| 6113 | packed = [] |
| 6114 | packed.append(struct.pack("!B", self.version)) |
| 6115 | packed.append(struct.pack("!B", self.type)) |
| 6116 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6117 | packed.append(struct.pack("!L", self.xid)) |
| 6118 | packed.append(struct.pack("!H", self.stats_type)) |
| 6119 | packed.append(struct.pack("!H", self.flags)) |
| 6120 | packed.append('\x00' * 4) |
| 6121 | length = sum([len(x) for x in packed]) |
| 6122 | packed[2] = struct.pack("!H", length) |
| 6123 | return ''.join(packed) |
| 6124 | |
| 6125 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6126 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6127 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6128 | _version = reader.read("!B")[0] |
| 6129 | assert(_version == 3) |
| 6130 | _type = reader.read("!B")[0] |
| 6131 | assert(_type == 18) |
| 6132 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6133 | orig_reader = reader |
| 6134 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6135 | obj.xid = reader.read("!L")[0] |
| 6136 | _stats_type = reader.read("!H")[0] |
| 6137 | assert(_stats_type == 8) |
| 6138 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6139 | reader.skip(4) |
| 6140 | return obj |
| 6141 | |
| 6142 | def __eq__(self, other): |
| 6143 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6144 | if self.xid != other.xid: return False |
| 6145 | if self.flags != other.flags: return False |
| 6146 | return True |
| 6147 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6148 | def pretty_print(self, q): |
| 6149 | q.text("group_features_stats_request {") |
| 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("flags = "); |
| 6160 | q.text("%#x" % self.flags) |
| 6161 | q.breakable() |
| 6162 | q.text('}') |
| 6163 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6164 | stats_request.subtypes[8] = group_features_stats_request |
| 6165 | |
| 6166 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6167 | version = 3 |
| 6168 | type = 1 |
| 6169 | err_type = 6 |
| 6170 | |
| 6171 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6172 | if xid != None: |
| 6173 | self.xid = xid |
| 6174 | else: |
| 6175 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6176 | if code != None: |
| 6177 | self.code = code |
| 6178 | else: |
| 6179 | self.code = 0 |
| 6180 | if data != None: |
| 6181 | self.data = data |
| 6182 | else: |
| 6183 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6184 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6185 | |
| 6186 | def pack(self): |
| 6187 | packed = [] |
| 6188 | packed.append(struct.pack("!B", self.version)) |
| 6189 | packed.append(struct.pack("!B", self.type)) |
| 6190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6191 | packed.append(struct.pack("!L", self.xid)) |
| 6192 | packed.append(struct.pack("!H", self.err_type)) |
| 6193 | packed.append(struct.pack("!H", self.code)) |
| 6194 | packed.append(self.data) |
| 6195 | length = sum([len(x) for x in packed]) |
| 6196 | packed[2] = struct.pack("!H", length) |
| 6197 | return ''.join(packed) |
| 6198 | |
| 6199 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6200 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6201 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6202 | _version = reader.read("!B")[0] |
| 6203 | assert(_version == 3) |
| 6204 | _type = reader.read("!B")[0] |
| 6205 | assert(_type == 1) |
| 6206 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6207 | orig_reader = reader |
| 6208 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6209 | obj.xid = reader.read("!L")[0] |
| 6210 | _err_type = reader.read("!H")[0] |
| 6211 | assert(_err_type == 6) |
| 6212 | obj.code = reader.read("!H")[0] |
| 6213 | obj.data = str(reader.read_all()) |
| 6214 | return obj |
| 6215 | |
| 6216 | def __eq__(self, other): |
| 6217 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6218 | if self.xid != other.xid: return False |
| 6219 | if self.code != other.code: return False |
| 6220 | if self.data != other.data: return False |
| 6221 | return True |
| 6222 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6223 | def pretty_print(self, q): |
| 6224 | q.text("group_mod_failed_error_msg {") |
| 6225 | with q.group(): |
| 6226 | with q.indent(2): |
| 6227 | q.breakable() |
| 6228 | q.text("xid = "); |
| 6229 | if self.xid != None: |
| 6230 | q.text("%#x" % self.xid) |
| 6231 | else: |
| 6232 | q.text('None') |
| 6233 | q.text(","); q.breakable() |
| 6234 | q.text("code = "); |
| 6235 | q.text("%#x" % self.code) |
| 6236 | q.text(","); q.breakable() |
| 6237 | q.text("data = "); |
| 6238 | q.pp(self.data) |
| 6239 | q.breakable() |
| 6240 | q.text('}') |
| 6241 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6242 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 6243 | |
| 6244 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6245 | version = 3 |
| 6246 | type = 15 |
| 6247 | command = 1 |
| 6248 | |
| 6249 | 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] | 6250 | if xid != None: |
| 6251 | self.xid = xid |
| 6252 | else: |
| 6253 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6254 | if group_type != None: |
| 6255 | self.group_type = group_type |
| 6256 | else: |
| 6257 | self.group_type = 0 |
| 6258 | if group_id != None: |
| 6259 | self.group_id = group_id |
| 6260 | else: |
| 6261 | self.group_id = 0 |
| 6262 | if buckets != None: |
| 6263 | self.buckets = buckets |
| 6264 | else: |
| 6265 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6266 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6267 | |
| 6268 | def pack(self): |
| 6269 | packed = [] |
| 6270 | packed.append(struct.pack("!B", self.version)) |
| 6271 | packed.append(struct.pack("!B", self.type)) |
| 6272 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6273 | packed.append(struct.pack("!L", self.xid)) |
| 6274 | packed.append(struct.pack("!H", self.command)) |
| 6275 | packed.append(struct.pack("!B", self.group_type)) |
| 6276 | packed.append('\x00' * 1) |
| 6277 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6278 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6279 | length = sum([len(x) for x in packed]) |
| 6280 | packed[2] = struct.pack("!H", length) |
| 6281 | return ''.join(packed) |
| 6282 | |
| 6283 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6284 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6285 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6286 | _version = reader.read("!B")[0] |
| 6287 | assert(_version == 3) |
| 6288 | _type = reader.read("!B")[0] |
| 6289 | assert(_type == 15) |
| 6290 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6291 | orig_reader = reader |
| 6292 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6293 | obj.xid = reader.read("!L")[0] |
| 6294 | _command = reader.read("!H")[0] |
| 6295 | assert(_command == 1) |
| 6296 | obj.group_type = reader.read("!B")[0] |
| 6297 | reader.skip(1) |
| 6298 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6299 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6300 | return obj |
| 6301 | |
| 6302 | def __eq__(self, other): |
| 6303 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6304 | if self.xid != other.xid: return False |
| 6305 | if self.group_type != other.group_type: return False |
| 6306 | if self.group_id != other.group_id: return False |
| 6307 | if self.buckets != other.buckets: return False |
| 6308 | return True |
| 6309 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6310 | def pretty_print(self, q): |
| 6311 | q.text("group_modify {") |
| 6312 | with q.group(): |
| 6313 | with q.indent(2): |
| 6314 | q.breakable() |
| 6315 | q.text("xid = "); |
| 6316 | if self.xid != None: |
| 6317 | q.text("%#x" % self.xid) |
| 6318 | else: |
| 6319 | q.text('None') |
| 6320 | q.text(","); q.breakable() |
| 6321 | q.text("group_type = "); |
| 6322 | q.text("%#x" % self.group_type) |
| 6323 | q.text(","); q.breakable() |
| 6324 | q.text("group_id = "); |
| 6325 | q.text("%#x" % self.group_id) |
| 6326 | q.text(","); q.breakable() |
| 6327 | q.text("buckets = "); |
| 6328 | q.pp(self.buckets) |
| 6329 | q.breakable() |
| 6330 | q.text('}') |
| 6331 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6332 | group_mod.subtypes[1] = group_modify |
| 6333 | |
| 6334 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6335 | version = 3 |
| 6336 | type = 19 |
| 6337 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6338 | |
| 6339 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6340 | if xid != None: |
| 6341 | self.xid = xid |
| 6342 | else: |
| 6343 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6344 | if flags != None: |
| 6345 | self.flags = flags |
| 6346 | else: |
| 6347 | self.flags = 0 |
| 6348 | if entries != None: |
| 6349 | self.entries = entries |
| 6350 | else: |
| 6351 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6352 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6353 | |
| 6354 | def pack(self): |
| 6355 | packed = [] |
| 6356 | packed.append(struct.pack("!B", self.version)) |
| 6357 | packed.append(struct.pack("!B", self.type)) |
| 6358 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6359 | packed.append(struct.pack("!L", self.xid)) |
| 6360 | packed.append(struct.pack("!H", self.stats_type)) |
| 6361 | packed.append(struct.pack("!H", self.flags)) |
| 6362 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6363 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6364 | length = sum([len(x) for x in packed]) |
| 6365 | packed[2] = struct.pack("!H", length) |
| 6366 | return ''.join(packed) |
| 6367 | |
| 6368 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6369 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6370 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6371 | _version = reader.read("!B")[0] |
| 6372 | assert(_version == 3) |
| 6373 | _type = reader.read("!B")[0] |
| 6374 | assert(_type == 19) |
| 6375 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6376 | orig_reader = reader |
| 6377 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6378 | obj.xid = reader.read("!L")[0] |
| 6379 | _stats_type = reader.read("!H")[0] |
| 6380 | assert(_stats_type == 6) |
| 6381 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6382 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6383 | 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] | 6384 | return obj |
| 6385 | |
| 6386 | def __eq__(self, other): |
| 6387 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6388 | if self.xid != other.xid: return False |
| 6389 | if self.flags != other.flags: return False |
| 6390 | if self.entries != other.entries: return False |
| 6391 | return True |
| 6392 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6393 | def pretty_print(self, q): |
| 6394 | q.text("group_stats_reply {") |
| 6395 | with q.group(): |
| 6396 | with q.indent(2): |
| 6397 | q.breakable() |
| 6398 | q.text("xid = "); |
| 6399 | if self.xid != None: |
| 6400 | q.text("%#x" % self.xid) |
| 6401 | else: |
| 6402 | q.text('None') |
| 6403 | q.text(","); q.breakable() |
| 6404 | q.text("flags = "); |
| 6405 | q.text("%#x" % self.flags) |
| 6406 | q.text(","); q.breakable() |
| 6407 | q.text("entries = "); |
| 6408 | q.pp(self.entries) |
| 6409 | q.breakable() |
| 6410 | q.text('}') |
| 6411 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6412 | stats_reply.subtypes[6] = group_stats_reply |
| 6413 | |
| 6414 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6415 | version = 3 |
| 6416 | type = 18 |
| 6417 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6418 | |
| 6419 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6420 | if xid != None: |
| 6421 | self.xid = xid |
| 6422 | else: |
| 6423 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6424 | if flags != None: |
| 6425 | self.flags = flags |
| 6426 | else: |
| 6427 | self.flags = 0 |
| 6428 | if group_id != None: |
| 6429 | self.group_id = group_id |
| 6430 | else: |
| 6431 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6432 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6433 | |
| 6434 | def pack(self): |
| 6435 | packed = [] |
| 6436 | packed.append(struct.pack("!B", self.version)) |
| 6437 | packed.append(struct.pack("!B", self.type)) |
| 6438 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6439 | packed.append(struct.pack("!L", self.xid)) |
| 6440 | packed.append(struct.pack("!H", self.stats_type)) |
| 6441 | packed.append(struct.pack("!H", self.flags)) |
| 6442 | packed.append('\x00' * 4) |
| 6443 | packed.append(struct.pack("!L", self.group_id)) |
| 6444 | packed.append('\x00' * 4) |
| 6445 | length = sum([len(x) for x in packed]) |
| 6446 | packed[2] = struct.pack("!H", length) |
| 6447 | return ''.join(packed) |
| 6448 | |
| 6449 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6450 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6451 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6452 | _version = reader.read("!B")[0] |
| 6453 | assert(_version == 3) |
| 6454 | _type = reader.read("!B")[0] |
| 6455 | assert(_type == 18) |
| 6456 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6457 | orig_reader = reader |
| 6458 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6459 | obj.xid = reader.read("!L")[0] |
| 6460 | _stats_type = reader.read("!H")[0] |
| 6461 | assert(_stats_type == 6) |
| 6462 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6463 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6464 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6465 | reader.skip(4) |
| 6466 | return obj |
| 6467 | |
| 6468 | def __eq__(self, other): |
| 6469 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6470 | if self.xid != other.xid: return False |
| 6471 | if self.flags != other.flags: return False |
| 6472 | if self.group_id != other.group_id: return False |
| 6473 | return True |
| 6474 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6475 | def pretty_print(self, q): |
| 6476 | q.text("group_stats_request {") |
| 6477 | with q.group(): |
| 6478 | with q.indent(2): |
| 6479 | q.breakable() |
| 6480 | q.text("xid = "); |
| 6481 | if self.xid != None: |
| 6482 | q.text("%#x" % self.xid) |
| 6483 | else: |
| 6484 | q.text('None') |
| 6485 | q.text(","); q.breakable() |
| 6486 | q.text("flags = "); |
| 6487 | q.text("%#x" % self.flags) |
| 6488 | q.text(","); q.breakable() |
| 6489 | q.text("group_id = "); |
| 6490 | q.text("%#x" % self.group_id) |
| 6491 | q.breakable() |
| 6492 | q.text('}') |
| 6493 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6494 | stats_request.subtypes[6] = group_stats_request |
| 6495 | |
| 6496 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6497 | version = 3 |
| 6498 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6499 | |
| 6500 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6501 | if xid != None: |
| 6502 | self.xid = xid |
| 6503 | else: |
| 6504 | self.xid = None |
| 6505 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6506 | |
| 6507 | def pack(self): |
| 6508 | packed = [] |
| 6509 | packed.append(struct.pack("!B", self.version)) |
| 6510 | packed.append(struct.pack("!B", self.type)) |
| 6511 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6512 | packed.append(struct.pack("!L", self.xid)) |
| 6513 | length = sum([len(x) for x in packed]) |
| 6514 | packed[2] = struct.pack("!H", length) |
| 6515 | return ''.join(packed) |
| 6516 | |
| 6517 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6518 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6519 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6520 | _version = reader.read("!B")[0] |
| 6521 | assert(_version == 3) |
| 6522 | _type = reader.read("!B")[0] |
| 6523 | assert(_type == 0) |
| 6524 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6525 | orig_reader = reader |
| 6526 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6527 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6528 | return obj |
| 6529 | |
| 6530 | def __eq__(self, other): |
| 6531 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6532 | if self.xid != other.xid: return False |
| 6533 | return True |
| 6534 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6535 | def pretty_print(self, q): |
| 6536 | q.text("hello {") |
| 6537 | with q.group(): |
| 6538 | with q.indent(2): |
| 6539 | q.breakable() |
| 6540 | q.text("xid = "); |
| 6541 | if self.xid != None: |
| 6542 | q.text("%#x" % self.xid) |
| 6543 | else: |
| 6544 | q.text('None') |
| 6545 | q.breakable() |
| 6546 | q.text('}') |
| 6547 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6548 | message.subtypes[0] = hello |
| 6549 | |
| 6550 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6551 | version = 3 |
| 6552 | type = 1 |
| 6553 | err_type = 0 |
| 6554 | |
| 6555 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6556 | if xid != None: |
| 6557 | self.xid = xid |
| 6558 | else: |
| 6559 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6560 | if code != None: |
| 6561 | self.code = code |
| 6562 | else: |
| 6563 | self.code = 0 |
| 6564 | if data != None: |
| 6565 | self.data = data |
| 6566 | else: |
| 6567 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6568 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6569 | |
| 6570 | def pack(self): |
| 6571 | packed = [] |
| 6572 | packed.append(struct.pack("!B", self.version)) |
| 6573 | packed.append(struct.pack("!B", self.type)) |
| 6574 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6575 | packed.append(struct.pack("!L", self.xid)) |
| 6576 | packed.append(struct.pack("!H", self.err_type)) |
| 6577 | packed.append(struct.pack("!H", self.code)) |
| 6578 | packed.append(self.data) |
| 6579 | length = sum([len(x) for x in packed]) |
| 6580 | packed[2] = struct.pack("!H", length) |
| 6581 | return ''.join(packed) |
| 6582 | |
| 6583 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6584 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6585 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6586 | _version = reader.read("!B")[0] |
| 6587 | assert(_version == 3) |
| 6588 | _type = reader.read("!B")[0] |
| 6589 | assert(_type == 1) |
| 6590 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6591 | orig_reader = reader |
| 6592 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6593 | obj.xid = reader.read("!L")[0] |
| 6594 | _err_type = reader.read("!H")[0] |
| 6595 | assert(_err_type == 0) |
| 6596 | obj.code = reader.read("!H")[0] |
| 6597 | obj.data = str(reader.read_all()) |
| 6598 | return obj |
| 6599 | |
| 6600 | def __eq__(self, other): |
| 6601 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6602 | if self.xid != other.xid: return False |
| 6603 | if self.code != other.code: return False |
| 6604 | if self.data != other.data: return False |
| 6605 | return True |
| 6606 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6607 | def pretty_print(self, q): |
| 6608 | q.text("hello_failed_error_msg {") |
| 6609 | with q.group(): |
| 6610 | with q.indent(2): |
| 6611 | q.breakable() |
| 6612 | q.text("xid = "); |
| 6613 | if self.xid != None: |
| 6614 | q.text("%#x" % self.xid) |
| 6615 | else: |
| 6616 | q.text('None') |
| 6617 | q.text(","); q.breakable() |
| 6618 | q.text("code = "); |
| 6619 | q.text("%#x" % self.code) |
| 6620 | q.text(","); q.breakable() |
| 6621 | q.text("data = "); |
| 6622 | q.pp(self.data) |
| 6623 | q.breakable() |
| 6624 | q.text('}') |
| 6625 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6626 | error_msg.subtypes[0] = hello_failed_error_msg |
| 6627 | |
| 6628 | class nicira_header(experimenter): |
| 6629 | subtypes = {} |
| 6630 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6631 | version = 3 |
| 6632 | type = 4 |
| 6633 | experimenter = 8992 |
| 6634 | |
| 6635 | def __init__(self, xid=None, subtype=None): |
| 6636 | if xid != None: |
| 6637 | self.xid = xid |
| 6638 | else: |
| 6639 | self.xid = None |
| 6640 | if subtype != None: |
| 6641 | self.subtype = subtype |
| 6642 | else: |
| 6643 | self.subtype = 0 |
| 6644 | return |
| 6645 | |
| 6646 | def pack(self): |
| 6647 | packed = [] |
| 6648 | packed.append(struct.pack("!B", self.version)) |
| 6649 | packed.append(struct.pack("!B", self.type)) |
| 6650 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6651 | packed.append(struct.pack("!L", self.xid)) |
| 6652 | packed.append(struct.pack("!L", self.experimenter)) |
| 6653 | packed.append(struct.pack("!L", self.subtype)) |
| 6654 | length = sum([len(x) for x in packed]) |
| 6655 | packed[2] = struct.pack("!H", length) |
| 6656 | return ''.join(packed) |
| 6657 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6658 | @staticmethod |
| 6659 | def unpack(reader): |
| 6660 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6661 | subclass = nicira_header.subtypes.get(subtype) |
| 6662 | if subclass: |
| 6663 | return subclass.unpack(reader) |
| 6664 | |
| 6665 | obj = nicira_header() |
| 6666 | _version = reader.read("!B")[0] |
| 6667 | assert(_version == 3) |
| 6668 | _type = reader.read("!B")[0] |
| 6669 | assert(_type == 4) |
| 6670 | _length = reader.read("!H")[0] |
| 6671 | orig_reader = reader |
| 6672 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6673 | obj.xid = reader.read("!L")[0] |
| 6674 | _experimenter = reader.read("!L")[0] |
| 6675 | assert(_experimenter == 8992) |
| 6676 | obj.subtype = reader.read("!L")[0] |
| 6677 | return obj |
| 6678 | |
| 6679 | def __eq__(self, other): |
| 6680 | if type(self) != type(other): return False |
| 6681 | if self.xid != other.xid: return False |
| 6682 | if self.subtype != other.subtype: return False |
| 6683 | return True |
| 6684 | |
| 6685 | def pretty_print(self, q): |
| 6686 | q.text("nicira_header {") |
| 6687 | with q.group(): |
| 6688 | with q.indent(2): |
| 6689 | q.breakable() |
| 6690 | q.text("xid = "); |
| 6691 | if self.xid != None: |
| 6692 | q.text("%#x" % self.xid) |
| 6693 | else: |
| 6694 | q.text('None') |
| 6695 | q.breakable() |
| 6696 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6697 | |
| 6698 | experimenter.subtypes[8992] = nicira_header |
| 6699 | |
| 6700 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6701 | version = 3 |
| 6702 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6703 | |
| 6704 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6705 | if xid != None: |
| 6706 | self.xid = xid |
| 6707 | else: |
| 6708 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6709 | if buffer_id != None: |
| 6710 | self.buffer_id = buffer_id |
| 6711 | else: |
| 6712 | self.buffer_id = 0 |
| 6713 | if total_len != None: |
| 6714 | self.total_len = total_len |
| 6715 | else: |
| 6716 | self.total_len = 0 |
| 6717 | if reason != None: |
| 6718 | self.reason = reason |
| 6719 | else: |
| 6720 | self.reason = 0 |
| 6721 | if table_id != None: |
| 6722 | self.table_id = table_id |
| 6723 | else: |
| 6724 | self.table_id = 0 |
| 6725 | if match != None: |
| 6726 | self.match = match |
| 6727 | else: |
| 6728 | self.match = common.match() |
| 6729 | if data != None: |
| 6730 | self.data = data |
| 6731 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6732 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6733 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6734 | |
| 6735 | def pack(self): |
| 6736 | packed = [] |
| 6737 | packed.append(struct.pack("!B", self.version)) |
| 6738 | packed.append(struct.pack("!B", self.type)) |
| 6739 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6740 | packed.append(struct.pack("!L", self.xid)) |
| 6741 | packed.append(struct.pack("!L", self.buffer_id)) |
| 6742 | packed.append(struct.pack("!H", self.total_len)) |
| 6743 | packed.append(struct.pack("!B", self.reason)) |
| 6744 | packed.append(struct.pack("!B", self.table_id)) |
| 6745 | packed.append(self.match.pack()) |
| 6746 | packed.append('\x00' * 2) |
| 6747 | packed.append(self.data) |
| 6748 | length = sum([len(x) for x in packed]) |
| 6749 | packed[2] = struct.pack("!H", length) |
| 6750 | return ''.join(packed) |
| 6751 | |
| 6752 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6753 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6754 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6755 | _version = reader.read("!B")[0] |
| 6756 | assert(_version == 3) |
| 6757 | _type = reader.read("!B")[0] |
| 6758 | assert(_type == 10) |
| 6759 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6760 | orig_reader = reader |
| 6761 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6762 | obj.xid = reader.read("!L")[0] |
| 6763 | obj.buffer_id = reader.read("!L")[0] |
| 6764 | obj.total_len = reader.read("!H")[0] |
| 6765 | obj.reason = reader.read("!B")[0] |
| 6766 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6767 | obj.match = common.match.unpack(reader) |
| 6768 | reader.skip(2) |
| 6769 | obj.data = str(reader.read_all()) |
| 6770 | return obj |
| 6771 | |
| 6772 | def __eq__(self, other): |
| 6773 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6774 | if self.xid != other.xid: return False |
| 6775 | if self.buffer_id != other.buffer_id: return False |
| 6776 | if self.total_len != other.total_len: return False |
| 6777 | if self.reason != other.reason: return False |
| 6778 | if self.table_id != other.table_id: return False |
| 6779 | if self.match != other.match: return False |
| 6780 | if self.data != other.data: return False |
| 6781 | return True |
| 6782 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6783 | def pretty_print(self, q): |
| 6784 | q.text("packet_in {") |
| 6785 | with q.group(): |
| 6786 | with q.indent(2): |
| 6787 | q.breakable() |
| 6788 | q.text("xid = "); |
| 6789 | if self.xid != None: |
| 6790 | q.text("%#x" % self.xid) |
| 6791 | else: |
| 6792 | q.text('None') |
| 6793 | q.text(","); q.breakable() |
| 6794 | q.text("buffer_id = "); |
| 6795 | q.text("%#x" % self.buffer_id) |
| 6796 | q.text(","); q.breakable() |
| 6797 | q.text("total_len = "); |
| 6798 | q.text("%#x" % self.total_len) |
| 6799 | q.text(","); q.breakable() |
| 6800 | q.text("reason = "); |
| 6801 | q.text("%#x" % self.reason) |
| 6802 | q.text(","); q.breakable() |
| 6803 | q.text("table_id = "); |
| 6804 | q.text("%#x" % self.table_id) |
| 6805 | q.text(","); q.breakable() |
| 6806 | q.text("match = "); |
| 6807 | q.pp(self.match) |
| 6808 | q.text(","); q.breakable() |
| 6809 | q.text("data = "); |
| 6810 | q.pp(self.data) |
| 6811 | q.breakable() |
| 6812 | q.text('}') |
| 6813 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6814 | message.subtypes[10] = packet_in |
| 6815 | |
| 6816 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6817 | version = 3 |
| 6818 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6819 | |
| 6820 | 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] | 6821 | if xid != None: |
| 6822 | self.xid = xid |
| 6823 | else: |
| 6824 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6825 | if buffer_id != None: |
| 6826 | self.buffer_id = buffer_id |
| 6827 | else: |
| 6828 | self.buffer_id = 0 |
| 6829 | if in_port != None: |
| 6830 | self.in_port = in_port |
| 6831 | else: |
| 6832 | self.in_port = 0 |
| 6833 | if actions != None: |
| 6834 | self.actions = actions |
| 6835 | else: |
| 6836 | self.actions = [] |
| 6837 | if data != None: |
| 6838 | self.data = data |
| 6839 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6840 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6841 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6842 | |
| 6843 | def pack(self): |
| 6844 | packed = [] |
| 6845 | packed.append(struct.pack("!B", self.version)) |
| 6846 | packed.append(struct.pack("!B", self.type)) |
| 6847 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6848 | packed.append(struct.pack("!L", self.xid)) |
| 6849 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6850 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6851 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 6852 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6853 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6854 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 6855 | packed.append(self.data) |
| 6856 | length = sum([len(x) for x in packed]) |
| 6857 | packed[2] = struct.pack("!H", length) |
| 6858 | return ''.join(packed) |
| 6859 | |
| 6860 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6861 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6862 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6863 | _version = reader.read("!B")[0] |
| 6864 | assert(_version == 3) |
| 6865 | _type = reader.read("!B")[0] |
| 6866 | assert(_type == 13) |
| 6867 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6868 | orig_reader = reader |
| 6869 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6870 | obj.xid = reader.read("!L")[0] |
| 6871 | obj.buffer_id = reader.read("!L")[0] |
| 6872 | obj.in_port = util.unpack_port_no(reader) |
| 6873 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6874 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6875 | 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] | 6876 | obj.data = str(reader.read_all()) |
| 6877 | return obj |
| 6878 | |
| 6879 | def __eq__(self, other): |
| 6880 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6881 | if self.xid != other.xid: return False |
| 6882 | if self.buffer_id != other.buffer_id: return False |
| 6883 | if self.in_port != other.in_port: return False |
| 6884 | if self.actions != other.actions: return False |
| 6885 | if self.data != other.data: return False |
| 6886 | return True |
| 6887 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6888 | def pretty_print(self, q): |
| 6889 | q.text("packet_out {") |
| 6890 | with q.group(): |
| 6891 | with q.indent(2): |
| 6892 | q.breakable() |
| 6893 | q.text("xid = "); |
| 6894 | if self.xid != None: |
| 6895 | q.text("%#x" % self.xid) |
| 6896 | else: |
| 6897 | q.text('None') |
| 6898 | q.text(","); q.breakable() |
| 6899 | q.text("buffer_id = "); |
| 6900 | q.text("%#x" % self.buffer_id) |
| 6901 | q.text(","); q.breakable() |
| 6902 | q.text("in_port = "); |
| 6903 | q.text(util.pretty_port(self.in_port)) |
| 6904 | q.text(","); q.breakable() |
| 6905 | q.text("actions = "); |
| 6906 | q.pp(self.actions) |
| 6907 | q.text(","); q.breakable() |
| 6908 | q.text("data = "); |
| 6909 | q.pp(self.data) |
| 6910 | q.breakable() |
| 6911 | q.text('}') |
| 6912 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6913 | message.subtypes[13] = packet_out |
| 6914 | |
| 6915 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6916 | version = 3 |
| 6917 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6918 | |
| 6919 | 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] | 6920 | if xid != None: |
| 6921 | self.xid = xid |
| 6922 | else: |
| 6923 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6924 | if port_no != None: |
| 6925 | self.port_no = port_no |
| 6926 | else: |
| 6927 | self.port_no = 0 |
| 6928 | if hw_addr != None: |
| 6929 | self.hw_addr = hw_addr |
| 6930 | else: |
| 6931 | self.hw_addr = [0,0,0,0,0,0] |
| 6932 | if config != None: |
| 6933 | self.config = config |
| 6934 | else: |
| 6935 | self.config = 0 |
| 6936 | if mask != None: |
| 6937 | self.mask = mask |
| 6938 | else: |
| 6939 | self.mask = 0 |
| 6940 | if advertise != None: |
| 6941 | self.advertise = advertise |
| 6942 | else: |
| 6943 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6944 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6945 | |
| 6946 | def pack(self): |
| 6947 | packed = [] |
| 6948 | packed.append(struct.pack("!B", self.version)) |
| 6949 | packed.append(struct.pack("!B", self.type)) |
| 6950 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6951 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6952 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6953 | packed.append('\x00' * 4) |
| 6954 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6955 | packed.append('\x00' * 2) |
| 6956 | packed.append(struct.pack("!L", self.config)) |
| 6957 | packed.append(struct.pack("!L", self.mask)) |
| 6958 | packed.append(struct.pack("!L", self.advertise)) |
| 6959 | packed.append('\x00' * 4) |
| 6960 | length = sum([len(x) for x in packed]) |
| 6961 | packed[2] = struct.pack("!H", length) |
| 6962 | return ''.join(packed) |
| 6963 | |
| 6964 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6965 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6966 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6967 | _version = reader.read("!B")[0] |
| 6968 | assert(_version == 3) |
| 6969 | _type = reader.read("!B")[0] |
| 6970 | assert(_type == 16) |
| 6971 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6972 | orig_reader = reader |
| 6973 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6974 | obj.xid = reader.read("!L")[0] |
| 6975 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6976 | reader.skip(4) |
| 6977 | obj.hw_addr = list(reader.read('!6B')) |
| 6978 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6979 | obj.config = reader.read("!L")[0] |
| 6980 | obj.mask = reader.read("!L")[0] |
| 6981 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6982 | reader.skip(4) |
| 6983 | return obj |
| 6984 | |
| 6985 | def __eq__(self, other): |
| 6986 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6987 | if self.xid != other.xid: return False |
| 6988 | if self.port_no != other.port_no: return False |
| 6989 | if self.hw_addr != other.hw_addr: return False |
| 6990 | if self.config != other.config: return False |
| 6991 | if self.mask != other.mask: return False |
| 6992 | if self.advertise != other.advertise: return False |
| 6993 | return True |
| 6994 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6995 | def pretty_print(self, q): |
| 6996 | q.text("port_mod {") |
| 6997 | with q.group(): |
| 6998 | with q.indent(2): |
| 6999 | q.breakable() |
| 7000 | q.text("xid = "); |
| 7001 | if self.xid != None: |
| 7002 | q.text("%#x" % self.xid) |
| 7003 | else: |
| 7004 | q.text('None') |
| 7005 | q.text(","); q.breakable() |
| 7006 | q.text("port_no = "); |
| 7007 | q.text(util.pretty_port(self.port_no)) |
| 7008 | q.text(","); q.breakable() |
| 7009 | q.text("hw_addr = "); |
| 7010 | q.text(util.pretty_mac(self.hw_addr)) |
| 7011 | q.text(","); q.breakable() |
| 7012 | q.text("config = "); |
| 7013 | q.text("%#x" % self.config) |
| 7014 | q.text(","); q.breakable() |
| 7015 | q.text("mask = "); |
| 7016 | q.text("%#x" % self.mask) |
| 7017 | q.text(","); q.breakable() |
| 7018 | q.text("advertise = "); |
| 7019 | q.text("%#x" % self.advertise) |
| 7020 | q.breakable() |
| 7021 | q.text('}') |
| 7022 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7023 | message.subtypes[16] = port_mod |
| 7024 | |
| 7025 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7026 | version = 3 |
| 7027 | type = 1 |
| 7028 | err_type = 7 |
| 7029 | |
| 7030 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7031 | if xid != None: |
| 7032 | self.xid = xid |
| 7033 | else: |
| 7034 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7035 | if code != None: |
| 7036 | self.code = code |
| 7037 | else: |
| 7038 | self.code = 0 |
| 7039 | if data != None: |
| 7040 | self.data = data |
| 7041 | else: |
| 7042 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7043 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7044 | |
| 7045 | def pack(self): |
| 7046 | packed = [] |
| 7047 | packed.append(struct.pack("!B", self.version)) |
| 7048 | packed.append(struct.pack("!B", self.type)) |
| 7049 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7050 | packed.append(struct.pack("!L", self.xid)) |
| 7051 | packed.append(struct.pack("!H", self.err_type)) |
| 7052 | packed.append(struct.pack("!H", self.code)) |
| 7053 | packed.append(self.data) |
| 7054 | length = sum([len(x) for x in packed]) |
| 7055 | packed[2] = struct.pack("!H", length) |
| 7056 | return ''.join(packed) |
| 7057 | |
| 7058 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7059 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7060 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7061 | _version = reader.read("!B")[0] |
| 7062 | assert(_version == 3) |
| 7063 | _type = reader.read("!B")[0] |
| 7064 | assert(_type == 1) |
| 7065 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7066 | orig_reader = reader |
| 7067 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7068 | obj.xid = reader.read("!L")[0] |
| 7069 | _err_type = reader.read("!H")[0] |
| 7070 | assert(_err_type == 7) |
| 7071 | obj.code = reader.read("!H")[0] |
| 7072 | obj.data = str(reader.read_all()) |
| 7073 | return obj |
| 7074 | |
| 7075 | def __eq__(self, other): |
| 7076 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7077 | if self.xid != other.xid: return False |
| 7078 | if self.code != other.code: return False |
| 7079 | if self.data != other.data: return False |
| 7080 | return True |
| 7081 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7082 | def pretty_print(self, q): |
| 7083 | q.text("port_mod_failed_error_msg {") |
| 7084 | with q.group(): |
| 7085 | with q.indent(2): |
| 7086 | q.breakable() |
| 7087 | q.text("xid = "); |
| 7088 | if self.xid != None: |
| 7089 | q.text("%#x" % self.xid) |
| 7090 | else: |
| 7091 | q.text('None') |
| 7092 | q.text(","); q.breakable() |
| 7093 | q.text("code = "); |
| 7094 | q.text("%#x" % self.code) |
| 7095 | q.text(","); q.breakable() |
| 7096 | q.text("data = "); |
| 7097 | q.pp(self.data) |
| 7098 | q.breakable() |
| 7099 | q.text('}') |
| 7100 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7101 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 7102 | |
| 7103 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7104 | version = 3 |
| 7105 | type = 19 |
| 7106 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7107 | |
| 7108 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7109 | if xid != None: |
| 7110 | self.xid = xid |
| 7111 | else: |
| 7112 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7113 | if flags != None: |
| 7114 | self.flags = flags |
| 7115 | else: |
| 7116 | self.flags = 0 |
| 7117 | if entries != None: |
| 7118 | self.entries = entries |
| 7119 | else: |
| 7120 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7121 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7122 | |
| 7123 | def pack(self): |
| 7124 | packed = [] |
| 7125 | packed.append(struct.pack("!B", self.version)) |
| 7126 | packed.append(struct.pack("!B", self.type)) |
| 7127 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7128 | packed.append(struct.pack("!L", self.xid)) |
| 7129 | packed.append(struct.pack("!H", self.stats_type)) |
| 7130 | packed.append(struct.pack("!H", self.flags)) |
| 7131 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7132 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7133 | length = sum([len(x) for x in packed]) |
| 7134 | packed[2] = struct.pack("!H", length) |
| 7135 | return ''.join(packed) |
| 7136 | |
| 7137 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7138 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7139 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7140 | _version = reader.read("!B")[0] |
| 7141 | assert(_version == 3) |
| 7142 | _type = reader.read("!B")[0] |
| 7143 | assert(_type == 19) |
| 7144 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7145 | orig_reader = reader |
| 7146 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7147 | obj.xid = reader.read("!L")[0] |
| 7148 | _stats_type = reader.read("!H")[0] |
| 7149 | assert(_stats_type == 4) |
| 7150 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7151 | reader.skip(4) |
| 7152 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 7153 | return obj |
| 7154 | |
| 7155 | def __eq__(self, other): |
| 7156 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7157 | if self.xid != other.xid: return False |
| 7158 | if self.flags != other.flags: return False |
| 7159 | if self.entries != other.entries: return False |
| 7160 | return True |
| 7161 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7162 | def pretty_print(self, q): |
| 7163 | q.text("port_stats_reply {") |
| 7164 | with q.group(): |
| 7165 | with q.indent(2): |
| 7166 | q.breakable() |
| 7167 | q.text("xid = "); |
| 7168 | if self.xid != None: |
| 7169 | q.text("%#x" % self.xid) |
| 7170 | else: |
| 7171 | q.text('None') |
| 7172 | q.text(","); q.breakable() |
| 7173 | q.text("flags = "); |
| 7174 | q.text("%#x" % self.flags) |
| 7175 | q.text(","); q.breakable() |
| 7176 | q.text("entries = "); |
| 7177 | q.pp(self.entries) |
| 7178 | q.breakable() |
| 7179 | q.text('}') |
| 7180 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7181 | stats_reply.subtypes[4] = port_stats_reply |
| 7182 | |
| 7183 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7184 | version = 3 |
| 7185 | type = 18 |
| 7186 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7187 | |
| 7188 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7189 | if xid != None: |
| 7190 | self.xid = xid |
| 7191 | else: |
| 7192 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7193 | if flags != None: |
| 7194 | self.flags = flags |
| 7195 | else: |
| 7196 | self.flags = 0 |
| 7197 | if port_no != None: |
| 7198 | self.port_no = port_no |
| 7199 | else: |
| 7200 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7201 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7202 | |
| 7203 | def pack(self): |
| 7204 | packed = [] |
| 7205 | packed.append(struct.pack("!B", self.version)) |
| 7206 | packed.append(struct.pack("!B", self.type)) |
| 7207 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7208 | packed.append(struct.pack("!L", self.xid)) |
| 7209 | packed.append(struct.pack("!H", self.stats_type)) |
| 7210 | packed.append(struct.pack("!H", self.flags)) |
| 7211 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7212 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7213 | packed.append('\x00' * 4) |
| 7214 | length = sum([len(x) for x in packed]) |
| 7215 | packed[2] = struct.pack("!H", length) |
| 7216 | return ''.join(packed) |
| 7217 | |
| 7218 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7219 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7220 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7221 | _version = reader.read("!B")[0] |
| 7222 | assert(_version == 3) |
| 7223 | _type = reader.read("!B")[0] |
| 7224 | assert(_type == 18) |
| 7225 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7226 | orig_reader = reader |
| 7227 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7228 | obj.xid = reader.read("!L")[0] |
| 7229 | _stats_type = reader.read("!H")[0] |
| 7230 | assert(_stats_type == 4) |
| 7231 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7232 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7233 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7234 | reader.skip(4) |
| 7235 | return obj |
| 7236 | |
| 7237 | def __eq__(self, other): |
| 7238 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7239 | if self.xid != other.xid: return False |
| 7240 | if self.flags != other.flags: return False |
| 7241 | if self.port_no != other.port_no: return False |
| 7242 | return True |
| 7243 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7244 | def pretty_print(self, q): |
| 7245 | q.text("port_stats_request {") |
| 7246 | with q.group(): |
| 7247 | with q.indent(2): |
| 7248 | q.breakable() |
| 7249 | q.text("xid = "); |
| 7250 | if self.xid != None: |
| 7251 | q.text("%#x" % self.xid) |
| 7252 | else: |
| 7253 | q.text('None') |
| 7254 | q.text(","); q.breakable() |
| 7255 | q.text("flags = "); |
| 7256 | q.text("%#x" % self.flags) |
| 7257 | q.text(","); q.breakable() |
| 7258 | q.text("port_no = "); |
| 7259 | q.text(util.pretty_port(self.port_no)) |
| 7260 | q.breakable() |
| 7261 | q.text('}') |
| 7262 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7263 | stats_request.subtypes[4] = port_stats_request |
| 7264 | |
| 7265 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7266 | version = 3 |
| 7267 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7268 | |
| 7269 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7270 | if xid != None: |
| 7271 | self.xid = xid |
| 7272 | else: |
| 7273 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7274 | if reason != None: |
| 7275 | self.reason = reason |
| 7276 | else: |
| 7277 | self.reason = 0 |
| 7278 | if desc != None: |
| 7279 | self.desc = desc |
| 7280 | else: |
| 7281 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7282 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7283 | |
| 7284 | def pack(self): |
| 7285 | packed = [] |
| 7286 | packed.append(struct.pack("!B", self.version)) |
| 7287 | packed.append(struct.pack("!B", self.type)) |
| 7288 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7289 | packed.append(struct.pack("!L", self.xid)) |
| 7290 | packed.append(struct.pack("!B", self.reason)) |
| 7291 | packed.append('\x00' * 7) |
| 7292 | packed.append(self.desc.pack()) |
| 7293 | length = sum([len(x) for x in packed]) |
| 7294 | packed[2] = struct.pack("!H", length) |
| 7295 | return ''.join(packed) |
| 7296 | |
| 7297 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7298 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7299 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7300 | _version = reader.read("!B")[0] |
| 7301 | assert(_version == 3) |
| 7302 | _type = reader.read("!B")[0] |
| 7303 | assert(_type == 12) |
| 7304 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7305 | orig_reader = reader |
| 7306 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7307 | obj.xid = reader.read("!L")[0] |
| 7308 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7309 | reader.skip(7) |
| 7310 | obj.desc = common.port_desc.unpack(reader) |
| 7311 | return obj |
| 7312 | |
| 7313 | def __eq__(self, other): |
| 7314 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7315 | if self.xid != other.xid: return False |
| 7316 | if self.reason != other.reason: return False |
| 7317 | if self.desc != other.desc: return False |
| 7318 | return True |
| 7319 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7320 | def pretty_print(self, q): |
| 7321 | q.text("port_status {") |
| 7322 | with q.group(): |
| 7323 | with q.indent(2): |
| 7324 | q.breakable() |
| 7325 | q.text("xid = "); |
| 7326 | if self.xid != None: |
| 7327 | q.text("%#x" % self.xid) |
| 7328 | else: |
| 7329 | q.text('None') |
| 7330 | q.text(","); q.breakable() |
| 7331 | q.text("reason = "); |
| 7332 | q.text("%#x" % self.reason) |
| 7333 | q.text(","); q.breakable() |
| 7334 | q.text("desc = "); |
| 7335 | q.pp(self.desc) |
| 7336 | q.breakable() |
| 7337 | q.text('}') |
| 7338 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7339 | message.subtypes[12] = port_status |
| 7340 | |
| 7341 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7342 | version = 3 |
| 7343 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7344 | |
| 7345 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7346 | if xid != None: |
| 7347 | self.xid = xid |
| 7348 | else: |
| 7349 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7350 | if port != None: |
| 7351 | self.port = port |
| 7352 | else: |
| 7353 | self.port = 0 |
| 7354 | if queues != None: |
| 7355 | self.queues = queues |
| 7356 | else: |
| 7357 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7358 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7359 | |
| 7360 | def pack(self): |
| 7361 | packed = [] |
| 7362 | packed.append(struct.pack("!B", self.version)) |
| 7363 | packed.append(struct.pack("!B", self.type)) |
| 7364 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7365 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7366 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7367 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7368 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7369 | length = sum([len(x) for x in packed]) |
| 7370 | packed[2] = struct.pack("!H", length) |
| 7371 | return ''.join(packed) |
| 7372 | |
| 7373 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7374 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7375 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7376 | _version = reader.read("!B")[0] |
| 7377 | assert(_version == 3) |
| 7378 | _type = reader.read("!B")[0] |
| 7379 | assert(_type == 23) |
| 7380 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7381 | orig_reader = reader |
| 7382 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7383 | obj.xid = reader.read("!L")[0] |
| 7384 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7385 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7386 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7387 | return obj |
| 7388 | |
| 7389 | def __eq__(self, other): |
| 7390 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7391 | if self.xid != other.xid: return False |
| 7392 | if self.port != other.port: return False |
| 7393 | if self.queues != other.queues: return False |
| 7394 | return True |
| 7395 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7396 | def pretty_print(self, q): |
| 7397 | q.text("queue_get_config_reply {") |
| 7398 | with q.group(): |
| 7399 | with q.indent(2): |
| 7400 | q.breakable() |
| 7401 | q.text("xid = "); |
| 7402 | if self.xid != None: |
| 7403 | q.text("%#x" % self.xid) |
| 7404 | else: |
| 7405 | q.text('None') |
| 7406 | q.text(","); q.breakable() |
| 7407 | q.text("port = "); |
| 7408 | q.text(util.pretty_port(self.port)) |
| 7409 | q.text(","); q.breakable() |
| 7410 | q.text("queues = "); |
| 7411 | q.pp(self.queues) |
| 7412 | q.breakable() |
| 7413 | q.text('}') |
| 7414 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7415 | message.subtypes[23] = queue_get_config_reply |
| 7416 | |
| 7417 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7418 | version = 3 |
| 7419 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7420 | |
| 7421 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7422 | if xid != None: |
| 7423 | self.xid = xid |
| 7424 | else: |
| 7425 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7426 | if port != None: |
| 7427 | self.port = port |
| 7428 | else: |
| 7429 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7430 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7431 | |
| 7432 | def pack(self): |
| 7433 | packed = [] |
| 7434 | packed.append(struct.pack("!B", self.version)) |
| 7435 | packed.append(struct.pack("!B", self.type)) |
| 7436 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7437 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7438 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7439 | packed.append('\x00' * 4) |
| 7440 | length = sum([len(x) for x in packed]) |
| 7441 | packed[2] = struct.pack("!H", length) |
| 7442 | return ''.join(packed) |
| 7443 | |
| 7444 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7445 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7446 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7447 | _version = reader.read("!B")[0] |
| 7448 | assert(_version == 3) |
| 7449 | _type = reader.read("!B")[0] |
| 7450 | assert(_type == 22) |
| 7451 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7452 | orig_reader = reader |
| 7453 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7454 | obj.xid = reader.read("!L")[0] |
| 7455 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7456 | reader.skip(4) |
| 7457 | return obj |
| 7458 | |
| 7459 | def __eq__(self, other): |
| 7460 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7461 | if self.xid != other.xid: return False |
| 7462 | if self.port != other.port: return False |
| 7463 | return True |
| 7464 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7465 | def pretty_print(self, q): |
| 7466 | q.text("queue_get_config_request {") |
| 7467 | with q.group(): |
| 7468 | with q.indent(2): |
| 7469 | q.breakable() |
| 7470 | q.text("xid = "); |
| 7471 | if self.xid != None: |
| 7472 | q.text("%#x" % self.xid) |
| 7473 | else: |
| 7474 | q.text('None') |
| 7475 | q.text(","); q.breakable() |
| 7476 | q.text("port = "); |
| 7477 | q.text(util.pretty_port(self.port)) |
| 7478 | q.breakable() |
| 7479 | q.text('}') |
| 7480 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7481 | message.subtypes[22] = queue_get_config_request |
| 7482 | |
| 7483 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7484 | version = 3 |
| 7485 | type = 1 |
| 7486 | err_type = 9 |
| 7487 | |
| 7488 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7489 | if xid != None: |
| 7490 | self.xid = xid |
| 7491 | else: |
| 7492 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7493 | if code != None: |
| 7494 | self.code = code |
| 7495 | else: |
| 7496 | self.code = 0 |
| 7497 | if data != None: |
| 7498 | self.data = data |
| 7499 | else: |
| 7500 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7501 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7502 | |
| 7503 | def pack(self): |
| 7504 | packed = [] |
| 7505 | packed.append(struct.pack("!B", self.version)) |
| 7506 | packed.append(struct.pack("!B", self.type)) |
| 7507 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7508 | packed.append(struct.pack("!L", self.xid)) |
| 7509 | packed.append(struct.pack("!H", self.err_type)) |
| 7510 | packed.append(struct.pack("!H", self.code)) |
| 7511 | packed.append(self.data) |
| 7512 | length = sum([len(x) for x in packed]) |
| 7513 | packed[2] = struct.pack("!H", length) |
| 7514 | return ''.join(packed) |
| 7515 | |
| 7516 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7517 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7518 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7519 | _version = reader.read("!B")[0] |
| 7520 | assert(_version == 3) |
| 7521 | _type = reader.read("!B")[0] |
| 7522 | assert(_type == 1) |
| 7523 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7524 | orig_reader = reader |
| 7525 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7526 | obj.xid = reader.read("!L")[0] |
| 7527 | _err_type = reader.read("!H")[0] |
| 7528 | assert(_err_type == 9) |
| 7529 | obj.code = reader.read("!H")[0] |
| 7530 | obj.data = str(reader.read_all()) |
| 7531 | return obj |
| 7532 | |
| 7533 | def __eq__(self, other): |
| 7534 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7535 | if self.xid != other.xid: return False |
| 7536 | if self.code != other.code: return False |
| 7537 | if self.data != other.data: return False |
| 7538 | return True |
| 7539 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7540 | def pretty_print(self, q): |
| 7541 | q.text("queue_op_failed_error_msg {") |
| 7542 | with q.group(): |
| 7543 | with q.indent(2): |
| 7544 | q.breakable() |
| 7545 | q.text("xid = "); |
| 7546 | if self.xid != None: |
| 7547 | q.text("%#x" % self.xid) |
| 7548 | else: |
| 7549 | q.text('None') |
| 7550 | q.text(","); q.breakable() |
| 7551 | q.text("code = "); |
| 7552 | q.text("%#x" % self.code) |
| 7553 | q.text(","); q.breakable() |
| 7554 | q.text("data = "); |
| 7555 | q.pp(self.data) |
| 7556 | q.breakable() |
| 7557 | q.text('}') |
| 7558 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7559 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 7560 | |
| 7561 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7562 | version = 3 |
| 7563 | type = 19 |
| 7564 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7565 | |
| 7566 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7567 | if xid != None: |
| 7568 | self.xid = xid |
| 7569 | else: |
| 7570 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7571 | if flags != None: |
| 7572 | self.flags = flags |
| 7573 | else: |
| 7574 | self.flags = 0 |
| 7575 | if entries != None: |
| 7576 | self.entries = entries |
| 7577 | else: |
| 7578 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7579 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7580 | |
| 7581 | def pack(self): |
| 7582 | packed = [] |
| 7583 | packed.append(struct.pack("!B", self.version)) |
| 7584 | packed.append(struct.pack("!B", self.type)) |
| 7585 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7586 | packed.append(struct.pack("!L", self.xid)) |
| 7587 | packed.append(struct.pack("!H", self.stats_type)) |
| 7588 | packed.append(struct.pack("!H", self.flags)) |
| 7589 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7590 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7591 | length = sum([len(x) for x in packed]) |
| 7592 | packed[2] = struct.pack("!H", length) |
| 7593 | return ''.join(packed) |
| 7594 | |
| 7595 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7596 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7597 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7598 | _version = reader.read("!B")[0] |
| 7599 | assert(_version == 3) |
| 7600 | _type = reader.read("!B")[0] |
| 7601 | assert(_type == 19) |
| 7602 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7603 | orig_reader = reader |
| 7604 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7605 | obj.xid = reader.read("!L")[0] |
| 7606 | _stats_type = reader.read("!H")[0] |
| 7607 | assert(_stats_type == 5) |
| 7608 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7609 | reader.skip(4) |
| 7610 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 7611 | return obj |
| 7612 | |
| 7613 | def __eq__(self, other): |
| 7614 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7615 | if self.xid != other.xid: return False |
| 7616 | if self.flags != other.flags: return False |
| 7617 | if self.entries != other.entries: return False |
| 7618 | return True |
| 7619 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7620 | def pretty_print(self, q): |
| 7621 | q.text("queue_stats_reply {") |
| 7622 | with q.group(): |
| 7623 | with q.indent(2): |
| 7624 | q.breakable() |
| 7625 | q.text("xid = "); |
| 7626 | if self.xid != None: |
| 7627 | q.text("%#x" % self.xid) |
| 7628 | else: |
| 7629 | q.text('None') |
| 7630 | q.text(","); q.breakable() |
| 7631 | q.text("flags = "); |
| 7632 | q.text("%#x" % self.flags) |
| 7633 | q.text(","); q.breakable() |
| 7634 | q.text("entries = "); |
| 7635 | q.pp(self.entries) |
| 7636 | q.breakable() |
| 7637 | q.text('}') |
| 7638 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7639 | stats_reply.subtypes[5] = queue_stats_reply |
| 7640 | |
| 7641 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7642 | version = 3 |
| 7643 | type = 18 |
| 7644 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7645 | |
| 7646 | 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] | 7647 | if xid != None: |
| 7648 | self.xid = xid |
| 7649 | else: |
| 7650 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7651 | if flags != None: |
| 7652 | self.flags = flags |
| 7653 | else: |
| 7654 | self.flags = 0 |
| 7655 | if port_no != None: |
| 7656 | self.port_no = port_no |
| 7657 | else: |
| 7658 | self.port_no = 0 |
| 7659 | if queue_id != None: |
| 7660 | self.queue_id = queue_id |
| 7661 | else: |
| 7662 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7663 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7664 | |
| 7665 | def pack(self): |
| 7666 | packed = [] |
| 7667 | packed.append(struct.pack("!B", self.version)) |
| 7668 | packed.append(struct.pack("!B", self.type)) |
| 7669 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7670 | packed.append(struct.pack("!L", self.xid)) |
| 7671 | packed.append(struct.pack("!H", self.stats_type)) |
| 7672 | packed.append(struct.pack("!H", self.flags)) |
| 7673 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7674 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7675 | packed.append(struct.pack("!L", self.queue_id)) |
| 7676 | length = sum([len(x) for x in packed]) |
| 7677 | packed[2] = struct.pack("!H", length) |
| 7678 | return ''.join(packed) |
| 7679 | |
| 7680 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7681 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7682 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7683 | _version = reader.read("!B")[0] |
| 7684 | assert(_version == 3) |
| 7685 | _type = reader.read("!B")[0] |
| 7686 | assert(_type == 18) |
| 7687 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7688 | orig_reader = reader |
| 7689 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7690 | obj.xid = reader.read("!L")[0] |
| 7691 | _stats_type = reader.read("!H")[0] |
| 7692 | assert(_stats_type == 5) |
| 7693 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7694 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7695 | obj.port_no = util.unpack_port_no(reader) |
| 7696 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7697 | return obj |
| 7698 | |
| 7699 | def __eq__(self, other): |
| 7700 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7701 | if self.xid != other.xid: return False |
| 7702 | if self.flags != other.flags: return False |
| 7703 | if self.port_no != other.port_no: return False |
| 7704 | if self.queue_id != other.queue_id: return False |
| 7705 | return True |
| 7706 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7707 | def pretty_print(self, q): |
| 7708 | q.text("queue_stats_request {") |
| 7709 | with q.group(): |
| 7710 | with q.indent(2): |
| 7711 | q.breakable() |
| 7712 | q.text("xid = "); |
| 7713 | if self.xid != None: |
| 7714 | q.text("%#x" % self.xid) |
| 7715 | else: |
| 7716 | q.text('None') |
| 7717 | q.text(","); q.breakable() |
| 7718 | q.text("flags = "); |
| 7719 | q.text("%#x" % self.flags) |
| 7720 | q.text(","); q.breakable() |
| 7721 | q.text("port_no = "); |
| 7722 | q.text(util.pretty_port(self.port_no)) |
| 7723 | q.text(","); q.breakable() |
| 7724 | q.text("queue_id = "); |
| 7725 | q.text("%#x" % self.queue_id) |
| 7726 | q.breakable() |
| 7727 | q.text('}') |
| 7728 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7729 | stats_request.subtypes[5] = queue_stats_request |
| 7730 | |
| 7731 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7732 | version = 3 |
| 7733 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7734 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7735 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7736 | if xid != None: |
| 7737 | self.xid = xid |
| 7738 | else: |
| 7739 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7740 | if role != None: |
| 7741 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7742 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7743 | self.role = 0 |
| 7744 | if generation_id != None: |
| 7745 | self.generation_id = generation_id |
| 7746 | else: |
| 7747 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7748 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7749 | |
| 7750 | def pack(self): |
| 7751 | packed = [] |
| 7752 | packed.append(struct.pack("!B", self.version)) |
| 7753 | packed.append(struct.pack("!B", self.type)) |
| 7754 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7755 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7756 | packed.append(struct.pack("!L", self.role)) |
| 7757 | packed.append('\x00' * 4) |
| 7758 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7759 | length = sum([len(x) for x in packed]) |
| 7760 | packed[2] = struct.pack("!H", length) |
| 7761 | return ''.join(packed) |
| 7762 | |
| 7763 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7764 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7765 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7766 | _version = reader.read("!B")[0] |
| 7767 | assert(_version == 3) |
| 7768 | _type = reader.read("!B")[0] |
| 7769 | assert(_type == 25) |
| 7770 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7771 | orig_reader = reader |
| 7772 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7773 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7774 | obj.role = reader.read("!L")[0] |
| 7775 | reader.skip(4) |
| 7776 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7777 | return obj |
| 7778 | |
| 7779 | def __eq__(self, other): |
| 7780 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7781 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7782 | if self.role != other.role: return False |
| 7783 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7784 | return True |
| 7785 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7786 | def pretty_print(self, q): |
| 7787 | q.text("role_reply {") |
| 7788 | with q.group(): |
| 7789 | with q.indent(2): |
| 7790 | q.breakable() |
| 7791 | q.text("xid = "); |
| 7792 | if self.xid != None: |
| 7793 | q.text("%#x" % self.xid) |
| 7794 | else: |
| 7795 | q.text('None') |
| 7796 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7797 | q.text("role = "); |
| 7798 | q.text("%#x" % self.role) |
| 7799 | q.text(","); q.breakable() |
| 7800 | q.text("generation_id = "); |
| 7801 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7802 | q.breakable() |
| 7803 | q.text('}') |
| 7804 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7805 | message.subtypes[25] = role_reply |
| 7806 | |
| 7807 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7808 | version = 3 |
| 7809 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7810 | |
| 7811 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7812 | if xid != None: |
| 7813 | self.xid = xid |
| 7814 | else: |
| 7815 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7816 | if role != None: |
| 7817 | self.role = role |
| 7818 | else: |
| 7819 | self.role = 0 |
| 7820 | if generation_id != None: |
| 7821 | self.generation_id = generation_id |
| 7822 | else: |
| 7823 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7824 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7825 | |
| 7826 | def pack(self): |
| 7827 | packed = [] |
| 7828 | packed.append(struct.pack("!B", self.version)) |
| 7829 | packed.append(struct.pack("!B", self.type)) |
| 7830 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7831 | packed.append(struct.pack("!L", self.xid)) |
| 7832 | packed.append(struct.pack("!L", self.role)) |
| 7833 | packed.append('\x00' * 4) |
| 7834 | packed.append(struct.pack("!Q", self.generation_id)) |
| 7835 | length = sum([len(x) for x in packed]) |
| 7836 | packed[2] = struct.pack("!H", length) |
| 7837 | return ''.join(packed) |
| 7838 | |
| 7839 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7840 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7841 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7842 | _version = reader.read("!B")[0] |
| 7843 | assert(_version == 3) |
| 7844 | _type = reader.read("!B")[0] |
| 7845 | assert(_type == 24) |
| 7846 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7847 | orig_reader = reader |
| 7848 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7849 | obj.xid = reader.read("!L")[0] |
| 7850 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7851 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7852 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7853 | return obj |
| 7854 | |
| 7855 | def __eq__(self, other): |
| 7856 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7857 | if self.xid != other.xid: return False |
| 7858 | if self.role != other.role: return False |
| 7859 | if self.generation_id != other.generation_id: return False |
| 7860 | return True |
| 7861 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7862 | def pretty_print(self, q): |
| 7863 | q.text("role_request {") |
| 7864 | with q.group(): |
| 7865 | with q.indent(2): |
| 7866 | q.breakable() |
| 7867 | q.text("xid = "); |
| 7868 | if self.xid != None: |
| 7869 | q.text("%#x" % self.xid) |
| 7870 | else: |
| 7871 | q.text('None') |
| 7872 | q.text(","); q.breakable() |
| 7873 | q.text("role = "); |
| 7874 | q.text("%#x" % self.role) |
| 7875 | q.text(","); q.breakable() |
| 7876 | q.text("generation_id = "); |
| 7877 | q.text("%#x" % self.generation_id) |
| 7878 | q.breakable() |
| 7879 | q.text('}') |
| 7880 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7881 | message.subtypes[24] = role_request |
| 7882 | |
| 7883 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7884 | version = 3 |
| 7885 | type = 1 |
| 7886 | err_type = 11 |
| 7887 | |
| 7888 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7889 | if xid != None: |
| 7890 | self.xid = xid |
| 7891 | else: |
| 7892 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7893 | if code != None: |
| 7894 | self.code = code |
| 7895 | else: |
| 7896 | self.code = 0 |
| 7897 | if data != None: |
| 7898 | self.data = data |
| 7899 | else: |
| 7900 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7901 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7902 | |
| 7903 | def pack(self): |
| 7904 | packed = [] |
| 7905 | packed.append(struct.pack("!B", self.version)) |
| 7906 | packed.append(struct.pack("!B", self.type)) |
| 7907 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7908 | packed.append(struct.pack("!L", self.xid)) |
| 7909 | packed.append(struct.pack("!H", self.err_type)) |
| 7910 | packed.append(struct.pack("!H", self.code)) |
| 7911 | packed.append(self.data) |
| 7912 | length = sum([len(x) for x in packed]) |
| 7913 | packed[2] = struct.pack("!H", length) |
| 7914 | return ''.join(packed) |
| 7915 | |
| 7916 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7917 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7918 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7919 | _version = reader.read("!B")[0] |
| 7920 | assert(_version == 3) |
| 7921 | _type = reader.read("!B")[0] |
| 7922 | assert(_type == 1) |
| 7923 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7924 | orig_reader = reader |
| 7925 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7926 | obj.xid = reader.read("!L")[0] |
| 7927 | _err_type = reader.read("!H")[0] |
| 7928 | assert(_err_type == 11) |
| 7929 | obj.code = reader.read("!H")[0] |
| 7930 | obj.data = str(reader.read_all()) |
| 7931 | return obj |
| 7932 | |
| 7933 | def __eq__(self, other): |
| 7934 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7935 | if self.xid != other.xid: return False |
| 7936 | if self.code != other.code: return False |
| 7937 | if self.data != other.data: return False |
| 7938 | return True |
| 7939 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7940 | def pretty_print(self, q): |
| 7941 | q.text("role_request_failed_error_msg {") |
| 7942 | with q.group(): |
| 7943 | with q.indent(2): |
| 7944 | q.breakable() |
| 7945 | q.text("xid = "); |
| 7946 | if self.xid != None: |
| 7947 | q.text("%#x" % self.xid) |
| 7948 | else: |
| 7949 | q.text('None') |
| 7950 | q.text(","); q.breakable() |
| 7951 | q.text("code = "); |
| 7952 | q.text("%#x" % self.code) |
| 7953 | q.text(","); q.breakable() |
| 7954 | q.text("data = "); |
| 7955 | q.pp(self.data) |
| 7956 | q.breakable() |
| 7957 | q.text('}') |
| 7958 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7959 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 7960 | |
| 7961 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7962 | version = 3 |
| 7963 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7964 | |
| 7965 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7966 | if xid != None: |
| 7967 | self.xid = xid |
| 7968 | else: |
| 7969 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7970 | if flags != None: |
| 7971 | self.flags = flags |
| 7972 | else: |
| 7973 | self.flags = 0 |
| 7974 | if miss_send_len != None: |
| 7975 | self.miss_send_len = miss_send_len |
| 7976 | else: |
| 7977 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7978 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7979 | |
| 7980 | def pack(self): |
| 7981 | packed = [] |
| 7982 | packed.append(struct.pack("!B", self.version)) |
| 7983 | packed.append(struct.pack("!B", self.type)) |
| 7984 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7985 | packed.append(struct.pack("!L", self.xid)) |
| 7986 | packed.append(struct.pack("!H", self.flags)) |
| 7987 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7988 | length = sum([len(x) for x in packed]) |
| 7989 | packed[2] = struct.pack("!H", length) |
| 7990 | return ''.join(packed) |
| 7991 | |
| 7992 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7993 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7994 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7995 | _version = reader.read("!B")[0] |
| 7996 | assert(_version == 3) |
| 7997 | _type = reader.read("!B")[0] |
| 7998 | assert(_type == 9) |
| 7999 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8000 | orig_reader = reader |
| 8001 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8002 | obj.xid = reader.read("!L")[0] |
| 8003 | obj.flags = reader.read("!H")[0] |
| 8004 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8005 | return obj |
| 8006 | |
| 8007 | def __eq__(self, other): |
| 8008 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8009 | if self.xid != other.xid: return False |
| 8010 | if self.flags != other.flags: return False |
| 8011 | if self.miss_send_len != other.miss_send_len: return False |
| 8012 | return True |
| 8013 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8014 | def pretty_print(self, q): |
| 8015 | q.text("set_config {") |
| 8016 | with q.group(): |
| 8017 | with q.indent(2): |
| 8018 | q.breakable() |
| 8019 | q.text("xid = "); |
| 8020 | if self.xid != None: |
| 8021 | q.text("%#x" % self.xid) |
| 8022 | else: |
| 8023 | q.text('None') |
| 8024 | q.text(","); q.breakable() |
| 8025 | q.text("flags = "); |
| 8026 | q.text("%#x" % self.flags) |
| 8027 | q.text(","); q.breakable() |
| 8028 | q.text("miss_send_len = "); |
| 8029 | q.text("%#x" % self.miss_send_len) |
| 8030 | q.breakable() |
| 8031 | q.text('}') |
| 8032 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8033 | message.subtypes[9] = set_config |
| 8034 | |
| 8035 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8036 | version = 3 |
| 8037 | type = 1 |
| 8038 | err_type = 10 |
| 8039 | |
| 8040 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8041 | if xid != None: |
| 8042 | self.xid = xid |
| 8043 | else: |
| 8044 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8045 | if code != None: |
| 8046 | self.code = code |
| 8047 | else: |
| 8048 | self.code = 0 |
| 8049 | if data != None: |
| 8050 | self.data = data |
| 8051 | else: |
| 8052 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8053 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8054 | |
| 8055 | def pack(self): |
| 8056 | packed = [] |
| 8057 | packed.append(struct.pack("!B", self.version)) |
| 8058 | packed.append(struct.pack("!B", self.type)) |
| 8059 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8060 | packed.append(struct.pack("!L", self.xid)) |
| 8061 | packed.append(struct.pack("!H", self.err_type)) |
| 8062 | packed.append(struct.pack("!H", self.code)) |
| 8063 | packed.append(self.data) |
| 8064 | length = sum([len(x) for x in packed]) |
| 8065 | packed[2] = struct.pack("!H", length) |
| 8066 | return ''.join(packed) |
| 8067 | |
| 8068 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8069 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8070 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8071 | _version = reader.read("!B")[0] |
| 8072 | assert(_version == 3) |
| 8073 | _type = reader.read("!B")[0] |
| 8074 | assert(_type == 1) |
| 8075 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8076 | orig_reader = reader |
| 8077 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8078 | obj.xid = reader.read("!L")[0] |
| 8079 | _err_type = reader.read("!H")[0] |
| 8080 | assert(_err_type == 10) |
| 8081 | obj.code = reader.read("!H")[0] |
| 8082 | obj.data = str(reader.read_all()) |
| 8083 | return obj |
| 8084 | |
| 8085 | def __eq__(self, other): |
| 8086 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8087 | if self.xid != other.xid: return False |
| 8088 | if self.code != other.code: return False |
| 8089 | if self.data != other.data: return False |
| 8090 | return True |
| 8091 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8092 | def pretty_print(self, q): |
| 8093 | q.text("switch_config_failed_error_msg {") |
| 8094 | with q.group(): |
| 8095 | with q.indent(2): |
| 8096 | q.breakable() |
| 8097 | q.text("xid = "); |
| 8098 | if self.xid != None: |
| 8099 | q.text("%#x" % self.xid) |
| 8100 | else: |
| 8101 | q.text('None') |
| 8102 | q.text(","); q.breakable() |
| 8103 | q.text("code = "); |
| 8104 | q.text("%#x" % self.code) |
| 8105 | q.text(","); q.breakable() |
| 8106 | q.text("data = "); |
| 8107 | q.pp(self.data) |
| 8108 | q.breakable() |
| 8109 | q.text('}') |
| 8110 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8111 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 8112 | |
| 8113 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8114 | version = 3 |
| 8115 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8116 | |
| 8117 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8118 | if xid != None: |
| 8119 | self.xid = xid |
| 8120 | else: |
| 8121 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8122 | if table_id != None: |
| 8123 | self.table_id = table_id |
| 8124 | else: |
| 8125 | self.table_id = 0 |
| 8126 | if config != None: |
| 8127 | self.config = config |
| 8128 | else: |
| 8129 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8130 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8131 | |
| 8132 | def pack(self): |
| 8133 | packed = [] |
| 8134 | packed.append(struct.pack("!B", self.version)) |
| 8135 | packed.append(struct.pack("!B", self.type)) |
| 8136 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8137 | packed.append(struct.pack("!L", self.xid)) |
| 8138 | packed.append(struct.pack("!B", self.table_id)) |
| 8139 | packed.append('\x00' * 3) |
| 8140 | packed.append(struct.pack("!L", self.config)) |
| 8141 | length = sum([len(x) for x in packed]) |
| 8142 | packed[2] = struct.pack("!H", length) |
| 8143 | return ''.join(packed) |
| 8144 | |
| 8145 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8146 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8147 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8148 | _version = reader.read("!B")[0] |
| 8149 | assert(_version == 3) |
| 8150 | _type = reader.read("!B")[0] |
| 8151 | assert(_type == 17) |
| 8152 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8153 | orig_reader = reader |
| 8154 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8155 | obj.xid = reader.read("!L")[0] |
| 8156 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8157 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8158 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8159 | return obj |
| 8160 | |
| 8161 | def __eq__(self, other): |
| 8162 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8163 | if self.xid != other.xid: return False |
| 8164 | if self.table_id != other.table_id: return False |
| 8165 | if self.config != other.config: return False |
| 8166 | return True |
| 8167 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8168 | def pretty_print(self, q): |
| 8169 | q.text("table_mod {") |
| 8170 | with q.group(): |
| 8171 | with q.indent(2): |
| 8172 | q.breakable() |
| 8173 | q.text("xid = "); |
| 8174 | if self.xid != None: |
| 8175 | q.text("%#x" % self.xid) |
| 8176 | else: |
| 8177 | q.text('None') |
| 8178 | q.text(","); q.breakable() |
| 8179 | q.text("table_id = "); |
| 8180 | q.text("%#x" % self.table_id) |
| 8181 | q.text(","); q.breakable() |
| 8182 | q.text("config = "); |
| 8183 | q.text("%#x" % self.config) |
| 8184 | q.breakable() |
| 8185 | q.text('}') |
| 8186 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8187 | message.subtypes[17] = table_mod |
| 8188 | |
| 8189 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8190 | version = 3 |
| 8191 | type = 1 |
| 8192 | err_type = 8 |
| 8193 | |
| 8194 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8195 | if xid != None: |
| 8196 | self.xid = xid |
| 8197 | else: |
| 8198 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8199 | if code != None: |
| 8200 | self.code = code |
| 8201 | else: |
| 8202 | self.code = 0 |
| 8203 | if data != None: |
| 8204 | self.data = data |
| 8205 | else: |
| 8206 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8207 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8208 | |
| 8209 | def pack(self): |
| 8210 | packed = [] |
| 8211 | packed.append(struct.pack("!B", self.version)) |
| 8212 | packed.append(struct.pack("!B", self.type)) |
| 8213 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8214 | packed.append(struct.pack("!L", self.xid)) |
| 8215 | packed.append(struct.pack("!H", self.err_type)) |
| 8216 | packed.append(struct.pack("!H", self.code)) |
| 8217 | packed.append(self.data) |
| 8218 | length = sum([len(x) for x in packed]) |
| 8219 | packed[2] = struct.pack("!H", length) |
| 8220 | return ''.join(packed) |
| 8221 | |
| 8222 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8223 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8224 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8225 | _version = reader.read("!B")[0] |
| 8226 | assert(_version == 3) |
| 8227 | _type = reader.read("!B")[0] |
| 8228 | assert(_type == 1) |
| 8229 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8230 | orig_reader = reader |
| 8231 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8232 | obj.xid = reader.read("!L")[0] |
| 8233 | _err_type = reader.read("!H")[0] |
| 8234 | assert(_err_type == 8) |
| 8235 | obj.code = reader.read("!H")[0] |
| 8236 | obj.data = str(reader.read_all()) |
| 8237 | return obj |
| 8238 | |
| 8239 | def __eq__(self, other): |
| 8240 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8241 | if self.xid != other.xid: return False |
| 8242 | if self.code != other.code: return False |
| 8243 | if self.data != other.data: return False |
| 8244 | return True |
| 8245 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8246 | def pretty_print(self, q): |
| 8247 | q.text("table_mod_failed_error_msg {") |
| 8248 | with q.group(): |
| 8249 | with q.indent(2): |
| 8250 | q.breakable() |
| 8251 | q.text("xid = "); |
| 8252 | if self.xid != None: |
| 8253 | q.text("%#x" % self.xid) |
| 8254 | else: |
| 8255 | q.text('None') |
| 8256 | q.text(","); q.breakable() |
| 8257 | q.text("code = "); |
| 8258 | q.text("%#x" % self.code) |
| 8259 | q.text(","); q.breakable() |
| 8260 | q.text("data = "); |
| 8261 | q.pp(self.data) |
| 8262 | q.breakable() |
| 8263 | q.text('}') |
| 8264 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8265 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 8266 | |
| 8267 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8268 | version = 3 |
| 8269 | type = 19 |
| 8270 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8271 | |
| 8272 | def __init__(self, xid=None, flags=None, entries=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 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8277 | if flags != None: |
| 8278 | self.flags = flags |
| 8279 | else: |
| 8280 | self.flags = 0 |
| 8281 | if entries != None: |
| 8282 | self.entries = entries |
| 8283 | else: |
| 8284 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8285 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8286 | |
| 8287 | def pack(self): |
| 8288 | packed = [] |
| 8289 | packed.append(struct.pack("!B", self.version)) |
| 8290 | packed.append(struct.pack("!B", self.type)) |
| 8291 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8292 | packed.append(struct.pack("!L", self.xid)) |
| 8293 | packed.append(struct.pack("!H", self.stats_type)) |
| 8294 | packed.append(struct.pack("!H", self.flags)) |
| 8295 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8296 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8297 | length = sum([len(x) for x in packed]) |
| 8298 | packed[2] = struct.pack("!H", length) |
| 8299 | return ''.join(packed) |
| 8300 | |
| 8301 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8302 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8303 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8304 | _version = reader.read("!B")[0] |
| 8305 | assert(_version == 3) |
| 8306 | _type = reader.read("!B")[0] |
| 8307 | assert(_type == 19) |
| 8308 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8309 | orig_reader = reader |
| 8310 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8311 | obj.xid = reader.read("!L")[0] |
| 8312 | _stats_type = reader.read("!H")[0] |
| 8313 | assert(_stats_type == 3) |
| 8314 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8315 | reader.skip(4) |
| 8316 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 8317 | return obj |
| 8318 | |
| 8319 | def __eq__(self, other): |
| 8320 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8321 | if self.xid != other.xid: return False |
| 8322 | if self.flags != other.flags: return False |
| 8323 | if self.entries != other.entries: return False |
| 8324 | return True |
| 8325 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8326 | def pretty_print(self, q): |
| 8327 | q.text("table_stats_reply {") |
| 8328 | with q.group(): |
| 8329 | with q.indent(2): |
| 8330 | q.breakable() |
| 8331 | q.text("xid = "); |
| 8332 | if self.xid != None: |
| 8333 | q.text("%#x" % self.xid) |
| 8334 | else: |
| 8335 | q.text('None') |
| 8336 | q.text(","); q.breakable() |
| 8337 | q.text("flags = "); |
| 8338 | q.text("%#x" % self.flags) |
| 8339 | q.text(","); q.breakable() |
| 8340 | q.text("entries = "); |
| 8341 | q.pp(self.entries) |
| 8342 | q.breakable() |
| 8343 | q.text('}') |
| 8344 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8345 | stats_reply.subtypes[3] = table_stats_reply |
| 8346 | |
| 8347 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8348 | version = 3 |
| 8349 | type = 18 |
| 8350 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8351 | |
| 8352 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8353 | if xid != None: |
| 8354 | self.xid = xid |
| 8355 | else: |
| 8356 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8357 | if flags != None: |
| 8358 | self.flags = flags |
| 8359 | else: |
| 8360 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8361 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8362 | |
| 8363 | def pack(self): |
| 8364 | packed = [] |
| 8365 | packed.append(struct.pack("!B", self.version)) |
| 8366 | packed.append(struct.pack("!B", self.type)) |
| 8367 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8368 | packed.append(struct.pack("!L", self.xid)) |
| 8369 | packed.append(struct.pack("!H", self.stats_type)) |
| 8370 | packed.append(struct.pack("!H", self.flags)) |
| 8371 | packed.append('\x00' * 4) |
| 8372 | length = sum([len(x) for x in packed]) |
| 8373 | packed[2] = struct.pack("!H", length) |
| 8374 | return ''.join(packed) |
| 8375 | |
| 8376 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8377 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8378 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8379 | _version = reader.read("!B")[0] |
| 8380 | assert(_version == 3) |
| 8381 | _type = reader.read("!B")[0] |
| 8382 | assert(_type == 18) |
| 8383 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8384 | orig_reader = reader |
| 8385 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8386 | obj.xid = reader.read("!L")[0] |
| 8387 | _stats_type = reader.read("!H")[0] |
| 8388 | assert(_stats_type == 3) |
| 8389 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8390 | reader.skip(4) |
| 8391 | return obj |
| 8392 | |
| 8393 | def __eq__(self, other): |
| 8394 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8395 | if self.xid != other.xid: return False |
| 8396 | if self.flags != other.flags: return False |
| 8397 | return True |
| 8398 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8399 | def pretty_print(self, q): |
| 8400 | q.text("table_stats_request {") |
| 8401 | with q.group(): |
| 8402 | with q.indent(2): |
| 8403 | q.breakable() |
| 8404 | q.text("xid = "); |
| 8405 | if self.xid != None: |
| 8406 | q.text("%#x" % self.xid) |
| 8407 | else: |
| 8408 | q.text('None') |
| 8409 | q.text(","); q.breakable() |
| 8410 | q.text("flags = "); |
| 8411 | q.text("%#x" % self.flags) |
| 8412 | q.breakable() |
| 8413 | q.text('}') |
| 8414 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8415 | stats_request.subtypes[3] = table_stats_request |
| 8416 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8417 | |
| 8418 | def parse_header(buf): |
| 8419 | if len(buf) < 8: |
| 8420 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 8421 | return struct.unpack_from("!BBHL", buf) |
| 8422 | |
| 8423 | def parse_message(buf): |
| 8424 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 8425 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 8426 | 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] | 8427 | if len(buf) != msg_len: |
| 8428 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8429 | return message.unpack(loxi.generic_util.OFReader(buf)) |