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 | b658ddd | 2013-03-12 10:15:10 -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 | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12 | import action |
Harshmeet Singh | 1db4633 | 2014-10-14 16:29:13 -0700 | [diff] [blame] | 13 | import message |
| 14 | import common |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 15 | import util |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 16 | import loxi.generic_util |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 17 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 18 | class message(loxi.OFObject): |
| 19 | subtypes = {} |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 20 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 21 | version = 1 |
| 22 | |
| 23 | def __init__(self, type=None, xid=None): |
| 24 | if type != None: |
| 25 | self.type = type |
| 26 | else: |
| 27 | self.type = 0 |
| 28 | if xid != None: |
| 29 | self.xid = xid |
| 30 | else: |
| 31 | self.xid = None |
| 32 | return |
| 33 | |
| 34 | def pack(self): |
| 35 | packed = [] |
| 36 | packed.append(struct.pack("!B", self.version)) |
| 37 | packed.append(struct.pack("!B", self.type)) |
| 38 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 39 | packed.append(struct.pack("!L", self.xid)) |
| 40 | length = sum([len(x) for x in packed]) |
| 41 | packed[2] = struct.pack("!H", length) |
| 42 | return ''.join(packed) |
| 43 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 44 | @staticmethod |
| 45 | def unpack(reader): |
| 46 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 47 | subclass = message.subtypes.get(subtype) |
| 48 | if subclass: |
| 49 | return subclass.unpack(reader) |
| 50 | |
| 51 | obj = message() |
| 52 | _version = reader.read("!B")[0] |
| 53 | assert(_version == 1) |
| 54 | obj.type = reader.read("!B")[0] |
| 55 | _length = reader.read("!H")[0] |
| 56 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 57 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 58 | obj.xid = reader.read("!L")[0] |
| 59 | return obj |
| 60 | |
| 61 | def __eq__(self, other): |
| 62 | if type(self) != type(other): return False |
| 63 | if self.type != other.type: return False |
| 64 | if self.xid != other.xid: return False |
| 65 | return True |
| 66 | |
| 67 | def pretty_print(self, q): |
| 68 | q.text("message {") |
| 69 | with q.group(): |
| 70 | with q.indent(2): |
| 71 | q.breakable() |
| 72 | q.text("xid = "); |
| 73 | if self.xid != None: |
| 74 | q.text("%#x" % self.xid) |
| 75 | else: |
| 76 | q.text('None') |
| 77 | q.breakable() |
| 78 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 79 | |
| 80 | |
| 81 | class stats_reply(message): |
| 82 | subtypes = {} |
| 83 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 84 | version = 1 |
| 85 | type = 17 |
| 86 | |
| 87 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 88 | if xid != None: |
| 89 | self.xid = xid |
| 90 | else: |
| 91 | self.xid = None |
| 92 | if stats_type != None: |
| 93 | self.stats_type = stats_type |
| 94 | else: |
| 95 | self.stats_type = 0 |
| 96 | if flags != None: |
| 97 | self.flags = flags |
| 98 | else: |
| 99 | self.flags = 0 |
| 100 | return |
| 101 | |
| 102 | def pack(self): |
| 103 | packed = [] |
| 104 | packed.append(struct.pack("!B", self.version)) |
| 105 | packed.append(struct.pack("!B", self.type)) |
| 106 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 107 | packed.append(struct.pack("!L", self.xid)) |
| 108 | packed.append(struct.pack("!H", self.stats_type)) |
| 109 | packed.append(struct.pack("!H", self.flags)) |
| 110 | length = sum([len(x) for x in packed]) |
| 111 | packed[2] = struct.pack("!H", length) |
| 112 | return ''.join(packed) |
| 113 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 114 | @staticmethod |
| 115 | def unpack(reader): |
| 116 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 117 | subclass = stats_reply.subtypes.get(subtype) |
| 118 | if subclass: |
| 119 | return subclass.unpack(reader) |
| 120 | |
| 121 | obj = stats_reply() |
| 122 | _version = reader.read("!B")[0] |
| 123 | assert(_version == 1) |
| 124 | _type = reader.read("!B")[0] |
| 125 | assert(_type == 17) |
| 126 | _length = reader.read("!H")[0] |
| 127 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 128 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 129 | obj.xid = reader.read("!L")[0] |
| 130 | obj.stats_type = reader.read("!H")[0] |
| 131 | obj.flags = reader.read("!H")[0] |
| 132 | return obj |
| 133 | |
| 134 | def __eq__(self, other): |
| 135 | if type(self) != type(other): return False |
| 136 | if self.xid != other.xid: return False |
| 137 | if self.stats_type != other.stats_type: return False |
| 138 | if self.flags != other.flags: return False |
| 139 | return True |
| 140 | |
| 141 | def pretty_print(self, q): |
| 142 | q.text("stats_reply {") |
| 143 | with q.group(): |
| 144 | with q.indent(2): |
| 145 | q.breakable() |
| 146 | q.text("xid = "); |
| 147 | if self.xid != None: |
| 148 | q.text("%#x" % self.xid) |
| 149 | else: |
| 150 | q.text('None') |
| 151 | q.text(","); q.breakable() |
| 152 | q.text("flags = "); |
| 153 | q.text("%#x" % self.flags) |
| 154 | q.breakable() |
| 155 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 156 | |
| 157 | message.subtypes[17] = stats_reply |
| 158 | |
| 159 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 160 | version = 1 |
| 161 | type = 17 |
| 162 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 163 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 164 | 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] | 165 | if xid != None: |
| 166 | self.xid = xid |
| 167 | else: |
| 168 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 169 | if flags != None: |
| 170 | self.flags = flags |
| 171 | else: |
| 172 | self.flags = 0 |
| 173 | if packet_count != None: |
| 174 | self.packet_count = packet_count |
| 175 | else: |
| 176 | self.packet_count = 0 |
| 177 | if byte_count != None: |
| 178 | self.byte_count = byte_count |
| 179 | else: |
| 180 | self.byte_count = 0 |
| 181 | if flow_count != None: |
| 182 | self.flow_count = flow_count |
| 183 | else: |
| 184 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 185 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 186 | |
| 187 | def pack(self): |
| 188 | packed = [] |
| 189 | packed.append(struct.pack("!B", self.version)) |
| 190 | packed.append(struct.pack("!B", self.type)) |
| 191 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 192 | packed.append(struct.pack("!L", self.xid)) |
| 193 | packed.append(struct.pack("!H", self.stats_type)) |
| 194 | packed.append(struct.pack("!H", self.flags)) |
| 195 | packed.append(struct.pack("!Q", self.packet_count)) |
| 196 | packed.append(struct.pack("!Q", self.byte_count)) |
| 197 | packed.append(struct.pack("!L", self.flow_count)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 198 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 199 | length = sum([len(x) for x in packed]) |
| 200 | packed[2] = struct.pack("!H", length) |
| 201 | return ''.join(packed) |
| 202 | |
| 203 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 204 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 205 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 206 | _version = reader.read("!B")[0] |
| 207 | assert(_version == 1) |
| 208 | _type = reader.read("!B")[0] |
| 209 | assert(_type == 17) |
| 210 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 211 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 212 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 213 | obj.xid = reader.read("!L")[0] |
| 214 | _stats_type = reader.read("!H")[0] |
| 215 | assert(_stats_type == 2) |
| 216 | obj.flags = reader.read("!H")[0] |
| 217 | obj.packet_count = reader.read("!Q")[0] |
| 218 | obj.byte_count = reader.read("!Q")[0] |
| 219 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 220 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 221 | return obj |
| 222 | |
| 223 | def __eq__(self, other): |
| 224 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 225 | if self.xid != other.xid: return False |
| 226 | if self.flags != other.flags: return False |
| 227 | if self.packet_count != other.packet_count: return False |
| 228 | if self.byte_count != other.byte_count: return False |
| 229 | if self.flow_count != other.flow_count: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 230 | return True |
| 231 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 232 | def pretty_print(self, q): |
| 233 | q.text("aggregate_stats_reply {") |
| 234 | with q.group(): |
| 235 | with q.indent(2): |
| 236 | q.breakable() |
| 237 | q.text("xid = "); |
| 238 | if self.xid != None: |
| 239 | q.text("%#x" % self.xid) |
| 240 | else: |
| 241 | q.text('None') |
| 242 | q.text(","); q.breakable() |
| 243 | q.text("flags = "); |
| 244 | q.text("%#x" % self.flags) |
| 245 | q.text(","); q.breakable() |
| 246 | q.text("packet_count = "); |
| 247 | q.text("%#x" % self.packet_count) |
| 248 | q.text(","); q.breakable() |
| 249 | q.text("byte_count = "); |
| 250 | q.text("%#x" % self.byte_count) |
| 251 | q.text(","); q.breakable() |
| 252 | q.text("flow_count = "); |
| 253 | q.text("%#x" % self.flow_count) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 254 | q.breakable() |
| 255 | q.text('}') |
| 256 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 257 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 258 | |
| 259 | class stats_request(message): |
| 260 | subtypes = {} |
| 261 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 262 | version = 1 |
| 263 | type = 16 |
| 264 | |
| 265 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 266 | if xid != None: |
| 267 | self.xid = xid |
| 268 | else: |
| 269 | self.xid = None |
| 270 | if stats_type != None: |
| 271 | self.stats_type = stats_type |
| 272 | else: |
| 273 | self.stats_type = 0 |
| 274 | if flags != None: |
| 275 | self.flags = flags |
| 276 | else: |
| 277 | self.flags = 0 |
| 278 | return |
| 279 | |
| 280 | def pack(self): |
| 281 | packed = [] |
| 282 | packed.append(struct.pack("!B", self.version)) |
| 283 | packed.append(struct.pack("!B", self.type)) |
| 284 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 285 | packed.append(struct.pack("!L", self.xid)) |
| 286 | packed.append(struct.pack("!H", self.stats_type)) |
| 287 | packed.append(struct.pack("!H", self.flags)) |
| 288 | length = sum([len(x) for x in packed]) |
| 289 | packed[2] = struct.pack("!H", length) |
| 290 | return ''.join(packed) |
| 291 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 292 | @staticmethod |
| 293 | def unpack(reader): |
| 294 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 295 | subclass = stats_request.subtypes.get(subtype) |
| 296 | if subclass: |
| 297 | return subclass.unpack(reader) |
| 298 | |
| 299 | obj = stats_request() |
| 300 | _version = reader.read("!B")[0] |
| 301 | assert(_version == 1) |
| 302 | _type = reader.read("!B")[0] |
| 303 | assert(_type == 16) |
| 304 | _length = reader.read("!H")[0] |
| 305 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 306 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 307 | obj.xid = reader.read("!L")[0] |
| 308 | obj.stats_type = reader.read("!H")[0] |
| 309 | obj.flags = reader.read("!H")[0] |
| 310 | return obj |
| 311 | |
| 312 | def __eq__(self, other): |
| 313 | if type(self) != type(other): return False |
| 314 | if self.xid != other.xid: return False |
| 315 | if self.stats_type != other.stats_type: return False |
| 316 | if self.flags != other.flags: return False |
| 317 | return True |
| 318 | |
| 319 | def pretty_print(self, q): |
| 320 | q.text("stats_request {") |
| 321 | with q.group(): |
| 322 | with q.indent(2): |
| 323 | q.breakable() |
| 324 | q.text("xid = "); |
| 325 | if self.xid != None: |
| 326 | q.text("%#x" % self.xid) |
| 327 | else: |
| 328 | q.text('None') |
| 329 | q.text(","); q.breakable() |
| 330 | q.text("flags = "); |
| 331 | q.text("%#x" % self.flags) |
| 332 | q.breakable() |
| 333 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 334 | |
| 335 | message.subtypes[16] = stats_request |
| 336 | |
| 337 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 338 | version = 1 |
| 339 | type = 16 |
| 340 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 341 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 342 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 343 | if xid != None: |
| 344 | self.xid = xid |
| 345 | else: |
| 346 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 347 | if flags != None: |
| 348 | self.flags = flags |
| 349 | else: |
| 350 | self.flags = 0 |
| 351 | if match != None: |
| 352 | self.match = match |
| 353 | else: |
| 354 | self.match = common.match() |
| 355 | if table_id != None: |
| 356 | self.table_id = table_id |
| 357 | else: |
| 358 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 359 | if out_port != None: |
| 360 | self.out_port = out_port |
| 361 | else: |
| 362 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 363 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 364 | |
| 365 | def pack(self): |
| 366 | packed = [] |
| 367 | packed.append(struct.pack("!B", self.version)) |
| 368 | packed.append(struct.pack("!B", self.type)) |
| 369 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 370 | packed.append(struct.pack("!L", self.xid)) |
| 371 | packed.append(struct.pack("!H", self.stats_type)) |
| 372 | packed.append(struct.pack("!H", self.flags)) |
| 373 | packed.append(self.match.pack()) |
| 374 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 375 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 376 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 377 | length = sum([len(x) for x in packed]) |
| 378 | packed[2] = struct.pack("!H", length) |
| 379 | return ''.join(packed) |
| 380 | |
| 381 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 382 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 383 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 384 | _version = reader.read("!B")[0] |
| 385 | assert(_version == 1) |
| 386 | _type = reader.read("!B")[0] |
| 387 | assert(_type == 16) |
| 388 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 389 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 390 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 391 | obj.xid = reader.read("!L")[0] |
| 392 | _stats_type = reader.read("!H")[0] |
| 393 | assert(_stats_type == 2) |
| 394 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 395 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 396 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 397 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 398 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 399 | return obj |
| 400 | |
| 401 | def __eq__(self, other): |
| 402 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 403 | if self.xid != other.xid: return False |
| 404 | if self.flags != other.flags: return False |
| 405 | if self.match != other.match: return False |
| 406 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 407 | if self.out_port != other.out_port: return False |
| 408 | return True |
| 409 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 410 | def pretty_print(self, q): |
| 411 | q.text("aggregate_stats_request {") |
| 412 | with q.group(): |
| 413 | with q.indent(2): |
| 414 | q.breakable() |
| 415 | q.text("xid = "); |
| 416 | if self.xid != None: |
| 417 | q.text("%#x" % self.xid) |
| 418 | else: |
| 419 | q.text('None') |
| 420 | q.text(","); q.breakable() |
| 421 | q.text("flags = "); |
| 422 | q.text("%#x" % self.flags) |
| 423 | q.text(","); q.breakable() |
| 424 | q.text("match = "); |
| 425 | q.pp(self.match) |
| 426 | q.text(","); q.breakable() |
| 427 | q.text("table_id = "); |
| 428 | q.text("%#x" % self.table_id) |
| 429 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 430 | q.text("out_port = "); |
| 431 | q.text(util.pretty_port(self.out_port)) |
| 432 | q.breakable() |
| 433 | q.text('}') |
| 434 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 435 | stats_request.subtypes[2] = aggregate_stats_request |
| 436 | |
| 437 | class error_msg(message): |
| 438 | subtypes = {} |
| 439 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 440 | version = 1 |
| 441 | type = 1 |
| 442 | |
| 443 | def __init__(self, xid=None, err_type=None): |
| 444 | if xid != None: |
| 445 | self.xid = xid |
| 446 | else: |
| 447 | self.xid = None |
| 448 | if err_type != None: |
| 449 | self.err_type = err_type |
| 450 | else: |
| 451 | self.err_type = 0 |
| 452 | return |
| 453 | |
| 454 | def pack(self): |
| 455 | packed = [] |
| 456 | packed.append(struct.pack("!B", self.version)) |
| 457 | packed.append(struct.pack("!B", self.type)) |
| 458 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 459 | packed.append(struct.pack("!L", self.xid)) |
| 460 | packed.append(struct.pack("!H", self.err_type)) |
| 461 | length = sum([len(x) for x in packed]) |
| 462 | packed[2] = struct.pack("!H", length) |
| 463 | return ''.join(packed) |
| 464 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 465 | @staticmethod |
| 466 | def unpack(reader): |
| 467 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 468 | subclass = error_msg.subtypes.get(subtype) |
| 469 | if subclass: |
| 470 | return subclass.unpack(reader) |
| 471 | |
| 472 | obj = error_msg() |
| 473 | _version = reader.read("!B")[0] |
| 474 | assert(_version == 1) |
| 475 | _type = reader.read("!B")[0] |
| 476 | assert(_type == 1) |
| 477 | _length = reader.read("!H")[0] |
| 478 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 479 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 480 | obj.xid = reader.read("!L")[0] |
| 481 | obj.err_type = reader.read("!H")[0] |
| 482 | return obj |
| 483 | |
| 484 | def __eq__(self, other): |
| 485 | if type(self) != type(other): return False |
| 486 | if self.xid != other.xid: return False |
| 487 | if self.err_type != other.err_type: return False |
| 488 | return True |
| 489 | |
| 490 | def pretty_print(self, q): |
| 491 | q.text("error_msg {") |
| 492 | with q.group(): |
| 493 | with q.indent(2): |
| 494 | q.breakable() |
| 495 | q.text("xid = "); |
| 496 | if self.xid != None: |
| 497 | q.text("%#x" % self.xid) |
| 498 | else: |
| 499 | q.text('None') |
| 500 | q.breakable() |
| 501 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 502 | |
| 503 | message.subtypes[1] = error_msg |
| 504 | |
| 505 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 506 | version = 1 |
| 507 | type = 1 |
| 508 | err_type = 2 |
| 509 | |
| 510 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 511 | if xid != None: |
| 512 | self.xid = xid |
| 513 | else: |
| 514 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 515 | if code != None: |
| 516 | self.code = code |
| 517 | else: |
| 518 | self.code = 0 |
| 519 | if data != None: |
| 520 | self.data = data |
| 521 | else: |
| 522 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 523 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 524 | |
| 525 | def pack(self): |
| 526 | packed = [] |
| 527 | packed.append(struct.pack("!B", self.version)) |
| 528 | packed.append(struct.pack("!B", self.type)) |
| 529 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 530 | packed.append(struct.pack("!L", self.xid)) |
| 531 | packed.append(struct.pack("!H", self.err_type)) |
| 532 | packed.append(struct.pack("!H", self.code)) |
| 533 | packed.append(self.data) |
| 534 | length = sum([len(x) for x in packed]) |
| 535 | packed[2] = struct.pack("!H", length) |
| 536 | return ''.join(packed) |
| 537 | |
| 538 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 539 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 540 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 541 | _version = reader.read("!B")[0] |
| 542 | assert(_version == 1) |
| 543 | _type = reader.read("!B")[0] |
| 544 | assert(_type == 1) |
| 545 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 546 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 547 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 548 | obj.xid = reader.read("!L")[0] |
| 549 | _err_type = reader.read("!H")[0] |
| 550 | assert(_err_type == 2) |
| 551 | obj.code = reader.read("!H")[0] |
| 552 | obj.data = str(reader.read_all()) |
| 553 | return obj |
| 554 | |
| 555 | def __eq__(self, other): |
| 556 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 557 | if self.xid != other.xid: return False |
| 558 | if self.code != other.code: return False |
| 559 | if self.data != other.data: return False |
| 560 | return True |
| 561 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 562 | def pretty_print(self, q): |
| 563 | q.text("bad_action_error_msg {") |
| 564 | with q.group(): |
| 565 | with q.indent(2): |
| 566 | q.breakable() |
| 567 | q.text("xid = "); |
| 568 | if self.xid != None: |
| 569 | q.text("%#x" % self.xid) |
| 570 | else: |
| 571 | q.text('None') |
| 572 | q.text(","); q.breakable() |
| 573 | q.text("code = "); |
| 574 | q.text("%#x" % self.code) |
| 575 | q.text(","); q.breakable() |
| 576 | q.text("data = "); |
| 577 | q.pp(self.data) |
| 578 | q.breakable() |
| 579 | q.text('}') |
| 580 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 581 | error_msg.subtypes[2] = bad_action_error_msg |
| 582 | |
| 583 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 584 | version = 1 |
| 585 | type = 1 |
| 586 | err_type = 1 |
| 587 | |
| 588 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 589 | if xid != None: |
| 590 | self.xid = xid |
| 591 | else: |
| 592 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 593 | if code != None: |
| 594 | self.code = code |
| 595 | else: |
| 596 | self.code = 0 |
| 597 | if data != None: |
| 598 | self.data = data |
| 599 | else: |
| 600 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 601 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 602 | |
| 603 | def pack(self): |
| 604 | packed = [] |
| 605 | packed.append(struct.pack("!B", self.version)) |
| 606 | packed.append(struct.pack("!B", self.type)) |
| 607 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 608 | packed.append(struct.pack("!L", self.xid)) |
| 609 | packed.append(struct.pack("!H", self.err_type)) |
| 610 | packed.append(struct.pack("!H", self.code)) |
| 611 | packed.append(self.data) |
| 612 | length = sum([len(x) for x in packed]) |
| 613 | packed[2] = struct.pack("!H", length) |
| 614 | return ''.join(packed) |
| 615 | |
| 616 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 617 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 618 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 619 | _version = reader.read("!B")[0] |
| 620 | assert(_version == 1) |
| 621 | _type = reader.read("!B")[0] |
| 622 | assert(_type == 1) |
| 623 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 624 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 625 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 626 | obj.xid = reader.read("!L")[0] |
| 627 | _err_type = reader.read("!H")[0] |
| 628 | assert(_err_type == 1) |
| 629 | obj.code = reader.read("!H")[0] |
| 630 | obj.data = str(reader.read_all()) |
| 631 | return obj |
| 632 | |
| 633 | def __eq__(self, other): |
| 634 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 635 | if self.xid != other.xid: return False |
| 636 | if self.code != other.code: return False |
| 637 | if self.data != other.data: return False |
| 638 | return True |
| 639 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 640 | def pretty_print(self, q): |
| 641 | q.text("bad_request_error_msg {") |
| 642 | with q.group(): |
| 643 | with q.indent(2): |
| 644 | q.breakable() |
| 645 | q.text("xid = "); |
| 646 | if self.xid != None: |
| 647 | q.text("%#x" % self.xid) |
| 648 | else: |
| 649 | q.text('None') |
| 650 | q.text(","); q.breakable() |
| 651 | q.text("code = "); |
| 652 | q.text("%#x" % self.code) |
| 653 | q.text(","); q.breakable() |
| 654 | q.text("data = "); |
| 655 | q.pp(self.data) |
| 656 | q.breakable() |
| 657 | q.text('}') |
| 658 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 659 | error_msg.subtypes[1] = bad_request_error_msg |
| 660 | |
| 661 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 662 | version = 1 |
| 663 | type = 19 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 664 | |
| 665 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 666 | if xid != None: |
| 667 | self.xid = xid |
| 668 | else: |
| 669 | self.xid = None |
| 670 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 671 | |
| 672 | def pack(self): |
| 673 | packed = [] |
| 674 | packed.append(struct.pack("!B", self.version)) |
| 675 | packed.append(struct.pack("!B", self.type)) |
| 676 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 677 | packed.append(struct.pack("!L", self.xid)) |
| 678 | length = sum([len(x) for x in packed]) |
| 679 | packed[2] = struct.pack("!H", length) |
| 680 | return ''.join(packed) |
| 681 | |
| 682 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 683 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 684 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 685 | _version = reader.read("!B")[0] |
| 686 | assert(_version == 1) |
| 687 | _type = reader.read("!B")[0] |
| 688 | assert(_type == 19) |
| 689 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 690 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 691 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 692 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 693 | return obj |
| 694 | |
| 695 | def __eq__(self, other): |
| 696 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 697 | if self.xid != other.xid: return False |
| 698 | return True |
| 699 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 700 | def pretty_print(self, q): |
| 701 | q.text("barrier_reply {") |
| 702 | with q.group(): |
| 703 | with q.indent(2): |
| 704 | q.breakable() |
| 705 | q.text("xid = "); |
| 706 | if self.xid != None: |
| 707 | q.text("%#x" % self.xid) |
| 708 | else: |
| 709 | q.text('None') |
| 710 | q.breakable() |
| 711 | q.text('}') |
| 712 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 713 | message.subtypes[19] = barrier_reply |
| 714 | |
| 715 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 716 | version = 1 |
| 717 | type = 18 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 718 | |
| 719 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 720 | if xid != None: |
| 721 | self.xid = xid |
| 722 | else: |
| 723 | self.xid = None |
| 724 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 725 | |
| 726 | def pack(self): |
| 727 | packed = [] |
| 728 | packed.append(struct.pack("!B", self.version)) |
| 729 | packed.append(struct.pack("!B", self.type)) |
| 730 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 731 | packed.append(struct.pack("!L", self.xid)) |
| 732 | length = sum([len(x) for x in packed]) |
| 733 | packed[2] = struct.pack("!H", length) |
| 734 | return ''.join(packed) |
| 735 | |
| 736 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 737 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 738 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 739 | _version = reader.read("!B")[0] |
| 740 | assert(_version == 1) |
| 741 | _type = reader.read("!B")[0] |
| 742 | assert(_type == 18) |
| 743 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 744 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 745 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 746 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 747 | return obj |
| 748 | |
| 749 | def __eq__(self, other): |
| 750 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 751 | if self.xid != other.xid: return False |
| 752 | return True |
| 753 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 754 | def pretty_print(self, q): |
| 755 | q.text("barrier_request {") |
| 756 | with q.group(): |
| 757 | with q.indent(2): |
| 758 | q.breakable() |
| 759 | q.text("xid = "); |
| 760 | if self.xid != None: |
| 761 | q.text("%#x" % self.xid) |
| 762 | else: |
| 763 | q.text('None') |
| 764 | q.breakable() |
| 765 | q.text('}') |
| 766 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 767 | message.subtypes[18] = barrier_request |
| 768 | |
| 769 | class experimenter(message): |
| 770 | subtypes = {} |
| 771 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 772 | version = 1 |
| 773 | type = 4 |
| 774 | |
Harshmeet Singh | c0378a9 | 2014-07-22 17:09:36 -0700 | [diff] [blame] | 775 | def __init__(self, xid=None, experimenter=None, data=None): |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 776 | if xid != None: |
| 777 | self.xid = xid |
| 778 | else: |
| 779 | self.xid = None |
| 780 | if experimenter != None: |
| 781 | self.experimenter = experimenter |
| 782 | else: |
| 783 | self.experimenter = 0 |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 784 | if data != None: |
| 785 | self.data = data |
| 786 | else: |
| 787 | self.data = '' |
| 788 | return |
| 789 | |
| 790 | def pack(self): |
| 791 | packed = [] |
| 792 | packed.append(struct.pack("!B", self.version)) |
| 793 | packed.append(struct.pack("!B", self.type)) |
| 794 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 795 | packed.append(struct.pack("!L", self.xid)) |
| 796 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 797 | packed.append(self.data) |
| 798 | length = sum([len(x) for x in packed]) |
| 799 | packed[2] = struct.pack("!H", length) |
| 800 | return ''.join(packed) |
| 801 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 802 | @staticmethod |
| 803 | def unpack(reader): |
| 804 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 805 | subclass = experimenter.subtypes.get(subtype) |
| 806 | if subclass: |
| 807 | return subclass.unpack(reader) |
| 808 | |
| 809 | obj = experimenter() |
| 810 | _version = reader.read("!B")[0] |
| 811 | assert(_version == 1) |
| 812 | _type = reader.read("!B")[0] |
| 813 | assert(_type == 4) |
| 814 | _length = reader.read("!H")[0] |
| 815 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 816 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 817 | obj.xid = reader.read("!L")[0] |
| 818 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 819 | obj.data = str(reader.read_all()) |
| 820 | return obj |
| 821 | |
| 822 | def __eq__(self, other): |
| 823 | if type(self) != type(other): return False |
| 824 | if self.xid != other.xid: return False |
| 825 | if self.experimenter != other.experimenter: return False |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 826 | if self.data != other.data: return False |
| 827 | return True |
| 828 | |
| 829 | def pretty_print(self, q): |
| 830 | q.text("experimenter {") |
| 831 | with q.group(): |
| 832 | with q.indent(2): |
| 833 | q.breakable() |
| 834 | q.text("xid = "); |
| 835 | if self.xid != None: |
| 836 | q.text("%#x" % self.xid) |
| 837 | else: |
| 838 | q.text('None') |
| 839 | q.text(","); q.breakable() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 840 | q.text("data = "); |
| 841 | q.pp(self.data) |
| 842 | q.breakable() |
| 843 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 844 | |
| 845 | message.subtypes[4] = experimenter |
| 846 | |
| 847 | class bsn_header(experimenter): |
| 848 | subtypes = {} |
| 849 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 850 | version = 1 |
| 851 | type = 4 |
| 852 | experimenter = 6035143 |
| 853 | |
| 854 | def __init__(self, xid=None, subtype=None): |
| 855 | if xid != None: |
| 856 | self.xid = xid |
| 857 | else: |
| 858 | self.xid = None |
| 859 | if subtype != None: |
| 860 | self.subtype = subtype |
| 861 | else: |
| 862 | self.subtype = 0 |
| 863 | return |
| 864 | |
| 865 | def pack(self): |
| 866 | packed = [] |
| 867 | packed.append(struct.pack("!B", self.version)) |
| 868 | packed.append(struct.pack("!B", self.type)) |
| 869 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 870 | packed.append(struct.pack("!L", self.xid)) |
| 871 | packed.append(struct.pack("!L", self.experimenter)) |
| 872 | packed.append(struct.pack("!L", self.subtype)) |
| 873 | length = sum([len(x) for x in packed]) |
| 874 | packed[2] = struct.pack("!H", length) |
| 875 | return ''.join(packed) |
| 876 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 877 | @staticmethod |
| 878 | def unpack(reader): |
| 879 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 880 | subclass = bsn_header.subtypes.get(subtype) |
| 881 | if subclass: |
| 882 | return subclass.unpack(reader) |
| 883 | |
| 884 | obj = bsn_header() |
| 885 | _version = reader.read("!B")[0] |
| 886 | assert(_version == 1) |
| 887 | _type = reader.read("!B")[0] |
| 888 | assert(_type == 4) |
| 889 | _length = reader.read("!H")[0] |
| 890 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 891 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 892 | obj.xid = reader.read("!L")[0] |
| 893 | _experimenter = reader.read("!L")[0] |
| 894 | assert(_experimenter == 6035143) |
| 895 | obj.subtype = reader.read("!L")[0] |
| 896 | return obj |
| 897 | |
| 898 | def __eq__(self, other): |
| 899 | if type(self) != type(other): return False |
| 900 | if self.xid != other.xid: return False |
| 901 | if self.subtype != other.subtype: return False |
| 902 | return True |
| 903 | |
| 904 | def pretty_print(self, q): |
| 905 | q.text("bsn_header {") |
| 906 | with q.group(): |
| 907 | with q.indent(2): |
| 908 | q.breakable() |
| 909 | q.text("xid = "); |
| 910 | if self.xid != None: |
| 911 | q.text("%#x" % self.xid) |
| 912 | else: |
| 913 | q.text('None') |
| 914 | q.breakable() |
| 915 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 916 | |
| 917 | experimenter.subtypes[6035143] = bsn_header |
| 918 | |
| 919 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 920 | version = 1 |
| 921 | type = 4 |
| 922 | experimenter = 6035143 |
| 923 | subtype = 22 |
| 924 | |
| 925 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 926 | if xid != None: |
| 927 | self.xid = xid |
| 928 | else: |
| 929 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 930 | if status != None: |
| 931 | self.status = status |
| 932 | else: |
| 933 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 934 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 935 | |
| 936 | def pack(self): |
| 937 | packed = [] |
| 938 | packed.append(struct.pack("!B", self.version)) |
| 939 | packed.append(struct.pack("!B", self.type)) |
| 940 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 941 | packed.append(struct.pack("!L", self.xid)) |
| 942 | packed.append(struct.pack("!L", self.experimenter)) |
| 943 | packed.append(struct.pack("!L", self.subtype)) |
| 944 | packed.append(struct.pack("!L", self.status)) |
| 945 | length = sum([len(x) for x in packed]) |
| 946 | packed[2] = struct.pack("!H", length) |
| 947 | return ''.join(packed) |
| 948 | |
| 949 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 950 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 951 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 952 | _version = reader.read("!B")[0] |
| 953 | assert(_version == 1) |
| 954 | _type = reader.read("!B")[0] |
| 955 | assert(_type == 4) |
| 956 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 957 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 958 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 959 | obj.xid = reader.read("!L")[0] |
| 960 | _experimenter = reader.read("!L")[0] |
| 961 | assert(_experimenter == 6035143) |
| 962 | _subtype = reader.read("!L")[0] |
| 963 | assert(_subtype == 22) |
| 964 | obj.status = reader.read("!L")[0] |
| 965 | return obj |
| 966 | |
| 967 | def __eq__(self, other): |
| 968 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 969 | if self.xid != other.xid: return False |
| 970 | if self.status != other.status: return False |
| 971 | return True |
| 972 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 973 | def pretty_print(self, q): |
| 974 | q.text("bsn_bw_clear_data_reply {") |
| 975 | with q.group(): |
| 976 | with q.indent(2): |
| 977 | q.breakable() |
| 978 | q.text("xid = "); |
| 979 | if self.xid != None: |
| 980 | q.text("%#x" % self.xid) |
| 981 | else: |
| 982 | q.text('None') |
| 983 | q.text(","); q.breakable() |
| 984 | q.text("status = "); |
| 985 | q.text("%#x" % self.status) |
| 986 | q.breakable() |
| 987 | q.text('}') |
| 988 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 989 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 990 | |
| 991 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 992 | version = 1 |
| 993 | type = 4 |
| 994 | experimenter = 6035143 |
| 995 | subtype = 21 |
| 996 | |
| 997 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 998 | if xid != None: |
| 999 | self.xid = xid |
| 1000 | else: |
| 1001 | self.xid = None |
| 1002 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1003 | |
| 1004 | def pack(self): |
| 1005 | packed = [] |
| 1006 | packed.append(struct.pack("!B", self.version)) |
| 1007 | packed.append(struct.pack("!B", self.type)) |
| 1008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1009 | packed.append(struct.pack("!L", self.xid)) |
| 1010 | packed.append(struct.pack("!L", self.experimenter)) |
| 1011 | packed.append(struct.pack("!L", self.subtype)) |
| 1012 | length = sum([len(x) for x in packed]) |
| 1013 | packed[2] = struct.pack("!H", length) |
| 1014 | return ''.join(packed) |
| 1015 | |
| 1016 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1017 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1018 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1019 | _version = reader.read("!B")[0] |
| 1020 | assert(_version == 1) |
| 1021 | _type = reader.read("!B")[0] |
| 1022 | assert(_type == 4) |
| 1023 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1024 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1025 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1026 | obj.xid = reader.read("!L")[0] |
| 1027 | _experimenter = reader.read("!L")[0] |
| 1028 | assert(_experimenter == 6035143) |
| 1029 | _subtype = reader.read("!L")[0] |
| 1030 | assert(_subtype == 21) |
| 1031 | return obj |
| 1032 | |
| 1033 | def __eq__(self, other): |
| 1034 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1035 | if self.xid != other.xid: return False |
| 1036 | return True |
| 1037 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1038 | def pretty_print(self, q): |
| 1039 | q.text("bsn_bw_clear_data_request {") |
| 1040 | with q.group(): |
| 1041 | with q.indent(2): |
| 1042 | q.breakable() |
| 1043 | q.text("xid = "); |
| 1044 | if self.xid != None: |
| 1045 | q.text("%#x" % self.xid) |
| 1046 | else: |
| 1047 | q.text('None') |
| 1048 | q.breakable() |
| 1049 | q.text('}') |
| 1050 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1051 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1052 | |
| 1053 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1054 | version = 1 |
| 1055 | type = 4 |
| 1056 | experimenter = 6035143 |
| 1057 | subtype = 20 |
| 1058 | |
| 1059 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1060 | if xid != None: |
| 1061 | self.xid = xid |
| 1062 | else: |
| 1063 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1064 | if enabled != None: |
| 1065 | self.enabled = enabled |
| 1066 | else: |
| 1067 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1068 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1069 | |
| 1070 | def pack(self): |
| 1071 | packed = [] |
| 1072 | packed.append(struct.pack("!B", self.version)) |
| 1073 | packed.append(struct.pack("!B", self.type)) |
| 1074 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1075 | packed.append(struct.pack("!L", self.xid)) |
| 1076 | packed.append(struct.pack("!L", self.experimenter)) |
| 1077 | packed.append(struct.pack("!L", self.subtype)) |
| 1078 | packed.append(struct.pack("!L", self.enabled)) |
| 1079 | length = sum([len(x) for x in packed]) |
| 1080 | packed[2] = struct.pack("!H", length) |
| 1081 | return ''.join(packed) |
| 1082 | |
| 1083 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1084 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1085 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1086 | _version = reader.read("!B")[0] |
| 1087 | assert(_version == 1) |
| 1088 | _type = reader.read("!B")[0] |
| 1089 | assert(_type == 4) |
| 1090 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1091 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1092 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1093 | obj.xid = reader.read("!L")[0] |
| 1094 | _experimenter = reader.read("!L")[0] |
| 1095 | assert(_experimenter == 6035143) |
| 1096 | _subtype = reader.read("!L")[0] |
| 1097 | assert(_subtype == 20) |
| 1098 | obj.enabled = reader.read("!L")[0] |
| 1099 | return obj |
| 1100 | |
| 1101 | def __eq__(self, other): |
| 1102 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1103 | if self.xid != other.xid: return False |
| 1104 | if self.enabled != other.enabled: return False |
| 1105 | return True |
| 1106 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1107 | def pretty_print(self, q): |
| 1108 | q.text("bsn_bw_enable_get_reply {") |
| 1109 | with q.group(): |
| 1110 | with q.indent(2): |
| 1111 | q.breakable() |
| 1112 | q.text("xid = "); |
| 1113 | if self.xid != None: |
| 1114 | q.text("%#x" % self.xid) |
| 1115 | else: |
| 1116 | q.text('None') |
| 1117 | q.text(","); q.breakable() |
| 1118 | q.text("enabled = "); |
| 1119 | q.text("%#x" % self.enabled) |
| 1120 | q.breakable() |
| 1121 | q.text('}') |
| 1122 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1123 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1124 | |
| 1125 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1126 | version = 1 |
| 1127 | type = 4 |
| 1128 | experimenter = 6035143 |
| 1129 | subtype = 19 |
| 1130 | |
| 1131 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1132 | if xid != None: |
| 1133 | self.xid = xid |
| 1134 | else: |
| 1135 | self.xid = None |
| 1136 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1137 | |
| 1138 | def pack(self): |
| 1139 | packed = [] |
| 1140 | packed.append(struct.pack("!B", self.version)) |
| 1141 | packed.append(struct.pack("!B", self.type)) |
| 1142 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1143 | packed.append(struct.pack("!L", self.xid)) |
| 1144 | packed.append(struct.pack("!L", self.experimenter)) |
| 1145 | packed.append(struct.pack("!L", self.subtype)) |
| 1146 | length = sum([len(x) for x in packed]) |
| 1147 | packed[2] = struct.pack("!H", length) |
| 1148 | return ''.join(packed) |
| 1149 | |
| 1150 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1151 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1152 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1153 | _version = reader.read("!B")[0] |
| 1154 | assert(_version == 1) |
| 1155 | _type = reader.read("!B")[0] |
| 1156 | assert(_type == 4) |
| 1157 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1158 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1159 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1160 | obj.xid = reader.read("!L")[0] |
| 1161 | _experimenter = reader.read("!L")[0] |
| 1162 | assert(_experimenter == 6035143) |
| 1163 | _subtype = reader.read("!L")[0] |
| 1164 | assert(_subtype == 19) |
| 1165 | return obj |
| 1166 | |
| 1167 | def __eq__(self, other): |
| 1168 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1169 | if self.xid != other.xid: return False |
| 1170 | return True |
| 1171 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1172 | def pretty_print(self, q): |
| 1173 | q.text("bsn_bw_enable_get_request {") |
| 1174 | with q.group(): |
| 1175 | with q.indent(2): |
| 1176 | q.breakable() |
| 1177 | q.text("xid = "); |
| 1178 | if self.xid != None: |
| 1179 | q.text("%#x" % self.xid) |
| 1180 | else: |
| 1181 | q.text('None') |
| 1182 | q.breakable() |
| 1183 | q.text('}') |
| 1184 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1185 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1186 | |
| 1187 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1188 | version = 1 |
| 1189 | type = 4 |
| 1190 | experimenter = 6035143 |
| 1191 | subtype = 23 |
| 1192 | |
| 1193 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1194 | if xid != None: |
| 1195 | self.xid = xid |
| 1196 | else: |
| 1197 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1198 | if enable != None: |
| 1199 | self.enable = enable |
| 1200 | else: |
| 1201 | self.enable = 0 |
| 1202 | if status != None: |
| 1203 | self.status = status |
| 1204 | else: |
| 1205 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1206 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1207 | |
| 1208 | def pack(self): |
| 1209 | packed = [] |
| 1210 | packed.append(struct.pack("!B", self.version)) |
| 1211 | packed.append(struct.pack("!B", self.type)) |
| 1212 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1213 | packed.append(struct.pack("!L", self.xid)) |
| 1214 | packed.append(struct.pack("!L", self.experimenter)) |
| 1215 | packed.append(struct.pack("!L", self.subtype)) |
| 1216 | packed.append(struct.pack("!L", self.enable)) |
| 1217 | packed.append(struct.pack("!L", self.status)) |
| 1218 | length = sum([len(x) for x in packed]) |
| 1219 | packed[2] = struct.pack("!H", length) |
| 1220 | return ''.join(packed) |
| 1221 | |
| 1222 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1223 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1224 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1225 | _version = reader.read("!B")[0] |
| 1226 | assert(_version == 1) |
| 1227 | _type = reader.read("!B")[0] |
| 1228 | assert(_type == 4) |
| 1229 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1230 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1231 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1232 | obj.xid = reader.read("!L")[0] |
| 1233 | _experimenter = reader.read("!L")[0] |
| 1234 | assert(_experimenter == 6035143) |
| 1235 | _subtype = reader.read("!L")[0] |
| 1236 | assert(_subtype == 23) |
| 1237 | obj.enable = reader.read("!L")[0] |
| 1238 | obj.status = reader.read("!L")[0] |
| 1239 | return obj |
| 1240 | |
| 1241 | def __eq__(self, other): |
| 1242 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1243 | if self.xid != other.xid: return False |
| 1244 | if self.enable != other.enable: return False |
| 1245 | if self.status != other.status: return False |
| 1246 | return True |
| 1247 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1248 | def pretty_print(self, q): |
| 1249 | q.text("bsn_bw_enable_set_reply {") |
| 1250 | with q.group(): |
| 1251 | with q.indent(2): |
| 1252 | q.breakable() |
| 1253 | q.text("xid = "); |
| 1254 | if self.xid != None: |
| 1255 | q.text("%#x" % self.xid) |
| 1256 | else: |
| 1257 | q.text('None') |
| 1258 | q.text(","); q.breakable() |
| 1259 | q.text("enable = "); |
| 1260 | q.text("%#x" % self.enable) |
| 1261 | q.text(","); q.breakable() |
| 1262 | q.text("status = "); |
| 1263 | q.text("%#x" % self.status) |
| 1264 | q.breakable() |
| 1265 | q.text('}') |
| 1266 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1267 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1268 | |
| 1269 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1270 | version = 1 |
| 1271 | type = 4 |
| 1272 | experimenter = 6035143 |
| 1273 | subtype = 18 |
| 1274 | |
| 1275 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1276 | if xid != None: |
| 1277 | self.xid = xid |
| 1278 | else: |
| 1279 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1280 | if enable != None: |
| 1281 | self.enable = enable |
| 1282 | else: |
| 1283 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1284 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1285 | |
| 1286 | def pack(self): |
| 1287 | packed = [] |
| 1288 | packed.append(struct.pack("!B", self.version)) |
| 1289 | packed.append(struct.pack("!B", self.type)) |
| 1290 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1291 | packed.append(struct.pack("!L", self.xid)) |
| 1292 | packed.append(struct.pack("!L", self.experimenter)) |
| 1293 | packed.append(struct.pack("!L", self.subtype)) |
| 1294 | packed.append(struct.pack("!L", self.enable)) |
| 1295 | length = sum([len(x) for x in packed]) |
| 1296 | packed[2] = struct.pack("!H", length) |
| 1297 | return ''.join(packed) |
| 1298 | |
| 1299 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1300 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1301 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1302 | _version = reader.read("!B")[0] |
| 1303 | assert(_version == 1) |
| 1304 | _type = reader.read("!B")[0] |
| 1305 | assert(_type == 4) |
| 1306 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1307 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1308 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1309 | obj.xid = reader.read("!L")[0] |
| 1310 | _experimenter = reader.read("!L")[0] |
| 1311 | assert(_experimenter == 6035143) |
| 1312 | _subtype = reader.read("!L")[0] |
| 1313 | assert(_subtype == 18) |
| 1314 | obj.enable = reader.read("!L")[0] |
| 1315 | return obj |
| 1316 | |
| 1317 | def __eq__(self, other): |
| 1318 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1319 | if self.xid != other.xid: return False |
| 1320 | if self.enable != other.enable: return False |
| 1321 | return True |
| 1322 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1323 | def pretty_print(self, q): |
| 1324 | q.text("bsn_bw_enable_set_request {") |
| 1325 | with q.group(): |
| 1326 | with q.indent(2): |
| 1327 | q.breakable() |
| 1328 | q.text("xid = "); |
| 1329 | if self.xid != None: |
| 1330 | q.text("%#x" % self.xid) |
| 1331 | else: |
| 1332 | q.text('None') |
| 1333 | q.text(","); q.breakable() |
| 1334 | q.text("enable = "); |
| 1335 | q.text("%#x" % self.enable) |
| 1336 | q.breakable() |
| 1337 | q.text('}') |
| 1338 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1339 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1340 | |
| 1341 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1342 | version = 1 |
| 1343 | type = 4 |
| 1344 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1345 | subtype = 10 |
| 1346 | |
| 1347 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1348 | if xid != None: |
| 1349 | self.xid = xid |
| 1350 | else: |
| 1351 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1352 | if interfaces != None: |
| 1353 | self.interfaces = interfaces |
| 1354 | else: |
| 1355 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1356 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1357 | |
| 1358 | def pack(self): |
| 1359 | packed = [] |
| 1360 | packed.append(struct.pack("!B", self.version)) |
| 1361 | packed.append(struct.pack("!B", self.type)) |
| 1362 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1363 | packed.append(struct.pack("!L", self.xid)) |
| 1364 | packed.append(struct.pack("!L", self.experimenter)) |
| 1365 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1366 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1367 | length = sum([len(x) for x in packed]) |
| 1368 | packed[2] = struct.pack("!H", length) |
| 1369 | return ''.join(packed) |
| 1370 | |
| 1371 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1372 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1373 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1374 | _version = reader.read("!B")[0] |
| 1375 | assert(_version == 1) |
| 1376 | _type = reader.read("!B")[0] |
| 1377 | assert(_type == 4) |
| 1378 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1379 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1380 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1381 | obj.xid = reader.read("!L")[0] |
| 1382 | _experimenter = reader.read("!L")[0] |
| 1383 | assert(_experimenter == 6035143) |
| 1384 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1385 | assert(_subtype == 10) |
| 1386 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1387 | return obj |
| 1388 | |
| 1389 | def __eq__(self, other): |
| 1390 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1391 | if self.xid != other.xid: return False |
| 1392 | if self.interfaces != other.interfaces: return False |
| 1393 | return True |
| 1394 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1395 | def pretty_print(self, q): |
| 1396 | q.text("bsn_get_interfaces_reply {") |
| 1397 | with q.group(): |
| 1398 | with q.indent(2): |
| 1399 | q.breakable() |
| 1400 | q.text("xid = "); |
| 1401 | if self.xid != None: |
| 1402 | q.text("%#x" % self.xid) |
| 1403 | else: |
| 1404 | q.text('None') |
| 1405 | q.text(","); q.breakable() |
| 1406 | q.text("interfaces = "); |
| 1407 | q.pp(self.interfaces) |
| 1408 | q.breakable() |
| 1409 | q.text('}') |
| 1410 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1411 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1412 | |
| 1413 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1414 | version = 1 |
| 1415 | type = 4 |
| 1416 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1417 | subtype = 9 |
| 1418 | |
| 1419 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1420 | if xid != None: |
| 1421 | self.xid = xid |
| 1422 | else: |
| 1423 | self.xid = None |
| 1424 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1425 | |
| 1426 | def pack(self): |
| 1427 | packed = [] |
| 1428 | packed.append(struct.pack("!B", self.version)) |
| 1429 | packed.append(struct.pack("!B", self.type)) |
| 1430 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1431 | packed.append(struct.pack("!L", self.xid)) |
| 1432 | packed.append(struct.pack("!L", self.experimenter)) |
| 1433 | packed.append(struct.pack("!L", self.subtype)) |
| 1434 | length = sum([len(x) for x in packed]) |
| 1435 | packed[2] = struct.pack("!H", length) |
| 1436 | return ''.join(packed) |
| 1437 | |
| 1438 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1439 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1440 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1441 | _version = reader.read("!B")[0] |
| 1442 | assert(_version == 1) |
| 1443 | _type = reader.read("!B")[0] |
| 1444 | assert(_type == 4) |
| 1445 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1446 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1447 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1448 | obj.xid = reader.read("!L")[0] |
| 1449 | _experimenter = reader.read("!L")[0] |
| 1450 | assert(_experimenter == 6035143) |
| 1451 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1452 | assert(_subtype == 9) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1453 | return obj |
| 1454 | |
| 1455 | def __eq__(self, other): |
| 1456 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1457 | if self.xid != other.xid: return False |
| 1458 | return True |
| 1459 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1460 | def pretty_print(self, q): |
| 1461 | q.text("bsn_get_interfaces_request {") |
| 1462 | with q.group(): |
| 1463 | with q.indent(2): |
| 1464 | q.breakable() |
| 1465 | q.text("xid = "); |
| 1466 | if self.xid != None: |
| 1467 | q.text("%#x" % self.xid) |
| 1468 | else: |
| 1469 | q.text('None') |
| 1470 | q.breakable() |
| 1471 | q.text('}') |
| 1472 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1473 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1474 | |
| 1475 | class bsn_get_ip_mask_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1476 | version = 1 |
| 1477 | type = 4 |
| 1478 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1479 | subtype = 2 |
| 1480 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1481 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1482 | if xid != None: |
| 1483 | self.xid = xid |
| 1484 | else: |
| 1485 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1486 | if index != None: |
| 1487 | self.index = index |
| 1488 | else: |
| 1489 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1490 | if mask != None: |
| 1491 | self.mask = mask |
| 1492 | else: |
| 1493 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1494 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1495 | |
| 1496 | def pack(self): |
| 1497 | packed = [] |
| 1498 | packed.append(struct.pack("!B", self.version)) |
| 1499 | packed.append(struct.pack("!B", self.type)) |
| 1500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1501 | packed.append(struct.pack("!L", self.xid)) |
| 1502 | packed.append(struct.pack("!L", self.experimenter)) |
| 1503 | packed.append(struct.pack("!L", self.subtype)) |
| 1504 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1505 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1506 | packed.append(struct.pack("!L", self.mask)) |
| 1507 | length = sum([len(x) for x in packed]) |
| 1508 | packed[2] = struct.pack("!H", length) |
| 1509 | return ''.join(packed) |
| 1510 | |
| 1511 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1512 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1513 | obj = bsn_get_ip_mask_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1514 | _version = reader.read("!B")[0] |
| 1515 | assert(_version == 1) |
| 1516 | _type = reader.read("!B")[0] |
| 1517 | assert(_type == 4) |
| 1518 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1519 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1520 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1521 | obj.xid = reader.read("!L")[0] |
| 1522 | _experimenter = reader.read("!L")[0] |
| 1523 | assert(_experimenter == 6035143) |
| 1524 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1525 | assert(_subtype == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1526 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1527 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1528 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1529 | return obj |
| 1530 | |
| 1531 | def __eq__(self, other): |
| 1532 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1533 | if self.xid != other.xid: return False |
| 1534 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1535 | if self.mask != other.mask: return False |
| 1536 | return True |
| 1537 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1538 | def pretty_print(self, q): |
| 1539 | q.text("bsn_get_ip_mask_reply {") |
| 1540 | with q.group(): |
| 1541 | with q.indent(2): |
| 1542 | q.breakable() |
| 1543 | q.text("xid = "); |
| 1544 | if self.xid != None: |
| 1545 | q.text("%#x" % self.xid) |
| 1546 | else: |
| 1547 | q.text('None') |
| 1548 | q.text(","); q.breakable() |
| 1549 | q.text("index = "); |
| 1550 | q.text("%#x" % self.index) |
| 1551 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1552 | q.text("mask = "); |
| 1553 | q.text("%#x" % self.mask) |
| 1554 | q.breakable() |
| 1555 | q.text('}') |
| 1556 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1557 | bsn_header.subtypes[2] = bsn_get_ip_mask_reply |
| 1558 | |
| 1559 | class bsn_get_ip_mask_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1560 | version = 1 |
| 1561 | type = 4 |
| 1562 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1563 | subtype = 1 |
| 1564 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1565 | def __init__(self, xid=None, index=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1566 | if xid != None: |
| 1567 | self.xid = xid |
| 1568 | else: |
| 1569 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1570 | if index != None: |
| 1571 | self.index = index |
| 1572 | else: |
| 1573 | self.index = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1574 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1575 | |
| 1576 | def pack(self): |
| 1577 | packed = [] |
| 1578 | packed.append(struct.pack("!B", self.version)) |
| 1579 | packed.append(struct.pack("!B", self.type)) |
| 1580 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1581 | packed.append(struct.pack("!L", self.xid)) |
| 1582 | packed.append(struct.pack("!L", self.experimenter)) |
| 1583 | packed.append(struct.pack("!L", self.subtype)) |
| 1584 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1585 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1586 | length = sum([len(x) for x in packed]) |
| 1587 | packed[2] = struct.pack("!H", length) |
| 1588 | return ''.join(packed) |
| 1589 | |
| 1590 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1591 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1592 | obj = bsn_get_ip_mask_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1593 | _version = reader.read("!B")[0] |
| 1594 | assert(_version == 1) |
| 1595 | _type = reader.read("!B")[0] |
| 1596 | assert(_type == 4) |
| 1597 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1598 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1599 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1600 | obj.xid = reader.read("!L")[0] |
| 1601 | _experimenter = reader.read("!L")[0] |
| 1602 | assert(_experimenter == 6035143) |
| 1603 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1604 | assert(_subtype == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1605 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1606 | reader.skip(7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1607 | return obj |
| 1608 | |
| 1609 | def __eq__(self, other): |
| 1610 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1611 | if self.xid != other.xid: return False |
| 1612 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1613 | return True |
| 1614 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1615 | def pretty_print(self, q): |
| 1616 | q.text("bsn_get_ip_mask_request {") |
| 1617 | with q.group(): |
| 1618 | with q.indent(2): |
| 1619 | q.breakable() |
| 1620 | q.text("xid = "); |
| 1621 | if self.xid != None: |
| 1622 | q.text("%#x" % self.xid) |
| 1623 | else: |
| 1624 | q.text('None') |
| 1625 | q.text(","); q.breakable() |
| 1626 | q.text("index = "); |
| 1627 | q.text("%#x" % self.index) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1628 | q.breakable() |
| 1629 | q.text('}') |
| 1630 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1631 | bsn_header.subtypes[1] = bsn_get_ip_mask_request |
| 1632 | |
| 1633 | class bsn_get_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1634 | version = 1 |
| 1635 | type = 4 |
| 1636 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1637 | subtype = 14 |
| 1638 | |
| 1639 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1640 | if xid != None: |
| 1641 | self.xid = xid |
| 1642 | else: |
| 1643 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1644 | if l2_table_enable != None: |
| 1645 | self.l2_table_enable = l2_table_enable |
| 1646 | else: |
| 1647 | self.l2_table_enable = 0 |
| 1648 | if l2_table_priority != None: |
| 1649 | self.l2_table_priority = l2_table_priority |
| 1650 | else: |
| 1651 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1652 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1653 | |
| 1654 | def pack(self): |
| 1655 | packed = [] |
| 1656 | packed.append(struct.pack("!B", self.version)) |
| 1657 | packed.append(struct.pack("!B", self.type)) |
| 1658 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1659 | packed.append(struct.pack("!L", self.xid)) |
| 1660 | packed.append(struct.pack("!L", self.experimenter)) |
| 1661 | packed.append(struct.pack("!L", self.subtype)) |
| 1662 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 1663 | packed.append('\x00' * 1) |
| 1664 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 1665 | packed.append('\x00' * 4) |
| 1666 | length = sum([len(x) for x in packed]) |
| 1667 | packed[2] = struct.pack("!H", length) |
| 1668 | return ''.join(packed) |
| 1669 | |
| 1670 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1671 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1672 | obj = bsn_get_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1673 | _version = reader.read("!B")[0] |
| 1674 | assert(_version == 1) |
| 1675 | _type = reader.read("!B")[0] |
| 1676 | assert(_type == 4) |
| 1677 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1678 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1679 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1680 | obj.xid = reader.read("!L")[0] |
| 1681 | _experimenter = reader.read("!L")[0] |
| 1682 | assert(_experimenter == 6035143) |
| 1683 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1684 | assert(_subtype == 14) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1685 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1686 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1687 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1688 | reader.skip(4) |
| 1689 | return obj |
| 1690 | |
| 1691 | def __eq__(self, other): |
| 1692 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1693 | if self.xid != other.xid: return False |
| 1694 | if self.l2_table_enable != other.l2_table_enable: return False |
| 1695 | if self.l2_table_priority != other.l2_table_priority: return False |
| 1696 | return True |
| 1697 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1698 | def pretty_print(self, q): |
| 1699 | q.text("bsn_get_l2_table_reply {") |
| 1700 | with q.group(): |
| 1701 | with q.indent(2): |
| 1702 | q.breakable() |
| 1703 | q.text("xid = "); |
| 1704 | if self.xid != None: |
| 1705 | q.text("%#x" % self.xid) |
| 1706 | else: |
| 1707 | q.text('None') |
| 1708 | q.text(","); q.breakable() |
| 1709 | q.text("l2_table_enable = "); |
| 1710 | q.text("%#x" % self.l2_table_enable) |
| 1711 | q.text(","); q.breakable() |
| 1712 | q.text("l2_table_priority = "); |
| 1713 | q.text("%#x" % self.l2_table_priority) |
| 1714 | q.breakable() |
| 1715 | q.text('}') |
| 1716 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1717 | bsn_header.subtypes[14] = bsn_get_l2_table_reply |
| 1718 | |
| 1719 | class bsn_get_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1720 | version = 1 |
| 1721 | type = 4 |
| 1722 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1723 | subtype = 13 |
| 1724 | |
| 1725 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1726 | if xid != None: |
| 1727 | self.xid = xid |
| 1728 | else: |
| 1729 | self.xid = None |
| 1730 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1731 | |
| 1732 | def pack(self): |
| 1733 | packed = [] |
| 1734 | packed.append(struct.pack("!B", self.version)) |
| 1735 | packed.append(struct.pack("!B", self.type)) |
| 1736 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1737 | packed.append(struct.pack("!L", self.xid)) |
| 1738 | packed.append(struct.pack("!L", self.experimenter)) |
| 1739 | packed.append(struct.pack("!L", self.subtype)) |
| 1740 | length = sum([len(x) for x in packed]) |
| 1741 | packed[2] = struct.pack("!H", length) |
| 1742 | return ''.join(packed) |
| 1743 | |
| 1744 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1745 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1746 | obj = bsn_get_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1747 | _version = reader.read("!B")[0] |
| 1748 | assert(_version == 1) |
| 1749 | _type = reader.read("!B")[0] |
| 1750 | assert(_type == 4) |
| 1751 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1752 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1753 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1754 | obj.xid = reader.read("!L")[0] |
| 1755 | _experimenter = reader.read("!L")[0] |
| 1756 | assert(_experimenter == 6035143) |
| 1757 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1758 | assert(_subtype == 13) |
| 1759 | return obj |
| 1760 | |
| 1761 | def __eq__(self, other): |
| 1762 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1763 | if self.xid != other.xid: return False |
| 1764 | return True |
| 1765 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1766 | def pretty_print(self, q): |
| 1767 | q.text("bsn_get_l2_table_request {") |
| 1768 | with q.group(): |
| 1769 | with q.indent(2): |
| 1770 | q.breakable() |
| 1771 | q.text("xid = "); |
| 1772 | if self.xid != None: |
| 1773 | q.text("%#x" % self.xid) |
| 1774 | else: |
| 1775 | q.text('None') |
| 1776 | q.breakable() |
| 1777 | q.text('}') |
| 1778 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1779 | bsn_header.subtypes[13] = bsn_get_l2_table_request |
| 1780 | |
| 1781 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1782 | version = 1 |
| 1783 | type = 4 |
| 1784 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1785 | subtype = 5 |
| 1786 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1787 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1788 | if xid != None: |
| 1789 | self.xid = xid |
| 1790 | else: |
| 1791 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1792 | if report_mirror_ports != None: |
| 1793 | self.report_mirror_ports = report_mirror_ports |
| 1794 | else: |
| 1795 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1796 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1797 | |
| 1798 | def pack(self): |
| 1799 | packed = [] |
| 1800 | packed.append(struct.pack("!B", self.version)) |
| 1801 | packed.append(struct.pack("!B", self.type)) |
| 1802 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1803 | packed.append(struct.pack("!L", self.xid)) |
| 1804 | packed.append(struct.pack("!L", self.experimenter)) |
| 1805 | packed.append(struct.pack("!L", self.subtype)) |
| 1806 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1807 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1808 | length = sum([len(x) for x in packed]) |
| 1809 | packed[2] = struct.pack("!H", length) |
| 1810 | return ''.join(packed) |
| 1811 | |
| 1812 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1813 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1814 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1815 | _version = reader.read("!B")[0] |
| 1816 | assert(_version == 1) |
| 1817 | _type = reader.read("!B")[0] |
| 1818 | assert(_type == 4) |
| 1819 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1820 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1821 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1822 | obj.xid = reader.read("!L")[0] |
| 1823 | _experimenter = reader.read("!L")[0] |
| 1824 | assert(_experimenter == 6035143) |
| 1825 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1826 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1827 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1828 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1829 | return obj |
| 1830 | |
| 1831 | def __eq__(self, other): |
| 1832 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1833 | if self.xid != other.xid: return False |
| 1834 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1835 | return True |
| 1836 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1837 | def pretty_print(self, q): |
| 1838 | q.text("bsn_get_mirroring_reply {") |
| 1839 | with q.group(): |
| 1840 | with q.indent(2): |
| 1841 | q.breakable() |
| 1842 | q.text("xid = "); |
| 1843 | if self.xid != None: |
| 1844 | q.text("%#x" % self.xid) |
| 1845 | else: |
| 1846 | q.text('None') |
| 1847 | q.text(","); q.breakable() |
| 1848 | q.text("report_mirror_ports = "); |
| 1849 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1850 | q.breakable() |
| 1851 | q.text('}') |
| 1852 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1853 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1854 | |
| 1855 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1856 | version = 1 |
| 1857 | type = 4 |
| 1858 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1859 | subtype = 4 |
| 1860 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1861 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1862 | if xid != None: |
| 1863 | self.xid = xid |
| 1864 | else: |
| 1865 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1866 | if report_mirror_ports != None: |
| 1867 | self.report_mirror_ports = report_mirror_ports |
| 1868 | else: |
| 1869 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1870 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1871 | |
| 1872 | def pack(self): |
| 1873 | packed = [] |
| 1874 | packed.append(struct.pack("!B", self.version)) |
| 1875 | packed.append(struct.pack("!B", self.type)) |
| 1876 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1877 | packed.append(struct.pack("!L", self.xid)) |
| 1878 | packed.append(struct.pack("!L", self.experimenter)) |
| 1879 | packed.append(struct.pack("!L", self.subtype)) |
| 1880 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1881 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1882 | length = sum([len(x) for x in packed]) |
| 1883 | packed[2] = struct.pack("!H", length) |
| 1884 | return ''.join(packed) |
| 1885 | |
| 1886 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1887 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1888 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1889 | _version = reader.read("!B")[0] |
| 1890 | assert(_version == 1) |
| 1891 | _type = reader.read("!B")[0] |
| 1892 | assert(_type == 4) |
| 1893 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1894 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1895 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1896 | obj.xid = reader.read("!L")[0] |
| 1897 | _experimenter = reader.read("!L")[0] |
| 1898 | assert(_experimenter == 6035143) |
| 1899 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1900 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1901 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1902 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1903 | return obj |
| 1904 | |
| 1905 | def __eq__(self, other): |
| 1906 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1907 | if self.xid != other.xid: return False |
| 1908 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1909 | return True |
| 1910 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1911 | def pretty_print(self, q): |
| 1912 | q.text("bsn_get_mirroring_request {") |
| 1913 | with q.group(): |
| 1914 | with q.indent(2): |
| 1915 | q.breakable() |
| 1916 | q.text("xid = "); |
| 1917 | if self.xid != None: |
| 1918 | q.text("%#x" % self.xid) |
| 1919 | else: |
| 1920 | q.text('None') |
| 1921 | q.text(","); q.breakable() |
| 1922 | q.text("report_mirror_ports = "); |
| 1923 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1924 | q.breakable() |
| 1925 | q.text('}') |
| 1926 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1927 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 1928 | |
| 1929 | class bsn_hybrid_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1930 | version = 1 |
| 1931 | type = 4 |
| 1932 | experimenter = 6035143 |
| 1933 | subtype = 28 |
| 1934 | |
| 1935 | def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1936 | if xid != None: |
| 1937 | self.xid = xid |
| 1938 | else: |
| 1939 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1940 | if hybrid_enable != None: |
| 1941 | self.hybrid_enable = hybrid_enable |
| 1942 | else: |
| 1943 | self.hybrid_enable = 0 |
| 1944 | if hybrid_version != None: |
| 1945 | self.hybrid_version = hybrid_version |
| 1946 | else: |
| 1947 | self.hybrid_version = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1948 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1949 | |
| 1950 | def pack(self): |
| 1951 | packed = [] |
| 1952 | packed.append(struct.pack("!B", self.version)) |
| 1953 | packed.append(struct.pack("!B", self.type)) |
| 1954 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1955 | packed.append(struct.pack("!L", self.xid)) |
| 1956 | packed.append(struct.pack("!L", self.experimenter)) |
| 1957 | packed.append(struct.pack("!L", self.subtype)) |
| 1958 | packed.append(struct.pack("!B", self.hybrid_enable)) |
| 1959 | packed.append('\x00' * 1) |
| 1960 | packed.append(struct.pack("!H", self.hybrid_version)) |
| 1961 | packed.append('\x00' * 4) |
| 1962 | length = sum([len(x) for x in packed]) |
| 1963 | packed[2] = struct.pack("!H", length) |
| 1964 | return ''.join(packed) |
| 1965 | |
| 1966 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1967 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1968 | obj = bsn_hybrid_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1969 | _version = reader.read("!B")[0] |
| 1970 | assert(_version == 1) |
| 1971 | _type = reader.read("!B")[0] |
| 1972 | assert(_type == 4) |
| 1973 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1974 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 1975 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1976 | obj.xid = reader.read("!L")[0] |
| 1977 | _experimenter = reader.read("!L")[0] |
| 1978 | assert(_experimenter == 6035143) |
| 1979 | _subtype = reader.read("!L")[0] |
| 1980 | assert(_subtype == 28) |
| 1981 | obj.hybrid_enable = reader.read("!B")[0] |
| 1982 | reader.skip(1) |
| 1983 | obj.hybrid_version = reader.read("!H")[0] |
| 1984 | reader.skip(4) |
| 1985 | return obj |
| 1986 | |
| 1987 | def __eq__(self, other): |
| 1988 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1989 | if self.xid != other.xid: return False |
| 1990 | if self.hybrid_enable != other.hybrid_enable: return False |
| 1991 | if self.hybrid_version != other.hybrid_version: return False |
| 1992 | return True |
| 1993 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1994 | def pretty_print(self, q): |
| 1995 | q.text("bsn_hybrid_get_reply {") |
| 1996 | with q.group(): |
| 1997 | with q.indent(2): |
| 1998 | q.breakable() |
| 1999 | q.text("xid = "); |
| 2000 | if self.xid != None: |
| 2001 | q.text("%#x" % self.xid) |
| 2002 | else: |
| 2003 | q.text('None') |
| 2004 | q.text(","); q.breakable() |
| 2005 | q.text("hybrid_enable = "); |
| 2006 | q.text("%#x" % self.hybrid_enable) |
| 2007 | q.text(","); q.breakable() |
| 2008 | q.text("hybrid_version = "); |
| 2009 | q.text("%#x" % self.hybrid_version) |
| 2010 | q.breakable() |
| 2011 | q.text('}') |
| 2012 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2013 | bsn_header.subtypes[28] = bsn_hybrid_get_reply |
| 2014 | |
| 2015 | class bsn_hybrid_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2016 | version = 1 |
| 2017 | type = 4 |
| 2018 | experimenter = 6035143 |
| 2019 | subtype = 27 |
| 2020 | |
| 2021 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2022 | if xid != None: |
| 2023 | self.xid = xid |
| 2024 | else: |
| 2025 | self.xid = None |
| 2026 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2027 | |
| 2028 | def pack(self): |
| 2029 | packed = [] |
| 2030 | packed.append(struct.pack("!B", self.version)) |
| 2031 | packed.append(struct.pack("!B", self.type)) |
| 2032 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2033 | packed.append(struct.pack("!L", self.xid)) |
| 2034 | packed.append(struct.pack("!L", self.experimenter)) |
| 2035 | packed.append(struct.pack("!L", self.subtype)) |
| 2036 | length = sum([len(x) for x in packed]) |
| 2037 | packed[2] = struct.pack("!H", length) |
| 2038 | return ''.join(packed) |
| 2039 | |
| 2040 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2041 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2042 | obj = bsn_hybrid_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2043 | _version = reader.read("!B")[0] |
| 2044 | assert(_version == 1) |
| 2045 | _type = reader.read("!B")[0] |
| 2046 | assert(_type == 4) |
| 2047 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2048 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2049 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2050 | obj.xid = reader.read("!L")[0] |
| 2051 | _experimenter = reader.read("!L")[0] |
| 2052 | assert(_experimenter == 6035143) |
| 2053 | _subtype = reader.read("!L")[0] |
| 2054 | assert(_subtype == 27) |
| 2055 | return obj |
| 2056 | |
| 2057 | def __eq__(self, other): |
| 2058 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2059 | if self.xid != other.xid: return False |
| 2060 | return True |
| 2061 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2062 | def pretty_print(self, q): |
| 2063 | q.text("bsn_hybrid_get_request {") |
| 2064 | with q.group(): |
| 2065 | with q.indent(2): |
| 2066 | q.breakable() |
| 2067 | q.text("xid = "); |
| 2068 | if self.xid != None: |
| 2069 | q.text("%#x" % self.xid) |
| 2070 | else: |
| 2071 | q.text('None') |
| 2072 | q.breakable() |
| 2073 | q.text('}') |
| 2074 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2075 | bsn_header.subtypes[27] = bsn_hybrid_get_request |
| 2076 | |
| 2077 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2078 | version = 1 |
| 2079 | type = 4 |
| 2080 | experimenter = 6035143 |
| 2081 | subtype = 34 |
| 2082 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2083 | 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] | 2084 | if xid != None: |
| 2085 | self.xid = xid |
| 2086 | else: |
| 2087 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2088 | if status != None: |
| 2089 | self.status = status |
| 2090 | else: |
| 2091 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2092 | if port_no != None: |
| 2093 | self.port_no = port_no |
| 2094 | else: |
| 2095 | self.port_no = 0 |
| 2096 | if slot_num != None: |
| 2097 | self.slot_num = slot_num |
| 2098 | else: |
| 2099 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2100 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2101 | |
| 2102 | def pack(self): |
| 2103 | packed = [] |
| 2104 | packed.append(struct.pack("!B", self.version)) |
| 2105 | packed.append(struct.pack("!B", self.type)) |
| 2106 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2107 | packed.append(struct.pack("!L", self.xid)) |
| 2108 | packed.append(struct.pack("!L", self.experimenter)) |
| 2109 | packed.append(struct.pack("!L", self.subtype)) |
| 2110 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2111 | packed.append(util.pack_port_no(self.port_no)) |
| 2112 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2113 | length = sum([len(x) for x in packed]) |
| 2114 | packed[2] = struct.pack("!H", length) |
| 2115 | return ''.join(packed) |
| 2116 | |
| 2117 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2118 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2119 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2120 | _version = reader.read("!B")[0] |
| 2121 | assert(_version == 1) |
| 2122 | _type = reader.read("!B")[0] |
| 2123 | assert(_type == 4) |
| 2124 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2125 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2126 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2127 | obj.xid = reader.read("!L")[0] |
| 2128 | _experimenter = reader.read("!L")[0] |
| 2129 | assert(_experimenter == 6035143) |
| 2130 | _subtype = reader.read("!L")[0] |
| 2131 | assert(_subtype == 34) |
| 2132 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2133 | obj.port_no = util.unpack_port_no(reader) |
| 2134 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2135 | return obj |
| 2136 | |
| 2137 | def __eq__(self, other): |
| 2138 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2139 | if self.xid != other.xid: return False |
| 2140 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2141 | if self.port_no != other.port_no: return False |
| 2142 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2143 | return True |
| 2144 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2145 | def pretty_print(self, q): |
| 2146 | q.text("bsn_pdu_rx_reply {") |
| 2147 | with q.group(): |
| 2148 | with q.indent(2): |
| 2149 | q.breakable() |
| 2150 | q.text("xid = "); |
| 2151 | if self.xid != None: |
| 2152 | q.text("%#x" % self.xid) |
| 2153 | else: |
| 2154 | q.text('None') |
| 2155 | q.text(","); q.breakable() |
| 2156 | q.text("status = "); |
| 2157 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2158 | q.text(","); q.breakable() |
| 2159 | q.text("port_no = "); |
| 2160 | q.text(util.pretty_port(self.port_no)) |
| 2161 | q.text(","); q.breakable() |
| 2162 | q.text("slot_num = "); |
| 2163 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2164 | q.breakable() |
| 2165 | q.text('}') |
| 2166 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2167 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 2168 | |
| 2169 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2170 | version = 1 |
| 2171 | type = 4 |
| 2172 | experimenter = 6035143 |
| 2173 | subtype = 33 |
| 2174 | |
| 2175 | 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] | 2176 | if xid != None: |
| 2177 | self.xid = xid |
| 2178 | else: |
| 2179 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2180 | if timeout_ms != None: |
| 2181 | self.timeout_ms = timeout_ms |
| 2182 | else: |
| 2183 | self.timeout_ms = 0 |
| 2184 | if port_no != None: |
| 2185 | self.port_no = port_no |
| 2186 | else: |
| 2187 | self.port_no = 0 |
| 2188 | if slot_num != None: |
| 2189 | self.slot_num = slot_num |
| 2190 | else: |
| 2191 | self.slot_num = 0 |
| 2192 | if data != None: |
| 2193 | self.data = data |
| 2194 | else: |
| 2195 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2196 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2197 | |
| 2198 | def pack(self): |
| 2199 | packed = [] |
| 2200 | packed.append(struct.pack("!B", self.version)) |
| 2201 | packed.append(struct.pack("!B", self.type)) |
| 2202 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2203 | packed.append(struct.pack("!L", self.xid)) |
| 2204 | packed.append(struct.pack("!L", self.experimenter)) |
| 2205 | packed.append(struct.pack("!L", self.subtype)) |
| 2206 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 2207 | packed.append(util.pack_port_no(self.port_no)) |
| 2208 | packed.append(struct.pack("!B", self.slot_num)) |
| 2209 | packed.append('\x00' * 3) |
| 2210 | packed.append(self.data) |
| 2211 | length = sum([len(x) for x in packed]) |
| 2212 | packed[2] = struct.pack("!H", length) |
| 2213 | return ''.join(packed) |
| 2214 | |
| 2215 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2216 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2217 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2218 | _version = reader.read("!B")[0] |
| 2219 | assert(_version == 1) |
| 2220 | _type = reader.read("!B")[0] |
| 2221 | assert(_type == 4) |
| 2222 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2223 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2224 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2225 | obj.xid = reader.read("!L")[0] |
| 2226 | _experimenter = reader.read("!L")[0] |
| 2227 | assert(_experimenter == 6035143) |
| 2228 | _subtype = reader.read("!L")[0] |
| 2229 | assert(_subtype == 33) |
| 2230 | obj.timeout_ms = reader.read("!L")[0] |
| 2231 | obj.port_no = util.unpack_port_no(reader) |
| 2232 | obj.slot_num = reader.read("!B")[0] |
| 2233 | reader.skip(3) |
| 2234 | obj.data = str(reader.read_all()) |
| 2235 | return obj |
| 2236 | |
| 2237 | def __eq__(self, other): |
| 2238 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2239 | if self.xid != other.xid: return False |
| 2240 | if self.timeout_ms != other.timeout_ms: return False |
| 2241 | if self.port_no != other.port_no: return False |
| 2242 | if self.slot_num != other.slot_num: return False |
| 2243 | if self.data != other.data: return False |
| 2244 | return True |
| 2245 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2246 | def pretty_print(self, q): |
| 2247 | q.text("bsn_pdu_rx_request {") |
| 2248 | with q.group(): |
| 2249 | with q.indent(2): |
| 2250 | q.breakable() |
| 2251 | q.text("xid = "); |
| 2252 | if self.xid != None: |
| 2253 | q.text("%#x" % self.xid) |
| 2254 | else: |
| 2255 | q.text('None') |
| 2256 | q.text(","); q.breakable() |
| 2257 | q.text("timeout_ms = "); |
| 2258 | q.text("%#x" % self.timeout_ms) |
| 2259 | q.text(","); q.breakable() |
| 2260 | q.text("port_no = "); |
| 2261 | q.text(util.pretty_port(self.port_no)) |
| 2262 | q.text(","); q.breakable() |
| 2263 | q.text("slot_num = "); |
| 2264 | q.text("%#x" % self.slot_num) |
| 2265 | q.text(","); q.breakable() |
| 2266 | q.text("data = "); |
| 2267 | q.pp(self.data) |
| 2268 | q.breakable() |
| 2269 | q.text('}') |
| 2270 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2271 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 2272 | |
| 2273 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2274 | version = 1 |
| 2275 | type = 4 |
| 2276 | experimenter = 6035143 |
| 2277 | subtype = 35 |
| 2278 | |
| 2279 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2280 | if xid != None: |
| 2281 | self.xid = xid |
| 2282 | else: |
| 2283 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2284 | if port_no != None: |
| 2285 | self.port_no = port_no |
| 2286 | else: |
| 2287 | self.port_no = 0 |
| 2288 | if slot_num != None: |
| 2289 | self.slot_num = slot_num |
| 2290 | else: |
| 2291 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2292 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2293 | |
| 2294 | def pack(self): |
| 2295 | packed = [] |
| 2296 | packed.append(struct.pack("!B", self.version)) |
| 2297 | packed.append(struct.pack("!B", self.type)) |
| 2298 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2299 | packed.append(struct.pack("!L", self.xid)) |
| 2300 | packed.append(struct.pack("!L", self.experimenter)) |
| 2301 | packed.append(struct.pack("!L", self.subtype)) |
| 2302 | packed.append(util.pack_port_no(self.port_no)) |
| 2303 | packed.append(struct.pack("!B", self.slot_num)) |
| 2304 | length = sum([len(x) for x in packed]) |
| 2305 | packed[2] = struct.pack("!H", length) |
| 2306 | return ''.join(packed) |
| 2307 | |
| 2308 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2309 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2310 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2311 | _version = reader.read("!B")[0] |
| 2312 | assert(_version == 1) |
| 2313 | _type = reader.read("!B")[0] |
| 2314 | assert(_type == 4) |
| 2315 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2316 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2317 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2318 | obj.xid = reader.read("!L")[0] |
| 2319 | _experimenter = reader.read("!L")[0] |
| 2320 | assert(_experimenter == 6035143) |
| 2321 | _subtype = reader.read("!L")[0] |
| 2322 | assert(_subtype == 35) |
| 2323 | obj.port_no = util.unpack_port_no(reader) |
| 2324 | obj.slot_num = reader.read("!B")[0] |
| 2325 | return obj |
| 2326 | |
| 2327 | def __eq__(self, other): |
| 2328 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2329 | if self.xid != other.xid: return False |
| 2330 | if self.port_no != other.port_no: return False |
| 2331 | if self.slot_num != other.slot_num: return False |
| 2332 | return True |
| 2333 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2334 | def pretty_print(self, q): |
| 2335 | q.text("bsn_pdu_rx_timeout {") |
| 2336 | with q.group(): |
| 2337 | with q.indent(2): |
| 2338 | q.breakable() |
| 2339 | q.text("xid = "); |
| 2340 | if self.xid != None: |
| 2341 | q.text("%#x" % self.xid) |
| 2342 | else: |
| 2343 | q.text('None') |
| 2344 | q.text(","); q.breakable() |
| 2345 | q.text("port_no = "); |
| 2346 | q.text(util.pretty_port(self.port_no)) |
| 2347 | q.text(","); q.breakable() |
| 2348 | q.text("slot_num = "); |
| 2349 | q.text("%#x" % self.slot_num) |
| 2350 | q.breakable() |
| 2351 | q.text('}') |
| 2352 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2353 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 2354 | |
| 2355 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2356 | version = 1 |
| 2357 | type = 4 |
| 2358 | experimenter = 6035143 |
| 2359 | subtype = 32 |
| 2360 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2361 | 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] | 2362 | if xid != None: |
| 2363 | self.xid = xid |
| 2364 | else: |
| 2365 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2366 | if status != None: |
| 2367 | self.status = status |
| 2368 | else: |
| 2369 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2370 | if port_no != None: |
| 2371 | self.port_no = port_no |
| 2372 | else: |
| 2373 | self.port_no = 0 |
| 2374 | if slot_num != None: |
| 2375 | self.slot_num = slot_num |
| 2376 | else: |
| 2377 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2378 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2379 | |
| 2380 | def pack(self): |
| 2381 | packed = [] |
| 2382 | packed.append(struct.pack("!B", self.version)) |
| 2383 | packed.append(struct.pack("!B", self.type)) |
| 2384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2385 | packed.append(struct.pack("!L", self.xid)) |
| 2386 | packed.append(struct.pack("!L", self.experimenter)) |
| 2387 | packed.append(struct.pack("!L", self.subtype)) |
| 2388 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2389 | packed.append(util.pack_port_no(self.port_no)) |
| 2390 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2391 | length = sum([len(x) for x in packed]) |
| 2392 | packed[2] = struct.pack("!H", length) |
| 2393 | return ''.join(packed) |
| 2394 | |
| 2395 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2396 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2397 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2398 | _version = reader.read("!B")[0] |
| 2399 | assert(_version == 1) |
| 2400 | _type = reader.read("!B")[0] |
| 2401 | assert(_type == 4) |
| 2402 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2403 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2404 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2405 | obj.xid = reader.read("!L")[0] |
| 2406 | _experimenter = reader.read("!L")[0] |
| 2407 | assert(_experimenter == 6035143) |
| 2408 | _subtype = reader.read("!L")[0] |
| 2409 | assert(_subtype == 32) |
| 2410 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2411 | obj.port_no = util.unpack_port_no(reader) |
| 2412 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2413 | return obj |
| 2414 | |
| 2415 | def __eq__(self, other): |
| 2416 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2417 | if self.xid != other.xid: return False |
| 2418 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2419 | if self.port_no != other.port_no: return False |
| 2420 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2421 | return True |
| 2422 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2423 | def pretty_print(self, q): |
| 2424 | q.text("bsn_pdu_tx_reply {") |
| 2425 | with q.group(): |
| 2426 | with q.indent(2): |
| 2427 | q.breakable() |
| 2428 | q.text("xid = "); |
| 2429 | if self.xid != None: |
| 2430 | q.text("%#x" % self.xid) |
| 2431 | else: |
| 2432 | q.text('None') |
| 2433 | q.text(","); q.breakable() |
| 2434 | q.text("status = "); |
| 2435 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2436 | q.text(","); q.breakable() |
| 2437 | q.text("port_no = "); |
| 2438 | q.text(util.pretty_port(self.port_no)) |
| 2439 | q.text(","); q.breakable() |
| 2440 | q.text("slot_num = "); |
| 2441 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2442 | q.breakable() |
| 2443 | q.text('}') |
| 2444 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2445 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2446 | |
| 2447 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2448 | version = 1 |
| 2449 | type = 4 |
| 2450 | experimenter = 6035143 |
| 2451 | subtype = 31 |
| 2452 | |
| 2453 | 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] | 2454 | if xid != None: |
| 2455 | self.xid = xid |
| 2456 | else: |
| 2457 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2458 | if tx_interval_ms != None: |
| 2459 | self.tx_interval_ms = tx_interval_ms |
| 2460 | else: |
| 2461 | self.tx_interval_ms = 0 |
| 2462 | if port_no != None: |
| 2463 | self.port_no = port_no |
| 2464 | else: |
| 2465 | self.port_no = 0 |
| 2466 | if slot_num != None: |
| 2467 | self.slot_num = slot_num |
| 2468 | else: |
| 2469 | self.slot_num = 0 |
| 2470 | if data != None: |
| 2471 | self.data = data |
| 2472 | else: |
| 2473 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2474 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2475 | |
| 2476 | def pack(self): |
| 2477 | packed = [] |
| 2478 | packed.append(struct.pack("!B", self.version)) |
| 2479 | packed.append(struct.pack("!B", self.type)) |
| 2480 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2481 | packed.append(struct.pack("!L", self.xid)) |
| 2482 | packed.append(struct.pack("!L", self.experimenter)) |
| 2483 | packed.append(struct.pack("!L", self.subtype)) |
| 2484 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2485 | packed.append(util.pack_port_no(self.port_no)) |
| 2486 | packed.append(struct.pack("!B", self.slot_num)) |
| 2487 | packed.append('\x00' * 3) |
| 2488 | packed.append(self.data) |
| 2489 | length = sum([len(x) for x in packed]) |
| 2490 | packed[2] = struct.pack("!H", length) |
| 2491 | return ''.join(packed) |
| 2492 | |
| 2493 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2494 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2495 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2496 | _version = reader.read("!B")[0] |
| 2497 | assert(_version == 1) |
| 2498 | _type = reader.read("!B")[0] |
| 2499 | assert(_type == 4) |
| 2500 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2501 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2502 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2503 | obj.xid = reader.read("!L")[0] |
| 2504 | _experimenter = reader.read("!L")[0] |
| 2505 | assert(_experimenter == 6035143) |
| 2506 | _subtype = reader.read("!L")[0] |
| 2507 | assert(_subtype == 31) |
| 2508 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2509 | obj.port_no = util.unpack_port_no(reader) |
| 2510 | obj.slot_num = reader.read("!B")[0] |
| 2511 | reader.skip(3) |
| 2512 | obj.data = str(reader.read_all()) |
| 2513 | return obj |
| 2514 | |
| 2515 | def __eq__(self, other): |
| 2516 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2517 | if self.xid != other.xid: return False |
| 2518 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2519 | if self.port_no != other.port_no: return False |
| 2520 | if self.slot_num != other.slot_num: return False |
| 2521 | if self.data != other.data: return False |
| 2522 | return True |
| 2523 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2524 | def pretty_print(self, q): |
| 2525 | q.text("bsn_pdu_tx_request {") |
| 2526 | with q.group(): |
| 2527 | with q.indent(2): |
| 2528 | q.breakable() |
| 2529 | q.text("xid = "); |
| 2530 | if self.xid != None: |
| 2531 | q.text("%#x" % self.xid) |
| 2532 | else: |
| 2533 | q.text('None') |
| 2534 | q.text(","); q.breakable() |
| 2535 | q.text("tx_interval_ms = "); |
| 2536 | q.text("%#x" % self.tx_interval_ms) |
| 2537 | q.text(","); q.breakable() |
| 2538 | q.text("port_no = "); |
| 2539 | q.text(util.pretty_port(self.port_no)) |
| 2540 | q.text(","); q.breakable() |
| 2541 | q.text("slot_num = "); |
| 2542 | q.text("%#x" % self.slot_num) |
| 2543 | q.text(","); q.breakable() |
| 2544 | q.text("data = "); |
| 2545 | q.pp(self.data) |
| 2546 | q.breakable() |
| 2547 | q.text('}') |
| 2548 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2549 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2550 | |
| 2551 | class bsn_set_ip_mask(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2552 | version = 1 |
| 2553 | type = 4 |
| 2554 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2555 | subtype = 0 |
| 2556 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2557 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2558 | if xid != None: |
| 2559 | self.xid = xid |
| 2560 | else: |
| 2561 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2562 | if index != None: |
| 2563 | self.index = index |
| 2564 | else: |
| 2565 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2566 | if mask != None: |
| 2567 | self.mask = mask |
| 2568 | else: |
| 2569 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2570 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2571 | |
| 2572 | def pack(self): |
| 2573 | packed = [] |
| 2574 | packed.append(struct.pack("!B", self.version)) |
| 2575 | packed.append(struct.pack("!B", self.type)) |
| 2576 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2577 | packed.append(struct.pack("!L", self.xid)) |
| 2578 | packed.append(struct.pack("!L", self.experimenter)) |
| 2579 | packed.append(struct.pack("!L", self.subtype)) |
| 2580 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2581 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2582 | packed.append(struct.pack("!L", self.mask)) |
| 2583 | length = sum([len(x) for x in packed]) |
| 2584 | packed[2] = struct.pack("!H", length) |
| 2585 | return ''.join(packed) |
| 2586 | |
| 2587 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2588 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2589 | obj = bsn_set_ip_mask() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2590 | _version = reader.read("!B")[0] |
| 2591 | assert(_version == 1) |
| 2592 | _type = reader.read("!B")[0] |
| 2593 | assert(_type == 4) |
| 2594 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2595 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2596 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2597 | obj.xid = reader.read("!L")[0] |
| 2598 | _experimenter = reader.read("!L")[0] |
| 2599 | assert(_experimenter == 6035143) |
| 2600 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2601 | assert(_subtype == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2602 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2603 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2604 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2605 | return obj |
| 2606 | |
| 2607 | def __eq__(self, other): |
| 2608 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2609 | if self.xid != other.xid: return False |
| 2610 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2611 | if self.mask != other.mask: return False |
| 2612 | return True |
| 2613 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2614 | def pretty_print(self, q): |
| 2615 | q.text("bsn_set_ip_mask {") |
| 2616 | with q.group(): |
| 2617 | with q.indent(2): |
| 2618 | q.breakable() |
| 2619 | q.text("xid = "); |
| 2620 | if self.xid != None: |
| 2621 | q.text("%#x" % self.xid) |
| 2622 | else: |
| 2623 | q.text('None') |
| 2624 | q.text(","); q.breakable() |
| 2625 | q.text("index = "); |
| 2626 | q.text("%#x" % self.index) |
| 2627 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2628 | q.text("mask = "); |
| 2629 | q.text("%#x" % self.mask) |
| 2630 | q.breakable() |
| 2631 | q.text('}') |
| 2632 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2633 | bsn_header.subtypes[0] = bsn_set_ip_mask |
| 2634 | |
| 2635 | class bsn_set_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2636 | version = 1 |
| 2637 | type = 4 |
| 2638 | experimenter = 6035143 |
| 2639 | subtype = 24 |
| 2640 | |
| 2641 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2642 | if xid != None: |
| 2643 | self.xid = xid |
| 2644 | else: |
| 2645 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2646 | if l2_table_enable != None: |
| 2647 | self.l2_table_enable = l2_table_enable |
| 2648 | else: |
| 2649 | self.l2_table_enable = 0 |
| 2650 | if l2_table_priority != None: |
| 2651 | self.l2_table_priority = l2_table_priority |
| 2652 | else: |
| 2653 | self.l2_table_priority = 0 |
| 2654 | if status != None: |
| 2655 | self.status = status |
| 2656 | else: |
| 2657 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2658 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2659 | |
| 2660 | def pack(self): |
| 2661 | packed = [] |
| 2662 | packed.append(struct.pack("!B", self.version)) |
| 2663 | packed.append(struct.pack("!B", self.type)) |
| 2664 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2665 | packed.append(struct.pack("!L", self.xid)) |
| 2666 | packed.append(struct.pack("!L", self.experimenter)) |
| 2667 | packed.append(struct.pack("!L", self.subtype)) |
| 2668 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2669 | packed.append('\x00' * 1) |
| 2670 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2671 | packed.append(struct.pack("!L", self.status)) |
| 2672 | length = sum([len(x) for x in packed]) |
| 2673 | packed[2] = struct.pack("!H", length) |
| 2674 | return ''.join(packed) |
| 2675 | |
| 2676 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2677 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2678 | obj = bsn_set_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2679 | _version = reader.read("!B")[0] |
| 2680 | assert(_version == 1) |
| 2681 | _type = reader.read("!B")[0] |
| 2682 | assert(_type == 4) |
| 2683 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2684 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2685 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2686 | obj.xid = reader.read("!L")[0] |
| 2687 | _experimenter = reader.read("!L")[0] |
| 2688 | assert(_experimenter == 6035143) |
| 2689 | _subtype = reader.read("!L")[0] |
| 2690 | assert(_subtype == 24) |
| 2691 | obj.l2_table_enable = reader.read("!B")[0] |
| 2692 | reader.skip(1) |
| 2693 | obj.l2_table_priority = reader.read("!H")[0] |
| 2694 | obj.status = reader.read("!L")[0] |
| 2695 | return obj |
| 2696 | |
| 2697 | def __eq__(self, other): |
| 2698 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2699 | if self.xid != other.xid: return False |
| 2700 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2701 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2702 | if self.status != other.status: return False |
| 2703 | return True |
| 2704 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2705 | def pretty_print(self, q): |
| 2706 | q.text("bsn_set_l2_table_reply {") |
| 2707 | with q.group(): |
| 2708 | with q.indent(2): |
| 2709 | q.breakable() |
| 2710 | q.text("xid = "); |
| 2711 | if self.xid != None: |
| 2712 | q.text("%#x" % self.xid) |
| 2713 | else: |
| 2714 | q.text('None') |
| 2715 | q.text(","); q.breakable() |
| 2716 | q.text("l2_table_enable = "); |
| 2717 | q.text("%#x" % self.l2_table_enable) |
| 2718 | q.text(","); q.breakable() |
| 2719 | q.text("l2_table_priority = "); |
| 2720 | q.text("%#x" % self.l2_table_priority) |
| 2721 | q.text(","); q.breakable() |
| 2722 | q.text("status = "); |
| 2723 | q.text("%#x" % self.status) |
| 2724 | q.breakable() |
| 2725 | q.text('}') |
| 2726 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2727 | bsn_header.subtypes[24] = bsn_set_l2_table_reply |
| 2728 | |
| 2729 | class bsn_set_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2730 | version = 1 |
| 2731 | type = 4 |
| 2732 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2733 | subtype = 12 |
| 2734 | |
| 2735 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2736 | if xid != None: |
| 2737 | self.xid = xid |
| 2738 | else: |
| 2739 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2740 | if l2_table_enable != None: |
| 2741 | self.l2_table_enable = l2_table_enable |
| 2742 | else: |
| 2743 | self.l2_table_enable = 0 |
| 2744 | if l2_table_priority != None: |
| 2745 | self.l2_table_priority = l2_table_priority |
| 2746 | else: |
| 2747 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2748 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2749 | |
| 2750 | def pack(self): |
| 2751 | packed = [] |
| 2752 | packed.append(struct.pack("!B", self.version)) |
| 2753 | packed.append(struct.pack("!B", self.type)) |
| 2754 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2755 | packed.append(struct.pack("!L", self.xid)) |
| 2756 | packed.append(struct.pack("!L", self.experimenter)) |
| 2757 | packed.append(struct.pack("!L", self.subtype)) |
| 2758 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2759 | packed.append('\x00' * 1) |
| 2760 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2761 | packed.append('\x00' * 4) |
| 2762 | length = sum([len(x) for x in packed]) |
| 2763 | packed[2] = struct.pack("!H", length) |
| 2764 | return ''.join(packed) |
| 2765 | |
| 2766 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2767 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2768 | obj = bsn_set_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2769 | _version = reader.read("!B")[0] |
| 2770 | assert(_version == 1) |
| 2771 | _type = reader.read("!B")[0] |
| 2772 | assert(_type == 4) |
| 2773 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2774 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2775 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2776 | obj.xid = reader.read("!L")[0] |
| 2777 | _experimenter = reader.read("!L")[0] |
| 2778 | assert(_experimenter == 6035143) |
| 2779 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2780 | assert(_subtype == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2781 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2782 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2783 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2784 | reader.skip(4) |
| 2785 | return obj |
| 2786 | |
| 2787 | def __eq__(self, other): |
| 2788 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2789 | if self.xid != other.xid: return False |
| 2790 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2791 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2792 | return True |
| 2793 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2794 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2795 | q.text("bsn_set_l2_table_request {") |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2796 | with q.group(): |
| 2797 | with q.indent(2): |
| 2798 | q.breakable() |
| 2799 | q.text("xid = "); |
| 2800 | if self.xid != None: |
| 2801 | q.text("%#x" % self.xid) |
| 2802 | else: |
| 2803 | q.text('None') |
| 2804 | q.text(","); q.breakable() |
| 2805 | q.text("l2_table_enable = "); |
| 2806 | q.text("%#x" % self.l2_table_enable) |
| 2807 | q.text(","); q.breakable() |
| 2808 | q.text("l2_table_priority = "); |
| 2809 | q.text("%#x" % self.l2_table_priority) |
| 2810 | q.breakable() |
| 2811 | q.text('}') |
| 2812 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2813 | bsn_header.subtypes[12] = bsn_set_l2_table_request |
| 2814 | |
| 2815 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2816 | version = 1 |
| 2817 | type = 4 |
| 2818 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2819 | subtype = 3 |
| 2820 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2821 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2822 | if xid != None: |
| 2823 | self.xid = xid |
| 2824 | else: |
| 2825 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2826 | if report_mirror_ports != None: |
| 2827 | self.report_mirror_ports = report_mirror_ports |
| 2828 | else: |
| 2829 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2830 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2831 | |
| 2832 | def pack(self): |
| 2833 | packed = [] |
| 2834 | packed.append(struct.pack("!B", self.version)) |
| 2835 | packed.append(struct.pack("!B", self.type)) |
| 2836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2837 | packed.append(struct.pack("!L", self.xid)) |
| 2838 | packed.append(struct.pack("!L", self.experimenter)) |
| 2839 | packed.append(struct.pack("!L", self.subtype)) |
| 2840 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2841 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2842 | length = sum([len(x) for x in packed]) |
| 2843 | packed[2] = struct.pack("!H", length) |
| 2844 | return ''.join(packed) |
| 2845 | |
| 2846 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2847 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2848 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2849 | _version = reader.read("!B")[0] |
| 2850 | assert(_version == 1) |
| 2851 | _type = reader.read("!B")[0] |
| 2852 | assert(_type == 4) |
| 2853 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2854 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2855 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2856 | obj.xid = reader.read("!L")[0] |
| 2857 | _experimenter = reader.read("!L")[0] |
| 2858 | assert(_experimenter == 6035143) |
| 2859 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2860 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2861 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2862 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2863 | return obj |
| 2864 | |
| 2865 | def __eq__(self, other): |
| 2866 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2867 | if self.xid != other.xid: return False |
| 2868 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2869 | return True |
| 2870 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2871 | def pretty_print(self, q): |
| 2872 | q.text("bsn_set_mirroring {") |
| 2873 | with q.group(): |
| 2874 | with q.indent(2): |
| 2875 | q.breakable() |
| 2876 | q.text("xid = "); |
| 2877 | if self.xid != None: |
| 2878 | q.text("%#x" % self.xid) |
| 2879 | else: |
| 2880 | q.text('None') |
| 2881 | q.text(","); q.breakable() |
| 2882 | q.text("report_mirror_ports = "); |
| 2883 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2884 | q.breakable() |
| 2885 | q.text('}') |
| 2886 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2887 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2888 | |
| 2889 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2890 | version = 1 |
| 2891 | type = 4 |
| 2892 | experimenter = 6035143 |
| 2893 | subtype = 25 |
| 2894 | |
| 2895 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2896 | if xid != None: |
| 2897 | self.xid = xid |
| 2898 | else: |
| 2899 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2900 | if status != None: |
| 2901 | self.status = status |
| 2902 | else: |
| 2903 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2904 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2905 | |
| 2906 | def pack(self): |
| 2907 | packed = [] |
| 2908 | packed.append(struct.pack("!B", self.version)) |
| 2909 | packed.append(struct.pack("!B", self.type)) |
| 2910 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2911 | packed.append(struct.pack("!L", self.xid)) |
| 2912 | packed.append(struct.pack("!L", self.experimenter)) |
| 2913 | packed.append(struct.pack("!L", self.subtype)) |
| 2914 | packed.append(struct.pack("!L", self.status)) |
| 2915 | length = sum([len(x) for x in packed]) |
| 2916 | packed[2] = struct.pack("!H", length) |
| 2917 | return ''.join(packed) |
| 2918 | |
| 2919 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2920 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2921 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2922 | _version = reader.read("!B")[0] |
| 2923 | assert(_version == 1) |
| 2924 | _type = reader.read("!B")[0] |
| 2925 | assert(_type == 4) |
| 2926 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2927 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 2928 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2929 | obj.xid = reader.read("!L")[0] |
| 2930 | _experimenter = reader.read("!L")[0] |
| 2931 | assert(_experimenter == 6035143) |
| 2932 | _subtype = reader.read("!L")[0] |
| 2933 | assert(_subtype == 25) |
| 2934 | obj.status = reader.read("!L")[0] |
| 2935 | return obj |
| 2936 | |
| 2937 | def __eq__(self, other): |
| 2938 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2939 | if self.xid != other.xid: return False |
| 2940 | if self.status != other.status: return False |
| 2941 | return True |
| 2942 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2943 | def pretty_print(self, q): |
| 2944 | q.text("bsn_set_pktin_suppression_reply {") |
| 2945 | with q.group(): |
| 2946 | with q.indent(2): |
| 2947 | q.breakable() |
| 2948 | q.text("xid = "); |
| 2949 | if self.xid != None: |
| 2950 | q.text("%#x" % self.xid) |
| 2951 | else: |
| 2952 | q.text('None') |
| 2953 | q.text(","); q.breakable() |
| 2954 | q.text("status = "); |
| 2955 | q.text("%#x" % self.status) |
| 2956 | q.breakable() |
| 2957 | q.text('}') |
| 2958 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2959 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2960 | |
| 2961 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2962 | version = 1 |
| 2963 | type = 4 |
| 2964 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2965 | subtype = 11 |
| 2966 | |
| 2967 | 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] | 2968 | if xid != None: |
| 2969 | self.xid = xid |
| 2970 | else: |
| 2971 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2972 | if enabled != None: |
| 2973 | self.enabled = enabled |
| 2974 | else: |
| 2975 | self.enabled = 0 |
| 2976 | if idle_timeout != None: |
| 2977 | self.idle_timeout = idle_timeout |
| 2978 | else: |
| 2979 | self.idle_timeout = 0 |
| 2980 | if hard_timeout != None: |
| 2981 | self.hard_timeout = hard_timeout |
| 2982 | else: |
| 2983 | self.hard_timeout = 0 |
| 2984 | if priority != None: |
| 2985 | self.priority = priority |
| 2986 | else: |
| 2987 | self.priority = 0 |
| 2988 | if cookie != None: |
| 2989 | self.cookie = cookie |
| 2990 | else: |
| 2991 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2992 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2993 | |
| 2994 | def pack(self): |
| 2995 | packed = [] |
| 2996 | packed.append(struct.pack("!B", self.version)) |
| 2997 | packed.append(struct.pack("!B", self.type)) |
| 2998 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2999 | packed.append(struct.pack("!L", self.xid)) |
| 3000 | packed.append(struct.pack("!L", self.experimenter)) |
| 3001 | packed.append(struct.pack("!L", self.subtype)) |
| 3002 | packed.append(struct.pack("!B", self.enabled)) |
| 3003 | packed.append('\x00' * 1) |
| 3004 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3005 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3006 | packed.append(struct.pack("!H", self.priority)) |
| 3007 | packed.append(struct.pack("!Q", self.cookie)) |
| 3008 | length = sum([len(x) for x in packed]) |
| 3009 | packed[2] = struct.pack("!H", length) |
| 3010 | return ''.join(packed) |
| 3011 | |
| 3012 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3013 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3014 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3015 | _version = reader.read("!B")[0] |
| 3016 | assert(_version == 1) |
| 3017 | _type = reader.read("!B")[0] |
| 3018 | assert(_type == 4) |
| 3019 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3020 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3021 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3022 | obj.xid = reader.read("!L")[0] |
| 3023 | _experimenter = reader.read("!L")[0] |
| 3024 | assert(_experimenter == 6035143) |
| 3025 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3026 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3027 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3028 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3029 | obj.idle_timeout = reader.read("!H")[0] |
| 3030 | obj.hard_timeout = reader.read("!H")[0] |
| 3031 | obj.priority = reader.read("!H")[0] |
| 3032 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3033 | return obj |
| 3034 | |
| 3035 | def __eq__(self, other): |
| 3036 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3037 | if self.xid != other.xid: return False |
| 3038 | if self.enabled != other.enabled: return False |
| 3039 | if self.idle_timeout != other.idle_timeout: return False |
| 3040 | if self.hard_timeout != other.hard_timeout: return False |
| 3041 | if self.priority != other.priority: return False |
| 3042 | if self.cookie != other.cookie: return False |
| 3043 | return True |
| 3044 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3045 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3046 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3047 | with q.group(): |
| 3048 | with q.indent(2): |
| 3049 | q.breakable() |
| 3050 | q.text("xid = "); |
| 3051 | if self.xid != None: |
| 3052 | q.text("%#x" % self.xid) |
| 3053 | else: |
| 3054 | q.text('None') |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3055 | q.text(","); q.breakable() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3056 | q.text("enabled = "); |
| 3057 | q.text("%#x" % self.enabled) |
| 3058 | q.text(","); q.breakable() |
| 3059 | q.text("idle_timeout = "); |
| 3060 | q.text("%#x" % self.idle_timeout) |
| 3061 | q.text(","); q.breakable() |
| 3062 | q.text("hard_timeout = "); |
| 3063 | q.text("%#x" % self.hard_timeout) |
| 3064 | q.text(","); q.breakable() |
| 3065 | q.text("priority = "); |
| 3066 | q.text("%#x" % self.priority) |
| 3067 | q.text(","); q.breakable() |
| 3068 | q.text("cookie = "); |
| 3069 | q.text("%#x" % self.cookie) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3070 | q.breakable() |
| 3071 | q.text('}') |
| 3072 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3073 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 3074 | |
| 3075 | class bsn_shell_command(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3076 | version = 1 |
| 3077 | type = 4 |
| 3078 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3079 | subtype = 6 |
| 3080 | |
| 3081 | def __init__(self, xid=None, service=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3082 | if xid != None: |
| 3083 | self.xid = xid |
| 3084 | else: |
| 3085 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3086 | if service != None: |
| 3087 | self.service = service |
| 3088 | else: |
| 3089 | self.service = 0 |
| 3090 | if data != None: |
| 3091 | self.data = data |
| 3092 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3093 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3094 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3095 | |
| 3096 | def pack(self): |
| 3097 | packed = [] |
| 3098 | packed.append(struct.pack("!B", self.version)) |
| 3099 | packed.append(struct.pack("!B", self.type)) |
| 3100 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3101 | packed.append(struct.pack("!L", self.xid)) |
| 3102 | packed.append(struct.pack("!L", self.experimenter)) |
| 3103 | packed.append(struct.pack("!L", self.subtype)) |
| 3104 | packed.append(struct.pack("!L", self.service)) |
| 3105 | packed.append(self.data) |
| 3106 | length = sum([len(x) for x in packed]) |
| 3107 | packed[2] = struct.pack("!H", length) |
| 3108 | return ''.join(packed) |
| 3109 | |
| 3110 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3111 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3112 | obj = bsn_shell_command() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3113 | _version = reader.read("!B")[0] |
| 3114 | assert(_version == 1) |
| 3115 | _type = reader.read("!B")[0] |
| 3116 | assert(_type == 4) |
| 3117 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3118 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3119 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3120 | obj.xid = reader.read("!L")[0] |
| 3121 | _experimenter = reader.read("!L")[0] |
| 3122 | assert(_experimenter == 6035143) |
| 3123 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3124 | assert(_subtype == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3125 | obj.service = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3126 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3127 | return obj |
| 3128 | |
| 3129 | def __eq__(self, other): |
| 3130 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3131 | if self.xid != other.xid: return False |
| 3132 | if self.service != other.service: return False |
| 3133 | if self.data != other.data: return False |
| 3134 | return True |
| 3135 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3136 | def pretty_print(self, q): |
| 3137 | q.text("bsn_shell_command {") |
| 3138 | with q.group(): |
| 3139 | with q.indent(2): |
| 3140 | q.breakable() |
| 3141 | q.text("xid = "); |
| 3142 | if self.xid != None: |
| 3143 | q.text("%#x" % self.xid) |
| 3144 | else: |
| 3145 | q.text('None') |
| 3146 | q.text(","); q.breakable() |
| 3147 | q.text("service = "); |
| 3148 | q.text("%#x" % self.service) |
| 3149 | q.text(","); q.breakable() |
| 3150 | q.text("data = "); |
| 3151 | q.pp(self.data) |
| 3152 | q.breakable() |
| 3153 | q.text('}') |
| 3154 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3155 | bsn_header.subtypes[6] = bsn_shell_command |
| 3156 | |
| 3157 | class bsn_shell_output(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3158 | version = 1 |
| 3159 | type = 4 |
| 3160 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3161 | subtype = 7 |
| 3162 | |
| 3163 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3164 | if xid != None: |
| 3165 | self.xid = xid |
| 3166 | else: |
| 3167 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3168 | if data != None: |
| 3169 | self.data = data |
| 3170 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3171 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3172 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3173 | |
| 3174 | def pack(self): |
| 3175 | packed = [] |
| 3176 | packed.append(struct.pack("!B", self.version)) |
| 3177 | packed.append(struct.pack("!B", self.type)) |
| 3178 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3179 | packed.append(struct.pack("!L", self.xid)) |
| 3180 | packed.append(struct.pack("!L", self.experimenter)) |
| 3181 | packed.append(struct.pack("!L", self.subtype)) |
| 3182 | packed.append(self.data) |
| 3183 | length = sum([len(x) for x in packed]) |
| 3184 | packed[2] = struct.pack("!H", length) |
| 3185 | return ''.join(packed) |
| 3186 | |
| 3187 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3188 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3189 | obj = bsn_shell_output() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3190 | _version = reader.read("!B")[0] |
| 3191 | assert(_version == 1) |
| 3192 | _type = reader.read("!B")[0] |
| 3193 | assert(_type == 4) |
| 3194 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3195 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3196 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3197 | obj.xid = reader.read("!L")[0] |
| 3198 | _experimenter = reader.read("!L")[0] |
| 3199 | assert(_experimenter == 6035143) |
| 3200 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3201 | assert(_subtype == 7) |
| 3202 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3203 | return obj |
| 3204 | |
| 3205 | def __eq__(self, other): |
| 3206 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3207 | if self.xid != other.xid: return False |
| 3208 | if self.data != other.data: return False |
| 3209 | return True |
| 3210 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3211 | def pretty_print(self, q): |
| 3212 | q.text("bsn_shell_output {") |
| 3213 | with q.group(): |
| 3214 | with q.indent(2): |
| 3215 | q.breakable() |
| 3216 | q.text("xid = "); |
| 3217 | if self.xid != None: |
| 3218 | q.text("%#x" % self.xid) |
| 3219 | else: |
| 3220 | q.text('None') |
| 3221 | q.text(","); q.breakable() |
| 3222 | q.text("data = "); |
| 3223 | q.pp(self.data) |
| 3224 | q.breakable() |
| 3225 | q.text('}') |
| 3226 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3227 | bsn_header.subtypes[7] = bsn_shell_output |
| 3228 | |
| 3229 | class bsn_shell_status(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3230 | version = 1 |
| 3231 | type = 4 |
| 3232 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3233 | subtype = 8 |
| 3234 | |
| 3235 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3236 | if xid != None: |
| 3237 | self.xid = xid |
| 3238 | else: |
| 3239 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3240 | if status != None: |
| 3241 | self.status = status |
| 3242 | else: |
| 3243 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3244 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3245 | |
| 3246 | def pack(self): |
| 3247 | packed = [] |
| 3248 | packed.append(struct.pack("!B", self.version)) |
| 3249 | packed.append(struct.pack("!B", self.type)) |
| 3250 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3251 | packed.append(struct.pack("!L", self.xid)) |
| 3252 | packed.append(struct.pack("!L", self.experimenter)) |
| 3253 | packed.append(struct.pack("!L", self.subtype)) |
| 3254 | packed.append(struct.pack("!L", self.status)) |
| 3255 | length = sum([len(x) for x in packed]) |
| 3256 | packed[2] = struct.pack("!H", length) |
| 3257 | return ''.join(packed) |
| 3258 | |
| 3259 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3260 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3261 | obj = bsn_shell_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3262 | _version = reader.read("!B")[0] |
| 3263 | assert(_version == 1) |
| 3264 | _type = reader.read("!B")[0] |
| 3265 | assert(_type == 4) |
| 3266 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3267 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3268 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3269 | obj.xid = reader.read("!L")[0] |
| 3270 | _experimenter = reader.read("!L")[0] |
| 3271 | assert(_experimenter == 6035143) |
| 3272 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3273 | assert(_subtype == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3274 | obj.status = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3275 | return obj |
| 3276 | |
| 3277 | def __eq__(self, other): |
| 3278 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3279 | if self.xid != other.xid: return False |
| 3280 | if self.status != other.status: return False |
| 3281 | return True |
| 3282 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3283 | def pretty_print(self, q): |
| 3284 | q.text("bsn_shell_status {") |
| 3285 | with q.group(): |
| 3286 | with q.indent(2): |
| 3287 | q.breakable() |
| 3288 | q.text("xid = "); |
| 3289 | if self.xid != None: |
| 3290 | q.text("%#x" % self.xid) |
| 3291 | else: |
| 3292 | q.text('None') |
| 3293 | q.text(","); q.breakable() |
| 3294 | q.text("status = "); |
| 3295 | q.text("%#x" % self.status) |
| 3296 | q.breakable() |
| 3297 | q.text('}') |
| 3298 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3299 | bsn_header.subtypes[8] = bsn_shell_status |
| 3300 | |
| 3301 | class experimenter_stats_reply(stats_reply): |
| 3302 | subtypes = {} |
| 3303 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3304 | version = 1 |
| 3305 | type = 17 |
| 3306 | stats_type = 65535 |
| 3307 | |
| 3308 | def __init__(self, xid=None, flags=None, experimenter=None, data=None): |
| 3309 | if xid != None: |
| 3310 | self.xid = xid |
| 3311 | else: |
| 3312 | self.xid = None |
| 3313 | if flags != None: |
| 3314 | self.flags = flags |
| 3315 | else: |
| 3316 | self.flags = 0 |
| 3317 | if experimenter != None: |
| 3318 | self.experimenter = experimenter |
| 3319 | else: |
| 3320 | self.experimenter = 0 |
| 3321 | if data != None: |
| 3322 | self.data = data |
| 3323 | else: |
| 3324 | self.data = '' |
| 3325 | return |
| 3326 | |
| 3327 | def pack(self): |
| 3328 | packed = [] |
| 3329 | packed.append(struct.pack("!B", self.version)) |
| 3330 | packed.append(struct.pack("!B", self.type)) |
| 3331 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3332 | packed.append(struct.pack("!L", self.xid)) |
| 3333 | packed.append(struct.pack("!H", self.stats_type)) |
| 3334 | packed.append(struct.pack("!H", self.flags)) |
| 3335 | packed.append(struct.pack("!L", self.experimenter)) |
| 3336 | packed.append(self.data) |
| 3337 | length = sum([len(x) for x in packed]) |
| 3338 | packed[2] = struct.pack("!H", length) |
| 3339 | return ''.join(packed) |
| 3340 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3341 | @staticmethod |
| 3342 | def unpack(reader): |
| 3343 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3344 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 3345 | if subclass: |
| 3346 | return subclass.unpack(reader) |
| 3347 | |
| 3348 | obj = experimenter_stats_reply() |
| 3349 | _version = reader.read("!B")[0] |
| 3350 | assert(_version == 1) |
| 3351 | _type = reader.read("!B")[0] |
| 3352 | assert(_type == 17) |
| 3353 | _length = reader.read("!H")[0] |
| 3354 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3355 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3356 | obj.xid = reader.read("!L")[0] |
| 3357 | _stats_type = reader.read("!H")[0] |
| 3358 | assert(_stats_type == 65535) |
| 3359 | obj.flags = reader.read("!H")[0] |
| 3360 | obj.experimenter = reader.read("!L")[0] |
| 3361 | obj.data = str(reader.read_all()) |
| 3362 | return obj |
| 3363 | |
| 3364 | def __eq__(self, other): |
| 3365 | if type(self) != type(other): return False |
| 3366 | if self.xid != other.xid: return False |
| 3367 | if self.flags != other.flags: return False |
| 3368 | if self.experimenter != other.experimenter: return False |
| 3369 | if self.data != other.data: return False |
| 3370 | return True |
| 3371 | |
| 3372 | def pretty_print(self, q): |
| 3373 | q.text("experimenter_stats_reply {") |
| 3374 | with q.group(): |
| 3375 | with q.indent(2): |
| 3376 | q.breakable() |
| 3377 | q.text("xid = "); |
| 3378 | if self.xid != None: |
| 3379 | q.text("%#x" % self.xid) |
| 3380 | else: |
| 3381 | q.text('None') |
| 3382 | q.text(","); q.breakable() |
| 3383 | q.text("flags = "); |
| 3384 | q.text("%#x" % self.flags) |
| 3385 | q.text(","); q.breakable() |
| 3386 | q.text("data = "); |
| 3387 | q.pp(self.data) |
| 3388 | q.breakable() |
| 3389 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3390 | |
| 3391 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 3392 | |
| 3393 | class bsn_stats_reply(experimenter_stats_reply): |
| 3394 | subtypes = {} |
| 3395 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3396 | version = 1 |
| 3397 | type = 19 |
| 3398 | stats_type = 65535 |
| 3399 | experimenter = 6035143 |
| 3400 | |
| 3401 | def __init__(self, xid=None, flags=None, subtype=None): |
| 3402 | if xid != None: |
| 3403 | self.xid = xid |
| 3404 | else: |
| 3405 | self.xid = None |
| 3406 | if flags != None: |
| 3407 | self.flags = flags |
| 3408 | else: |
| 3409 | self.flags = 0 |
| 3410 | if subtype != None: |
| 3411 | self.subtype = subtype |
| 3412 | else: |
| 3413 | self.subtype = 0 |
| 3414 | return |
| 3415 | |
| 3416 | def pack(self): |
| 3417 | packed = [] |
| 3418 | packed.append(struct.pack("!B", self.version)) |
| 3419 | packed.append(struct.pack("!B", self.type)) |
| 3420 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3421 | packed.append(struct.pack("!L", self.xid)) |
| 3422 | packed.append(struct.pack("!H", self.stats_type)) |
| 3423 | packed.append(struct.pack("!H", self.flags)) |
| 3424 | packed.append('\x00' * 4) |
| 3425 | packed.append(struct.pack("!L", self.experimenter)) |
| 3426 | packed.append(struct.pack("!L", self.subtype)) |
| 3427 | length = sum([len(x) for x in packed]) |
| 3428 | packed[2] = struct.pack("!H", length) |
| 3429 | return ''.join(packed) |
| 3430 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3431 | @staticmethod |
| 3432 | def unpack(reader): |
| 3433 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3434 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 3435 | if subclass: |
| 3436 | return subclass.unpack(reader) |
| 3437 | |
| 3438 | obj = bsn_stats_reply() |
| 3439 | _version = reader.read("!B")[0] |
| 3440 | assert(_version == 1) |
| 3441 | _type = reader.read("!B")[0] |
| 3442 | assert(_type == 19) |
| 3443 | _length = reader.read("!H")[0] |
| 3444 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3445 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3446 | obj.xid = reader.read("!L")[0] |
| 3447 | _stats_type = reader.read("!H")[0] |
| 3448 | assert(_stats_type == 65535) |
| 3449 | obj.flags = reader.read("!H")[0] |
| 3450 | reader.skip(4) |
| 3451 | _experimenter = reader.read("!L")[0] |
| 3452 | assert(_experimenter == 6035143) |
| 3453 | obj.subtype = reader.read("!L")[0] |
| 3454 | return obj |
| 3455 | |
| 3456 | def __eq__(self, other): |
| 3457 | if type(self) != type(other): return False |
| 3458 | if self.xid != other.xid: return False |
| 3459 | if self.flags != other.flags: return False |
| 3460 | if self.subtype != other.subtype: return False |
| 3461 | return True |
| 3462 | |
| 3463 | def pretty_print(self, q): |
| 3464 | q.text("bsn_stats_reply {") |
| 3465 | with q.group(): |
| 3466 | with q.indent(2): |
| 3467 | q.breakable() |
| 3468 | q.text("xid = "); |
| 3469 | if self.xid != None: |
| 3470 | q.text("%#x" % self.xid) |
| 3471 | else: |
| 3472 | q.text('None') |
| 3473 | q.text(","); q.breakable() |
| 3474 | q.text("flags = "); |
| 3475 | q.text("%#x" % self.flags) |
| 3476 | q.breakable() |
| 3477 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3478 | |
| 3479 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 3480 | |
| 3481 | class experimenter_stats_request(stats_request): |
| 3482 | subtypes = {} |
| 3483 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3484 | version = 1 |
| 3485 | type = 16 |
| 3486 | stats_type = 65535 |
| 3487 | |
| 3488 | def __init__(self, xid=None, flags=None, experimenter=None, data=None): |
| 3489 | if xid != None: |
| 3490 | self.xid = xid |
| 3491 | else: |
| 3492 | self.xid = None |
| 3493 | if flags != None: |
| 3494 | self.flags = flags |
| 3495 | else: |
| 3496 | self.flags = 0 |
| 3497 | if experimenter != None: |
| 3498 | self.experimenter = experimenter |
| 3499 | else: |
| 3500 | self.experimenter = 0 |
| 3501 | if data != None: |
| 3502 | self.data = data |
| 3503 | else: |
| 3504 | self.data = '' |
| 3505 | return |
| 3506 | |
| 3507 | def pack(self): |
| 3508 | packed = [] |
| 3509 | packed.append(struct.pack("!B", self.version)) |
| 3510 | packed.append(struct.pack("!B", self.type)) |
| 3511 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3512 | packed.append(struct.pack("!L", self.xid)) |
| 3513 | packed.append(struct.pack("!H", self.stats_type)) |
| 3514 | packed.append(struct.pack("!H", self.flags)) |
| 3515 | packed.append(struct.pack("!L", self.experimenter)) |
| 3516 | packed.append(self.data) |
| 3517 | length = sum([len(x) for x in packed]) |
| 3518 | packed[2] = struct.pack("!H", length) |
| 3519 | return ''.join(packed) |
| 3520 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3521 | @staticmethod |
| 3522 | def unpack(reader): |
| 3523 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3524 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 3525 | if subclass: |
| 3526 | return subclass.unpack(reader) |
| 3527 | |
| 3528 | obj = experimenter_stats_request() |
| 3529 | _version = reader.read("!B")[0] |
| 3530 | assert(_version == 1) |
| 3531 | _type = reader.read("!B")[0] |
| 3532 | assert(_type == 16) |
| 3533 | _length = reader.read("!H")[0] |
| 3534 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3535 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3536 | obj.xid = reader.read("!L")[0] |
| 3537 | _stats_type = reader.read("!H")[0] |
| 3538 | assert(_stats_type == 65535) |
| 3539 | obj.flags = reader.read("!H")[0] |
| 3540 | obj.experimenter = reader.read("!L")[0] |
| 3541 | obj.data = str(reader.read_all()) |
| 3542 | return obj |
| 3543 | |
| 3544 | def __eq__(self, other): |
| 3545 | if type(self) != type(other): return False |
| 3546 | if self.xid != other.xid: return False |
| 3547 | if self.flags != other.flags: return False |
| 3548 | if self.experimenter != other.experimenter: return False |
| 3549 | if self.data != other.data: return False |
| 3550 | return True |
| 3551 | |
| 3552 | def pretty_print(self, q): |
| 3553 | q.text("experimenter_stats_request {") |
| 3554 | with q.group(): |
| 3555 | with q.indent(2): |
| 3556 | q.breakable() |
| 3557 | q.text("xid = "); |
| 3558 | if self.xid != None: |
| 3559 | q.text("%#x" % self.xid) |
| 3560 | else: |
| 3561 | q.text('None') |
| 3562 | q.text(","); q.breakable() |
| 3563 | q.text("flags = "); |
| 3564 | q.text("%#x" % self.flags) |
| 3565 | q.text(","); q.breakable() |
| 3566 | q.text("data = "); |
| 3567 | q.pp(self.data) |
| 3568 | q.breakable() |
| 3569 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3570 | |
| 3571 | stats_request.subtypes[65535] = experimenter_stats_request |
| 3572 | |
| 3573 | class bsn_stats_request(experimenter_stats_request): |
| 3574 | subtypes = {} |
| 3575 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3576 | version = 1 |
| 3577 | type = 18 |
| 3578 | stats_type = 65535 |
| 3579 | experimenter = 6035143 |
| 3580 | |
| 3581 | def __init__(self, xid=None, flags=None, subtype=None): |
| 3582 | if xid != None: |
| 3583 | self.xid = xid |
| 3584 | else: |
| 3585 | self.xid = None |
| 3586 | if flags != None: |
| 3587 | self.flags = flags |
| 3588 | else: |
| 3589 | self.flags = 0 |
| 3590 | if subtype != None: |
| 3591 | self.subtype = subtype |
| 3592 | else: |
| 3593 | self.subtype = 0 |
| 3594 | return |
| 3595 | |
| 3596 | def pack(self): |
| 3597 | packed = [] |
| 3598 | packed.append(struct.pack("!B", self.version)) |
| 3599 | packed.append(struct.pack("!B", self.type)) |
| 3600 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3601 | packed.append(struct.pack("!L", self.xid)) |
| 3602 | packed.append(struct.pack("!H", self.stats_type)) |
| 3603 | packed.append(struct.pack("!H", self.flags)) |
| 3604 | packed.append('\x00' * 4) |
| 3605 | packed.append(struct.pack("!L", self.experimenter)) |
| 3606 | packed.append(struct.pack("!L", self.subtype)) |
| 3607 | length = sum([len(x) for x in packed]) |
| 3608 | packed[2] = struct.pack("!H", length) |
| 3609 | return ''.join(packed) |
| 3610 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3611 | @staticmethod |
| 3612 | def unpack(reader): |
| 3613 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3614 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 3615 | if subclass: |
| 3616 | return subclass.unpack(reader) |
| 3617 | |
| 3618 | obj = bsn_stats_request() |
| 3619 | _version = reader.read("!B")[0] |
| 3620 | assert(_version == 1) |
| 3621 | _type = reader.read("!B")[0] |
| 3622 | assert(_type == 18) |
| 3623 | _length = reader.read("!H")[0] |
| 3624 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3625 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3626 | obj.xid = reader.read("!L")[0] |
| 3627 | _stats_type = reader.read("!H")[0] |
| 3628 | assert(_stats_type == 65535) |
| 3629 | obj.flags = reader.read("!H")[0] |
| 3630 | reader.skip(4) |
| 3631 | _experimenter = reader.read("!L")[0] |
| 3632 | assert(_experimenter == 6035143) |
| 3633 | obj.subtype = reader.read("!L")[0] |
| 3634 | return obj |
| 3635 | |
| 3636 | def __eq__(self, other): |
| 3637 | if type(self) != type(other): return False |
| 3638 | if self.xid != other.xid: return False |
| 3639 | if self.flags != other.flags: return False |
| 3640 | if self.subtype != other.subtype: return False |
| 3641 | return True |
| 3642 | |
| 3643 | def pretty_print(self, q): |
| 3644 | q.text("bsn_stats_request {") |
| 3645 | with q.group(): |
| 3646 | with q.indent(2): |
| 3647 | q.breakable() |
| 3648 | q.text("xid = "); |
| 3649 | if self.xid != None: |
| 3650 | q.text("%#x" % self.xid) |
| 3651 | else: |
| 3652 | q.text('None') |
| 3653 | q.text(","); q.breakable() |
| 3654 | q.text("flags = "); |
| 3655 | q.text("%#x" % self.flags) |
| 3656 | q.breakable() |
| 3657 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3658 | |
| 3659 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 3660 | |
| 3661 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3662 | version = 1 |
| 3663 | type = 4 |
| 3664 | experimenter = 6035143 |
| 3665 | subtype = 16 |
| 3666 | |
| 3667 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3668 | if xid != None: |
| 3669 | self.xid = xid |
| 3670 | else: |
| 3671 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3672 | if status != None: |
| 3673 | self.status = status |
| 3674 | else: |
| 3675 | self.status = 0 |
| 3676 | if vport_no != None: |
| 3677 | self.vport_no = vport_no |
| 3678 | else: |
| 3679 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3680 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3681 | |
| 3682 | def pack(self): |
| 3683 | packed = [] |
| 3684 | packed.append(struct.pack("!B", self.version)) |
| 3685 | packed.append(struct.pack("!B", self.type)) |
| 3686 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3687 | packed.append(struct.pack("!L", self.xid)) |
| 3688 | packed.append(struct.pack("!L", self.experimenter)) |
| 3689 | packed.append(struct.pack("!L", self.subtype)) |
| 3690 | packed.append(struct.pack("!L", self.status)) |
| 3691 | packed.append(struct.pack("!L", self.vport_no)) |
| 3692 | length = sum([len(x) for x in packed]) |
| 3693 | packed[2] = struct.pack("!H", length) |
| 3694 | return ''.join(packed) |
| 3695 | |
| 3696 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3697 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3698 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3699 | _version = reader.read("!B")[0] |
| 3700 | assert(_version == 1) |
| 3701 | _type = reader.read("!B")[0] |
| 3702 | assert(_type == 4) |
| 3703 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3704 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3705 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3706 | obj.xid = reader.read("!L")[0] |
| 3707 | _experimenter = reader.read("!L")[0] |
| 3708 | assert(_experimenter == 6035143) |
| 3709 | _subtype = reader.read("!L")[0] |
| 3710 | assert(_subtype == 16) |
| 3711 | obj.status = reader.read("!L")[0] |
| 3712 | obj.vport_no = reader.read("!L")[0] |
| 3713 | return obj |
| 3714 | |
| 3715 | def __eq__(self, other): |
| 3716 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3717 | if self.xid != other.xid: return False |
| 3718 | if self.status != other.status: return False |
| 3719 | if self.vport_no != other.vport_no: return False |
| 3720 | return True |
| 3721 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3722 | def pretty_print(self, q): |
| 3723 | q.text("bsn_virtual_port_create_reply {") |
| 3724 | with q.group(): |
| 3725 | with q.indent(2): |
| 3726 | q.breakable() |
| 3727 | q.text("xid = "); |
| 3728 | if self.xid != None: |
| 3729 | q.text("%#x" % self.xid) |
| 3730 | else: |
| 3731 | q.text('None') |
| 3732 | q.text(","); q.breakable() |
| 3733 | q.text("status = "); |
| 3734 | q.text("%#x" % self.status) |
| 3735 | q.text(","); q.breakable() |
| 3736 | q.text("vport_no = "); |
| 3737 | q.text("%#x" % self.vport_no) |
| 3738 | q.breakable() |
| 3739 | q.text('}') |
| 3740 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3741 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3742 | |
| 3743 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3744 | version = 1 |
| 3745 | type = 4 |
| 3746 | experimenter = 6035143 |
| 3747 | subtype = 15 |
| 3748 | |
| 3749 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3750 | if xid != None: |
| 3751 | self.xid = xid |
| 3752 | else: |
| 3753 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3754 | if vport != None: |
| 3755 | self.vport = vport |
| 3756 | else: |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3757 | self.vport = common.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3758 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3759 | |
| 3760 | def pack(self): |
| 3761 | packed = [] |
| 3762 | packed.append(struct.pack("!B", self.version)) |
| 3763 | packed.append(struct.pack("!B", self.type)) |
| 3764 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3765 | packed.append(struct.pack("!L", self.xid)) |
| 3766 | packed.append(struct.pack("!L", self.experimenter)) |
| 3767 | packed.append(struct.pack("!L", self.subtype)) |
| 3768 | packed.append(self.vport.pack()) |
| 3769 | length = sum([len(x) for x in packed]) |
| 3770 | packed[2] = struct.pack("!H", length) |
| 3771 | return ''.join(packed) |
| 3772 | |
| 3773 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3774 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3775 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3776 | _version = reader.read("!B")[0] |
| 3777 | assert(_version == 1) |
| 3778 | _type = reader.read("!B")[0] |
| 3779 | assert(_type == 4) |
| 3780 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3781 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3782 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3783 | obj.xid = reader.read("!L")[0] |
| 3784 | _experimenter = reader.read("!L")[0] |
| 3785 | assert(_experimenter == 6035143) |
| 3786 | _subtype = reader.read("!L")[0] |
| 3787 | assert(_subtype == 15) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 3788 | obj.vport = common.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3789 | return obj |
| 3790 | |
| 3791 | def __eq__(self, other): |
| 3792 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3793 | if self.xid != other.xid: return False |
| 3794 | if self.vport != other.vport: return False |
| 3795 | return True |
| 3796 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3797 | def pretty_print(self, q): |
| 3798 | q.text("bsn_virtual_port_create_request {") |
| 3799 | with q.group(): |
| 3800 | with q.indent(2): |
| 3801 | q.breakable() |
| 3802 | q.text("xid = "); |
| 3803 | if self.xid != None: |
| 3804 | q.text("%#x" % self.xid) |
| 3805 | else: |
| 3806 | q.text('None') |
| 3807 | q.text(","); q.breakable() |
| 3808 | q.text("vport = "); |
| 3809 | q.pp(self.vport) |
| 3810 | q.breakable() |
| 3811 | q.text('}') |
| 3812 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3813 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3814 | |
| 3815 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3816 | version = 1 |
| 3817 | type = 4 |
| 3818 | experimenter = 6035143 |
| 3819 | subtype = 26 |
| 3820 | |
| 3821 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3822 | if xid != None: |
| 3823 | self.xid = xid |
| 3824 | else: |
| 3825 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3826 | if status != None: |
| 3827 | self.status = status |
| 3828 | else: |
| 3829 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3830 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3831 | |
| 3832 | def pack(self): |
| 3833 | packed = [] |
| 3834 | packed.append(struct.pack("!B", self.version)) |
| 3835 | packed.append(struct.pack("!B", self.type)) |
| 3836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3837 | packed.append(struct.pack("!L", self.xid)) |
| 3838 | packed.append(struct.pack("!L", self.experimenter)) |
| 3839 | packed.append(struct.pack("!L", self.subtype)) |
| 3840 | packed.append(struct.pack("!L", self.status)) |
| 3841 | length = sum([len(x) for x in packed]) |
| 3842 | packed[2] = struct.pack("!H", length) |
| 3843 | return ''.join(packed) |
| 3844 | |
| 3845 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3846 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3847 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3848 | _version = reader.read("!B")[0] |
| 3849 | assert(_version == 1) |
| 3850 | _type = reader.read("!B")[0] |
| 3851 | assert(_type == 4) |
| 3852 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3853 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3854 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3855 | obj.xid = reader.read("!L")[0] |
| 3856 | _experimenter = reader.read("!L")[0] |
| 3857 | assert(_experimenter == 6035143) |
| 3858 | _subtype = reader.read("!L")[0] |
| 3859 | assert(_subtype == 26) |
| 3860 | obj.status = reader.read("!L")[0] |
| 3861 | return obj |
| 3862 | |
| 3863 | def __eq__(self, other): |
| 3864 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3865 | if self.xid != other.xid: return False |
| 3866 | if self.status != other.status: return False |
| 3867 | return True |
| 3868 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3869 | def pretty_print(self, q): |
| 3870 | q.text("bsn_virtual_port_remove_reply {") |
| 3871 | with q.group(): |
| 3872 | with q.indent(2): |
| 3873 | q.breakable() |
| 3874 | q.text("xid = "); |
| 3875 | if self.xid != None: |
| 3876 | q.text("%#x" % self.xid) |
| 3877 | else: |
| 3878 | q.text('None') |
| 3879 | q.text(","); q.breakable() |
| 3880 | q.text("status = "); |
| 3881 | q.text("%#x" % self.status) |
| 3882 | q.breakable() |
| 3883 | q.text('}') |
| 3884 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3885 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3886 | |
| 3887 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3888 | version = 1 |
| 3889 | type = 4 |
| 3890 | experimenter = 6035143 |
| 3891 | subtype = 17 |
| 3892 | |
| 3893 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3894 | if xid != None: |
| 3895 | self.xid = xid |
| 3896 | else: |
| 3897 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3898 | if vport_no != None: |
| 3899 | self.vport_no = vport_no |
| 3900 | else: |
| 3901 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3902 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3903 | |
| 3904 | def pack(self): |
| 3905 | packed = [] |
| 3906 | packed.append(struct.pack("!B", self.version)) |
| 3907 | packed.append(struct.pack("!B", self.type)) |
| 3908 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3909 | packed.append(struct.pack("!L", self.xid)) |
| 3910 | packed.append(struct.pack("!L", self.experimenter)) |
| 3911 | packed.append(struct.pack("!L", self.subtype)) |
| 3912 | packed.append(struct.pack("!L", self.vport_no)) |
| 3913 | length = sum([len(x) for x in packed]) |
| 3914 | packed[2] = struct.pack("!H", length) |
| 3915 | return ''.join(packed) |
| 3916 | |
| 3917 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3918 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3919 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3920 | _version = reader.read("!B")[0] |
| 3921 | assert(_version == 1) |
| 3922 | _type = reader.read("!B")[0] |
| 3923 | assert(_type == 4) |
| 3924 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3925 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 3926 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3927 | obj.xid = reader.read("!L")[0] |
| 3928 | _experimenter = reader.read("!L")[0] |
| 3929 | assert(_experimenter == 6035143) |
| 3930 | _subtype = reader.read("!L")[0] |
| 3931 | assert(_subtype == 17) |
| 3932 | obj.vport_no = reader.read("!L")[0] |
| 3933 | return obj |
| 3934 | |
| 3935 | def __eq__(self, other): |
| 3936 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3937 | if self.xid != other.xid: return False |
| 3938 | if self.vport_no != other.vport_no: return False |
| 3939 | return True |
| 3940 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3941 | def pretty_print(self, q): |
| 3942 | q.text("bsn_virtual_port_remove_request {") |
| 3943 | with q.group(): |
| 3944 | with q.indent(2): |
| 3945 | q.breakable() |
| 3946 | q.text("xid = "); |
| 3947 | if self.xid != None: |
| 3948 | q.text("%#x" % self.xid) |
| 3949 | else: |
| 3950 | q.text('None') |
| 3951 | q.text(","); q.breakable() |
| 3952 | q.text("vport_no = "); |
| 3953 | q.text("%#x" % self.vport_no) |
| 3954 | q.breakable() |
| 3955 | q.text('}') |
| 3956 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3957 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3958 | |
| 3959 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3960 | version = 1 |
| 3961 | type = 17 |
| 3962 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3963 | |
| 3964 | 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] | 3965 | if xid != None: |
| 3966 | self.xid = xid |
| 3967 | else: |
| 3968 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3969 | if flags != None: |
| 3970 | self.flags = flags |
| 3971 | else: |
| 3972 | self.flags = 0 |
| 3973 | if mfr_desc != None: |
| 3974 | self.mfr_desc = mfr_desc |
| 3975 | else: |
| 3976 | self.mfr_desc = "" |
| 3977 | if hw_desc != None: |
| 3978 | self.hw_desc = hw_desc |
| 3979 | else: |
| 3980 | self.hw_desc = "" |
| 3981 | if sw_desc != None: |
| 3982 | self.sw_desc = sw_desc |
| 3983 | else: |
| 3984 | self.sw_desc = "" |
| 3985 | if serial_num != None: |
| 3986 | self.serial_num = serial_num |
| 3987 | else: |
| 3988 | self.serial_num = "" |
| 3989 | if dp_desc != None: |
| 3990 | self.dp_desc = dp_desc |
| 3991 | else: |
| 3992 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3993 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3994 | |
| 3995 | def pack(self): |
| 3996 | packed = [] |
| 3997 | packed.append(struct.pack("!B", self.version)) |
| 3998 | packed.append(struct.pack("!B", self.type)) |
| 3999 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4000 | packed.append(struct.pack("!L", self.xid)) |
| 4001 | packed.append(struct.pack("!H", self.stats_type)) |
| 4002 | packed.append(struct.pack("!H", self.flags)) |
| 4003 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 4004 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 4005 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 4006 | packed.append(struct.pack("!32s", self.serial_num)) |
| 4007 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 4008 | length = sum([len(x) for x in packed]) |
| 4009 | packed[2] = struct.pack("!H", length) |
| 4010 | return ''.join(packed) |
| 4011 | |
| 4012 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4013 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4014 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4015 | _version = reader.read("!B")[0] |
| 4016 | assert(_version == 1) |
| 4017 | _type = reader.read("!B")[0] |
| 4018 | assert(_type == 17) |
| 4019 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4020 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4021 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4022 | obj.xid = reader.read("!L")[0] |
| 4023 | _stats_type = reader.read("!H")[0] |
| 4024 | assert(_stats_type == 0) |
| 4025 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4026 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4027 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4028 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4029 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 4030 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4031 | return obj |
| 4032 | |
| 4033 | def __eq__(self, other): |
| 4034 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4035 | if self.xid != other.xid: return False |
| 4036 | if self.flags != other.flags: return False |
| 4037 | if self.mfr_desc != other.mfr_desc: return False |
| 4038 | if self.hw_desc != other.hw_desc: return False |
| 4039 | if self.sw_desc != other.sw_desc: return False |
| 4040 | if self.serial_num != other.serial_num: return False |
| 4041 | if self.dp_desc != other.dp_desc: return False |
| 4042 | return True |
| 4043 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4044 | def pretty_print(self, q): |
| 4045 | q.text("desc_stats_reply {") |
| 4046 | with q.group(): |
| 4047 | with q.indent(2): |
| 4048 | q.breakable() |
| 4049 | q.text("xid = "); |
| 4050 | if self.xid != None: |
| 4051 | q.text("%#x" % self.xid) |
| 4052 | else: |
| 4053 | q.text('None') |
| 4054 | q.text(","); q.breakable() |
| 4055 | q.text("flags = "); |
| 4056 | q.text("%#x" % self.flags) |
| 4057 | q.text(","); q.breakable() |
| 4058 | q.text("mfr_desc = "); |
| 4059 | q.pp(self.mfr_desc) |
| 4060 | q.text(","); q.breakable() |
| 4061 | q.text("hw_desc = "); |
| 4062 | q.pp(self.hw_desc) |
| 4063 | q.text(","); q.breakable() |
| 4064 | q.text("sw_desc = "); |
| 4065 | q.pp(self.sw_desc) |
| 4066 | q.text(","); q.breakable() |
| 4067 | q.text("serial_num = "); |
| 4068 | q.pp(self.serial_num) |
| 4069 | q.text(","); q.breakable() |
| 4070 | q.text("dp_desc = "); |
| 4071 | q.pp(self.dp_desc) |
| 4072 | q.breakable() |
| 4073 | q.text('}') |
| 4074 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4075 | stats_reply.subtypes[0] = desc_stats_reply |
| 4076 | |
| 4077 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4078 | version = 1 |
| 4079 | type = 16 |
| 4080 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4081 | |
| 4082 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4083 | if xid != None: |
| 4084 | self.xid = xid |
| 4085 | else: |
| 4086 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4087 | if flags != None: |
| 4088 | self.flags = flags |
| 4089 | else: |
| 4090 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4091 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4092 | |
| 4093 | def pack(self): |
| 4094 | packed = [] |
| 4095 | packed.append(struct.pack("!B", self.version)) |
| 4096 | packed.append(struct.pack("!B", self.type)) |
| 4097 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4098 | packed.append(struct.pack("!L", self.xid)) |
| 4099 | packed.append(struct.pack("!H", self.stats_type)) |
| 4100 | packed.append(struct.pack("!H", self.flags)) |
| 4101 | length = sum([len(x) for x in packed]) |
| 4102 | packed[2] = struct.pack("!H", length) |
| 4103 | return ''.join(packed) |
| 4104 | |
| 4105 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4106 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4107 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4108 | _version = reader.read("!B")[0] |
| 4109 | assert(_version == 1) |
| 4110 | _type = reader.read("!B")[0] |
| 4111 | assert(_type == 16) |
| 4112 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4113 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4114 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4115 | obj.xid = reader.read("!L")[0] |
| 4116 | _stats_type = reader.read("!H")[0] |
| 4117 | assert(_stats_type == 0) |
| 4118 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4119 | return obj |
| 4120 | |
| 4121 | def __eq__(self, other): |
| 4122 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4123 | if self.xid != other.xid: return False |
| 4124 | if self.flags != other.flags: return False |
| 4125 | return True |
| 4126 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4127 | def pretty_print(self, q): |
| 4128 | q.text("desc_stats_request {") |
| 4129 | with q.group(): |
| 4130 | with q.indent(2): |
| 4131 | q.breakable() |
| 4132 | q.text("xid = "); |
| 4133 | if self.xid != None: |
| 4134 | q.text("%#x" % self.xid) |
| 4135 | else: |
| 4136 | q.text('None') |
| 4137 | q.text(","); q.breakable() |
| 4138 | q.text("flags = "); |
| 4139 | q.text("%#x" % self.flags) |
| 4140 | q.breakable() |
| 4141 | q.text('}') |
| 4142 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4143 | stats_request.subtypes[0] = desc_stats_request |
| 4144 | |
| 4145 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4146 | version = 1 |
| 4147 | type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4148 | |
| 4149 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4150 | if xid != None: |
| 4151 | self.xid = xid |
| 4152 | else: |
| 4153 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4154 | if data != None: |
| 4155 | self.data = data |
| 4156 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4157 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4158 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4159 | |
| 4160 | def pack(self): |
| 4161 | packed = [] |
| 4162 | packed.append(struct.pack("!B", self.version)) |
| 4163 | packed.append(struct.pack("!B", self.type)) |
| 4164 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4165 | packed.append(struct.pack("!L", self.xid)) |
| 4166 | packed.append(self.data) |
| 4167 | length = sum([len(x) for x in packed]) |
| 4168 | packed[2] = struct.pack("!H", length) |
| 4169 | return ''.join(packed) |
| 4170 | |
| 4171 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4172 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4173 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4174 | _version = reader.read("!B")[0] |
| 4175 | assert(_version == 1) |
| 4176 | _type = reader.read("!B")[0] |
| 4177 | assert(_type == 3) |
| 4178 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4179 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4180 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4181 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4182 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4183 | return obj |
| 4184 | |
| 4185 | def __eq__(self, other): |
| 4186 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4187 | if self.xid != other.xid: return False |
| 4188 | if self.data != other.data: return False |
| 4189 | return True |
| 4190 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4191 | def pretty_print(self, q): |
| 4192 | q.text("echo_reply {") |
| 4193 | with q.group(): |
| 4194 | with q.indent(2): |
| 4195 | q.breakable() |
| 4196 | q.text("xid = "); |
| 4197 | if self.xid != None: |
| 4198 | q.text("%#x" % self.xid) |
| 4199 | else: |
| 4200 | q.text('None') |
| 4201 | q.text(","); q.breakable() |
| 4202 | q.text("data = "); |
| 4203 | q.pp(self.data) |
| 4204 | q.breakable() |
| 4205 | q.text('}') |
| 4206 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4207 | message.subtypes[3] = echo_reply |
| 4208 | |
| 4209 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4210 | version = 1 |
| 4211 | type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4212 | |
| 4213 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4214 | if xid != None: |
| 4215 | self.xid = xid |
| 4216 | else: |
| 4217 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4218 | if data != None: |
| 4219 | self.data = data |
| 4220 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4221 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4222 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4223 | |
| 4224 | def pack(self): |
| 4225 | packed = [] |
| 4226 | packed.append(struct.pack("!B", self.version)) |
| 4227 | packed.append(struct.pack("!B", self.type)) |
| 4228 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4229 | packed.append(struct.pack("!L", self.xid)) |
| 4230 | packed.append(self.data) |
| 4231 | length = sum([len(x) for x in packed]) |
| 4232 | packed[2] = struct.pack("!H", length) |
| 4233 | return ''.join(packed) |
| 4234 | |
| 4235 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4236 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4237 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4238 | _version = reader.read("!B")[0] |
| 4239 | assert(_version == 1) |
| 4240 | _type = reader.read("!B")[0] |
| 4241 | assert(_type == 2) |
| 4242 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4243 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4244 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4245 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4246 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4247 | return obj |
| 4248 | |
| 4249 | def __eq__(self, other): |
| 4250 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4251 | if self.xid != other.xid: return False |
| 4252 | if self.data != other.data: return False |
| 4253 | return True |
| 4254 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4255 | def pretty_print(self, q): |
| 4256 | q.text("echo_request {") |
| 4257 | with q.group(): |
| 4258 | with q.indent(2): |
| 4259 | q.breakable() |
| 4260 | q.text("xid = "); |
| 4261 | if self.xid != None: |
| 4262 | q.text("%#x" % self.xid) |
| 4263 | else: |
| 4264 | q.text('None') |
| 4265 | q.text(","); q.breakable() |
| 4266 | q.text("data = "); |
| 4267 | q.pp(self.data) |
| 4268 | q.breakable() |
| 4269 | q.text('}') |
| 4270 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4271 | message.subtypes[2] = echo_request |
| 4272 | |
| 4273 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4274 | version = 1 |
| 4275 | type = 6 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4276 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4277 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4278 | if xid != None: |
| 4279 | self.xid = xid |
| 4280 | else: |
| 4281 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4282 | if datapath_id != None: |
| 4283 | self.datapath_id = datapath_id |
| 4284 | else: |
| 4285 | self.datapath_id = 0 |
| 4286 | if n_buffers != None: |
| 4287 | self.n_buffers = n_buffers |
| 4288 | else: |
| 4289 | self.n_buffers = 0 |
| 4290 | if n_tables != None: |
| 4291 | self.n_tables = n_tables |
| 4292 | else: |
| 4293 | self.n_tables = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4294 | if capabilities != None: |
| 4295 | self.capabilities = capabilities |
| 4296 | else: |
| 4297 | self.capabilities = 0 |
| 4298 | if actions != None: |
| 4299 | self.actions = actions |
| 4300 | else: |
| 4301 | self.actions = 0 |
| 4302 | if ports != None: |
| 4303 | self.ports = ports |
| 4304 | else: |
| 4305 | self.ports = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4306 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4307 | |
| 4308 | def pack(self): |
| 4309 | packed = [] |
| 4310 | packed.append(struct.pack("!B", self.version)) |
| 4311 | packed.append(struct.pack("!B", self.type)) |
| 4312 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4313 | packed.append(struct.pack("!L", self.xid)) |
| 4314 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 4315 | packed.append(struct.pack("!L", self.n_buffers)) |
| 4316 | packed.append(struct.pack("!B", self.n_tables)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4317 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4318 | packed.append(struct.pack("!L", self.capabilities)) |
| 4319 | packed.append(struct.pack("!L", self.actions)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4320 | packed.append(loxi.generic_util.pack_list(self.ports)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4321 | length = sum([len(x) for x in packed]) |
| 4322 | packed[2] = struct.pack("!H", length) |
| 4323 | return ''.join(packed) |
| 4324 | |
| 4325 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4326 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4327 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4328 | _version = reader.read("!B")[0] |
| 4329 | assert(_version == 1) |
| 4330 | _type = reader.read("!B")[0] |
| 4331 | assert(_type == 6) |
| 4332 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4333 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4334 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4335 | obj.xid = reader.read("!L")[0] |
| 4336 | obj.datapath_id = reader.read("!Q")[0] |
| 4337 | obj.n_buffers = reader.read("!L")[0] |
| 4338 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4339 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4340 | obj.capabilities = reader.read("!L")[0] |
| 4341 | obj.actions = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4342 | obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4343 | return obj |
| 4344 | |
| 4345 | def __eq__(self, other): |
| 4346 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4347 | if self.xid != other.xid: return False |
| 4348 | if self.datapath_id != other.datapath_id: return False |
| 4349 | if self.n_buffers != other.n_buffers: return False |
| 4350 | if self.n_tables != other.n_tables: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4351 | if self.capabilities != other.capabilities: return False |
| 4352 | if self.actions != other.actions: return False |
| 4353 | if self.ports != other.ports: return False |
| 4354 | return True |
| 4355 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4356 | def pretty_print(self, q): |
| 4357 | q.text("features_reply {") |
| 4358 | with q.group(): |
| 4359 | with q.indent(2): |
| 4360 | q.breakable() |
| 4361 | q.text("xid = "); |
| 4362 | if self.xid != None: |
| 4363 | q.text("%#x" % self.xid) |
| 4364 | else: |
| 4365 | q.text('None') |
| 4366 | q.text(","); q.breakable() |
| 4367 | q.text("datapath_id = "); |
| 4368 | q.text("%#x" % self.datapath_id) |
| 4369 | q.text(","); q.breakable() |
| 4370 | q.text("n_buffers = "); |
| 4371 | q.text("%#x" % self.n_buffers) |
| 4372 | q.text(","); q.breakable() |
| 4373 | q.text("n_tables = "); |
| 4374 | q.text("%#x" % self.n_tables) |
| 4375 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4376 | q.text("capabilities = "); |
| 4377 | q.text("%#x" % self.capabilities) |
| 4378 | q.text(","); q.breakable() |
| 4379 | q.text("actions = "); |
| 4380 | q.text("%#x" % self.actions) |
| 4381 | q.text(","); q.breakable() |
| 4382 | q.text("ports = "); |
| 4383 | q.pp(self.ports) |
| 4384 | q.breakable() |
| 4385 | q.text('}') |
| 4386 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4387 | message.subtypes[6] = features_reply |
| 4388 | |
| 4389 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4390 | version = 1 |
| 4391 | type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4392 | |
| 4393 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4394 | if xid != None: |
| 4395 | self.xid = xid |
| 4396 | else: |
| 4397 | self.xid = None |
| 4398 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4399 | |
| 4400 | def pack(self): |
| 4401 | packed = [] |
| 4402 | packed.append(struct.pack("!B", self.version)) |
| 4403 | packed.append(struct.pack("!B", self.type)) |
| 4404 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4405 | packed.append(struct.pack("!L", self.xid)) |
| 4406 | length = sum([len(x) for x in packed]) |
| 4407 | packed[2] = struct.pack("!H", length) |
| 4408 | return ''.join(packed) |
| 4409 | |
| 4410 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4411 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4412 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4413 | _version = reader.read("!B")[0] |
| 4414 | assert(_version == 1) |
| 4415 | _type = reader.read("!B")[0] |
| 4416 | assert(_type == 5) |
| 4417 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4418 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4419 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4420 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4421 | return obj |
| 4422 | |
| 4423 | def __eq__(self, other): |
| 4424 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4425 | if self.xid != other.xid: return False |
| 4426 | return True |
| 4427 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4428 | def pretty_print(self, q): |
| 4429 | q.text("features_request {") |
| 4430 | with q.group(): |
| 4431 | with q.indent(2): |
| 4432 | q.breakable() |
| 4433 | q.text("xid = "); |
| 4434 | if self.xid != None: |
| 4435 | q.text("%#x" % self.xid) |
| 4436 | else: |
| 4437 | q.text('None') |
| 4438 | q.breakable() |
| 4439 | q.text('}') |
| 4440 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4441 | message.subtypes[5] = features_request |
| 4442 | |
| 4443 | class flow_mod(message): |
| 4444 | subtypes = {} |
| 4445 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4446 | version = 1 |
| 4447 | type = 14 |
| 4448 | |
| 4449 | def __init__(self, xid=None, match=None, cookie=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
| 4450 | if xid != None: |
| 4451 | self.xid = xid |
| 4452 | else: |
| 4453 | self.xid = None |
| 4454 | if match != None: |
| 4455 | self.match = match |
| 4456 | else: |
| 4457 | self.match = common.match() |
| 4458 | if cookie != None: |
| 4459 | self.cookie = cookie |
| 4460 | else: |
| 4461 | self.cookie = 0 |
| 4462 | if _command != None: |
| 4463 | self._command = _command |
| 4464 | else: |
| 4465 | self._command = 0 |
| 4466 | if idle_timeout != None: |
| 4467 | self.idle_timeout = idle_timeout |
| 4468 | else: |
| 4469 | self.idle_timeout = 0 |
| 4470 | if hard_timeout != None: |
| 4471 | self.hard_timeout = hard_timeout |
| 4472 | else: |
| 4473 | self.hard_timeout = 0 |
| 4474 | if priority != None: |
| 4475 | self.priority = priority |
| 4476 | else: |
| 4477 | self.priority = 0 |
| 4478 | if buffer_id != None: |
| 4479 | self.buffer_id = buffer_id |
| 4480 | else: |
| 4481 | self.buffer_id = 0 |
| 4482 | if out_port != None: |
| 4483 | self.out_port = out_port |
| 4484 | else: |
| 4485 | self.out_port = 0 |
| 4486 | if flags != None: |
| 4487 | self.flags = flags |
| 4488 | else: |
| 4489 | self.flags = 0 |
| 4490 | if actions != None: |
| 4491 | self.actions = actions |
| 4492 | else: |
| 4493 | self.actions = [] |
| 4494 | return |
| 4495 | |
| 4496 | def pack(self): |
| 4497 | packed = [] |
| 4498 | packed.append(struct.pack("!B", self.version)) |
| 4499 | packed.append(struct.pack("!B", self.type)) |
| 4500 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4501 | packed.append(struct.pack("!L", self.xid)) |
| 4502 | packed.append(self.match.pack()) |
| 4503 | packed.append(struct.pack("!Q", self.cookie)) |
| 4504 | packed.append(util.pack_fm_cmd(self._command)) |
| 4505 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4506 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4507 | packed.append(struct.pack("!H", self.priority)) |
| 4508 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4509 | packed.append(util.pack_port_no(self.out_port)) |
| 4510 | packed.append(struct.pack("!H", self.flags)) |
| 4511 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 4512 | length = sum([len(x) for x in packed]) |
| 4513 | packed[2] = struct.pack("!H", length) |
| 4514 | return ''.join(packed) |
| 4515 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4516 | @staticmethod |
| 4517 | def unpack(reader): |
| 4518 | subtype, = reader.peek('!H', 56) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4519 | subclass = flow_mod.subtypes.get(subtype) |
| 4520 | if subclass: |
| 4521 | return subclass.unpack(reader) |
| 4522 | |
| 4523 | obj = flow_mod() |
| 4524 | _version = reader.read("!B")[0] |
| 4525 | assert(_version == 1) |
| 4526 | _type = reader.read("!B")[0] |
| 4527 | assert(_type == 14) |
| 4528 | _length = reader.read("!H")[0] |
| 4529 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4530 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4531 | obj.xid = reader.read("!L")[0] |
| 4532 | obj.match = common.match.unpack(reader) |
| 4533 | obj.cookie = reader.read("!Q")[0] |
| 4534 | obj._command = util.unpack_fm_cmd(reader) |
| 4535 | obj.idle_timeout = reader.read("!H")[0] |
| 4536 | obj.hard_timeout = reader.read("!H")[0] |
| 4537 | obj.priority = reader.read("!H")[0] |
| 4538 | obj.buffer_id = reader.read("!L")[0] |
| 4539 | obj.out_port = util.unpack_port_no(reader) |
| 4540 | obj.flags = reader.read("!H")[0] |
| 4541 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
| 4542 | return obj |
| 4543 | |
| 4544 | def __eq__(self, other): |
| 4545 | if type(self) != type(other): return False |
| 4546 | if self.xid != other.xid: return False |
| 4547 | if self.match != other.match: return False |
| 4548 | if self.cookie != other.cookie: return False |
| 4549 | if self._command != other._command: return False |
| 4550 | if self.idle_timeout != other.idle_timeout: return False |
| 4551 | if self.hard_timeout != other.hard_timeout: return False |
| 4552 | if self.priority != other.priority: return False |
| 4553 | if self.buffer_id != other.buffer_id: return False |
| 4554 | if self.out_port != other.out_port: return False |
| 4555 | if self.flags != other.flags: return False |
| 4556 | if self.actions != other.actions: return False |
| 4557 | return True |
| 4558 | |
| 4559 | def pretty_print(self, q): |
| 4560 | q.text("flow_mod {") |
| 4561 | with q.group(): |
| 4562 | with q.indent(2): |
| 4563 | q.breakable() |
| 4564 | q.text("xid = "); |
| 4565 | if self.xid != None: |
| 4566 | q.text("%#x" % self.xid) |
| 4567 | else: |
| 4568 | q.text('None') |
| 4569 | q.text(","); q.breakable() |
| 4570 | q.text("match = "); |
| 4571 | q.pp(self.match) |
| 4572 | q.text(","); q.breakable() |
| 4573 | q.text("cookie = "); |
| 4574 | q.text("%#x" % self.cookie) |
| 4575 | q.text(","); q.breakable() |
| 4576 | q.text("idle_timeout = "); |
| 4577 | q.text("%#x" % self.idle_timeout) |
| 4578 | q.text(","); q.breakable() |
| 4579 | q.text("hard_timeout = "); |
| 4580 | q.text("%#x" % self.hard_timeout) |
| 4581 | q.text(","); q.breakable() |
| 4582 | q.text("priority = "); |
| 4583 | q.text("%#x" % self.priority) |
| 4584 | q.text(","); q.breakable() |
| 4585 | q.text("buffer_id = "); |
| 4586 | q.text("%#x" % self.buffer_id) |
| 4587 | q.text(","); q.breakable() |
| 4588 | q.text("out_port = "); |
| 4589 | q.text(util.pretty_port(self.out_port)) |
| 4590 | q.text(","); q.breakable() |
| 4591 | q.text("flags = "); |
| 4592 | q.text("%#x" % self.flags) |
| 4593 | q.text(","); q.breakable() |
| 4594 | q.text("actions = "); |
| 4595 | q.pp(self.actions) |
| 4596 | q.breakable() |
| 4597 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4598 | |
| 4599 | message.subtypes[14] = flow_mod |
| 4600 | |
| 4601 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4602 | version = 1 |
| 4603 | type = 14 |
| 4604 | _command = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4605 | |
| 4606 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4607 | if xid != None: |
| 4608 | self.xid = xid |
| 4609 | else: |
| 4610 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4611 | if match != None: |
| 4612 | self.match = match |
| 4613 | else: |
| 4614 | self.match = common.match() |
| 4615 | if cookie != None: |
| 4616 | self.cookie = cookie |
| 4617 | else: |
| 4618 | self.cookie = 0 |
| 4619 | if idle_timeout != None: |
| 4620 | self.idle_timeout = idle_timeout |
| 4621 | else: |
| 4622 | self.idle_timeout = 0 |
| 4623 | if hard_timeout != None: |
| 4624 | self.hard_timeout = hard_timeout |
| 4625 | else: |
| 4626 | self.hard_timeout = 0 |
| 4627 | if priority != None: |
| 4628 | self.priority = priority |
| 4629 | else: |
| 4630 | self.priority = 0 |
| 4631 | if buffer_id != None: |
| 4632 | self.buffer_id = buffer_id |
| 4633 | else: |
| 4634 | self.buffer_id = 0 |
| 4635 | if out_port != None: |
| 4636 | self.out_port = out_port |
| 4637 | else: |
| 4638 | self.out_port = 0 |
| 4639 | if flags != None: |
| 4640 | self.flags = flags |
| 4641 | else: |
| 4642 | self.flags = 0 |
| 4643 | if actions != None: |
| 4644 | self.actions = actions |
| 4645 | else: |
| 4646 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4647 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4648 | |
| 4649 | def pack(self): |
| 4650 | packed = [] |
| 4651 | packed.append(struct.pack("!B", self.version)) |
| 4652 | packed.append(struct.pack("!B", self.type)) |
| 4653 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4654 | packed.append(struct.pack("!L", self.xid)) |
| 4655 | packed.append(self.match.pack()) |
| 4656 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4657 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4658 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4659 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4660 | packed.append(struct.pack("!H", self.priority)) |
| 4661 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4662 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4663 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4664 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4665 | length = sum([len(x) for x in packed]) |
| 4666 | packed[2] = struct.pack("!H", length) |
| 4667 | return ''.join(packed) |
| 4668 | |
| 4669 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4670 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4671 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4672 | _version = reader.read("!B")[0] |
| 4673 | assert(_version == 1) |
| 4674 | _type = reader.read("!B")[0] |
| 4675 | assert(_type == 14) |
| 4676 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4677 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4678 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4679 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4680 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4681 | obj.cookie = reader.read("!Q")[0] |
| 4682 | __command = util.unpack_fm_cmd(reader) |
| 4683 | assert(__command == 0) |
| 4684 | obj.idle_timeout = reader.read("!H")[0] |
| 4685 | obj.hard_timeout = reader.read("!H")[0] |
| 4686 | obj.priority = reader.read("!H")[0] |
| 4687 | obj.buffer_id = reader.read("!L")[0] |
| 4688 | obj.out_port = util.unpack_port_no(reader) |
| 4689 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4690 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4691 | return obj |
| 4692 | |
| 4693 | def __eq__(self, other): |
| 4694 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4695 | if self.xid != other.xid: return False |
| 4696 | if self.match != other.match: return False |
| 4697 | if self.cookie != other.cookie: return False |
| 4698 | if self.idle_timeout != other.idle_timeout: return False |
| 4699 | if self.hard_timeout != other.hard_timeout: return False |
| 4700 | if self.priority != other.priority: return False |
| 4701 | if self.buffer_id != other.buffer_id: return False |
| 4702 | if self.out_port != other.out_port: return False |
| 4703 | if self.flags != other.flags: return False |
| 4704 | if self.actions != other.actions: return False |
| 4705 | return True |
| 4706 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4707 | def pretty_print(self, q): |
| 4708 | q.text("flow_add {") |
| 4709 | with q.group(): |
| 4710 | with q.indent(2): |
| 4711 | q.breakable() |
| 4712 | q.text("xid = "); |
| 4713 | if self.xid != None: |
| 4714 | q.text("%#x" % self.xid) |
| 4715 | else: |
| 4716 | q.text('None') |
| 4717 | q.text(","); q.breakable() |
| 4718 | q.text("match = "); |
| 4719 | q.pp(self.match) |
| 4720 | q.text(","); q.breakable() |
| 4721 | q.text("cookie = "); |
| 4722 | q.text("%#x" % self.cookie) |
| 4723 | q.text(","); q.breakable() |
| 4724 | q.text("idle_timeout = "); |
| 4725 | q.text("%#x" % self.idle_timeout) |
| 4726 | q.text(","); q.breakable() |
| 4727 | q.text("hard_timeout = "); |
| 4728 | q.text("%#x" % self.hard_timeout) |
| 4729 | q.text(","); q.breakable() |
| 4730 | q.text("priority = "); |
| 4731 | q.text("%#x" % self.priority) |
| 4732 | q.text(","); q.breakable() |
| 4733 | q.text("buffer_id = "); |
| 4734 | q.text("%#x" % self.buffer_id) |
| 4735 | q.text(","); q.breakable() |
| 4736 | q.text("out_port = "); |
| 4737 | q.text(util.pretty_port(self.out_port)) |
| 4738 | q.text(","); q.breakable() |
| 4739 | q.text("flags = "); |
| 4740 | q.text("%#x" % self.flags) |
| 4741 | q.text(","); q.breakable() |
| 4742 | q.text("actions = "); |
| 4743 | q.pp(self.actions) |
| 4744 | q.breakable() |
| 4745 | q.text('}') |
| 4746 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4747 | flow_mod.subtypes[0] = flow_add |
| 4748 | |
| 4749 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4750 | version = 1 |
| 4751 | type = 14 |
| 4752 | _command = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4753 | |
| 4754 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4755 | if xid != None: |
| 4756 | self.xid = xid |
| 4757 | else: |
| 4758 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4759 | if match != None: |
| 4760 | self.match = match |
| 4761 | else: |
| 4762 | self.match = common.match() |
| 4763 | if cookie != None: |
| 4764 | self.cookie = cookie |
| 4765 | else: |
| 4766 | self.cookie = 0 |
| 4767 | if idle_timeout != None: |
| 4768 | self.idle_timeout = idle_timeout |
| 4769 | else: |
| 4770 | self.idle_timeout = 0 |
| 4771 | if hard_timeout != None: |
| 4772 | self.hard_timeout = hard_timeout |
| 4773 | else: |
| 4774 | self.hard_timeout = 0 |
| 4775 | if priority != None: |
| 4776 | self.priority = priority |
| 4777 | else: |
| 4778 | self.priority = 0 |
| 4779 | if buffer_id != None: |
| 4780 | self.buffer_id = buffer_id |
| 4781 | else: |
| 4782 | self.buffer_id = 0 |
| 4783 | if out_port != None: |
| 4784 | self.out_port = out_port |
| 4785 | else: |
| 4786 | self.out_port = 0 |
| 4787 | if flags != None: |
| 4788 | self.flags = flags |
| 4789 | else: |
| 4790 | self.flags = 0 |
| 4791 | if actions != None: |
| 4792 | self.actions = actions |
| 4793 | else: |
| 4794 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4795 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4796 | |
| 4797 | def pack(self): |
| 4798 | packed = [] |
| 4799 | packed.append(struct.pack("!B", self.version)) |
| 4800 | packed.append(struct.pack("!B", self.type)) |
| 4801 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4802 | packed.append(struct.pack("!L", self.xid)) |
| 4803 | packed.append(self.match.pack()) |
| 4804 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4805 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4806 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4807 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4808 | packed.append(struct.pack("!H", self.priority)) |
| 4809 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4810 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4811 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4812 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4813 | length = sum([len(x) for x in packed]) |
| 4814 | packed[2] = struct.pack("!H", length) |
| 4815 | return ''.join(packed) |
| 4816 | |
| 4817 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4818 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4819 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4820 | _version = reader.read("!B")[0] |
| 4821 | assert(_version == 1) |
| 4822 | _type = reader.read("!B")[0] |
| 4823 | assert(_type == 14) |
| 4824 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4825 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4826 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4827 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4828 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4829 | obj.cookie = reader.read("!Q")[0] |
| 4830 | __command = util.unpack_fm_cmd(reader) |
| 4831 | assert(__command == 3) |
| 4832 | obj.idle_timeout = reader.read("!H")[0] |
| 4833 | obj.hard_timeout = reader.read("!H")[0] |
| 4834 | obj.priority = reader.read("!H")[0] |
| 4835 | obj.buffer_id = reader.read("!L")[0] |
| 4836 | obj.out_port = util.unpack_port_no(reader) |
| 4837 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4838 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4839 | return obj |
| 4840 | |
| 4841 | def __eq__(self, other): |
| 4842 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4843 | if self.xid != other.xid: return False |
| 4844 | if self.match != other.match: return False |
| 4845 | if self.cookie != other.cookie: return False |
| 4846 | if self.idle_timeout != other.idle_timeout: return False |
| 4847 | if self.hard_timeout != other.hard_timeout: return False |
| 4848 | if self.priority != other.priority: return False |
| 4849 | if self.buffer_id != other.buffer_id: return False |
| 4850 | if self.out_port != other.out_port: return False |
| 4851 | if self.flags != other.flags: return False |
| 4852 | if self.actions != other.actions: return False |
| 4853 | return True |
| 4854 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4855 | def pretty_print(self, q): |
| 4856 | q.text("flow_delete {") |
| 4857 | with q.group(): |
| 4858 | with q.indent(2): |
| 4859 | q.breakable() |
| 4860 | q.text("xid = "); |
| 4861 | if self.xid != None: |
| 4862 | q.text("%#x" % self.xid) |
| 4863 | else: |
| 4864 | q.text('None') |
| 4865 | q.text(","); q.breakable() |
| 4866 | q.text("match = "); |
| 4867 | q.pp(self.match) |
| 4868 | q.text(","); q.breakable() |
| 4869 | q.text("cookie = "); |
| 4870 | q.text("%#x" % self.cookie) |
| 4871 | q.text(","); q.breakable() |
| 4872 | q.text("idle_timeout = "); |
| 4873 | q.text("%#x" % self.idle_timeout) |
| 4874 | q.text(","); q.breakable() |
| 4875 | q.text("hard_timeout = "); |
| 4876 | q.text("%#x" % self.hard_timeout) |
| 4877 | q.text(","); q.breakable() |
| 4878 | q.text("priority = "); |
| 4879 | q.text("%#x" % self.priority) |
| 4880 | q.text(","); q.breakable() |
| 4881 | q.text("buffer_id = "); |
| 4882 | q.text("%#x" % self.buffer_id) |
| 4883 | q.text(","); q.breakable() |
| 4884 | q.text("out_port = "); |
| 4885 | q.text(util.pretty_port(self.out_port)) |
| 4886 | q.text(","); q.breakable() |
| 4887 | q.text("flags = "); |
| 4888 | q.text("%#x" % self.flags) |
| 4889 | q.text(","); q.breakable() |
| 4890 | q.text("actions = "); |
| 4891 | q.pp(self.actions) |
| 4892 | q.breakable() |
| 4893 | q.text('}') |
| 4894 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4895 | flow_mod.subtypes[3] = flow_delete |
| 4896 | |
| 4897 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4898 | version = 1 |
| 4899 | type = 14 |
| 4900 | _command = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4901 | |
| 4902 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4903 | if xid != None: |
| 4904 | self.xid = xid |
| 4905 | else: |
| 4906 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4907 | if match != None: |
| 4908 | self.match = match |
| 4909 | else: |
| 4910 | self.match = common.match() |
| 4911 | if cookie != None: |
| 4912 | self.cookie = cookie |
| 4913 | else: |
| 4914 | self.cookie = 0 |
| 4915 | if idle_timeout != None: |
| 4916 | self.idle_timeout = idle_timeout |
| 4917 | else: |
| 4918 | self.idle_timeout = 0 |
| 4919 | if hard_timeout != None: |
| 4920 | self.hard_timeout = hard_timeout |
| 4921 | else: |
| 4922 | self.hard_timeout = 0 |
| 4923 | if priority != None: |
| 4924 | self.priority = priority |
| 4925 | else: |
| 4926 | self.priority = 0 |
| 4927 | if buffer_id != None: |
| 4928 | self.buffer_id = buffer_id |
| 4929 | else: |
| 4930 | self.buffer_id = 0 |
| 4931 | if out_port != None: |
| 4932 | self.out_port = out_port |
| 4933 | else: |
| 4934 | self.out_port = 0 |
| 4935 | if flags != None: |
| 4936 | self.flags = flags |
| 4937 | else: |
| 4938 | self.flags = 0 |
| 4939 | if actions != None: |
| 4940 | self.actions = actions |
| 4941 | else: |
| 4942 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4943 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4944 | |
| 4945 | def pack(self): |
| 4946 | packed = [] |
| 4947 | packed.append(struct.pack("!B", self.version)) |
| 4948 | packed.append(struct.pack("!B", self.type)) |
| 4949 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4950 | packed.append(struct.pack("!L", self.xid)) |
| 4951 | packed.append(self.match.pack()) |
| 4952 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4953 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4954 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4955 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4956 | packed.append(struct.pack("!H", self.priority)) |
| 4957 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4958 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4959 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4960 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4961 | length = sum([len(x) for x in packed]) |
| 4962 | packed[2] = struct.pack("!H", length) |
| 4963 | return ''.join(packed) |
| 4964 | |
| 4965 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4966 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4967 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4968 | _version = reader.read("!B")[0] |
| 4969 | assert(_version == 1) |
| 4970 | _type = reader.read("!B")[0] |
| 4971 | assert(_type == 14) |
| 4972 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4973 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 4974 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4975 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4976 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4977 | obj.cookie = reader.read("!Q")[0] |
| 4978 | __command = util.unpack_fm_cmd(reader) |
| 4979 | assert(__command == 4) |
| 4980 | obj.idle_timeout = reader.read("!H")[0] |
| 4981 | obj.hard_timeout = reader.read("!H")[0] |
| 4982 | obj.priority = reader.read("!H")[0] |
| 4983 | obj.buffer_id = reader.read("!L")[0] |
| 4984 | obj.out_port = util.unpack_port_no(reader) |
| 4985 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4986 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4987 | return obj |
| 4988 | |
| 4989 | def __eq__(self, other): |
| 4990 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4991 | if self.xid != other.xid: return False |
| 4992 | if self.match != other.match: return False |
| 4993 | if self.cookie != other.cookie: return False |
| 4994 | if self.idle_timeout != other.idle_timeout: return False |
| 4995 | if self.hard_timeout != other.hard_timeout: return False |
| 4996 | if self.priority != other.priority: return False |
| 4997 | if self.buffer_id != other.buffer_id: return False |
| 4998 | if self.out_port != other.out_port: return False |
| 4999 | if self.flags != other.flags: return False |
| 5000 | if self.actions != other.actions: return False |
| 5001 | return True |
| 5002 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5003 | def pretty_print(self, q): |
| 5004 | q.text("flow_delete_strict {") |
| 5005 | with q.group(): |
| 5006 | with q.indent(2): |
| 5007 | q.breakable() |
| 5008 | q.text("xid = "); |
| 5009 | if self.xid != None: |
| 5010 | q.text("%#x" % self.xid) |
| 5011 | else: |
| 5012 | q.text('None') |
| 5013 | q.text(","); q.breakable() |
| 5014 | q.text("match = "); |
| 5015 | q.pp(self.match) |
| 5016 | q.text(","); q.breakable() |
| 5017 | q.text("cookie = "); |
| 5018 | q.text("%#x" % self.cookie) |
| 5019 | q.text(","); q.breakable() |
| 5020 | q.text("idle_timeout = "); |
| 5021 | q.text("%#x" % self.idle_timeout) |
| 5022 | q.text(","); q.breakable() |
| 5023 | q.text("hard_timeout = "); |
| 5024 | q.text("%#x" % self.hard_timeout) |
| 5025 | q.text(","); q.breakable() |
| 5026 | q.text("priority = "); |
| 5027 | q.text("%#x" % self.priority) |
| 5028 | q.text(","); q.breakable() |
| 5029 | q.text("buffer_id = "); |
| 5030 | q.text("%#x" % self.buffer_id) |
| 5031 | q.text(","); q.breakable() |
| 5032 | q.text("out_port = "); |
| 5033 | q.text(util.pretty_port(self.out_port)) |
| 5034 | q.text(","); q.breakable() |
| 5035 | q.text("flags = "); |
| 5036 | q.text("%#x" % self.flags) |
| 5037 | q.text(","); q.breakable() |
| 5038 | q.text("actions = "); |
| 5039 | q.pp(self.actions) |
| 5040 | q.breakable() |
| 5041 | q.text('}') |
| 5042 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5043 | flow_mod.subtypes[4] = flow_delete_strict |
| 5044 | |
| 5045 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5046 | version = 1 |
| 5047 | type = 1 |
| 5048 | err_type = 3 |
| 5049 | |
| 5050 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5051 | if xid != None: |
| 5052 | self.xid = xid |
| 5053 | else: |
| 5054 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5055 | if code != None: |
| 5056 | self.code = code |
| 5057 | else: |
| 5058 | self.code = 0 |
| 5059 | if data != None: |
| 5060 | self.data = data |
| 5061 | else: |
| 5062 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5063 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5064 | |
| 5065 | def pack(self): |
| 5066 | packed = [] |
| 5067 | packed.append(struct.pack("!B", self.version)) |
| 5068 | packed.append(struct.pack("!B", self.type)) |
| 5069 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5070 | packed.append(struct.pack("!L", self.xid)) |
| 5071 | packed.append(struct.pack("!H", self.err_type)) |
| 5072 | packed.append(struct.pack("!H", self.code)) |
| 5073 | packed.append(self.data) |
| 5074 | length = sum([len(x) for x in packed]) |
| 5075 | packed[2] = struct.pack("!H", length) |
| 5076 | return ''.join(packed) |
| 5077 | |
| 5078 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5079 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5080 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5081 | _version = reader.read("!B")[0] |
| 5082 | assert(_version == 1) |
| 5083 | _type = reader.read("!B")[0] |
| 5084 | assert(_type == 1) |
| 5085 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5086 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5087 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5088 | obj.xid = reader.read("!L")[0] |
| 5089 | _err_type = reader.read("!H")[0] |
| 5090 | assert(_err_type == 3) |
| 5091 | obj.code = reader.read("!H")[0] |
| 5092 | obj.data = str(reader.read_all()) |
| 5093 | return obj |
| 5094 | |
| 5095 | def __eq__(self, other): |
| 5096 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5097 | if self.xid != other.xid: return False |
| 5098 | if self.code != other.code: return False |
| 5099 | if self.data != other.data: return False |
| 5100 | return True |
| 5101 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5102 | def pretty_print(self, q): |
| 5103 | q.text("flow_mod_failed_error_msg {") |
| 5104 | with q.group(): |
| 5105 | with q.indent(2): |
| 5106 | q.breakable() |
| 5107 | q.text("xid = "); |
| 5108 | if self.xid != None: |
| 5109 | q.text("%#x" % self.xid) |
| 5110 | else: |
| 5111 | q.text('None') |
| 5112 | q.text(","); q.breakable() |
| 5113 | q.text("code = "); |
| 5114 | q.text("%#x" % self.code) |
| 5115 | q.text(","); q.breakable() |
| 5116 | q.text("data = "); |
| 5117 | q.pp(self.data) |
| 5118 | q.breakable() |
| 5119 | q.text('}') |
| 5120 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5121 | error_msg.subtypes[3] = flow_mod_failed_error_msg |
| 5122 | |
| 5123 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5124 | version = 1 |
| 5125 | type = 14 |
| 5126 | _command = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5127 | |
| 5128 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5129 | if xid != None: |
| 5130 | self.xid = xid |
| 5131 | else: |
| 5132 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5133 | if match != None: |
| 5134 | self.match = match |
| 5135 | else: |
| 5136 | self.match = common.match() |
| 5137 | if cookie != None: |
| 5138 | self.cookie = cookie |
| 5139 | else: |
| 5140 | self.cookie = 0 |
| 5141 | if idle_timeout != None: |
| 5142 | self.idle_timeout = idle_timeout |
| 5143 | else: |
| 5144 | self.idle_timeout = 0 |
| 5145 | if hard_timeout != None: |
| 5146 | self.hard_timeout = hard_timeout |
| 5147 | else: |
| 5148 | self.hard_timeout = 0 |
| 5149 | if priority != None: |
| 5150 | self.priority = priority |
| 5151 | else: |
| 5152 | self.priority = 0 |
| 5153 | if buffer_id != None: |
| 5154 | self.buffer_id = buffer_id |
| 5155 | else: |
| 5156 | self.buffer_id = 0 |
| 5157 | if out_port != None: |
| 5158 | self.out_port = out_port |
| 5159 | else: |
| 5160 | self.out_port = 0 |
| 5161 | if flags != None: |
| 5162 | self.flags = flags |
| 5163 | else: |
| 5164 | self.flags = 0 |
| 5165 | if actions != None: |
| 5166 | self.actions = actions |
| 5167 | else: |
| 5168 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5169 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5170 | |
| 5171 | def pack(self): |
| 5172 | packed = [] |
| 5173 | packed.append(struct.pack("!B", self.version)) |
| 5174 | packed.append(struct.pack("!B", self.type)) |
| 5175 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5176 | packed.append(struct.pack("!L", self.xid)) |
| 5177 | packed.append(self.match.pack()) |
| 5178 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5179 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5180 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5181 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5182 | packed.append(struct.pack("!H", self.priority)) |
| 5183 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5184 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5185 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5186 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5187 | length = sum([len(x) for x in packed]) |
| 5188 | packed[2] = struct.pack("!H", length) |
| 5189 | return ''.join(packed) |
| 5190 | |
| 5191 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5192 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5193 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5194 | _version = reader.read("!B")[0] |
| 5195 | assert(_version == 1) |
| 5196 | _type = reader.read("!B")[0] |
| 5197 | assert(_type == 14) |
| 5198 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5199 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5200 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5201 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5202 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5203 | obj.cookie = reader.read("!Q")[0] |
| 5204 | __command = util.unpack_fm_cmd(reader) |
| 5205 | assert(__command == 1) |
| 5206 | obj.idle_timeout = reader.read("!H")[0] |
| 5207 | obj.hard_timeout = reader.read("!H")[0] |
| 5208 | obj.priority = reader.read("!H")[0] |
| 5209 | obj.buffer_id = reader.read("!L")[0] |
| 5210 | obj.out_port = util.unpack_port_no(reader) |
| 5211 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5212 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5213 | return obj |
| 5214 | |
| 5215 | def __eq__(self, other): |
| 5216 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5217 | if self.xid != other.xid: return False |
| 5218 | if self.match != other.match: return False |
| 5219 | if self.cookie != other.cookie: return False |
| 5220 | if self.idle_timeout != other.idle_timeout: return False |
| 5221 | if self.hard_timeout != other.hard_timeout: return False |
| 5222 | if self.priority != other.priority: return False |
| 5223 | if self.buffer_id != other.buffer_id: return False |
| 5224 | if self.out_port != other.out_port: return False |
| 5225 | if self.flags != other.flags: return False |
| 5226 | if self.actions != other.actions: return False |
| 5227 | return True |
| 5228 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5229 | def pretty_print(self, q): |
| 5230 | q.text("flow_modify {") |
| 5231 | with q.group(): |
| 5232 | with q.indent(2): |
| 5233 | q.breakable() |
| 5234 | q.text("xid = "); |
| 5235 | if self.xid != None: |
| 5236 | q.text("%#x" % self.xid) |
| 5237 | else: |
| 5238 | q.text('None') |
| 5239 | q.text(","); q.breakable() |
| 5240 | q.text("match = "); |
| 5241 | q.pp(self.match) |
| 5242 | q.text(","); q.breakable() |
| 5243 | q.text("cookie = "); |
| 5244 | q.text("%#x" % self.cookie) |
| 5245 | q.text(","); q.breakable() |
| 5246 | q.text("idle_timeout = "); |
| 5247 | q.text("%#x" % self.idle_timeout) |
| 5248 | q.text(","); q.breakable() |
| 5249 | q.text("hard_timeout = "); |
| 5250 | q.text("%#x" % self.hard_timeout) |
| 5251 | q.text(","); q.breakable() |
| 5252 | q.text("priority = "); |
| 5253 | q.text("%#x" % self.priority) |
| 5254 | q.text(","); q.breakable() |
| 5255 | q.text("buffer_id = "); |
| 5256 | q.text("%#x" % self.buffer_id) |
| 5257 | q.text(","); q.breakable() |
| 5258 | q.text("out_port = "); |
| 5259 | q.text(util.pretty_port(self.out_port)) |
| 5260 | q.text(","); q.breakable() |
| 5261 | q.text("flags = "); |
| 5262 | q.text("%#x" % self.flags) |
| 5263 | q.text(","); q.breakable() |
| 5264 | q.text("actions = "); |
| 5265 | q.pp(self.actions) |
| 5266 | q.breakable() |
| 5267 | q.text('}') |
| 5268 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5269 | flow_mod.subtypes[1] = flow_modify |
| 5270 | |
| 5271 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5272 | version = 1 |
| 5273 | type = 14 |
| 5274 | _command = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5275 | |
| 5276 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5277 | if xid != None: |
| 5278 | self.xid = xid |
| 5279 | else: |
| 5280 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5281 | if match != None: |
| 5282 | self.match = match |
| 5283 | else: |
| 5284 | self.match = common.match() |
| 5285 | if cookie != None: |
| 5286 | self.cookie = cookie |
| 5287 | else: |
| 5288 | self.cookie = 0 |
| 5289 | if idle_timeout != None: |
| 5290 | self.idle_timeout = idle_timeout |
| 5291 | else: |
| 5292 | self.idle_timeout = 0 |
| 5293 | if hard_timeout != None: |
| 5294 | self.hard_timeout = hard_timeout |
| 5295 | else: |
| 5296 | self.hard_timeout = 0 |
| 5297 | if priority != None: |
| 5298 | self.priority = priority |
| 5299 | else: |
| 5300 | self.priority = 0 |
| 5301 | if buffer_id != None: |
| 5302 | self.buffer_id = buffer_id |
| 5303 | else: |
| 5304 | self.buffer_id = 0 |
| 5305 | if out_port != None: |
| 5306 | self.out_port = out_port |
| 5307 | else: |
| 5308 | self.out_port = 0 |
| 5309 | if flags != None: |
| 5310 | self.flags = flags |
| 5311 | else: |
| 5312 | self.flags = 0 |
| 5313 | if actions != None: |
| 5314 | self.actions = actions |
| 5315 | else: |
| 5316 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5317 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5318 | |
| 5319 | def pack(self): |
| 5320 | packed = [] |
| 5321 | packed.append(struct.pack("!B", self.version)) |
| 5322 | packed.append(struct.pack("!B", self.type)) |
| 5323 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5324 | packed.append(struct.pack("!L", self.xid)) |
| 5325 | packed.append(self.match.pack()) |
| 5326 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5327 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5328 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5329 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5330 | packed.append(struct.pack("!H", self.priority)) |
| 5331 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5332 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5333 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5334 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5335 | length = sum([len(x) for x in packed]) |
| 5336 | packed[2] = struct.pack("!H", length) |
| 5337 | return ''.join(packed) |
| 5338 | |
| 5339 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5340 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5341 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5342 | _version = reader.read("!B")[0] |
| 5343 | assert(_version == 1) |
| 5344 | _type = reader.read("!B")[0] |
| 5345 | assert(_type == 14) |
| 5346 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5347 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5348 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5349 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5350 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5351 | obj.cookie = reader.read("!Q")[0] |
| 5352 | __command = util.unpack_fm_cmd(reader) |
| 5353 | assert(__command == 2) |
| 5354 | obj.idle_timeout = reader.read("!H")[0] |
| 5355 | obj.hard_timeout = reader.read("!H")[0] |
| 5356 | obj.priority = reader.read("!H")[0] |
| 5357 | obj.buffer_id = reader.read("!L")[0] |
| 5358 | obj.out_port = util.unpack_port_no(reader) |
| 5359 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5360 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5361 | return obj |
| 5362 | |
| 5363 | def __eq__(self, other): |
| 5364 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5365 | if self.xid != other.xid: return False |
| 5366 | if self.match != other.match: return False |
| 5367 | if self.cookie != other.cookie: return False |
| 5368 | if self.idle_timeout != other.idle_timeout: return False |
| 5369 | if self.hard_timeout != other.hard_timeout: return False |
| 5370 | if self.priority != other.priority: return False |
| 5371 | if self.buffer_id != other.buffer_id: return False |
| 5372 | if self.out_port != other.out_port: return False |
| 5373 | if self.flags != other.flags: return False |
| 5374 | if self.actions != other.actions: return False |
| 5375 | return True |
| 5376 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5377 | def pretty_print(self, q): |
| 5378 | q.text("flow_modify_strict {") |
| 5379 | with q.group(): |
| 5380 | with q.indent(2): |
| 5381 | q.breakable() |
| 5382 | q.text("xid = "); |
| 5383 | if self.xid != None: |
| 5384 | q.text("%#x" % self.xid) |
| 5385 | else: |
| 5386 | q.text('None') |
| 5387 | q.text(","); q.breakable() |
| 5388 | q.text("match = "); |
| 5389 | q.pp(self.match) |
| 5390 | q.text(","); q.breakable() |
| 5391 | q.text("cookie = "); |
| 5392 | q.text("%#x" % self.cookie) |
| 5393 | q.text(","); q.breakable() |
| 5394 | q.text("idle_timeout = "); |
| 5395 | q.text("%#x" % self.idle_timeout) |
| 5396 | q.text(","); q.breakable() |
| 5397 | q.text("hard_timeout = "); |
| 5398 | q.text("%#x" % self.hard_timeout) |
| 5399 | q.text(","); q.breakable() |
| 5400 | q.text("priority = "); |
| 5401 | q.text("%#x" % self.priority) |
| 5402 | q.text(","); q.breakable() |
| 5403 | q.text("buffer_id = "); |
| 5404 | q.text("%#x" % self.buffer_id) |
| 5405 | q.text(","); q.breakable() |
| 5406 | q.text("out_port = "); |
| 5407 | q.text(util.pretty_port(self.out_port)) |
| 5408 | q.text(","); q.breakable() |
| 5409 | q.text("flags = "); |
| 5410 | q.text("%#x" % self.flags) |
| 5411 | q.text(","); q.breakable() |
| 5412 | q.text("actions = "); |
| 5413 | q.pp(self.actions) |
| 5414 | q.breakable() |
| 5415 | q.text('}') |
| 5416 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5417 | flow_mod.subtypes[2] = flow_modify_strict |
| 5418 | |
| 5419 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5420 | version = 1 |
| 5421 | type = 11 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5422 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5423 | def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5424 | if xid != None: |
| 5425 | self.xid = xid |
| 5426 | else: |
| 5427 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5428 | if match != None: |
| 5429 | self.match = match |
| 5430 | else: |
| 5431 | self.match = common.match() |
| 5432 | if cookie != None: |
| 5433 | self.cookie = cookie |
| 5434 | else: |
| 5435 | self.cookie = 0 |
| 5436 | if priority != None: |
| 5437 | self.priority = priority |
| 5438 | else: |
| 5439 | self.priority = 0 |
| 5440 | if reason != None: |
| 5441 | self.reason = reason |
| 5442 | else: |
| 5443 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5444 | if duration_sec != None: |
| 5445 | self.duration_sec = duration_sec |
| 5446 | else: |
| 5447 | self.duration_sec = 0 |
| 5448 | if duration_nsec != None: |
| 5449 | self.duration_nsec = duration_nsec |
| 5450 | else: |
| 5451 | self.duration_nsec = 0 |
| 5452 | if idle_timeout != None: |
| 5453 | self.idle_timeout = idle_timeout |
| 5454 | else: |
| 5455 | self.idle_timeout = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5456 | if packet_count != None: |
| 5457 | self.packet_count = packet_count |
| 5458 | else: |
| 5459 | self.packet_count = 0 |
| 5460 | if byte_count != None: |
| 5461 | self.byte_count = byte_count |
| 5462 | else: |
| 5463 | self.byte_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5464 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5465 | |
| 5466 | def pack(self): |
| 5467 | packed = [] |
| 5468 | packed.append(struct.pack("!B", self.version)) |
| 5469 | packed.append(struct.pack("!B", self.type)) |
| 5470 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5471 | packed.append(struct.pack("!L", self.xid)) |
| 5472 | packed.append(self.match.pack()) |
| 5473 | packed.append(struct.pack("!Q", self.cookie)) |
| 5474 | packed.append(struct.pack("!H", self.priority)) |
| 5475 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5476 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5477 | packed.append(struct.pack("!L", self.duration_sec)) |
| 5478 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 5479 | packed.append(struct.pack("!H", self.idle_timeout)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5480 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5481 | packed.append(struct.pack("!Q", self.packet_count)) |
| 5482 | packed.append(struct.pack("!Q", self.byte_count)) |
| 5483 | length = sum([len(x) for x in packed]) |
| 5484 | packed[2] = struct.pack("!H", length) |
| 5485 | return ''.join(packed) |
| 5486 | |
| 5487 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5488 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5489 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5490 | _version = reader.read("!B")[0] |
| 5491 | assert(_version == 1) |
| 5492 | _type = reader.read("!B")[0] |
| 5493 | assert(_type == 11) |
| 5494 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5495 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5496 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5497 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5498 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5499 | obj.cookie = reader.read("!Q")[0] |
| 5500 | obj.priority = reader.read("!H")[0] |
| 5501 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5502 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5503 | obj.duration_sec = reader.read("!L")[0] |
| 5504 | obj.duration_nsec = reader.read("!L")[0] |
| 5505 | obj.idle_timeout = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5506 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5507 | obj.packet_count = reader.read("!Q")[0] |
| 5508 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5509 | return obj |
| 5510 | |
| 5511 | def __eq__(self, other): |
| 5512 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5513 | if self.xid != other.xid: return False |
| 5514 | if self.match != other.match: return False |
| 5515 | if self.cookie != other.cookie: return False |
| 5516 | if self.priority != other.priority: return False |
| 5517 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5518 | if self.duration_sec != other.duration_sec: return False |
| 5519 | if self.duration_nsec != other.duration_nsec: return False |
| 5520 | if self.idle_timeout != other.idle_timeout: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5521 | if self.packet_count != other.packet_count: return False |
| 5522 | if self.byte_count != other.byte_count: return False |
| 5523 | return True |
| 5524 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5525 | def pretty_print(self, q): |
| 5526 | q.text("flow_removed {") |
| 5527 | with q.group(): |
| 5528 | with q.indent(2): |
| 5529 | q.breakable() |
| 5530 | q.text("xid = "); |
| 5531 | if self.xid != None: |
| 5532 | q.text("%#x" % self.xid) |
| 5533 | else: |
| 5534 | q.text('None') |
| 5535 | q.text(","); q.breakable() |
| 5536 | q.text("match = "); |
| 5537 | q.pp(self.match) |
| 5538 | q.text(","); q.breakable() |
| 5539 | q.text("cookie = "); |
| 5540 | q.text("%#x" % self.cookie) |
| 5541 | q.text(","); q.breakable() |
| 5542 | q.text("priority = "); |
| 5543 | q.text("%#x" % self.priority) |
| 5544 | q.text(","); q.breakable() |
| 5545 | q.text("reason = "); |
| 5546 | q.text("%#x" % self.reason) |
| 5547 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5548 | q.text("duration_sec = "); |
| 5549 | q.text("%#x" % self.duration_sec) |
| 5550 | q.text(","); q.breakable() |
| 5551 | q.text("duration_nsec = "); |
| 5552 | q.text("%#x" % self.duration_nsec) |
| 5553 | q.text(","); q.breakable() |
| 5554 | q.text("idle_timeout = "); |
| 5555 | q.text("%#x" % self.idle_timeout) |
| 5556 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5557 | q.text("packet_count = "); |
| 5558 | q.text("%#x" % self.packet_count) |
| 5559 | q.text(","); q.breakable() |
| 5560 | q.text("byte_count = "); |
| 5561 | q.text("%#x" % self.byte_count) |
| 5562 | q.breakable() |
| 5563 | q.text('}') |
| 5564 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5565 | message.subtypes[11] = flow_removed |
| 5566 | |
| 5567 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5568 | version = 1 |
| 5569 | type = 17 |
| 5570 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5571 | |
| 5572 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5573 | if xid != None: |
| 5574 | self.xid = xid |
| 5575 | else: |
| 5576 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5577 | if flags != None: |
| 5578 | self.flags = flags |
| 5579 | else: |
| 5580 | self.flags = 0 |
| 5581 | if entries != None: |
| 5582 | self.entries = entries |
| 5583 | else: |
| 5584 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5585 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5586 | |
| 5587 | def pack(self): |
| 5588 | packed = [] |
| 5589 | packed.append(struct.pack("!B", self.version)) |
| 5590 | packed.append(struct.pack("!B", self.type)) |
| 5591 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5592 | packed.append(struct.pack("!L", self.xid)) |
| 5593 | packed.append(struct.pack("!H", self.stats_type)) |
| 5594 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5595 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5596 | length = sum([len(x) for x in packed]) |
| 5597 | packed[2] = struct.pack("!H", length) |
| 5598 | return ''.join(packed) |
| 5599 | |
| 5600 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5601 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5602 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5603 | _version = reader.read("!B")[0] |
| 5604 | assert(_version == 1) |
| 5605 | _type = reader.read("!B")[0] |
| 5606 | assert(_type == 17) |
| 5607 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5608 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5609 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5610 | obj.xid = reader.read("!L")[0] |
| 5611 | _stats_type = reader.read("!H")[0] |
| 5612 | assert(_stats_type == 1) |
| 5613 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5614 | obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5615 | return obj |
| 5616 | |
| 5617 | def __eq__(self, other): |
| 5618 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5619 | if self.xid != other.xid: return False |
| 5620 | if self.flags != other.flags: return False |
| 5621 | if self.entries != other.entries: return False |
| 5622 | return True |
| 5623 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5624 | def pretty_print(self, q): |
| 5625 | q.text("flow_stats_reply {") |
| 5626 | with q.group(): |
| 5627 | with q.indent(2): |
| 5628 | q.breakable() |
| 5629 | q.text("xid = "); |
| 5630 | if self.xid != None: |
| 5631 | q.text("%#x" % self.xid) |
| 5632 | else: |
| 5633 | q.text('None') |
| 5634 | q.text(","); q.breakable() |
| 5635 | q.text("flags = "); |
| 5636 | q.text("%#x" % self.flags) |
| 5637 | q.text(","); q.breakable() |
| 5638 | q.text("entries = "); |
| 5639 | q.pp(self.entries) |
| 5640 | q.breakable() |
| 5641 | q.text('}') |
| 5642 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5643 | stats_reply.subtypes[1] = flow_stats_reply |
| 5644 | |
| 5645 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5646 | version = 1 |
| 5647 | type = 16 |
| 5648 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5649 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5650 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5651 | if xid != None: |
| 5652 | self.xid = xid |
| 5653 | else: |
| 5654 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5655 | if flags != None: |
| 5656 | self.flags = flags |
| 5657 | else: |
| 5658 | self.flags = 0 |
| 5659 | if match != None: |
| 5660 | self.match = match |
| 5661 | else: |
| 5662 | self.match = common.match() |
| 5663 | if table_id != None: |
| 5664 | self.table_id = table_id |
| 5665 | else: |
| 5666 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5667 | if out_port != None: |
| 5668 | self.out_port = out_port |
| 5669 | else: |
| 5670 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5671 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5672 | |
| 5673 | def pack(self): |
| 5674 | packed = [] |
| 5675 | packed.append(struct.pack("!B", self.version)) |
| 5676 | packed.append(struct.pack("!B", self.type)) |
| 5677 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5678 | packed.append(struct.pack("!L", self.xid)) |
| 5679 | packed.append(struct.pack("!H", self.stats_type)) |
| 5680 | packed.append(struct.pack("!H", self.flags)) |
| 5681 | packed.append(self.match.pack()) |
| 5682 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5683 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5684 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5685 | length = sum([len(x) for x in packed]) |
| 5686 | packed[2] = struct.pack("!H", length) |
| 5687 | return ''.join(packed) |
| 5688 | |
| 5689 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5690 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5691 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5692 | _version = reader.read("!B")[0] |
| 5693 | assert(_version == 1) |
| 5694 | _type = reader.read("!B")[0] |
| 5695 | assert(_type == 16) |
| 5696 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5697 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5698 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5699 | obj.xid = reader.read("!L")[0] |
| 5700 | _stats_type = reader.read("!H")[0] |
| 5701 | assert(_stats_type == 1) |
| 5702 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5703 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5704 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5705 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5706 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5707 | return obj |
| 5708 | |
| 5709 | def __eq__(self, other): |
| 5710 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5711 | if self.xid != other.xid: return False |
| 5712 | if self.flags != other.flags: return False |
| 5713 | if self.match != other.match: return False |
| 5714 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5715 | if self.out_port != other.out_port: return False |
| 5716 | return True |
| 5717 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5718 | def pretty_print(self, q): |
| 5719 | q.text("flow_stats_request {") |
| 5720 | with q.group(): |
| 5721 | with q.indent(2): |
| 5722 | q.breakable() |
| 5723 | q.text("xid = "); |
| 5724 | if self.xid != None: |
| 5725 | q.text("%#x" % self.xid) |
| 5726 | else: |
| 5727 | q.text('None') |
| 5728 | q.text(","); q.breakable() |
| 5729 | q.text("flags = "); |
| 5730 | q.text("%#x" % self.flags) |
| 5731 | q.text(","); q.breakable() |
| 5732 | q.text("match = "); |
| 5733 | q.pp(self.match) |
| 5734 | q.text(","); q.breakable() |
| 5735 | q.text("table_id = "); |
| 5736 | q.text("%#x" % self.table_id) |
| 5737 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5738 | q.text("out_port = "); |
| 5739 | q.text(util.pretty_port(self.out_port)) |
| 5740 | q.breakable() |
| 5741 | q.text('}') |
| 5742 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5743 | stats_request.subtypes[1] = flow_stats_request |
| 5744 | |
| 5745 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5746 | version = 1 |
| 5747 | type = 8 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5748 | |
| 5749 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5750 | if xid != None: |
| 5751 | self.xid = xid |
| 5752 | else: |
| 5753 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5754 | if flags != None: |
| 5755 | self.flags = flags |
| 5756 | else: |
| 5757 | self.flags = 0 |
| 5758 | if miss_send_len != None: |
| 5759 | self.miss_send_len = miss_send_len |
| 5760 | else: |
| 5761 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5762 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5763 | |
| 5764 | def pack(self): |
| 5765 | packed = [] |
| 5766 | packed.append(struct.pack("!B", self.version)) |
| 5767 | packed.append(struct.pack("!B", self.type)) |
| 5768 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5769 | packed.append(struct.pack("!L", self.xid)) |
| 5770 | packed.append(struct.pack("!H", self.flags)) |
| 5771 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 5772 | length = sum([len(x) for x in packed]) |
| 5773 | packed[2] = struct.pack("!H", length) |
| 5774 | return ''.join(packed) |
| 5775 | |
| 5776 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5777 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5778 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5779 | _version = reader.read("!B")[0] |
| 5780 | assert(_version == 1) |
| 5781 | _type = reader.read("!B")[0] |
| 5782 | assert(_type == 8) |
| 5783 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5784 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5785 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5786 | obj.xid = reader.read("!L")[0] |
| 5787 | obj.flags = reader.read("!H")[0] |
| 5788 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5789 | return obj |
| 5790 | |
| 5791 | def __eq__(self, other): |
| 5792 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5793 | if self.xid != other.xid: return False |
| 5794 | if self.flags != other.flags: return False |
| 5795 | if self.miss_send_len != other.miss_send_len: return False |
| 5796 | return True |
| 5797 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5798 | def pretty_print(self, q): |
| 5799 | q.text("get_config_reply {") |
| 5800 | with q.group(): |
| 5801 | with q.indent(2): |
| 5802 | q.breakable() |
| 5803 | q.text("xid = "); |
| 5804 | if self.xid != None: |
| 5805 | q.text("%#x" % self.xid) |
| 5806 | else: |
| 5807 | q.text('None') |
| 5808 | q.text(","); q.breakable() |
| 5809 | q.text("flags = "); |
| 5810 | q.text("%#x" % self.flags) |
| 5811 | q.text(","); q.breakable() |
| 5812 | q.text("miss_send_len = "); |
| 5813 | q.text("%#x" % self.miss_send_len) |
| 5814 | q.breakable() |
| 5815 | q.text('}') |
| 5816 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5817 | message.subtypes[8] = get_config_reply |
| 5818 | |
| 5819 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5820 | version = 1 |
| 5821 | type = 7 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5822 | |
| 5823 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5824 | if xid != None: |
| 5825 | self.xid = xid |
| 5826 | else: |
| 5827 | self.xid = None |
| 5828 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5829 | |
| 5830 | def pack(self): |
| 5831 | packed = [] |
| 5832 | packed.append(struct.pack("!B", self.version)) |
| 5833 | packed.append(struct.pack("!B", self.type)) |
| 5834 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5835 | packed.append(struct.pack("!L", self.xid)) |
| 5836 | length = sum([len(x) for x in packed]) |
| 5837 | packed[2] = struct.pack("!H", length) |
| 5838 | return ''.join(packed) |
| 5839 | |
| 5840 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5841 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5842 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5843 | _version = reader.read("!B")[0] |
| 5844 | assert(_version == 1) |
| 5845 | _type = reader.read("!B")[0] |
| 5846 | assert(_type == 7) |
| 5847 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5848 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5849 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5850 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5851 | return obj |
| 5852 | |
| 5853 | def __eq__(self, other): |
| 5854 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5855 | if self.xid != other.xid: return False |
| 5856 | return True |
| 5857 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5858 | def pretty_print(self, q): |
| 5859 | q.text("get_config_request {") |
| 5860 | with q.group(): |
| 5861 | with q.indent(2): |
| 5862 | q.breakable() |
| 5863 | q.text("xid = "); |
| 5864 | if self.xid != None: |
| 5865 | q.text("%#x" % self.xid) |
| 5866 | else: |
| 5867 | q.text('None') |
| 5868 | q.breakable() |
| 5869 | q.text('}') |
| 5870 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5871 | message.subtypes[7] = get_config_request |
| 5872 | |
| 5873 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5874 | version = 1 |
| 5875 | type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5876 | |
| 5877 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5878 | if xid != None: |
| 5879 | self.xid = xid |
| 5880 | else: |
| 5881 | self.xid = None |
| 5882 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5883 | |
| 5884 | def pack(self): |
| 5885 | packed = [] |
| 5886 | packed.append(struct.pack("!B", self.version)) |
| 5887 | packed.append(struct.pack("!B", self.type)) |
| 5888 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5889 | packed.append(struct.pack("!L", self.xid)) |
| 5890 | length = sum([len(x) for x in packed]) |
| 5891 | packed[2] = struct.pack("!H", length) |
| 5892 | return ''.join(packed) |
| 5893 | |
| 5894 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5895 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5896 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5897 | _version = reader.read("!B")[0] |
| 5898 | assert(_version == 1) |
| 5899 | _type = reader.read("!B")[0] |
| 5900 | assert(_type == 0) |
| 5901 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5902 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5903 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5904 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5905 | return obj |
| 5906 | |
| 5907 | def __eq__(self, other): |
| 5908 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5909 | if self.xid != other.xid: return False |
| 5910 | return True |
| 5911 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5912 | def pretty_print(self, q): |
| 5913 | q.text("hello {") |
| 5914 | with q.group(): |
| 5915 | with q.indent(2): |
| 5916 | q.breakable() |
| 5917 | q.text("xid = "); |
| 5918 | if self.xid != None: |
| 5919 | q.text("%#x" % self.xid) |
| 5920 | else: |
| 5921 | q.text('None') |
| 5922 | q.breakable() |
| 5923 | q.text('}') |
| 5924 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5925 | message.subtypes[0] = hello |
| 5926 | |
| 5927 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5928 | version = 1 |
| 5929 | type = 1 |
| 5930 | err_type = 0 |
| 5931 | |
| 5932 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5933 | if xid != None: |
| 5934 | self.xid = xid |
| 5935 | else: |
| 5936 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5937 | if code != None: |
| 5938 | self.code = code |
| 5939 | else: |
| 5940 | self.code = 0 |
| 5941 | if data != None: |
| 5942 | self.data = data |
| 5943 | else: |
| 5944 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5945 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5946 | |
| 5947 | def pack(self): |
| 5948 | packed = [] |
| 5949 | packed.append(struct.pack("!B", self.version)) |
| 5950 | packed.append(struct.pack("!B", self.type)) |
| 5951 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5952 | packed.append(struct.pack("!L", self.xid)) |
| 5953 | packed.append(struct.pack("!H", self.err_type)) |
| 5954 | packed.append(struct.pack("!H", self.code)) |
| 5955 | packed.append(self.data) |
| 5956 | length = sum([len(x) for x in packed]) |
| 5957 | packed[2] = struct.pack("!H", length) |
| 5958 | return ''.join(packed) |
| 5959 | |
| 5960 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5961 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5962 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5963 | _version = reader.read("!B")[0] |
| 5964 | assert(_version == 1) |
| 5965 | _type = reader.read("!B")[0] |
| 5966 | assert(_type == 1) |
| 5967 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5968 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 5969 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5970 | obj.xid = reader.read("!L")[0] |
| 5971 | _err_type = reader.read("!H")[0] |
| 5972 | assert(_err_type == 0) |
| 5973 | obj.code = reader.read("!H")[0] |
| 5974 | obj.data = str(reader.read_all()) |
| 5975 | return obj |
| 5976 | |
| 5977 | def __eq__(self, other): |
| 5978 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5979 | if self.xid != other.xid: return False |
| 5980 | if self.code != other.code: return False |
| 5981 | if self.data != other.data: return False |
| 5982 | return True |
| 5983 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5984 | def pretty_print(self, q): |
| 5985 | q.text("hello_failed_error_msg {") |
| 5986 | with q.group(): |
| 5987 | with q.indent(2): |
| 5988 | q.breakable() |
| 5989 | q.text("xid = "); |
| 5990 | if self.xid != None: |
| 5991 | q.text("%#x" % self.xid) |
| 5992 | else: |
| 5993 | q.text('None') |
| 5994 | q.text(","); q.breakable() |
| 5995 | q.text("code = "); |
| 5996 | q.text("%#x" % self.code) |
| 5997 | q.text(","); q.breakable() |
| 5998 | q.text("data = "); |
| 5999 | q.pp(self.data) |
| 6000 | q.breakable() |
| 6001 | q.text('}') |
| 6002 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6003 | error_msg.subtypes[0] = hello_failed_error_msg |
| 6004 | |
| 6005 | class nicira_header(experimenter): |
| 6006 | subtypes = {} |
| 6007 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6008 | version = 1 |
| 6009 | type = 4 |
| 6010 | experimenter = 8992 |
| 6011 | |
| 6012 | def __init__(self, xid=None, subtype=None): |
| 6013 | if xid != None: |
| 6014 | self.xid = xid |
| 6015 | else: |
| 6016 | self.xid = None |
| 6017 | if subtype != None: |
| 6018 | self.subtype = subtype |
| 6019 | else: |
| 6020 | self.subtype = 0 |
| 6021 | return |
| 6022 | |
| 6023 | def pack(self): |
| 6024 | packed = [] |
| 6025 | packed.append(struct.pack("!B", self.version)) |
| 6026 | packed.append(struct.pack("!B", self.type)) |
| 6027 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6028 | packed.append(struct.pack("!L", self.xid)) |
| 6029 | packed.append(struct.pack("!L", self.experimenter)) |
| 6030 | packed.append(struct.pack("!L", self.subtype)) |
| 6031 | length = sum([len(x) for x in packed]) |
| 6032 | packed[2] = struct.pack("!H", length) |
| 6033 | return ''.join(packed) |
| 6034 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6035 | @staticmethod |
| 6036 | def unpack(reader): |
| 6037 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6038 | subclass = nicira_header.subtypes.get(subtype) |
| 6039 | if subclass: |
| 6040 | return subclass.unpack(reader) |
| 6041 | |
| 6042 | obj = nicira_header() |
| 6043 | _version = reader.read("!B")[0] |
| 6044 | assert(_version == 1) |
| 6045 | _type = reader.read("!B")[0] |
| 6046 | assert(_type == 4) |
| 6047 | _length = reader.read("!H")[0] |
| 6048 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6049 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6050 | obj.xid = reader.read("!L")[0] |
| 6051 | _experimenter = reader.read("!L")[0] |
| 6052 | assert(_experimenter == 8992) |
| 6053 | obj.subtype = reader.read("!L")[0] |
| 6054 | return obj |
| 6055 | |
| 6056 | def __eq__(self, other): |
| 6057 | if type(self) != type(other): return False |
| 6058 | if self.xid != other.xid: return False |
| 6059 | if self.subtype != other.subtype: return False |
| 6060 | return True |
| 6061 | |
| 6062 | def pretty_print(self, q): |
| 6063 | q.text("nicira_header {") |
| 6064 | with q.group(): |
| 6065 | with q.indent(2): |
| 6066 | q.breakable() |
| 6067 | q.text("xid = "); |
| 6068 | if self.xid != None: |
| 6069 | q.text("%#x" % self.xid) |
| 6070 | else: |
| 6071 | q.text('None') |
| 6072 | q.breakable() |
| 6073 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6074 | |
| 6075 | experimenter.subtypes[8992] = nicira_header |
| 6076 | |
| 6077 | class nicira_controller_role_reply(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6078 | version = 1 |
| 6079 | type = 4 |
| 6080 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6081 | subtype = 11 |
| 6082 | |
| 6083 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6084 | if xid != None: |
| 6085 | self.xid = xid |
| 6086 | else: |
| 6087 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6088 | if role != None: |
| 6089 | self.role = role |
| 6090 | else: |
| 6091 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6092 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6093 | |
| 6094 | def pack(self): |
| 6095 | packed = [] |
| 6096 | packed.append(struct.pack("!B", self.version)) |
| 6097 | packed.append(struct.pack("!B", self.type)) |
| 6098 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6099 | packed.append(struct.pack("!L", self.xid)) |
| 6100 | packed.append(struct.pack("!L", self.experimenter)) |
| 6101 | packed.append(struct.pack("!L", self.subtype)) |
| 6102 | packed.append(struct.pack("!L", self.role)) |
| 6103 | length = sum([len(x) for x in packed]) |
| 6104 | packed[2] = struct.pack("!H", length) |
| 6105 | return ''.join(packed) |
| 6106 | |
| 6107 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6108 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6109 | obj = nicira_controller_role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6110 | _version = reader.read("!B")[0] |
| 6111 | assert(_version == 1) |
| 6112 | _type = reader.read("!B")[0] |
| 6113 | assert(_type == 4) |
| 6114 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6115 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6116 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6117 | obj.xid = reader.read("!L")[0] |
| 6118 | _experimenter = reader.read("!L")[0] |
| 6119 | assert(_experimenter == 8992) |
| 6120 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6121 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6122 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6123 | return obj |
| 6124 | |
| 6125 | def __eq__(self, other): |
| 6126 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6127 | if self.xid != other.xid: return False |
| 6128 | if self.role != other.role: return False |
| 6129 | return True |
| 6130 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6131 | def pretty_print(self, q): |
| 6132 | q.text("nicira_controller_role_reply {") |
| 6133 | with q.group(): |
| 6134 | with q.indent(2): |
| 6135 | q.breakable() |
| 6136 | q.text("xid = "); |
| 6137 | if self.xid != None: |
| 6138 | q.text("%#x" % self.xid) |
| 6139 | else: |
| 6140 | q.text('None') |
| 6141 | q.text(","); q.breakable() |
| 6142 | q.text("role = "); |
| 6143 | q.text("%#x" % self.role) |
| 6144 | q.breakable() |
| 6145 | q.text('}') |
| 6146 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6147 | nicira_header.subtypes[11] = nicira_controller_role_reply |
| 6148 | |
| 6149 | class nicira_controller_role_request(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6150 | version = 1 |
| 6151 | type = 4 |
| 6152 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6153 | subtype = 10 |
| 6154 | |
| 6155 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6156 | if xid != None: |
| 6157 | self.xid = xid |
| 6158 | else: |
| 6159 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6160 | if role != None: |
| 6161 | self.role = role |
| 6162 | else: |
| 6163 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6164 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6165 | |
| 6166 | def pack(self): |
| 6167 | packed = [] |
| 6168 | packed.append(struct.pack("!B", self.version)) |
| 6169 | packed.append(struct.pack("!B", self.type)) |
| 6170 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6171 | packed.append(struct.pack("!L", self.xid)) |
| 6172 | packed.append(struct.pack("!L", self.experimenter)) |
| 6173 | packed.append(struct.pack("!L", self.subtype)) |
| 6174 | packed.append(struct.pack("!L", self.role)) |
| 6175 | length = sum([len(x) for x in packed]) |
| 6176 | packed[2] = struct.pack("!H", length) |
| 6177 | return ''.join(packed) |
| 6178 | |
| 6179 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6180 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6181 | obj = nicira_controller_role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6182 | _version = reader.read("!B")[0] |
| 6183 | assert(_version == 1) |
| 6184 | _type = reader.read("!B")[0] |
| 6185 | assert(_type == 4) |
| 6186 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6187 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6188 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6189 | obj.xid = reader.read("!L")[0] |
| 6190 | _experimenter = reader.read("!L")[0] |
| 6191 | assert(_experimenter == 8992) |
| 6192 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6193 | assert(_subtype == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6194 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6195 | return obj |
| 6196 | |
| 6197 | def __eq__(self, other): |
| 6198 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6199 | if self.xid != other.xid: return False |
| 6200 | if self.role != other.role: return False |
| 6201 | return True |
| 6202 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6203 | def pretty_print(self, q): |
| 6204 | q.text("nicira_controller_role_request {") |
| 6205 | with q.group(): |
| 6206 | with q.indent(2): |
| 6207 | q.breakable() |
| 6208 | q.text("xid = "); |
| 6209 | if self.xid != None: |
| 6210 | q.text("%#x" % self.xid) |
| 6211 | else: |
| 6212 | q.text('None') |
| 6213 | q.text(","); q.breakable() |
| 6214 | q.text("role = "); |
| 6215 | q.text("%#x" % self.role) |
| 6216 | q.breakable() |
| 6217 | q.text('}') |
| 6218 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6219 | nicira_header.subtypes[10] = nicira_controller_role_request |
| 6220 | |
| 6221 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6222 | version = 1 |
| 6223 | type = 10 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6224 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6225 | def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6226 | if xid != None: |
| 6227 | self.xid = xid |
| 6228 | else: |
| 6229 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6230 | if buffer_id != None: |
| 6231 | self.buffer_id = buffer_id |
| 6232 | else: |
| 6233 | self.buffer_id = 0 |
| 6234 | if total_len != None: |
| 6235 | self.total_len = total_len |
| 6236 | else: |
| 6237 | self.total_len = 0 |
| 6238 | if in_port != None: |
| 6239 | self.in_port = in_port |
| 6240 | else: |
| 6241 | self.in_port = 0 |
| 6242 | if reason != None: |
| 6243 | self.reason = reason |
| 6244 | else: |
| 6245 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6246 | if data != None: |
| 6247 | self.data = data |
| 6248 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6249 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6250 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6251 | |
| 6252 | def pack(self): |
| 6253 | packed = [] |
| 6254 | packed.append(struct.pack("!B", self.version)) |
| 6255 | packed.append(struct.pack("!B", self.type)) |
| 6256 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6257 | packed.append(struct.pack("!L", self.xid)) |
| 6258 | packed.append(struct.pack("!L", self.buffer_id)) |
| 6259 | packed.append(struct.pack("!H", self.total_len)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6260 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6261 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6262 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6263 | packed.append(self.data) |
| 6264 | length = sum([len(x) for x in packed]) |
| 6265 | packed[2] = struct.pack("!H", length) |
| 6266 | return ''.join(packed) |
| 6267 | |
| 6268 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6269 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6270 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6271 | _version = reader.read("!B")[0] |
| 6272 | assert(_version == 1) |
| 6273 | _type = reader.read("!B")[0] |
| 6274 | assert(_type == 10) |
| 6275 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6276 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6277 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6278 | obj.xid = reader.read("!L")[0] |
| 6279 | obj.buffer_id = reader.read("!L")[0] |
| 6280 | obj.total_len = reader.read("!H")[0] |
| 6281 | obj.in_port = util.unpack_port_no(reader) |
| 6282 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6283 | reader.skip(1) |
| 6284 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6285 | return obj |
| 6286 | |
| 6287 | def __eq__(self, other): |
| 6288 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6289 | if self.xid != other.xid: return False |
| 6290 | if self.buffer_id != other.buffer_id: return False |
| 6291 | if self.total_len != other.total_len: return False |
| 6292 | if self.in_port != other.in_port: return False |
| 6293 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6294 | if self.data != other.data: return False |
| 6295 | return True |
| 6296 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6297 | def pretty_print(self, q): |
| 6298 | q.text("packet_in {") |
| 6299 | with q.group(): |
| 6300 | with q.indent(2): |
| 6301 | q.breakable() |
| 6302 | q.text("xid = "); |
| 6303 | if self.xid != None: |
| 6304 | q.text("%#x" % self.xid) |
| 6305 | else: |
| 6306 | q.text('None') |
| 6307 | q.text(","); q.breakable() |
| 6308 | q.text("buffer_id = "); |
| 6309 | q.text("%#x" % self.buffer_id) |
| 6310 | q.text(","); q.breakable() |
| 6311 | q.text("total_len = "); |
| 6312 | q.text("%#x" % self.total_len) |
| 6313 | q.text(","); q.breakable() |
| 6314 | q.text("in_port = "); |
| 6315 | q.text(util.pretty_port(self.in_port)) |
| 6316 | q.text(","); q.breakable() |
| 6317 | q.text("reason = "); |
| 6318 | q.text("%#x" % self.reason) |
| 6319 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6320 | q.text("data = "); |
| 6321 | q.pp(self.data) |
| 6322 | q.breakable() |
| 6323 | q.text('}') |
| 6324 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6325 | message.subtypes[10] = packet_in |
| 6326 | |
| 6327 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6328 | version = 1 |
| 6329 | type = 13 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6330 | |
| 6331 | 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] | 6332 | if xid != None: |
| 6333 | self.xid = xid |
| 6334 | else: |
| 6335 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6336 | if buffer_id != None: |
| 6337 | self.buffer_id = buffer_id |
| 6338 | else: |
Rich Lane | ff637c9 | 2013-04-04 13:57:09 -0700 | [diff] [blame] | 6339 | self.buffer_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6340 | if in_port != None: |
| 6341 | self.in_port = in_port |
| 6342 | else: |
| 6343 | self.in_port = 0 |
| 6344 | if actions != None: |
| 6345 | self.actions = actions |
| 6346 | else: |
| 6347 | self.actions = [] |
| 6348 | if data != None: |
| 6349 | self.data = data |
| 6350 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6351 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6352 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -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)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6358 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6359 | packed.append(struct.pack("!L", self.xid)) |
| 6360 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6361 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6362 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6363 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6364 | packed[6] = struct.pack("!H", len(packed[-1])) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6365 | packed.append(self.data) |
| 6366 | length = sum([len(x) for x in packed]) |
| 6367 | packed[2] = struct.pack("!H", length) |
| 6368 | return ''.join(packed) |
| 6369 | |
| 6370 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6371 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6372 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6373 | _version = reader.read("!B")[0] |
| 6374 | assert(_version == 1) |
| 6375 | _type = reader.read("!B")[0] |
| 6376 | assert(_type == 13) |
| 6377 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6378 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6379 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6380 | obj.xid = reader.read("!L")[0] |
| 6381 | obj.buffer_id = reader.read("!L")[0] |
| 6382 | obj.in_port = util.unpack_port_no(reader) |
| 6383 | _actions_len = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6384 | 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] | 6385 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6386 | return obj |
| 6387 | |
| 6388 | def __eq__(self, other): |
| 6389 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6390 | if self.xid != other.xid: return False |
| 6391 | if self.buffer_id != other.buffer_id: return False |
| 6392 | if self.in_port != other.in_port: return False |
| 6393 | if self.actions != other.actions: return False |
| 6394 | if self.data != other.data: return False |
| 6395 | return True |
| 6396 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6397 | def pretty_print(self, q): |
| 6398 | q.text("packet_out {") |
| 6399 | with q.group(): |
| 6400 | with q.indent(2): |
| 6401 | q.breakable() |
| 6402 | q.text("xid = "); |
| 6403 | if self.xid != None: |
| 6404 | q.text("%#x" % self.xid) |
| 6405 | else: |
| 6406 | q.text('None') |
| 6407 | q.text(","); q.breakable() |
| 6408 | q.text("buffer_id = "); |
| 6409 | q.text("%#x" % self.buffer_id) |
| 6410 | q.text(","); q.breakable() |
| 6411 | q.text("in_port = "); |
| 6412 | q.text(util.pretty_port(self.in_port)) |
| 6413 | q.text(","); q.breakable() |
| 6414 | q.text("actions = "); |
| 6415 | q.pp(self.actions) |
| 6416 | q.text(","); q.breakable() |
| 6417 | q.text("data = "); |
| 6418 | q.pp(self.data) |
| 6419 | q.breakable() |
| 6420 | q.text('}') |
| 6421 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6422 | message.subtypes[13] = packet_out |
| 6423 | |
| 6424 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6425 | version = 1 |
| 6426 | type = 15 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6427 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6428 | 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] | 6429 | if xid != None: |
| 6430 | self.xid = xid |
| 6431 | else: |
| 6432 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6433 | if port_no != None: |
| 6434 | self.port_no = port_no |
| 6435 | else: |
| 6436 | self.port_no = 0 |
| 6437 | if hw_addr != None: |
| 6438 | self.hw_addr = hw_addr |
| 6439 | else: |
| 6440 | self.hw_addr = [0,0,0,0,0,0] |
| 6441 | if config != None: |
| 6442 | self.config = config |
| 6443 | else: |
| 6444 | self.config = 0 |
| 6445 | if mask != None: |
| 6446 | self.mask = mask |
| 6447 | else: |
| 6448 | self.mask = 0 |
| 6449 | if advertise != None: |
| 6450 | self.advertise = advertise |
| 6451 | else: |
| 6452 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6453 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6454 | |
| 6455 | def pack(self): |
| 6456 | packed = [] |
| 6457 | packed.append(struct.pack("!B", self.version)) |
| 6458 | packed.append(struct.pack("!B", self.type)) |
| 6459 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6460 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6461 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6462 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6463 | packed.append(struct.pack("!L", self.config)) |
| 6464 | packed.append(struct.pack("!L", self.mask)) |
| 6465 | packed.append(struct.pack("!L", self.advertise)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6466 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6467 | length = sum([len(x) for x in packed]) |
| 6468 | packed[2] = struct.pack("!H", length) |
| 6469 | return ''.join(packed) |
| 6470 | |
| 6471 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6472 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6473 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6474 | _version = reader.read("!B")[0] |
| 6475 | assert(_version == 1) |
| 6476 | _type = reader.read("!B")[0] |
| 6477 | assert(_type == 15) |
| 6478 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6479 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6480 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6481 | obj.xid = reader.read("!L")[0] |
| 6482 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6483 | obj.hw_addr = list(reader.read('!6B')) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6484 | obj.config = reader.read("!L")[0] |
| 6485 | obj.mask = reader.read("!L")[0] |
| 6486 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6487 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6488 | return obj |
| 6489 | |
| 6490 | def __eq__(self, other): |
| 6491 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6492 | if self.xid != other.xid: return False |
| 6493 | if self.port_no != other.port_no: return False |
| 6494 | if self.hw_addr != other.hw_addr: return False |
| 6495 | if self.config != other.config: return False |
| 6496 | if self.mask != other.mask: return False |
| 6497 | if self.advertise != other.advertise: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6498 | return True |
| 6499 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6500 | def pretty_print(self, q): |
| 6501 | q.text("port_mod {") |
| 6502 | with q.group(): |
| 6503 | with q.indent(2): |
| 6504 | q.breakable() |
| 6505 | q.text("xid = "); |
| 6506 | if self.xid != None: |
| 6507 | q.text("%#x" % self.xid) |
| 6508 | else: |
| 6509 | q.text('None') |
| 6510 | q.text(","); q.breakable() |
| 6511 | q.text("port_no = "); |
| 6512 | q.text(util.pretty_port(self.port_no)) |
| 6513 | q.text(","); q.breakable() |
| 6514 | q.text("hw_addr = "); |
| 6515 | q.text(util.pretty_mac(self.hw_addr)) |
| 6516 | q.text(","); q.breakable() |
| 6517 | q.text("config = "); |
| 6518 | q.text("%#x" % self.config) |
| 6519 | q.text(","); q.breakable() |
| 6520 | q.text("mask = "); |
| 6521 | q.text("%#x" % self.mask) |
| 6522 | q.text(","); q.breakable() |
| 6523 | q.text("advertise = "); |
| 6524 | q.text("%#x" % self.advertise) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6525 | q.breakable() |
| 6526 | q.text('}') |
| 6527 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6528 | message.subtypes[15] = port_mod |
| 6529 | |
| 6530 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6531 | version = 1 |
| 6532 | type = 1 |
| 6533 | err_type = 4 |
| 6534 | |
| 6535 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6536 | if xid != None: |
| 6537 | self.xid = xid |
| 6538 | else: |
| 6539 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6540 | if code != None: |
| 6541 | self.code = code |
| 6542 | else: |
| 6543 | self.code = 0 |
| 6544 | if data != None: |
| 6545 | self.data = data |
| 6546 | else: |
| 6547 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6548 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6549 | |
| 6550 | def pack(self): |
| 6551 | packed = [] |
| 6552 | packed.append(struct.pack("!B", self.version)) |
| 6553 | packed.append(struct.pack("!B", self.type)) |
| 6554 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6555 | packed.append(struct.pack("!L", self.xid)) |
| 6556 | packed.append(struct.pack("!H", self.err_type)) |
| 6557 | packed.append(struct.pack("!H", self.code)) |
| 6558 | packed.append(self.data) |
| 6559 | length = sum([len(x) for x in packed]) |
| 6560 | packed[2] = struct.pack("!H", length) |
| 6561 | return ''.join(packed) |
| 6562 | |
| 6563 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6564 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6565 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6566 | _version = reader.read("!B")[0] |
| 6567 | assert(_version == 1) |
| 6568 | _type = reader.read("!B")[0] |
| 6569 | assert(_type == 1) |
| 6570 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6571 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6572 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6573 | obj.xid = reader.read("!L")[0] |
| 6574 | _err_type = reader.read("!H")[0] |
| 6575 | assert(_err_type == 4) |
| 6576 | obj.code = reader.read("!H")[0] |
| 6577 | obj.data = str(reader.read_all()) |
| 6578 | return obj |
| 6579 | |
| 6580 | def __eq__(self, other): |
| 6581 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6582 | if self.xid != other.xid: return False |
| 6583 | if self.code != other.code: return False |
| 6584 | if self.data != other.data: return False |
| 6585 | return True |
| 6586 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6587 | def pretty_print(self, q): |
| 6588 | q.text("port_mod_failed_error_msg {") |
| 6589 | with q.group(): |
| 6590 | with q.indent(2): |
| 6591 | q.breakable() |
| 6592 | q.text("xid = "); |
| 6593 | if self.xid != None: |
| 6594 | q.text("%#x" % self.xid) |
| 6595 | else: |
| 6596 | q.text('None') |
| 6597 | q.text(","); q.breakable() |
| 6598 | q.text("code = "); |
| 6599 | q.text("%#x" % self.code) |
| 6600 | q.text(","); q.breakable() |
| 6601 | q.text("data = "); |
| 6602 | q.pp(self.data) |
| 6603 | q.breakable() |
| 6604 | q.text('}') |
| 6605 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6606 | error_msg.subtypes[4] = port_mod_failed_error_msg |
| 6607 | |
| 6608 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6609 | version = 1 |
| 6610 | type = 17 |
| 6611 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6612 | |
| 6613 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6614 | if xid != None: |
| 6615 | self.xid = xid |
| 6616 | else: |
| 6617 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6618 | if flags != None: |
| 6619 | self.flags = flags |
| 6620 | else: |
| 6621 | self.flags = 0 |
| 6622 | if entries != None: |
| 6623 | self.entries = entries |
| 6624 | else: |
| 6625 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6626 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6627 | |
| 6628 | def pack(self): |
| 6629 | packed = [] |
| 6630 | packed.append(struct.pack("!B", self.version)) |
| 6631 | packed.append(struct.pack("!B", self.type)) |
| 6632 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6633 | packed.append(struct.pack("!L", self.xid)) |
| 6634 | packed.append(struct.pack("!H", self.stats_type)) |
| 6635 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6636 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6637 | length = sum([len(x) for x in packed]) |
| 6638 | packed[2] = struct.pack("!H", length) |
| 6639 | return ''.join(packed) |
| 6640 | |
| 6641 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6642 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6643 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6644 | _version = reader.read("!B")[0] |
| 6645 | assert(_version == 1) |
| 6646 | _type = reader.read("!B")[0] |
| 6647 | assert(_type == 17) |
| 6648 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6650 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6651 | obj.xid = reader.read("!L")[0] |
| 6652 | _stats_type = reader.read("!H")[0] |
| 6653 | assert(_stats_type == 4) |
| 6654 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6655 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6656 | return obj |
| 6657 | |
| 6658 | def __eq__(self, other): |
| 6659 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6660 | if self.xid != other.xid: return False |
| 6661 | if self.flags != other.flags: return False |
| 6662 | if self.entries != other.entries: return False |
| 6663 | return True |
| 6664 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6665 | def pretty_print(self, q): |
| 6666 | q.text("port_stats_reply {") |
| 6667 | with q.group(): |
| 6668 | with q.indent(2): |
| 6669 | q.breakable() |
| 6670 | q.text("xid = "); |
| 6671 | if self.xid != None: |
| 6672 | q.text("%#x" % self.xid) |
| 6673 | else: |
| 6674 | q.text('None') |
| 6675 | q.text(","); q.breakable() |
| 6676 | q.text("flags = "); |
| 6677 | q.text("%#x" % self.flags) |
| 6678 | q.text(","); q.breakable() |
| 6679 | q.text("entries = "); |
| 6680 | q.pp(self.entries) |
| 6681 | q.breakable() |
| 6682 | q.text('}') |
| 6683 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6684 | stats_reply.subtypes[4] = port_stats_reply |
| 6685 | |
| 6686 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6687 | version = 1 |
| 6688 | type = 16 |
| 6689 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6690 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6691 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6692 | if xid != None: |
| 6693 | self.xid = xid |
| 6694 | else: |
| 6695 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6696 | if flags != None: |
| 6697 | self.flags = flags |
| 6698 | else: |
| 6699 | self.flags = 0 |
| 6700 | if port_no != None: |
| 6701 | self.port_no = port_no |
| 6702 | else: |
| 6703 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6704 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6705 | |
| 6706 | def pack(self): |
| 6707 | packed = [] |
| 6708 | packed.append(struct.pack("!B", self.version)) |
| 6709 | packed.append(struct.pack("!B", self.type)) |
| 6710 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6711 | packed.append(struct.pack("!L", self.xid)) |
| 6712 | packed.append(struct.pack("!H", self.stats_type)) |
| 6713 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6714 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6715 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6716 | length = sum([len(x) for x in packed]) |
| 6717 | packed[2] = struct.pack("!H", length) |
| 6718 | return ''.join(packed) |
| 6719 | |
| 6720 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6721 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6722 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6723 | _version = reader.read("!B")[0] |
| 6724 | assert(_version == 1) |
| 6725 | _type = reader.read("!B")[0] |
| 6726 | assert(_type == 16) |
| 6727 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6728 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6729 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6730 | obj.xid = reader.read("!L")[0] |
| 6731 | _stats_type = reader.read("!H")[0] |
| 6732 | assert(_stats_type == 4) |
| 6733 | obj.flags = reader.read("!H")[0] |
| 6734 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6735 | reader.skip(6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6736 | return obj |
| 6737 | |
| 6738 | def __eq__(self, other): |
| 6739 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6740 | if self.xid != other.xid: return False |
| 6741 | if self.flags != other.flags: return False |
| 6742 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6743 | return True |
| 6744 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6745 | def pretty_print(self, q): |
| 6746 | q.text("port_stats_request {") |
| 6747 | with q.group(): |
| 6748 | with q.indent(2): |
| 6749 | q.breakable() |
| 6750 | q.text("xid = "); |
| 6751 | if self.xid != None: |
| 6752 | q.text("%#x" % self.xid) |
| 6753 | else: |
| 6754 | q.text('None') |
| 6755 | q.text(","); q.breakable() |
| 6756 | q.text("flags = "); |
| 6757 | q.text("%#x" % self.flags) |
| 6758 | q.text(","); q.breakable() |
| 6759 | q.text("port_no = "); |
| 6760 | q.text(util.pretty_port(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6761 | q.breakable() |
| 6762 | q.text('}') |
| 6763 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6764 | stats_request.subtypes[4] = port_stats_request |
| 6765 | |
| 6766 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6767 | version = 1 |
| 6768 | type = 12 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6769 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6770 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6771 | if xid != None: |
| 6772 | self.xid = xid |
| 6773 | else: |
| 6774 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6775 | if reason != None: |
| 6776 | self.reason = reason |
| 6777 | else: |
| 6778 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6779 | if desc != None: |
| 6780 | self.desc = desc |
| 6781 | else: |
| 6782 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6783 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6784 | |
| 6785 | def pack(self): |
| 6786 | packed = [] |
| 6787 | packed.append(struct.pack("!B", self.version)) |
| 6788 | packed.append(struct.pack("!B", self.type)) |
| 6789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6790 | packed.append(struct.pack("!L", self.xid)) |
| 6791 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6792 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6793 | packed.append(self.desc.pack()) |
| 6794 | length = sum([len(x) for x in packed]) |
| 6795 | packed[2] = struct.pack("!H", length) |
| 6796 | return ''.join(packed) |
| 6797 | |
| 6798 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6799 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6800 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6801 | _version = reader.read("!B")[0] |
| 6802 | assert(_version == 1) |
| 6803 | _type = reader.read("!B")[0] |
| 6804 | assert(_type == 12) |
| 6805 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6806 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6807 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6808 | obj.xid = reader.read("!L")[0] |
| 6809 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6810 | reader.skip(7) |
| 6811 | obj.desc = common.port_desc.unpack(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6812 | return obj |
| 6813 | |
| 6814 | def __eq__(self, other): |
| 6815 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6816 | if self.xid != other.xid: return False |
| 6817 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6818 | if self.desc != other.desc: return False |
| 6819 | return True |
| 6820 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6821 | def pretty_print(self, q): |
| 6822 | q.text("port_status {") |
| 6823 | with q.group(): |
| 6824 | with q.indent(2): |
| 6825 | q.breakable() |
| 6826 | q.text("xid = "); |
| 6827 | if self.xid != None: |
| 6828 | q.text("%#x" % self.xid) |
| 6829 | else: |
| 6830 | q.text('None') |
| 6831 | q.text(","); q.breakable() |
| 6832 | q.text("reason = "); |
| 6833 | q.text("%#x" % self.reason) |
| 6834 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6835 | q.text("desc = "); |
| 6836 | q.pp(self.desc) |
| 6837 | q.breakable() |
| 6838 | q.text('}') |
| 6839 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6840 | message.subtypes[12] = port_status |
| 6841 | |
| 6842 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6843 | version = 1 |
| 6844 | type = 21 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6845 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6846 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6847 | if xid != None: |
| 6848 | self.xid = xid |
| 6849 | else: |
| 6850 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6851 | if port != None: |
| 6852 | self.port = port |
| 6853 | else: |
| 6854 | self.port = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6855 | if queues != None: |
| 6856 | self.queues = queues |
| 6857 | else: |
| 6858 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6859 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6860 | |
| 6861 | def pack(self): |
| 6862 | packed = [] |
| 6863 | packed.append(struct.pack("!B", self.version)) |
| 6864 | packed.append(struct.pack("!B", self.type)) |
| 6865 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6866 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6867 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6868 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6869 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6870 | length = sum([len(x) for x in packed]) |
| 6871 | packed[2] = struct.pack("!H", length) |
| 6872 | return ''.join(packed) |
| 6873 | |
| 6874 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6875 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6876 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6877 | _version = reader.read("!B")[0] |
| 6878 | assert(_version == 1) |
| 6879 | _type = reader.read("!B")[0] |
| 6880 | assert(_type == 21) |
| 6881 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6882 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6883 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6884 | obj.xid = reader.read("!L")[0] |
| 6885 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6886 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6887 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6888 | return obj |
| 6889 | |
| 6890 | def __eq__(self, other): |
| 6891 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6892 | if self.xid != other.xid: return False |
| 6893 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6894 | if self.queues != other.queues: return False |
| 6895 | return True |
| 6896 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6897 | def pretty_print(self, q): |
| 6898 | q.text("queue_get_config_reply {") |
| 6899 | with q.group(): |
| 6900 | with q.indent(2): |
| 6901 | q.breakable() |
| 6902 | q.text("xid = "); |
| 6903 | if self.xid != None: |
| 6904 | q.text("%#x" % self.xid) |
| 6905 | else: |
| 6906 | q.text('None') |
| 6907 | q.text(","); q.breakable() |
| 6908 | q.text("port = "); |
| 6909 | q.text(util.pretty_port(self.port)) |
| 6910 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6911 | q.text("queues = "); |
| 6912 | q.pp(self.queues) |
| 6913 | q.breakable() |
| 6914 | q.text('}') |
| 6915 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6916 | message.subtypes[21] = queue_get_config_reply |
| 6917 | |
| 6918 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6919 | version = 1 |
| 6920 | type = 20 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6921 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6922 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6923 | if xid != None: |
| 6924 | self.xid = xid |
| 6925 | else: |
| 6926 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6927 | if port != None: |
| 6928 | self.port = port |
| 6929 | else: |
| 6930 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6931 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6932 | |
| 6933 | def pack(self): |
| 6934 | packed = [] |
| 6935 | packed.append(struct.pack("!B", self.version)) |
| 6936 | packed.append(struct.pack("!B", self.type)) |
| 6937 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6938 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6939 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6940 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6941 | length = sum([len(x) for x in packed]) |
| 6942 | packed[2] = struct.pack("!H", length) |
| 6943 | return ''.join(packed) |
| 6944 | |
| 6945 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6946 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6947 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6948 | _version = reader.read("!B")[0] |
| 6949 | assert(_version == 1) |
| 6950 | _type = reader.read("!B")[0] |
| 6951 | assert(_type == 20) |
| 6952 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6953 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 6954 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6955 | obj.xid = reader.read("!L")[0] |
| 6956 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6957 | reader.skip(2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6958 | return obj |
| 6959 | |
| 6960 | def __eq__(self, other): |
| 6961 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6962 | if self.xid != other.xid: return False |
| 6963 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6964 | return True |
| 6965 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6966 | def pretty_print(self, q): |
| 6967 | q.text("queue_get_config_request {") |
| 6968 | with q.group(): |
| 6969 | with q.indent(2): |
| 6970 | q.breakable() |
| 6971 | q.text("xid = "); |
| 6972 | if self.xid != None: |
| 6973 | q.text("%#x" % self.xid) |
| 6974 | else: |
| 6975 | q.text('None') |
| 6976 | q.text(","); q.breakable() |
| 6977 | q.text("port = "); |
| 6978 | q.text(util.pretty_port(self.port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6979 | q.breakable() |
| 6980 | q.text('}') |
| 6981 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6982 | message.subtypes[20] = queue_get_config_request |
| 6983 | |
| 6984 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6985 | version = 1 |
| 6986 | type = 1 |
| 6987 | err_type = 5 |
| 6988 | |
| 6989 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6990 | if xid != None: |
| 6991 | self.xid = xid |
| 6992 | else: |
| 6993 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6994 | if code != None: |
| 6995 | self.code = code |
| 6996 | else: |
| 6997 | self.code = 0 |
| 6998 | if data != None: |
| 6999 | self.data = data |
| 7000 | else: |
| 7001 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7002 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7003 | |
| 7004 | def pack(self): |
| 7005 | packed = [] |
| 7006 | packed.append(struct.pack("!B", self.version)) |
| 7007 | packed.append(struct.pack("!B", self.type)) |
| 7008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7009 | packed.append(struct.pack("!L", self.xid)) |
| 7010 | packed.append(struct.pack("!H", self.err_type)) |
| 7011 | packed.append(struct.pack("!H", self.code)) |
| 7012 | packed.append(self.data) |
| 7013 | length = sum([len(x) for x in packed]) |
| 7014 | packed[2] = struct.pack("!H", length) |
| 7015 | return ''.join(packed) |
| 7016 | |
| 7017 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7018 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7019 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7020 | _version = reader.read("!B")[0] |
| 7021 | assert(_version == 1) |
| 7022 | _type = reader.read("!B")[0] |
| 7023 | assert(_type == 1) |
| 7024 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7025 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7026 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7027 | obj.xid = reader.read("!L")[0] |
| 7028 | _err_type = reader.read("!H")[0] |
| 7029 | assert(_err_type == 5) |
| 7030 | obj.code = reader.read("!H")[0] |
| 7031 | obj.data = str(reader.read_all()) |
| 7032 | return obj |
| 7033 | |
| 7034 | def __eq__(self, other): |
| 7035 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7036 | if self.xid != other.xid: return False |
| 7037 | if self.code != other.code: return False |
| 7038 | if self.data != other.data: return False |
| 7039 | return True |
| 7040 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7041 | def pretty_print(self, q): |
| 7042 | q.text("queue_op_failed_error_msg {") |
| 7043 | with q.group(): |
| 7044 | with q.indent(2): |
| 7045 | q.breakable() |
| 7046 | q.text("xid = "); |
| 7047 | if self.xid != None: |
| 7048 | q.text("%#x" % self.xid) |
| 7049 | else: |
| 7050 | q.text('None') |
| 7051 | q.text(","); q.breakable() |
| 7052 | q.text("code = "); |
| 7053 | q.text("%#x" % self.code) |
| 7054 | q.text(","); q.breakable() |
| 7055 | q.text("data = "); |
| 7056 | q.pp(self.data) |
| 7057 | q.breakable() |
| 7058 | q.text('}') |
| 7059 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7060 | error_msg.subtypes[5] = queue_op_failed_error_msg |
| 7061 | |
| 7062 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7063 | version = 1 |
| 7064 | type = 17 |
| 7065 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7066 | |
| 7067 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7068 | if xid != None: |
| 7069 | self.xid = xid |
| 7070 | else: |
| 7071 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7072 | if flags != None: |
| 7073 | self.flags = flags |
| 7074 | else: |
| 7075 | self.flags = 0 |
| 7076 | if entries != None: |
| 7077 | self.entries = entries |
| 7078 | else: |
| 7079 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7080 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7081 | |
| 7082 | def pack(self): |
| 7083 | packed = [] |
| 7084 | packed.append(struct.pack("!B", self.version)) |
| 7085 | packed.append(struct.pack("!B", self.type)) |
| 7086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7087 | packed.append(struct.pack("!L", self.xid)) |
| 7088 | packed.append(struct.pack("!H", self.stats_type)) |
| 7089 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7090 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7091 | length = sum([len(x) for x in packed]) |
| 7092 | packed[2] = struct.pack("!H", length) |
| 7093 | return ''.join(packed) |
| 7094 | |
| 7095 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7096 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7097 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7098 | _version = reader.read("!B")[0] |
| 7099 | assert(_version == 1) |
| 7100 | _type = reader.read("!B")[0] |
| 7101 | assert(_type == 17) |
| 7102 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7103 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7104 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7105 | obj.xid = reader.read("!L")[0] |
| 7106 | _stats_type = reader.read("!H")[0] |
| 7107 | assert(_stats_type == 5) |
| 7108 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7109 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7110 | return obj |
| 7111 | |
| 7112 | def __eq__(self, other): |
| 7113 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7114 | if self.xid != other.xid: return False |
| 7115 | if self.flags != other.flags: return False |
| 7116 | if self.entries != other.entries: return False |
| 7117 | return True |
| 7118 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7119 | def pretty_print(self, q): |
| 7120 | q.text("queue_stats_reply {") |
| 7121 | with q.group(): |
| 7122 | with q.indent(2): |
| 7123 | q.breakable() |
| 7124 | q.text("xid = "); |
| 7125 | if self.xid != None: |
| 7126 | q.text("%#x" % self.xid) |
| 7127 | else: |
| 7128 | q.text('None') |
| 7129 | q.text(","); q.breakable() |
| 7130 | q.text("flags = "); |
| 7131 | q.text("%#x" % self.flags) |
| 7132 | q.text(","); q.breakable() |
| 7133 | q.text("entries = "); |
| 7134 | q.pp(self.entries) |
| 7135 | q.breakable() |
| 7136 | q.text('}') |
| 7137 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7138 | stats_reply.subtypes[5] = queue_stats_reply |
| 7139 | |
| 7140 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7141 | version = 1 |
| 7142 | type = 16 |
| 7143 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7144 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7145 | 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] | 7146 | if xid != None: |
| 7147 | self.xid = xid |
| 7148 | else: |
| 7149 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7150 | if flags != None: |
| 7151 | self.flags = flags |
| 7152 | else: |
| 7153 | self.flags = 0 |
| 7154 | if port_no != None: |
| 7155 | self.port_no = port_no |
| 7156 | else: |
| 7157 | self.port_no = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7158 | if queue_id != None: |
| 7159 | self.queue_id = queue_id |
| 7160 | else: |
| 7161 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7162 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7163 | |
| 7164 | def pack(self): |
| 7165 | packed = [] |
| 7166 | packed.append(struct.pack("!B", self.version)) |
| 7167 | packed.append(struct.pack("!B", self.type)) |
| 7168 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7169 | packed.append(struct.pack("!L", self.xid)) |
| 7170 | packed.append(struct.pack("!H", self.stats_type)) |
| 7171 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7172 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7173 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7174 | packed.append(struct.pack("!L", self.queue_id)) |
| 7175 | length = sum([len(x) for x in packed]) |
| 7176 | packed[2] = struct.pack("!H", length) |
| 7177 | return ''.join(packed) |
| 7178 | |
| 7179 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7180 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7181 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7182 | _version = reader.read("!B")[0] |
| 7183 | assert(_version == 1) |
| 7184 | _type = reader.read("!B")[0] |
| 7185 | assert(_type == 16) |
| 7186 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7187 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7188 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7189 | obj.xid = reader.read("!L")[0] |
| 7190 | _stats_type = reader.read("!H")[0] |
| 7191 | assert(_stats_type == 5) |
| 7192 | obj.flags = reader.read("!H")[0] |
| 7193 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7194 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7195 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7196 | return obj |
| 7197 | |
| 7198 | def __eq__(self, other): |
| 7199 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7200 | if self.xid != other.xid: return False |
| 7201 | if self.flags != other.flags: return False |
| 7202 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7203 | if self.queue_id != other.queue_id: return False |
| 7204 | return True |
| 7205 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7206 | def pretty_print(self, q): |
| 7207 | q.text("queue_stats_request {") |
| 7208 | with q.group(): |
| 7209 | with q.indent(2): |
| 7210 | q.breakable() |
| 7211 | q.text("xid = "); |
| 7212 | if self.xid != None: |
| 7213 | q.text("%#x" % self.xid) |
| 7214 | else: |
| 7215 | q.text('None') |
| 7216 | q.text(","); q.breakable() |
| 7217 | q.text("flags = "); |
| 7218 | q.text("%#x" % self.flags) |
| 7219 | q.text(","); q.breakable() |
| 7220 | q.text("port_no = "); |
| 7221 | q.text(util.pretty_port(self.port_no)) |
| 7222 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7223 | q.text("queue_id = "); |
| 7224 | q.text("%#x" % self.queue_id) |
| 7225 | q.breakable() |
| 7226 | q.text('}') |
| 7227 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7228 | stats_request.subtypes[5] = queue_stats_request |
| 7229 | |
| 7230 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7231 | version = 1 |
| 7232 | type = 9 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7233 | |
| 7234 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7235 | if xid != None: |
| 7236 | self.xid = xid |
| 7237 | else: |
| 7238 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7239 | if flags != None: |
| 7240 | self.flags = flags |
| 7241 | else: |
| 7242 | self.flags = 0 |
| 7243 | if miss_send_len != None: |
| 7244 | self.miss_send_len = miss_send_len |
| 7245 | else: |
| 7246 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7247 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7248 | |
| 7249 | def pack(self): |
| 7250 | packed = [] |
| 7251 | packed.append(struct.pack("!B", self.version)) |
| 7252 | packed.append(struct.pack("!B", self.type)) |
| 7253 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7254 | packed.append(struct.pack("!L", self.xid)) |
| 7255 | packed.append(struct.pack("!H", self.flags)) |
| 7256 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7257 | length = sum([len(x) for x in packed]) |
| 7258 | packed[2] = struct.pack("!H", length) |
| 7259 | return ''.join(packed) |
| 7260 | |
| 7261 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7262 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7263 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7264 | _version = reader.read("!B")[0] |
| 7265 | assert(_version == 1) |
| 7266 | _type = reader.read("!B")[0] |
| 7267 | assert(_type == 9) |
| 7268 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7269 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7270 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7271 | obj.xid = reader.read("!L")[0] |
| 7272 | obj.flags = reader.read("!H")[0] |
| 7273 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7274 | return obj |
| 7275 | |
| 7276 | def __eq__(self, other): |
| 7277 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7278 | if self.xid != other.xid: return False |
| 7279 | if self.flags != other.flags: return False |
| 7280 | if self.miss_send_len != other.miss_send_len: return False |
| 7281 | return True |
| 7282 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7283 | def pretty_print(self, q): |
| 7284 | q.text("set_config {") |
| 7285 | with q.group(): |
| 7286 | with q.indent(2): |
| 7287 | q.breakable() |
| 7288 | q.text("xid = "); |
| 7289 | if self.xid != None: |
| 7290 | q.text("%#x" % self.xid) |
| 7291 | else: |
| 7292 | q.text('None') |
| 7293 | q.text(","); q.breakable() |
| 7294 | q.text("flags = "); |
| 7295 | q.text("%#x" % self.flags) |
| 7296 | q.text(","); q.breakable() |
| 7297 | q.text("miss_send_len = "); |
| 7298 | q.text("%#x" % self.miss_send_len) |
| 7299 | q.breakable() |
| 7300 | q.text('}') |
| 7301 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7302 | message.subtypes[9] = set_config |
| 7303 | |
| 7304 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7305 | version = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7306 | type = 22 |
| 7307 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7308 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7309 | if xid != None: |
| 7310 | self.xid = xid |
| 7311 | else: |
| 7312 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7313 | if table_id != None: |
| 7314 | self.table_id = table_id |
| 7315 | else: |
| 7316 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7317 | if config != None: |
| 7318 | self.config = config |
| 7319 | else: |
| 7320 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7321 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7322 | |
| 7323 | def pack(self): |
| 7324 | packed = [] |
| 7325 | packed.append(struct.pack("!B", self.version)) |
| 7326 | packed.append(struct.pack("!B", self.type)) |
| 7327 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7328 | packed.append(struct.pack("!L", self.xid)) |
| 7329 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7330 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7331 | packed.append(struct.pack("!L", self.config)) |
| 7332 | length = sum([len(x) for x in packed]) |
| 7333 | packed[2] = struct.pack("!H", length) |
| 7334 | return ''.join(packed) |
| 7335 | |
| 7336 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7337 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7338 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7339 | _version = reader.read("!B")[0] |
| 7340 | assert(_version == 1) |
| 7341 | _type = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7342 | assert(_type == 22) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7343 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7344 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7345 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7346 | obj.xid = reader.read("!L")[0] |
| 7347 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7348 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7349 | obj.config = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7350 | return obj |
| 7351 | |
| 7352 | def __eq__(self, other): |
| 7353 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7354 | if self.xid != other.xid: return False |
| 7355 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7356 | if self.config != other.config: return False |
| 7357 | return True |
| 7358 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7359 | def pretty_print(self, q): |
| 7360 | q.text("table_mod {") |
| 7361 | with q.group(): |
| 7362 | with q.indent(2): |
| 7363 | q.breakable() |
| 7364 | q.text("xid = "); |
| 7365 | if self.xid != None: |
| 7366 | q.text("%#x" % self.xid) |
| 7367 | else: |
| 7368 | q.text('None') |
| 7369 | q.text(","); q.breakable() |
| 7370 | q.text("table_id = "); |
| 7371 | q.text("%#x" % self.table_id) |
| 7372 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7373 | q.text("config = "); |
| 7374 | q.text("%#x" % self.config) |
| 7375 | q.breakable() |
| 7376 | q.text('}') |
| 7377 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7378 | message.subtypes[22] = table_mod |
| 7379 | |
| 7380 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7381 | version = 1 |
| 7382 | type = 17 |
| 7383 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7384 | |
| 7385 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7386 | if xid != None: |
| 7387 | self.xid = xid |
| 7388 | else: |
| 7389 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7390 | if flags != None: |
| 7391 | self.flags = flags |
| 7392 | else: |
| 7393 | self.flags = 0 |
| 7394 | if entries != None: |
| 7395 | self.entries = entries |
| 7396 | else: |
| 7397 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7398 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7399 | |
| 7400 | def pack(self): |
| 7401 | packed = [] |
| 7402 | packed.append(struct.pack("!B", self.version)) |
| 7403 | packed.append(struct.pack("!B", self.type)) |
| 7404 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7405 | packed.append(struct.pack("!L", self.xid)) |
| 7406 | packed.append(struct.pack("!H", self.stats_type)) |
| 7407 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7408 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7409 | length = sum([len(x) for x in packed]) |
| 7410 | packed[2] = struct.pack("!H", length) |
| 7411 | return ''.join(packed) |
| 7412 | |
| 7413 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7414 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7415 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7416 | _version = reader.read("!B")[0] |
| 7417 | assert(_version == 1) |
| 7418 | _type = reader.read("!B")[0] |
| 7419 | assert(_type == 17) |
| 7420 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7421 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7422 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7423 | obj.xid = reader.read("!L")[0] |
| 7424 | _stats_type = reader.read("!H")[0] |
| 7425 | assert(_stats_type == 3) |
| 7426 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7427 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7428 | return obj |
| 7429 | |
| 7430 | def __eq__(self, other): |
| 7431 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7432 | if self.xid != other.xid: return False |
| 7433 | if self.flags != other.flags: return False |
| 7434 | if self.entries != other.entries: return False |
| 7435 | return True |
| 7436 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7437 | def pretty_print(self, q): |
| 7438 | q.text("table_stats_reply {") |
| 7439 | with q.group(): |
| 7440 | with q.indent(2): |
| 7441 | q.breakable() |
| 7442 | q.text("xid = "); |
| 7443 | if self.xid != None: |
| 7444 | q.text("%#x" % self.xid) |
| 7445 | else: |
| 7446 | q.text('None') |
| 7447 | q.text(","); q.breakable() |
| 7448 | q.text("flags = "); |
| 7449 | q.text("%#x" % self.flags) |
| 7450 | q.text(","); q.breakable() |
| 7451 | q.text("entries = "); |
| 7452 | q.pp(self.entries) |
| 7453 | q.breakable() |
| 7454 | q.text('}') |
| 7455 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7456 | stats_reply.subtypes[3] = table_stats_reply |
| 7457 | |
| 7458 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7459 | version = 1 |
| 7460 | type = 16 |
| 7461 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7462 | |
| 7463 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7464 | if xid != None: |
| 7465 | self.xid = xid |
| 7466 | else: |
| 7467 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7468 | if flags != None: |
| 7469 | self.flags = flags |
| 7470 | else: |
| 7471 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7472 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7473 | |
| 7474 | def pack(self): |
| 7475 | packed = [] |
| 7476 | packed.append(struct.pack("!B", self.version)) |
| 7477 | packed.append(struct.pack("!B", self.type)) |
| 7478 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7479 | packed.append(struct.pack("!L", self.xid)) |
| 7480 | packed.append(struct.pack("!H", self.stats_type)) |
| 7481 | packed.append(struct.pack("!H", self.flags)) |
| 7482 | length = sum([len(x) for x in packed]) |
| 7483 | packed[2] = struct.pack("!H", length) |
| 7484 | return ''.join(packed) |
| 7485 | |
| 7486 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7487 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7488 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7489 | _version = reader.read("!B")[0] |
| 7490 | assert(_version == 1) |
| 7491 | _type = reader.read("!B")[0] |
| 7492 | assert(_type == 16) |
| 7493 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7494 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame^] | 7495 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7496 | obj.xid = reader.read("!L")[0] |
| 7497 | _stats_type = reader.read("!H")[0] |
| 7498 | assert(_stats_type == 3) |
| 7499 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7500 | return obj |
| 7501 | |
| 7502 | def __eq__(self, other): |
| 7503 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7504 | if self.xid != other.xid: return False |
| 7505 | if self.flags != other.flags: return False |
| 7506 | return True |
| 7507 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7508 | def pretty_print(self, q): |
| 7509 | q.text("table_stats_request {") |
| 7510 | with q.group(): |
| 7511 | with q.indent(2): |
| 7512 | q.breakable() |
| 7513 | q.text("xid = "); |
| 7514 | if self.xid != None: |
| 7515 | q.text("%#x" % self.xid) |
| 7516 | else: |
| 7517 | q.text('None') |
| 7518 | q.text(","); q.breakable() |
| 7519 | q.text("flags = "); |
| 7520 | q.text("%#x" % self.flags) |
| 7521 | q.breakable() |
| 7522 | q.text('}') |
| 7523 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7524 | stats_request.subtypes[3] = table_stats_request |
| 7525 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7526 | |
| 7527 | def parse_header(buf): |
| 7528 | if len(buf) < 8: |
| 7529 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 7530 | return struct.unpack_from("!BBHL", buf) |
| 7531 | |
| 7532 | def parse_message(buf): |
| 7533 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 7534 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 7535 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7536 | if len(buf) != msg_len: |
| 7537 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7538 | return message.unpack(loxi.generic_util.OFReader(buf)) |