Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13 | import action |
| 14 | import instruction |
| 15 | import oxm |
| 16 | import action_id |
| 17 | import instruction_id |
| 18 | import meter_band |
Rich Lane | 1a82041 | 2014-01-06 14:15:07 -0800 | [diff] [blame^] | 19 | import bsn_tlv |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 20 | import util |
| 21 | import loxi.generic_util |
| 22 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 23 | class message(loxi.OFObject): |
| 24 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 25 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 26 | @staticmethod |
| 27 | def unpack(reader): |
| 28 | subtype, = reader.peek('B', 1) |
| 29 | try: |
| 30 | subclass = message.subtypes[subtype] |
| 31 | except KeyError: |
| 32 | raise loxi.ProtocolError("unknown message subtype %#x" % subtype) |
| 33 | return subclass.unpack(reader) |
| 34 | |
| 35 | |
| 36 | class stats_reply(message): |
| 37 | subtypes = {} |
| 38 | |
| 39 | @staticmethod |
| 40 | def unpack(reader): |
| 41 | subtype, = reader.peek('!H', 8) |
| 42 | try: |
| 43 | subclass = stats_reply.subtypes[subtype] |
| 44 | except KeyError: |
| 45 | raise loxi.ProtocolError("unknown stats_reply message subtype %#x" % subtype) |
| 46 | return subclass.unpack(reader) |
| 47 | |
| 48 | message.subtypes[19] = stats_reply |
| 49 | |
| 50 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 51 | version = 4 |
| 52 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 53 | stats_type = 2 |
| 54 | |
| 55 | 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] | 56 | if xid != None: |
| 57 | self.xid = xid |
| 58 | else: |
| 59 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 60 | if flags != None: |
| 61 | self.flags = flags |
| 62 | else: |
| 63 | self.flags = 0 |
| 64 | if packet_count != None: |
| 65 | self.packet_count = packet_count |
| 66 | else: |
| 67 | self.packet_count = 0 |
| 68 | if byte_count != None: |
| 69 | self.byte_count = byte_count |
| 70 | else: |
| 71 | self.byte_count = 0 |
| 72 | if flow_count != None: |
| 73 | self.flow_count = flow_count |
| 74 | else: |
| 75 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 76 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 77 | |
| 78 | def pack(self): |
| 79 | packed = [] |
| 80 | packed.append(struct.pack("!B", self.version)) |
| 81 | packed.append(struct.pack("!B", self.type)) |
| 82 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 83 | packed.append(struct.pack("!L", self.xid)) |
| 84 | packed.append(struct.pack("!H", self.stats_type)) |
| 85 | packed.append(struct.pack("!H", self.flags)) |
| 86 | packed.append('\x00' * 4) |
| 87 | packed.append(struct.pack("!Q", self.packet_count)) |
| 88 | packed.append(struct.pack("!Q", self.byte_count)) |
| 89 | packed.append(struct.pack("!L", self.flow_count)) |
| 90 | packed.append('\x00' * 4) |
| 91 | length = sum([len(x) for x in packed]) |
| 92 | packed[2] = struct.pack("!H", length) |
| 93 | return ''.join(packed) |
| 94 | |
| 95 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 96 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 97 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 98 | _version = reader.read("!B")[0] |
| 99 | assert(_version == 4) |
| 100 | _type = reader.read("!B")[0] |
| 101 | assert(_type == 19) |
| 102 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 103 | orig_reader = reader |
| 104 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 105 | obj.xid = reader.read("!L")[0] |
| 106 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 107 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 108 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 109 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 110 | obj.packet_count = reader.read("!Q")[0] |
| 111 | obj.byte_count = reader.read("!Q")[0] |
| 112 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 113 | reader.skip(4) |
| 114 | return obj |
| 115 | |
| 116 | def __eq__(self, other): |
| 117 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 118 | if self.xid != other.xid: return False |
| 119 | if self.flags != other.flags: return False |
| 120 | if self.packet_count != other.packet_count: return False |
| 121 | if self.byte_count != other.byte_count: return False |
| 122 | if self.flow_count != other.flow_count: return False |
| 123 | return True |
| 124 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 125 | def pretty_print(self, q): |
| 126 | q.text("aggregate_stats_reply {") |
| 127 | with q.group(): |
| 128 | with q.indent(2): |
| 129 | q.breakable() |
| 130 | q.text("xid = "); |
| 131 | if self.xid != None: |
| 132 | q.text("%#x" % self.xid) |
| 133 | else: |
| 134 | q.text('None') |
| 135 | q.text(","); q.breakable() |
| 136 | q.text("flags = "); |
| 137 | q.text("%#x" % self.flags) |
| 138 | q.text(","); q.breakable() |
| 139 | q.text("packet_count = "); |
| 140 | q.text("%#x" % self.packet_count) |
| 141 | q.text(","); q.breakable() |
| 142 | q.text("byte_count = "); |
| 143 | q.text("%#x" % self.byte_count) |
| 144 | q.text(","); q.breakable() |
| 145 | q.text("flow_count = "); |
| 146 | q.text("%#x" % self.flow_count) |
| 147 | q.breakable() |
| 148 | q.text('}') |
| 149 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 150 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 151 | |
| 152 | class stats_request(message): |
| 153 | subtypes = {} |
| 154 | |
| 155 | @staticmethod |
| 156 | def unpack(reader): |
| 157 | subtype, = reader.peek('!H', 8) |
| 158 | try: |
| 159 | subclass = stats_request.subtypes[subtype] |
| 160 | except KeyError: |
| 161 | raise loxi.ProtocolError("unknown stats_request message subtype %#x" % subtype) |
| 162 | return subclass.unpack(reader) |
| 163 | |
| 164 | message.subtypes[18] = stats_request |
| 165 | |
| 166 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 167 | version = 4 |
| 168 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 169 | stats_type = 2 |
| 170 | |
| 171 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 172 | if xid != None: |
| 173 | self.xid = xid |
| 174 | else: |
| 175 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 176 | if flags != None: |
| 177 | self.flags = flags |
| 178 | else: |
| 179 | self.flags = 0 |
| 180 | if table_id != None: |
| 181 | self.table_id = table_id |
| 182 | else: |
| 183 | self.table_id = 0 |
| 184 | if out_port != None: |
| 185 | self.out_port = out_port |
| 186 | else: |
| 187 | self.out_port = 0 |
| 188 | if out_group != None: |
| 189 | self.out_group = out_group |
| 190 | else: |
| 191 | self.out_group = 0 |
| 192 | if cookie != None: |
| 193 | self.cookie = cookie |
| 194 | else: |
| 195 | self.cookie = 0 |
| 196 | if cookie_mask != None: |
| 197 | self.cookie_mask = cookie_mask |
| 198 | else: |
| 199 | self.cookie_mask = 0 |
| 200 | if match != None: |
| 201 | self.match = match |
| 202 | else: |
| 203 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 204 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 205 | |
| 206 | def pack(self): |
| 207 | packed = [] |
| 208 | packed.append(struct.pack("!B", self.version)) |
| 209 | packed.append(struct.pack("!B", self.type)) |
| 210 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 211 | packed.append(struct.pack("!L", self.xid)) |
| 212 | packed.append(struct.pack("!H", self.stats_type)) |
| 213 | packed.append(struct.pack("!H", self.flags)) |
| 214 | packed.append('\x00' * 4) |
| 215 | packed.append(struct.pack("!B", self.table_id)) |
| 216 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 217 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 218 | packed.append(struct.pack("!L", self.out_group)) |
| 219 | packed.append('\x00' * 4) |
| 220 | packed.append(struct.pack("!Q", self.cookie)) |
| 221 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 222 | packed.append(self.match.pack()) |
| 223 | length = sum([len(x) for x in packed]) |
| 224 | packed[2] = struct.pack("!H", length) |
| 225 | return ''.join(packed) |
| 226 | |
| 227 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 228 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 229 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 230 | _version = reader.read("!B")[0] |
| 231 | assert(_version == 4) |
| 232 | _type = reader.read("!B")[0] |
| 233 | assert(_type == 18) |
| 234 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 235 | orig_reader = reader |
| 236 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 237 | obj.xid = reader.read("!L")[0] |
| 238 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 239 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 240 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 241 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 242 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 243 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 244 | obj.out_port = util.unpack_port_no(reader) |
| 245 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 246 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 247 | obj.cookie = reader.read("!Q")[0] |
| 248 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 249 | obj.match = common.match.unpack(reader) |
| 250 | return obj |
| 251 | |
| 252 | def __eq__(self, other): |
| 253 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 254 | if self.xid != other.xid: return False |
| 255 | if self.flags != other.flags: return False |
| 256 | if self.table_id != other.table_id: return False |
| 257 | if self.out_port != other.out_port: return False |
| 258 | if self.out_group != other.out_group: return False |
| 259 | if self.cookie != other.cookie: return False |
| 260 | if self.cookie_mask != other.cookie_mask: return False |
| 261 | if self.match != other.match: return False |
| 262 | return True |
| 263 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 264 | def pretty_print(self, q): |
| 265 | q.text("aggregate_stats_request {") |
| 266 | with q.group(): |
| 267 | with q.indent(2): |
| 268 | q.breakable() |
| 269 | q.text("xid = "); |
| 270 | if self.xid != None: |
| 271 | q.text("%#x" % self.xid) |
| 272 | else: |
| 273 | q.text('None') |
| 274 | q.text(","); q.breakable() |
| 275 | q.text("flags = "); |
| 276 | q.text("%#x" % self.flags) |
| 277 | q.text(","); q.breakable() |
| 278 | q.text("table_id = "); |
| 279 | q.text("%#x" % self.table_id) |
| 280 | q.text(","); q.breakable() |
| 281 | q.text("out_port = "); |
| 282 | q.text(util.pretty_port(self.out_port)) |
| 283 | q.text(","); q.breakable() |
| 284 | q.text("out_group = "); |
| 285 | q.text("%#x" % self.out_group) |
| 286 | q.text(","); q.breakable() |
| 287 | q.text("cookie = "); |
| 288 | q.text("%#x" % self.cookie) |
| 289 | q.text(","); q.breakable() |
| 290 | q.text("cookie_mask = "); |
| 291 | q.text("%#x" % self.cookie_mask) |
| 292 | q.text(","); q.breakable() |
| 293 | q.text("match = "); |
| 294 | q.pp(self.match) |
| 295 | q.breakable() |
| 296 | q.text('}') |
| 297 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 298 | stats_request.subtypes[2] = aggregate_stats_request |
| 299 | |
| 300 | class async_get_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 301 | version = 4 |
| 302 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 303 | |
| 304 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 305 | if xid != None: |
| 306 | self.xid = xid |
| 307 | else: |
| 308 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 309 | if packet_in_mask_equal_master != None: |
| 310 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 311 | else: |
| 312 | self.packet_in_mask_equal_master = 0 |
| 313 | if packet_in_mask_slave != None: |
| 314 | self.packet_in_mask_slave = packet_in_mask_slave |
| 315 | else: |
| 316 | self.packet_in_mask_slave = 0 |
| 317 | if port_status_mask_equal_master != None: |
| 318 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 319 | else: |
| 320 | self.port_status_mask_equal_master = 0 |
| 321 | if port_status_mask_slave != None: |
| 322 | self.port_status_mask_slave = port_status_mask_slave |
| 323 | else: |
| 324 | self.port_status_mask_slave = 0 |
| 325 | if flow_removed_mask_equal_master != None: |
| 326 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 327 | else: |
| 328 | self.flow_removed_mask_equal_master = 0 |
| 329 | if flow_removed_mask_slave != None: |
| 330 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 331 | else: |
| 332 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 333 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 334 | |
| 335 | def pack(self): |
| 336 | packed = [] |
| 337 | packed.append(struct.pack("!B", self.version)) |
| 338 | packed.append(struct.pack("!B", self.type)) |
| 339 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 340 | packed.append(struct.pack("!L", self.xid)) |
| 341 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 342 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 343 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 344 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 345 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 346 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 347 | length = sum([len(x) for x in packed]) |
| 348 | packed[2] = struct.pack("!H", length) |
| 349 | return ''.join(packed) |
| 350 | |
| 351 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 352 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 353 | obj = async_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 354 | _version = reader.read("!B")[0] |
| 355 | assert(_version == 4) |
| 356 | _type = reader.read("!B")[0] |
| 357 | assert(_type == 27) |
| 358 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 359 | orig_reader = reader |
| 360 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 361 | obj.xid = reader.read("!L")[0] |
| 362 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 363 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 364 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 365 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 366 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 367 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 368 | return obj |
| 369 | |
| 370 | def __eq__(self, other): |
| 371 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 372 | if self.xid != other.xid: return False |
| 373 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 374 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 375 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 376 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 377 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 378 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 379 | return True |
| 380 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 381 | def pretty_print(self, q): |
| 382 | q.text("async_get_reply {") |
| 383 | with q.group(): |
| 384 | with q.indent(2): |
| 385 | q.breakable() |
| 386 | q.text("xid = "); |
| 387 | if self.xid != None: |
| 388 | q.text("%#x" % self.xid) |
| 389 | else: |
| 390 | q.text('None') |
| 391 | q.text(","); q.breakable() |
| 392 | q.text("packet_in_mask_equal_master = "); |
| 393 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 394 | q.text(","); q.breakable() |
| 395 | q.text("packet_in_mask_slave = "); |
| 396 | q.text("%#x" % self.packet_in_mask_slave) |
| 397 | q.text(","); q.breakable() |
| 398 | q.text("port_status_mask_equal_master = "); |
| 399 | q.text("%#x" % self.port_status_mask_equal_master) |
| 400 | q.text(","); q.breakable() |
| 401 | q.text("port_status_mask_slave = "); |
| 402 | q.text("%#x" % self.port_status_mask_slave) |
| 403 | q.text(","); q.breakable() |
| 404 | q.text("flow_removed_mask_equal_master = "); |
| 405 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 406 | q.text(","); q.breakable() |
| 407 | q.text("flow_removed_mask_slave = "); |
| 408 | q.text("%#x" % self.flow_removed_mask_slave) |
| 409 | q.breakable() |
| 410 | q.text('}') |
| 411 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 412 | message.subtypes[27] = async_get_reply |
| 413 | |
| 414 | class async_get_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 415 | version = 4 |
| 416 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 417 | |
| 418 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 419 | if xid != None: |
| 420 | self.xid = xid |
| 421 | else: |
| 422 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 423 | if packet_in_mask_equal_master != None: |
| 424 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 425 | else: |
| 426 | self.packet_in_mask_equal_master = 0 |
| 427 | if packet_in_mask_slave != None: |
| 428 | self.packet_in_mask_slave = packet_in_mask_slave |
| 429 | else: |
| 430 | self.packet_in_mask_slave = 0 |
| 431 | if port_status_mask_equal_master != None: |
| 432 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 433 | else: |
| 434 | self.port_status_mask_equal_master = 0 |
| 435 | if port_status_mask_slave != None: |
| 436 | self.port_status_mask_slave = port_status_mask_slave |
| 437 | else: |
| 438 | self.port_status_mask_slave = 0 |
| 439 | if flow_removed_mask_equal_master != None: |
| 440 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 441 | else: |
| 442 | self.flow_removed_mask_equal_master = 0 |
| 443 | if flow_removed_mask_slave != None: |
| 444 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 445 | else: |
| 446 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 447 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 448 | |
| 449 | def pack(self): |
| 450 | packed = [] |
| 451 | packed.append(struct.pack("!B", self.version)) |
| 452 | packed.append(struct.pack("!B", self.type)) |
| 453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 454 | packed.append(struct.pack("!L", self.xid)) |
| 455 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 456 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 457 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 458 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 459 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 460 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 461 | length = sum([len(x) for x in packed]) |
| 462 | packed[2] = struct.pack("!H", length) |
| 463 | return ''.join(packed) |
| 464 | |
| 465 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 466 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 467 | obj = async_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 468 | _version = reader.read("!B")[0] |
| 469 | assert(_version == 4) |
| 470 | _type = reader.read("!B")[0] |
| 471 | assert(_type == 26) |
| 472 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 473 | orig_reader = reader |
| 474 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 475 | obj.xid = reader.read("!L")[0] |
| 476 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 477 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 478 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 479 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 480 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 481 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 482 | return obj |
| 483 | |
| 484 | def __eq__(self, other): |
| 485 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 486 | if self.xid != other.xid: return False |
| 487 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 488 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 489 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 490 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 491 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 492 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 493 | return True |
| 494 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 495 | def pretty_print(self, q): |
| 496 | q.text("async_get_request {") |
| 497 | with q.group(): |
| 498 | with q.indent(2): |
| 499 | q.breakable() |
| 500 | q.text("xid = "); |
| 501 | if self.xid != None: |
| 502 | q.text("%#x" % self.xid) |
| 503 | else: |
| 504 | q.text('None') |
| 505 | q.text(","); q.breakable() |
| 506 | q.text("packet_in_mask_equal_master = "); |
| 507 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 508 | q.text(","); q.breakable() |
| 509 | q.text("packet_in_mask_slave = "); |
| 510 | q.text("%#x" % self.packet_in_mask_slave) |
| 511 | q.text(","); q.breakable() |
| 512 | q.text("port_status_mask_equal_master = "); |
| 513 | q.text("%#x" % self.port_status_mask_equal_master) |
| 514 | q.text(","); q.breakable() |
| 515 | q.text("port_status_mask_slave = "); |
| 516 | q.text("%#x" % self.port_status_mask_slave) |
| 517 | q.text(","); q.breakable() |
| 518 | q.text("flow_removed_mask_equal_master = "); |
| 519 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 520 | q.text(","); q.breakable() |
| 521 | q.text("flow_removed_mask_slave = "); |
| 522 | q.text("%#x" % self.flow_removed_mask_slave) |
| 523 | q.breakable() |
| 524 | q.text('}') |
| 525 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 526 | message.subtypes[26] = async_get_request |
| 527 | |
| 528 | class async_set(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 529 | version = 4 |
| 530 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 531 | |
| 532 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 533 | if xid != None: |
| 534 | self.xid = xid |
| 535 | else: |
| 536 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 537 | if packet_in_mask_equal_master != None: |
| 538 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 539 | else: |
| 540 | self.packet_in_mask_equal_master = 0 |
| 541 | if packet_in_mask_slave != None: |
| 542 | self.packet_in_mask_slave = packet_in_mask_slave |
| 543 | else: |
| 544 | self.packet_in_mask_slave = 0 |
| 545 | if port_status_mask_equal_master != None: |
| 546 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 547 | else: |
| 548 | self.port_status_mask_equal_master = 0 |
| 549 | if port_status_mask_slave != None: |
| 550 | self.port_status_mask_slave = port_status_mask_slave |
| 551 | else: |
| 552 | self.port_status_mask_slave = 0 |
| 553 | if flow_removed_mask_equal_master != None: |
| 554 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 555 | else: |
| 556 | self.flow_removed_mask_equal_master = 0 |
| 557 | if flow_removed_mask_slave != None: |
| 558 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 559 | else: |
| 560 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 561 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 562 | |
| 563 | def pack(self): |
| 564 | packed = [] |
| 565 | packed.append(struct.pack("!B", self.version)) |
| 566 | packed.append(struct.pack("!B", self.type)) |
| 567 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 568 | packed.append(struct.pack("!L", self.xid)) |
| 569 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 570 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 571 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 572 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 573 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 574 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 575 | length = sum([len(x) for x in packed]) |
| 576 | packed[2] = struct.pack("!H", length) |
| 577 | return ''.join(packed) |
| 578 | |
| 579 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 580 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 581 | obj = async_set() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 582 | _version = reader.read("!B")[0] |
| 583 | assert(_version == 4) |
| 584 | _type = reader.read("!B")[0] |
| 585 | assert(_type == 28) |
| 586 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 587 | orig_reader = reader |
| 588 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 589 | obj.xid = reader.read("!L")[0] |
| 590 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 591 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 592 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 593 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 594 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 595 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 596 | return obj |
| 597 | |
| 598 | def __eq__(self, other): |
| 599 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 600 | if self.xid != other.xid: return False |
| 601 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 602 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 603 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 604 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 605 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 606 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 607 | return True |
| 608 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 609 | def pretty_print(self, q): |
| 610 | q.text("async_set {") |
| 611 | with q.group(): |
| 612 | with q.indent(2): |
| 613 | q.breakable() |
| 614 | q.text("xid = "); |
| 615 | if self.xid != None: |
| 616 | q.text("%#x" % self.xid) |
| 617 | else: |
| 618 | q.text('None') |
| 619 | q.text(","); q.breakable() |
| 620 | q.text("packet_in_mask_equal_master = "); |
| 621 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 622 | q.text(","); q.breakable() |
| 623 | q.text("packet_in_mask_slave = "); |
| 624 | q.text("%#x" % self.packet_in_mask_slave) |
| 625 | q.text(","); q.breakable() |
| 626 | q.text("port_status_mask_equal_master = "); |
| 627 | q.text("%#x" % self.port_status_mask_equal_master) |
| 628 | q.text(","); q.breakable() |
| 629 | q.text("port_status_mask_slave = "); |
| 630 | q.text("%#x" % self.port_status_mask_slave) |
| 631 | q.text(","); q.breakable() |
| 632 | q.text("flow_removed_mask_equal_master = "); |
| 633 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 634 | q.text(","); q.breakable() |
| 635 | q.text("flow_removed_mask_slave = "); |
| 636 | q.text("%#x" % self.flow_removed_mask_slave) |
| 637 | q.breakable() |
| 638 | q.text('}') |
| 639 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 640 | message.subtypes[28] = async_set |
| 641 | |
| 642 | class error_msg(message): |
| 643 | subtypes = {} |
| 644 | |
| 645 | @staticmethod |
| 646 | def unpack(reader): |
| 647 | subtype, = reader.peek('!H', 8) |
| 648 | try: |
| 649 | subclass = error_msg.subtypes[subtype] |
| 650 | except KeyError: |
| 651 | raise loxi.ProtocolError("unknown error_msg message subtype %#x" % subtype) |
| 652 | return subclass.unpack(reader) |
| 653 | |
| 654 | message.subtypes[1] = error_msg |
| 655 | |
| 656 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 657 | version = 4 |
| 658 | type = 1 |
| 659 | err_type = 2 |
| 660 | |
| 661 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 662 | if xid != None: |
| 663 | self.xid = xid |
| 664 | else: |
| 665 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 666 | if code != None: |
| 667 | self.code = code |
| 668 | else: |
| 669 | self.code = 0 |
| 670 | if data != None: |
| 671 | self.data = data |
| 672 | else: |
| 673 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 674 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 675 | |
| 676 | def pack(self): |
| 677 | packed = [] |
| 678 | packed.append(struct.pack("!B", self.version)) |
| 679 | packed.append(struct.pack("!B", self.type)) |
| 680 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 681 | packed.append(struct.pack("!L", self.xid)) |
| 682 | packed.append(struct.pack("!H", self.err_type)) |
| 683 | packed.append(struct.pack("!H", self.code)) |
| 684 | packed.append(self.data) |
| 685 | length = sum([len(x) for x in packed]) |
| 686 | packed[2] = struct.pack("!H", length) |
| 687 | return ''.join(packed) |
| 688 | |
| 689 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 690 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 691 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 692 | _version = reader.read("!B")[0] |
| 693 | assert(_version == 4) |
| 694 | _type = reader.read("!B")[0] |
| 695 | assert(_type == 1) |
| 696 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 697 | orig_reader = reader |
| 698 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 699 | obj.xid = reader.read("!L")[0] |
| 700 | _err_type = reader.read("!H")[0] |
| 701 | assert(_err_type == 2) |
| 702 | obj.code = reader.read("!H")[0] |
| 703 | obj.data = str(reader.read_all()) |
| 704 | return obj |
| 705 | |
| 706 | def __eq__(self, other): |
| 707 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 708 | if self.xid != other.xid: return False |
| 709 | if self.code != other.code: return False |
| 710 | if self.data != other.data: return False |
| 711 | return True |
| 712 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 713 | def pretty_print(self, q): |
| 714 | q.text("bad_action_error_msg {") |
| 715 | with q.group(): |
| 716 | with q.indent(2): |
| 717 | q.breakable() |
| 718 | q.text("xid = "); |
| 719 | if self.xid != None: |
| 720 | q.text("%#x" % self.xid) |
| 721 | else: |
| 722 | q.text('None') |
| 723 | q.text(","); q.breakable() |
| 724 | q.text("code = "); |
| 725 | q.text("%#x" % self.code) |
| 726 | q.text(","); q.breakable() |
| 727 | q.text("data = "); |
| 728 | q.pp(self.data) |
| 729 | q.breakable() |
| 730 | q.text('}') |
| 731 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 732 | error_msg.subtypes[2] = bad_action_error_msg |
| 733 | |
| 734 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 735 | version = 4 |
| 736 | type = 1 |
| 737 | err_type = 3 |
| 738 | |
| 739 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 740 | if xid != None: |
| 741 | self.xid = xid |
| 742 | else: |
| 743 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 744 | if code != None: |
| 745 | self.code = code |
| 746 | else: |
| 747 | self.code = 0 |
| 748 | if data != None: |
| 749 | self.data = data |
| 750 | else: |
| 751 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 752 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 753 | |
| 754 | def pack(self): |
| 755 | packed = [] |
| 756 | packed.append(struct.pack("!B", self.version)) |
| 757 | packed.append(struct.pack("!B", self.type)) |
| 758 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 759 | packed.append(struct.pack("!L", self.xid)) |
| 760 | packed.append(struct.pack("!H", self.err_type)) |
| 761 | packed.append(struct.pack("!H", self.code)) |
| 762 | packed.append(self.data) |
| 763 | length = sum([len(x) for x in packed]) |
| 764 | packed[2] = struct.pack("!H", length) |
| 765 | return ''.join(packed) |
| 766 | |
| 767 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 768 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 769 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 770 | _version = reader.read("!B")[0] |
| 771 | assert(_version == 4) |
| 772 | _type = reader.read("!B")[0] |
| 773 | assert(_type == 1) |
| 774 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 775 | orig_reader = reader |
| 776 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 777 | obj.xid = reader.read("!L")[0] |
| 778 | _err_type = reader.read("!H")[0] |
| 779 | assert(_err_type == 3) |
| 780 | obj.code = reader.read("!H")[0] |
| 781 | obj.data = str(reader.read_all()) |
| 782 | return obj |
| 783 | |
| 784 | def __eq__(self, other): |
| 785 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 786 | if self.xid != other.xid: return False |
| 787 | if self.code != other.code: return False |
| 788 | if self.data != other.data: return False |
| 789 | return True |
| 790 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 791 | def pretty_print(self, q): |
| 792 | q.text("bad_instruction_error_msg {") |
| 793 | with q.group(): |
| 794 | with q.indent(2): |
| 795 | q.breakable() |
| 796 | q.text("xid = "); |
| 797 | if self.xid != None: |
| 798 | q.text("%#x" % self.xid) |
| 799 | else: |
| 800 | q.text('None') |
| 801 | q.text(","); q.breakable() |
| 802 | q.text("code = "); |
| 803 | q.text("%#x" % self.code) |
| 804 | q.text(","); q.breakable() |
| 805 | q.text("data = "); |
| 806 | q.pp(self.data) |
| 807 | q.breakable() |
| 808 | q.text('}') |
| 809 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 810 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 811 | |
| 812 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 813 | version = 4 |
| 814 | type = 1 |
| 815 | err_type = 4 |
| 816 | |
| 817 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 818 | if xid != None: |
| 819 | self.xid = xid |
| 820 | else: |
| 821 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 822 | if code != None: |
| 823 | self.code = code |
| 824 | else: |
| 825 | self.code = 0 |
| 826 | if data != None: |
| 827 | self.data = data |
| 828 | else: |
| 829 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 830 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 831 | |
| 832 | def pack(self): |
| 833 | packed = [] |
| 834 | packed.append(struct.pack("!B", self.version)) |
| 835 | packed.append(struct.pack("!B", self.type)) |
| 836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 837 | packed.append(struct.pack("!L", self.xid)) |
| 838 | packed.append(struct.pack("!H", self.err_type)) |
| 839 | packed.append(struct.pack("!H", self.code)) |
| 840 | packed.append(self.data) |
| 841 | length = sum([len(x) for x in packed]) |
| 842 | packed[2] = struct.pack("!H", length) |
| 843 | return ''.join(packed) |
| 844 | |
| 845 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 846 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 847 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 848 | _version = reader.read("!B")[0] |
| 849 | assert(_version == 4) |
| 850 | _type = reader.read("!B")[0] |
| 851 | assert(_type == 1) |
| 852 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 853 | orig_reader = reader |
| 854 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 855 | obj.xid = reader.read("!L")[0] |
| 856 | _err_type = reader.read("!H")[0] |
| 857 | assert(_err_type == 4) |
| 858 | obj.code = reader.read("!H")[0] |
| 859 | obj.data = str(reader.read_all()) |
| 860 | return obj |
| 861 | |
| 862 | def __eq__(self, other): |
| 863 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 864 | if self.xid != other.xid: return False |
| 865 | if self.code != other.code: return False |
| 866 | if self.data != other.data: return False |
| 867 | return True |
| 868 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 869 | def pretty_print(self, q): |
| 870 | q.text("bad_match_error_msg {") |
| 871 | with q.group(): |
| 872 | with q.indent(2): |
| 873 | q.breakable() |
| 874 | q.text("xid = "); |
| 875 | if self.xid != None: |
| 876 | q.text("%#x" % self.xid) |
| 877 | else: |
| 878 | q.text('None') |
| 879 | q.text(","); q.breakable() |
| 880 | q.text("code = "); |
| 881 | q.text("%#x" % self.code) |
| 882 | q.text(","); q.breakable() |
| 883 | q.text("data = "); |
| 884 | q.pp(self.data) |
| 885 | q.breakable() |
| 886 | q.text('}') |
| 887 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 888 | error_msg.subtypes[4] = bad_match_error_msg |
| 889 | |
| 890 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 891 | version = 4 |
| 892 | type = 1 |
| 893 | err_type = 1 |
| 894 | |
| 895 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 896 | if xid != None: |
| 897 | self.xid = xid |
| 898 | else: |
| 899 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 900 | if code != None: |
| 901 | self.code = code |
| 902 | else: |
| 903 | self.code = 0 |
| 904 | if data != None: |
| 905 | self.data = data |
| 906 | else: |
| 907 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 908 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 909 | |
| 910 | def pack(self): |
| 911 | packed = [] |
| 912 | packed.append(struct.pack("!B", self.version)) |
| 913 | packed.append(struct.pack("!B", self.type)) |
| 914 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 915 | packed.append(struct.pack("!L", self.xid)) |
| 916 | packed.append(struct.pack("!H", self.err_type)) |
| 917 | packed.append(struct.pack("!H", self.code)) |
| 918 | packed.append(self.data) |
| 919 | length = sum([len(x) for x in packed]) |
| 920 | packed[2] = struct.pack("!H", length) |
| 921 | return ''.join(packed) |
| 922 | |
| 923 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 924 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 925 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 926 | _version = reader.read("!B")[0] |
| 927 | assert(_version == 4) |
| 928 | _type = reader.read("!B")[0] |
| 929 | assert(_type == 1) |
| 930 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 931 | orig_reader = reader |
| 932 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 933 | obj.xid = reader.read("!L")[0] |
| 934 | _err_type = reader.read("!H")[0] |
| 935 | assert(_err_type == 1) |
| 936 | obj.code = reader.read("!H")[0] |
| 937 | obj.data = str(reader.read_all()) |
| 938 | return obj |
| 939 | |
| 940 | def __eq__(self, other): |
| 941 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 942 | if self.xid != other.xid: return False |
| 943 | if self.code != other.code: return False |
| 944 | if self.data != other.data: return False |
| 945 | return True |
| 946 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 947 | def pretty_print(self, q): |
| 948 | q.text("bad_request_error_msg {") |
| 949 | with q.group(): |
| 950 | with q.indent(2): |
| 951 | q.breakable() |
| 952 | q.text("xid = "); |
| 953 | if self.xid != None: |
| 954 | q.text("%#x" % self.xid) |
| 955 | else: |
| 956 | q.text('None') |
| 957 | q.text(","); q.breakable() |
| 958 | q.text("code = "); |
| 959 | q.text("%#x" % self.code) |
| 960 | q.text(","); q.breakable() |
| 961 | q.text("data = "); |
| 962 | q.pp(self.data) |
| 963 | q.breakable() |
| 964 | q.text('}') |
| 965 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 966 | error_msg.subtypes[1] = bad_request_error_msg |
| 967 | |
| 968 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 969 | version = 4 |
| 970 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 971 | |
| 972 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 973 | if xid != None: |
| 974 | self.xid = xid |
| 975 | else: |
| 976 | self.xid = None |
| 977 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 978 | |
| 979 | def pack(self): |
| 980 | packed = [] |
| 981 | packed.append(struct.pack("!B", self.version)) |
| 982 | packed.append(struct.pack("!B", self.type)) |
| 983 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 984 | packed.append(struct.pack("!L", self.xid)) |
| 985 | length = sum([len(x) for x in packed]) |
| 986 | packed[2] = struct.pack("!H", length) |
| 987 | return ''.join(packed) |
| 988 | |
| 989 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 990 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 991 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 992 | _version = reader.read("!B")[0] |
| 993 | assert(_version == 4) |
| 994 | _type = reader.read("!B")[0] |
| 995 | assert(_type == 21) |
| 996 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 997 | orig_reader = reader |
| 998 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 999 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1000 | return obj |
| 1001 | |
| 1002 | def __eq__(self, other): |
| 1003 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1004 | if self.xid != other.xid: return False |
| 1005 | return True |
| 1006 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1007 | def pretty_print(self, q): |
| 1008 | q.text("barrier_reply {") |
| 1009 | with q.group(): |
| 1010 | with q.indent(2): |
| 1011 | q.breakable() |
| 1012 | q.text("xid = "); |
| 1013 | if self.xid != None: |
| 1014 | q.text("%#x" % self.xid) |
| 1015 | else: |
| 1016 | q.text('None') |
| 1017 | q.breakable() |
| 1018 | q.text('}') |
| 1019 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1020 | message.subtypes[21] = barrier_reply |
| 1021 | |
| 1022 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1023 | version = 4 |
| 1024 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1025 | |
| 1026 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1027 | if xid != None: |
| 1028 | self.xid = xid |
| 1029 | else: |
| 1030 | self.xid = None |
| 1031 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1032 | |
| 1033 | def pack(self): |
| 1034 | packed = [] |
| 1035 | packed.append(struct.pack("!B", self.version)) |
| 1036 | packed.append(struct.pack("!B", self.type)) |
| 1037 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1038 | packed.append(struct.pack("!L", self.xid)) |
| 1039 | length = sum([len(x) for x in packed]) |
| 1040 | packed[2] = struct.pack("!H", length) |
| 1041 | return ''.join(packed) |
| 1042 | |
| 1043 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1044 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1045 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1046 | _version = reader.read("!B")[0] |
| 1047 | assert(_version == 4) |
| 1048 | _type = reader.read("!B")[0] |
| 1049 | assert(_type == 20) |
| 1050 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1051 | orig_reader = reader |
| 1052 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1053 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1054 | return obj |
| 1055 | |
| 1056 | def __eq__(self, other): |
| 1057 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1058 | if self.xid != other.xid: return False |
| 1059 | return True |
| 1060 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1061 | def pretty_print(self, q): |
| 1062 | q.text("barrier_request {") |
| 1063 | with q.group(): |
| 1064 | with q.indent(2): |
| 1065 | q.breakable() |
| 1066 | q.text("xid = "); |
| 1067 | if self.xid != None: |
| 1068 | q.text("%#x" % self.xid) |
| 1069 | else: |
| 1070 | q.text('None') |
| 1071 | q.breakable() |
| 1072 | q.text('}') |
| 1073 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1074 | message.subtypes[20] = barrier_request |
| 1075 | |
| 1076 | class experimenter(message): |
| 1077 | subtypes = {} |
| 1078 | |
| 1079 | @staticmethod |
| 1080 | def unpack(reader): |
| 1081 | subtype, = reader.peek('!L', 8) |
| 1082 | try: |
| 1083 | subclass = experimenter.subtypes[subtype] |
| 1084 | except KeyError: |
| 1085 | raise loxi.ProtocolError("unknown experimenter message subtype %#x" % subtype) |
| 1086 | return subclass.unpack(reader) |
| 1087 | |
| 1088 | message.subtypes[4] = experimenter |
| 1089 | |
| 1090 | class bsn_header(experimenter): |
| 1091 | subtypes = {} |
| 1092 | |
| 1093 | @staticmethod |
| 1094 | def unpack(reader): |
| 1095 | subtype, = reader.peek('!L', 12) |
| 1096 | try: |
| 1097 | subclass = bsn_header.subtypes[subtype] |
| 1098 | except KeyError: |
| 1099 | raise loxi.ProtocolError("unknown bsn_header experimenter message subtype %#x" % subtype) |
| 1100 | return subclass.unpack(reader) |
| 1101 | |
| 1102 | experimenter.subtypes[6035143] = bsn_header |
| 1103 | |
| 1104 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1105 | version = 4 |
| 1106 | type = 4 |
| 1107 | experimenter = 6035143 |
| 1108 | subtype = 22 |
| 1109 | |
| 1110 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1111 | if xid != None: |
| 1112 | self.xid = xid |
| 1113 | else: |
| 1114 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1115 | if status != None: |
| 1116 | self.status = status |
| 1117 | else: |
| 1118 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1119 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1120 | |
| 1121 | def pack(self): |
| 1122 | packed = [] |
| 1123 | packed.append(struct.pack("!B", self.version)) |
| 1124 | packed.append(struct.pack("!B", self.type)) |
| 1125 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1126 | packed.append(struct.pack("!L", self.xid)) |
| 1127 | packed.append(struct.pack("!L", self.experimenter)) |
| 1128 | packed.append(struct.pack("!L", self.subtype)) |
| 1129 | packed.append(struct.pack("!L", self.status)) |
| 1130 | length = sum([len(x) for x in packed]) |
| 1131 | packed[2] = struct.pack("!H", length) |
| 1132 | return ''.join(packed) |
| 1133 | |
| 1134 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1135 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1136 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1137 | _version = reader.read("!B")[0] |
| 1138 | assert(_version == 4) |
| 1139 | _type = reader.read("!B")[0] |
| 1140 | assert(_type == 4) |
| 1141 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1142 | orig_reader = reader |
| 1143 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1144 | obj.xid = reader.read("!L")[0] |
| 1145 | _experimenter = reader.read("!L")[0] |
| 1146 | assert(_experimenter == 6035143) |
| 1147 | _subtype = reader.read("!L")[0] |
| 1148 | assert(_subtype == 22) |
| 1149 | obj.status = reader.read("!L")[0] |
| 1150 | return obj |
| 1151 | |
| 1152 | def __eq__(self, other): |
| 1153 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1154 | if self.xid != other.xid: return False |
| 1155 | if self.status != other.status: return False |
| 1156 | return True |
| 1157 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1158 | def pretty_print(self, q): |
| 1159 | q.text("bsn_bw_clear_data_reply {") |
| 1160 | with q.group(): |
| 1161 | with q.indent(2): |
| 1162 | q.breakable() |
| 1163 | q.text("xid = "); |
| 1164 | if self.xid != None: |
| 1165 | q.text("%#x" % self.xid) |
| 1166 | else: |
| 1167 | q.text('None') |
| 1168 | q.text(","); q.breakable() |
| 1169 | q.text("status = "); |
| 1170 | q.text("%#x" % self.status) |
| 1171 | q.breakable() |
| 1172 | q.text('}') |
| 1173 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1174 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1175 | |
| 1176 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1177 | version = 4 |
| 1178 | type = 4 |
| 1179 | experimenter = 6035143 |
| 1180 | subtype = 21 |
| 1181 | |
| 1182 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1183 | if xid != None: |
| 1184 | self.xid = xid |
| 1185 | else: |
| 1186 | self.xid = None |
| 1187 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1188 | |
| 1189 | def pack(self): |
| 1190 | packed = [] |
| 1191 | packed.append(struct.pack("!B", self.version)) |
| 1192 | packed.append(struct.pack("!B", self.type)) |
| 1193 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1194 | packed.append(struct.pack("!L", self.xid)) |
| 1195 | packed.append(struct.pack("!L", self.experimenter)) |
| 1196 | packed.append(struct.pack("!L", self.subtype)) |
| 1197 | length = sum([len(x) for x in packed]) |
| 1198 | packed[2] = struct.pack("!H", length) |
| 1199 | return ''.join(packed) |
| 1200 | |
| 1201 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1202 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1203 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1204 | _version = reader.read("!B")[0] |
| 1205 | assert(_version == 4) |
| 1206 | _type = reader.read("!B")[0] |
| 1207 | assert(_type == 4) |
| 1208 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1209 | orig_reader = reader |
| 1210 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1211 | obj.xid = reader.read("!L")[0] |
| 1212 | _experimenter = reader.read("!L")[0] |
| 1213 | assert(_experimenter == 6035143) |
| 1214 | _subtype = reader.read("!L")[0] |
| 1215 | assert(_subtype == 21) |
| 1216 | return obj |
| 1217 | |
| 1218 | def __eq__(self, other): |
| 1219 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1220 | if self.xid != other.xid: return False |
| 1221 | return True |
| 1222 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1223 | def pretty_print(self, q): |
| 1224 | q.text("bsn_bw_clear_data_request {") |
| 1225 | with q.group(): |
| 1226 | with q.indent(2): |
| 1227 | q.breakable() |
| 1228 | q.text("xid = "); |
| 1229 | if self.xid != None: |
| 1230 | q.text("%#x" % self.xid) |
| 1231 | else: |
| 1232 | q.text('None') |
| 1233 | q.breakable() |
| 1234 | q.text('}') |
| 1235 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1236 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1237 | |
| 1238 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1239 | version = 4 |
| 1240 | type = 4 |
| 1241 | experimenter = 6035143 |
| 1242 | subtype = 20 |
| 1243 | |
| 1244 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1245 | if xid != None: |
| 1246 | self.xid = xid |
| 1247 | else: |
| 1248 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1249 | if enabled != None: |
| 1250 | self.enabled = enabled |
| 1251 | else: |
| 1252 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1253 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1254 | |
| 1255 | def pack(self): |
| 1256 | packed = [] |
| 1257 | packed.append(struct.pack("!B", self.version)) |
| 1258 | packed.append(struct.pack("!B", self.type)) |
| 1259 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1260 | packed.append(struct.pack("!L", self.xid)) |
| 1261 | packed.append(struct.pack("!L", self.experimenter)) |
| 1262 | packed.append(struct.pack("!L", self.subtype)) |
| 1263 | packed.append(struct.pack("!L", self.enabled)) |
| 1264 | length = sum([len(x) for x in packed]) |
| 1265 | packed[2] = struct.pack("!H", length) |
| 1266 | return ''.join(packed) |
| 1267 | |
| 1268 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1269 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1270 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1271 | _version = reader.read("!B")[0] |
| 1272 | assert(_version == 4) |
| 1273 | _type = reader.read("!B")[0] |
| 1274 | assert(_type == 4) |
| 1275 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1276 | orig_reader = reader |
| 1277 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1278 | obj.xid = reader.read("!L")[0] |
| 1279 | _experimenter = reader.read("!L")[0] |
| 1280 | assert(_experimenter == 6035143) |
| 1281 | _subtype = reader.read("!L")[0] |
| 1282 | assert(_subtype == 20) |
| 1283 | obj.enabled = reader.read("!L")[0] |
| 1284 | return obj |
| 1285 | |
| 1286 | def __eq__(self, other): |
| 1287 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1288 | if self.xid != other.xid: return False |
| 1289 | if self.enabled != other.enabled: return False |
| 1290 | return True |
| 1291 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1292 | def pretty_print(self, q): |
| 1293 | q.text("bsn_bw_enable_get_reply {") |
| 1294 | with q.group(): |
| 1295 | with q.indent(2): |
| 1296 | q.breakable() |
| 1297 | q.text("xid = "); |
| 1298 | if self.xid != None: |
| 1299 | q.text("%#x" % self.xid) |
| 1300 | else: |
| 1301 | q.text('None') |
| 1302 | q.text(","); q.breakable() |
| 1303 | q.text("enabled = "); |
| 1304 | q.text("%#x" % self.enabled) |
| 1305 | q.breakable() |
| 1306 | q.text('}') |
| 1307 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1308 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1309 | |
| 1310 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1311 | version = 4 |
| 1312 | type = 4 |
| 1313 | experimenter = 6035143 |
| 1314 | subtype = 19 |
| 1315 | |
| 1316 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1317 | if xid != None: |
| 1318 | self.xid = xid |
| 1319 | else: |
| 1320 | self.xid = None |
| 1321 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1322 | |
| 1323 | def pack(self): |
| 1324 | packed = [] |
| 1325 | packed.append(struct.pack("!B", self.version)) |
| 1326 | packed.append(struct.pack("!B", self.type)) |
| 1327 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1328 | packed.append(struct.pack("!L", self.xid)) |
| 1329 | packed.append(struct.pack("!L", self.experimenter)) |
| 1330 | packed.append(struct.pack("!L", self.subtype)) |
| 1331 | length = sum([len(x) for x in packed]) |
| 1332 | packed[2] = struct.pack("!H", length) |
| 1333 | return ''.join(packed) |
| 1334 | |
| 1335 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1336 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1337 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1338 | _version = reader.read("!B")[0] |
| 1339 | assert(_version == 4) |
| 1340 | _type = reader.read("!B")[0] |
| 1341 | assert(_type == 4) |
| 1342 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1343 | orig_reader = reader |
| 1344 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1345 | obj.xid = reader.read("!L")[0] |
| 1346 | _experimenter = reader.read("!L")[0] |
| 1347 | assert(_experimenter == 6035143) |
| 1348 | _subtype = reader.read("!L")[0] |
| 1349 | assert(_subtype == 19) |
| 1350 | return obj |
| 1351 | |
| 1352 | def __eq__(self, other): |
| 1353 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1354 | if self.xid != other.xid: return False |
| 1355 | return True |
| 1356 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1357 | def pretty_print(self, q): |
| 1358 | q.text("bsn_bw_enable_get_request {") |
| 1359 | with q.group(): |
| 1360 | with q.indent(2): |
| 1361 | q.breakable() |
| 1362 | q.text("xid = "); |
| 1363 | if self.xid != None: |
| 1364 | q.text("%#x" % self.xid) |
| 1365 | else: |
| 1366 | q.text('None') |
| 1367 | q.breakable() |
| 1368 | q.text('}') |
| 1369 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1370 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1371 | |
| 1372 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1373 | version = 4 |
| 1374 | type = 4 |
| 1375 | experimenter = 6035143 |
| 1376 | subtype = 23 |
| 1377 | |
| 1378 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1379 | if xid != None: |
| 1380 | self.xid = xid |
| 1381 | else: |
| 1382 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1383 | if enable != None: |
| 1384 | self.enable = enable |
| 1385 | else: |
| 1386 | self.enable = 0 |
| 1387 | if status != None: |
| 1388 | self.status = status |
| 1389 | else: |
| 1390 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1391 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1392 | |
| 1393 | def pack(self): |
| 1394 | packed = [] |
| 1395 | packed.append(struct.pack("!B", self.version)) |
| 1396 | packed.append(struct.pack("!B", self.type)) |
| 1397 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1398 | packed.append(struct.pack("!L", self.xid)) |
| 1399 | packed.append(struct.pack("!L", self.experimenter)) |
| 1400 | packed.append(struct.pack("!L", self.subtype)) |
| 1401 | packed.append(struct.pack("!L", self.enable)) |
| 1402 | packed.append(struct.pack("!L", self.status)) |
| 1403 | length = sum([len(x) for x in packed]) |
| 1404 | packed[2] = struct.pack("!H", length) |
| 1405 | return ''.join(packed) |
| 1406 | |
| 1407 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1408 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1409 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1410 | _version = reader.read("!B")[0] |
| 1411 | assert(_version == 4) |
| 1412 | _type = reader.read("!B")[0] |
| 1413 | assert(_type == 4) |
| 1414 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1415 | orig_reader = reader |
| 1416 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1417 | obj.xid = reader.read("!L")[0] |
| 1418 | _experimenter = reader.read("!L")[0] |
| 1419 | assert(_experimenter == 6035143) |
| 1420 | _subtype = reader.read("!L")[0] |
| 1421 | assert(_subtype == 23) |
| 1422 | obj.enable = reader.read("!L")[0] |
| 1423 | obj.status = reader.read("!L")[0] |
| 1424 | return obj |
| 1425 | |
| 1426 | def __eq__(self, other): |
| 1427 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1428 | if self.xid != other.xid: return False |
| 1429 | if self.enable != other.enable: return False |
| 1430 | if self.status != other.status: return False |
| 1431 | return True |
| 1432 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1433 | def pretty_print(self, q): |
| 1434 | q.text("bsn_bw_enable_set_reply {") |
| 1435 | with q.group(): |
| 1436 | with q.indent(2): |
| 1437 | q.breakable() |
| 1438 | q.text("xid = "); |
| 1439 | if self.xid != None: |
| 1440 | q.text("%#x" % self.xid) |
| 1441 | else: |
| 1442 | q.text('None') |
| 1443 | q.text(","); q.breakable() |
| 1444 | q.text("enable = "); |
| 1445 | q.text("%#x" % self.enable) |
| 1446 | q.text(","); q.breakable() |
| 1447 | q.text("status = "); |
| 1448 | q.text("%#x" % self.status) |
| 1449 | q.breakable() |
| 1450 | q.text('}') |
| 1451 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1452 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1453 | |
| 1454 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1455 | version = 4 |
| 1456 | type = 4 |
| 1457 | experimenter = 6035143 |
| 1458 | subtype = 18 |
| 1459 | |
| 1460 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1461 | if xid != None: |
| 1462 | self.xid = xid |
| 1463 | else: |
| 1464 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1465 | if enable != None: |
| 1466 | self.enable = enable |
| 1467 | else: |
| 1468 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1469 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1470 | |
| 1471 | def pack(self): |
| 1472 | packed = [] |
| 1473 | packed.append(struct.pack("!B", self.version)) |
| 1474 | packed.append(struct.pack("!B", self.type)) |
| 1475 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1476 | packed.append(struct.pack("!L", self.xid)) |
| 1477 | packed.append(struct.pack("!L", self.experimenter)) |
| 1478 | packed.append(struct.pack("!L", self.subtype)) |
| 1479 | packed.append(struct.pack("!L", self.enable)) |
| 1480 | length = sum([len(x) for x in packed]) |
| 1481 | packed[2] = struct.pack("!H", length) |
| 1482 | return ''.join(packed) |
| 1483 | |
| 1484 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1485 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1486 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1487 | _version = reader.read("!B")[0] |
| 1488 | assert(_version == 4) |
| 1489 | _type = reader.read("!B")[0] |
| 1490 | assert(_type == 4) |
| 1491 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1492 | orig_reader = reader |
| 1493 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1494 | obj.xid = reader.read("!L")[0] |
| 1495 | _experimenter = reader.read("!L")[0] |
| 1496 | assert(_experimenter == 6035143) |
| 1497 | _subtype = reader.read("!L")[0] |
| 1498 | assert(_subtype == 18) |
| 1499 | obj.enable = reader.read("!L")[0] |
| 1500 | return obj |
| 1501 | |
| 1502 | def __eq__(self, other): |
| 1503 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1504 | if self.xid != other.xid: return False |
| 1505 | if self.enable != other.enable: return False |
| 1506 | return True |
| 1507 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1508 | def pretty_print(self, q): |
| 1509 | q.text("bsn_bw_enable_set_request {") |
| 1510 | with q.group(): |
| 1511 | with q.indent(2): |
| 1512 | q.breakable() |
| 1513 | q.text("xid = "); |
| 1514 | if self.xid != None: |
| 1515 | q.text("%#x" % self.xid) |
| 1516 | else: |
| 1517 | q.text('None') |
| 1518 | q.text(","); q.breakable() |
| 1519 | q.text("enable = "); |
| 1520 | q.text("%#x" % self.enable) |
| 1521 | q.breakable() |
| 1522 | q.text('}') |
| 1523 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1524 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1525 | |
Rich Lane | 1a82041 | 2014-01-06 14:15:07 -0800 | [diff] [blame^] | 1526 | class bsn_controller_connections_reply(bsn_header): |
| 1527 | version = 4 |
| 1528 | type = 4 |
| 1529 | experimenter = 6035143 |
| 1530 | subtype = 57 |
| 1531 | |
| 1532 | def __init__(self, xid=None, connections=None): |
| 1533 | if xid != None: |
| 1534 | self.xid = xid |
| 1535 | else: |
| 1536 | self.xid = None |
| 1537 | if connections != None: |
| 1538 | self.connections = connections |
| 1539 | else: |
| 1540 | self.connections = [] |
| 1541 | return |
| 1542 | |
| 1543 | def pack(self): |
| 1544 | packed = [] |
| 1545 | packed.append(struct.pack("!B", self.version)) |
| 1546 | packed.append(struct.pack("!B", self.type)) |
| 1547 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1548 | packed.append(struct.pack("!L", self.xid)) |
| 1549 | packed.append(struct.pack("!L", self.experimenter)) |
| 1550 | packed.append(struct.pack("!L", self.subtype)) |
| 1551 | packed.append(loxi.generic_util.pack_list(self.connections)) |
| 1552 | length = sum([len(x) for x in packed]) |
| 1553 | packed[2] = struct.pack("!H", length) |
| 1554 | return ''.join(packed) |
| 1555 | |
| 1556 | @staticmethod |
| 1557 | def unpack(reader): |
| 1558 | obj = bsn_controller_connections_reply() |
| 1559 | _version = reader.read("!B")[0] |
| 1560 | assert(_version == 4) |
| 1561 | _type = reader.read("!B")[0] |
| 1562 | assert(_type == 4) |
| 1563 | _length = reader.read("!H")[0] |
| 1564 | orig_reader = reader |
| 1565 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1566 | obj.xid = reader.read("!L")[0] |
| 1567 | _experimenter = reader.read("!L")[0] |
| 1568 | assert(_experimenter == 6035143) |
| 1569 | _subtype = reader.read("!L")[0] |
| 1570 | assert(_subtype == 57) |
| 1571 | obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack) |
| 1572 | return obj |
| 1573 | |
| 1574 | def __eq__(self, other): |
| 1575 | if type(self) != type(other): return False |
| 1576 | if self.xid != other.xid: return False |
| 1577 | if self.connections != other.connections: return False |
| 1578 | return True |
| 1579 | |
| 1580 | def pretty_print(self, q): |
| 1581 | q.text("bsn_controller_connections_reply {") |
| 1582 | with q.group(): |
| 1583 | with q.indent(2): |
| 1584 | q.breakable() |
| 1585 | q.text("xid = "); |
| 1586 | if self.xid != None: |
| 1587 | q.text("%#x" % self.xid) |
| 1588 | else: |
| 1589 | q.text('None') |
| 1590 | q.text(","); q.breakable() |
| 1591 | q.text("connections = "); |
| 1592 | q.pp(self.connections) |
| 1593 | q.breakable() |
| 1594 | q.text('}') |
| 1595 | |
| 1596 | bsn_header.subtypes[57] = bsn_controller_connections_reply |
| 1597 | |
| 1598 | class bsn_controller_connections_request(bsn_header): |
| 1599 | version = 4 |
| 1600 | type = 4 |
| 1601 | experimenter = 6035143 |
| 1602 | subtype = 56 |
| 1603 | |
| 1604 | def __init__(self, xid=None): |
| 1605 | if xid != None: |
| 1606 | self.xid = xid |
| 1607 | else: |
| 1608 | self.xid = None |
| 1609 | return |
| 1610 | |
| 1611 | def pack(self): |
| 1612 | packed = [] |
| 1613 | packed.append(struct.pack("!B", self.version)) |
| 1614 | packed.append(struct.pack("!B", self.type)) |
| 1615 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1616 | packed.append(struct.pack("!L", self.xid)) |
| 1617 | packed.append(struct.pack("!L", self.experimenter)) |
| 1618 | packed.append(struct.pack("!L", self.subtype)) |
| 1619 | length = sum([len(x) for x in packed]) |
| 1620 | packed[2] = struct.pack("!H", length) |
| 1621 | return ''.join(packed) |
| 1622 | |
| 1623 | @staticmethod |
| 1624 | def unpack(reader): |
| 1625 | obj = bsn_controller_connections_request() |
| 1626 | _version = reader.read("!B")[0] |
| 1627 | assert(_version == 4) |
| 1628 | _type = reader.read("!B")[0] |
| 1629 | assert(_type == 4) |
| 1630 | _length = reader.read("!H")[0] |
| 1631 | orig_reader = reader |
| 1632 | reader = orig_reader.slice(_length - (2 + 2)) |
| 1633 | obj.xid = reader.read("!L")[0] |
| 1634 | _experimenter = reader.read("!L")[0] |
| 1635 | assert(_experimenter == 6035143) |
| 1636 | _subtype = reader.read("!L")[0] |
| 1637 | assert(_subtype == 56) |
| 1638 | return obj |
| 1639 | |
| 1640 | def __eq__(self, other): |
| 1641 | if type(self) != type(other): return False |
| 1642 | if self.xid != other.xid: return False |
| 1643 | return True |
| 1644 | |
| 1645 | def pretty_print(self, q): |
| 1646 | q.text("bsn_controller_connections_request {") |
| 1647 | with q.group(): |
| 1648 | with q.indent(2): |
| 1649 | q.breakable() |
| 1650 | q.text("xid = "); |
| 1651 | if self.xid != None: |
| 1652 | q.text("%#x" % self.xid) |
| 1653 | else: |
| 1654 | q.text('None') |
| 1655 | q.breakable() |
| 1656 | q.text('}') |
| 1657 | |
| 1658 | bsn_header.subtypes[56] = bsn_controller_connections_request |
| 1659 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1660 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1661 | version = 4 |
| 1662 | type = 4 |
| 1663 | experimenter = 6035143 |
| 1664 | subtype = 40 |
| 1665 | |
| 1666 | def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1667 | if xid != None: |
| 1668 | self.xid = xid |
| 1669 | else: |
| 1670 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1671 | if cookie != None: |
| 1672 | self.cookie = cookie |
| 1673 | else: |
| 1674 | self.cookie = 0 |
| 1675 | if priority != None: |
| 1676 | self.priority = priority |
| 1677 | else: |
| 1678 | self.priority = 0 |
| 1679 | if table_id != None: |
| 1680 | self.table_id = table_id |
| 1681 | else: |
| 1682 | self.table_id = 0 |
| 1683 | if match != None: |
| 1684 | self.match = match |
| 1685 | else: |
| 1686 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1687 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1688 | |
| 1689 | def pack(self): |
| 1690 | packed = [] |
| 1691 | packed.append(struct.pack("!B", self.version)) |
| 1692 | packed.append(struct.pack("!B", self.type)) |
| 1693 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1694 | packed.append(struct.pack("!L", self.xid)) |
| 1695 | packed.append(struct.pack("!L", self.experimenter)) |
| 1696 | packed.append(struct.pack("!L", self.subtype)) |
| 1697 | packed.append(struct.pack("!Q", self.cookie)) |
| 1698 | packed.append(struct.pack("!H", self.priority)) |
| 1699 | packed.append(struct.pack("!B", self.table_id)) |
| 1700 | packed.append('\x00' * 5) |
| 1701 | packed.append(self.match.pack()) |
| 1702 | length = sum([len(x) for x in packed]) |
| 1703 | packed[2] = struct.pack("!H", length) |
| 1704 | return ''.join(packed) |
| 1705 | |
| 1706 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1707 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1708 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1709 | _version = reader.read("!B")[0] |
| 1710 | assert(_version == 4) |
| 1711 | _type = reader.read("!B")[0] |
| 1712 | assert(_type == 4) |
| 1713 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1714 | orig_reader = reader |
| 1715 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1716 | obj.xid = reader.read("!L")[0] |
| 1717 | _experimenter = reader.read("!L")[0] |
| 1718 | assert(_experimenter == 6035143) |
| 1719 | _subtype = reader.read("!L")[0] |
| 1720 | assert(_subtype == 40) |
| 1721 | obj.cookie = reader.read("!Q")[0] |
| 1722 | obj.priority = reader.read("!H")[0] |
| 1723 | obj.table_id = reader.read("!B")[0] |
| 1724 | reader.skip(5) |
| 1725 | obj.match = common.match.unpack(reader) |
| 1726 | return obj |
| 1727 | |
| 1728 | def __eq__(self, other): |
| 1729 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1730 | if self.xid != other.xid: return False |
| 1731 | if self.cookie != other.cookie: return False |
| 1732 | if self.priority != other.priority: return False |
| 1733 | if self.table_id != other.table_id: return False |
| 1734 | if self.match != other.match: return False |
| 1735 | return True |
| 1736 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1737 | def pretty_print(self, q): |
| 1738 | q.text("bsn_flow_idle {") |
| 1739 | with q.group(): |
| 1740 | with q.indent(2): |
| 1741 | q.breakable() |
| 1742 | q.text("xid = "); |
| 1743 | if self.xid != None: |
| 1744 | q.text("%#x" % self.xid) |
| 1745 | else: |
| 1746 | q.text('None') |
| 1747 | q.text(","); q.breakable() |
| 1748 | q.text("cookie = "); |
| 1749 | q.text("%#x" % self.cookie) |
| 1750 | q.text(","); q.breakable() |
| 1751 | q.text("priority = "); |
| 1752 | q.text("%#x" % self.priority) |
| 1753 | q.text(","); q.breakable() |
| 1754 | q.text("table_id = "); |
| 1755 | q.text("%#x" % self.table_id) |
| 1756 | q.text(","); q.breakable() |
| 1757 | q.text("match = "); |
| 1758 | q.pp(self.match) |
| 1759 | q.breakable() |
| 1760 | q.text('}') |
| 1761 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1762 | bsn_header.subtypes[40] = bsn_flow_idle |
| 1763 | |
| 1764 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1765 | version = 4 |
| 1766 | type = 4 |
| 1767 | experimenter = 6035143 |
| 1768 | subtype = 39 |
| 1769 | |
| 1770 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1771 | if xid != None: |
| 1772 | self.xid = xid |
| 1773 | else: |
| 1774 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1775 | if enabled != None: |
| 1776 | self.enabled = enabled |
| 1777 | else: |
| 1778 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1779 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1780 | |
| 1781 | def pack(self): |
| 1782 | packed = [] |
| 1783 | packed.append(struct.pack("!B", self.version)) |
| 1784 | packed.append(struct.pack("!B", self.type)) |
| 1785 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1786 | packed.append(struct.pack("!L", self.xid)) |
| 1787 | packed.append(struct.pack("!L", self.experimenter)) |
| 1788 | packed.append(struct.pack("!L", self.subtype)) |
| 1789 | packed.append(struct.pack("!L", self.enabled)) |
| 1790 | length = sum([len(x) for x in packed]) |
| 1791 | packed[2] = struct.pack("!H", length) |
| 1792 | return ''.join(packed) |
| 1793 | |
| 1794 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1795 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1796 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1797 | _version = reader.read("!B")[0] |
| 1798 | assert(_version == 4) |
| 1799 | _type = reader.read("!B")[0] |
| 1800 | assert(_type == 4) |
| 1801 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1802 | orig_reader = reader |
| 1803 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1804 | obj.xid = reader.read("!L")[0] |
| 1805 | _experimenter = reader.read("!L")[0] |
| 1806 | assert(_experimenter == 6035143) |
| 1807 | _subtype = reader.read("!L")[0] |
| 1808 | assert(_subtype == 39) |
| 1809 | obj.enabled = reader.read("!L")[0] |
| 1810 | return obj |
| 1811 | |
| 1812 | def __eq__(self, other): |
| 1813 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1814 | if self.xid != other.xid: return False |
| 1815 | if self.enabled != other.enabled: return False |
| 1816 | return True |
| 1817 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1818 | def pretty_print(self, q): |
| 1819 | q.text("bsn_flow_idle_enable_get_reply {") |
| 1820 | with q.group(): |
| 1821 | with q.indent(2): |
| 1822 | q.breakable() |
| 1823 | q.text("xid = "); |
| 1824 | if self.xid != None: |
| 1825 | q.text("%#x" % self.xid) |
| 1826 | else: |
| 1827 | q.text('None') |
| 1828 | q.text(","); q.breakable() |
| 1829 | q.text("enabled = "); |
| 1830 | q.text("%#x" % self.enabled) |
| 1831 | q.breakable() |
| 1832 | q.text('}') |
| 1833 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1834 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 1835 | |
| 1836 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1837 | version = 4 |
| 1838 | type = 4 |
| 1839 | experimenter = 6035143 |
| 1840 | subtype = 38 |
| 1841 | |
| 1842 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1843 | if xid != None: |
| 1844 | self.xid = xid |
| 1845 | else: |
| 1846 | self.xid = None |
| 1847 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1848 | |
| 1849 | def pack(self): |
| 1850 | packed = [] |
| 1851 | packed.append(struct.pack("!B", self.version)) |
| 1852 | packed.append(struct.pack("!B", self.type)) |
| 1853 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1854 | packed.append(struct.pack("!L", self.xid)) |
| 1855 | packed.append(struct.pack("!L", self.experimenter)) |
| 1856 | packed.append(struct.pack("!L", self.subtype)) |
| 1857 | length = sum([len(x) for x in packed]) |
| 1858 | packed[2] = struct.pack("!H", length) |
| 1859 | return ''.join(packed) |
| 1860 | |
| 1861 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1862 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1863 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1864 | _version = reader.read("!B")[0] |
| 1865 | assert(_version == 4) |
| 1866 | _type = reader.read("!B")[0] |
| 1867 | assert(_type == 4) |
| 1868 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1869 | orig_reader = reader |
| 1870 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1871 | obj.xid = reader.read("!L")[0] |
| 1872 | _experimenter = reader.read("!L")[0] |
| 1873 | assert(_experimenter == 6035143) |
| 1874 | _subtype = reader.read("!L")[0] |
| 1875 | assert(_subtype == 38) |
| 1876 | return obj |
| 1877 | |
| 1878 | def __eq__(self, other): |
| 1879 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1880 | if self.xid != other.xid: return False |
| 1881 | return True |
| 1882 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1883 | def pretty_print(self, q): |
| 1884 | q.text("bsn_flow_idle_enable_get_request {") |
| 1885 | with q.group(): |
| 1886 | with q.indent(2): |
| 1887 | q.breakable() |
| 1888 | q.text("xid = "); |
| 1889 | if self.xid != None: |
| 1890 | q.text("%#x" % self.xid) |
| 1891 | else: |
| 1892 | q.text('None') |
| 1893 | q.breakable() |
| 1894 | q.text('}') |
| 1895 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1896 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 1897 | |
| 1898 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1899 | version = 4 |
| 1900 | type = 4 |
| 1901 | experimenter = 6035143 |
| 1902 | subtype = 37 |
| 1903 | |
| 1904 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1905 | if xid != None: |
| 1906 | self.xid = xid |
| 1907 | else: |
| 1908 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1909 | if enable != None: |
| 1910 | self.enable = enable |
| 1911 | else: |
| 1912 | self.enable = 0 |
| 1913 | if status != None: |
| 1914 | self.status = status |
| 1915 | else: |
| 1916 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1917 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1918 | |
| 1919 | def pack(self): |
| 1920 | packed = [] |
| 1921 | packed.append(struct.pack("!B", self.version)) |
| 1922 | packed.append(struct.pack("!B", self.type)) |
| 1923 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1924 | packed.append(struct.pack("!L", self.xid)) |
| 1925 | packed.append(struct.pack("!L", self.experimenter)) |
| 1926 | packed.append(struct.pack("!L", self.subtype)) |
| 1927 | packed.append(struct.pack("!L", self.enable)) |
| 1928 | packed.append(struct.pack("!L", self.status)) |
| 1929 | length = sum([len(x) for x in packed]) |
| 1930 | packed[2] = struct.pack("!H", length) |
| 1931 | return ''.join(packed) |
| 1932 | |
| 1933 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1934 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1935 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1936 | _version = reader.read("!B")[0] |
| 1937 | assert(_version == 4) |
| 1938 | _type = reader.read("!B")[0] |
| 1939 | assert(_type == 4) |
| 1940 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1941 | orig_reader = reader |
| 1942 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1943 | obj.xid = reader.read("!L")[0] |
| 1944 | _experimenter = reader.read("!L")[0] |
| 1945 | assert(_experimenter == 6035143) |
| 1946 | _subtype = reader.read("!L")[0] |
| 1947 | assert(_subtype == 37) |
| 1948 | obj.enable = reader.read("!L")[0] |
| 1949 | obj.status = reader.read("!L")[0] |
| 1950 | return obj |
| 1951 | |
| 1952 | def __eq__(self, other): |
| 1953 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1954 | if self.xid != other.xid: return False |
| 1955 | if self.enable != other.enable: return False |
| 1956 | if self.status != other.status: return False |
| 1957 | return True |
| 1958 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1959 | def pretty_print(self, q): |
| 1960 | q.text("bsn_flow_idle_enable_set_reply {") |
| 1961 | with q.group(): |
| 1962 | with q.indent(2): |
| 1963 | q.breakable() |
| 1964 | q.text("xid = "); |
| 1965 | if self.xid != None: |
| 1966 | q.text("%#x" % self.xid) |
| 1967 | else: |
| 1968 | q.text('None') |
| 1969 | q.text(","); q.breakable() |
| 1970 | q.text("enable = "); |
| 1971 | q.text("%#x" % self.enable) |
| 1972 | q.text(","); q.breakable() |
| 1973 | q.text("status = "); |
| 1974 | q.text("%#x" % self.status) |
| 1975 | q.breakable() |
| 1976 | q.text('}') |
| 1977 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1978 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 1979 | |
| 1980 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1981 | version = 4 |
| 1982 | type = 4 |
| 1983 | experimenter = 6035143 |
| 1984 | subtype = 36 |
| 1985 | |
| 1986 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1987 | if xid != None: |
| 1988 | self.xid = xid |
| 1989 | else: |
| 1990 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1991 | if enable != None: |
| 1992 | self.enable = enable |
| 1993 | else: |
| 1994 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1995 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1996 | |
| 1997 | def pack(self): |
| 1998 | packed = [] |
| 1999 | packed.append(struct.pack("!B", self.version)) |
| 2000 | packed.append(struct.pack("!B", self.type)) |
| 2001 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2002 | packed.append(struct.pack("!L", self.xid)) |
| 2003 | packed.append(struct.pack("!L", self.experimenter)) |
| 2004 | packed.append(struct.pack("!L", self.subtype)) |
| 2005 | packed.append(struct.pack("!L", self.enable)) |
| 2006 | length = sum([len(x) for x in packed]) |
| 2007 | packed[2] = struct.pack("!H", length) |
| 2008 | return ''.join(packed) |
| 2009 | |
| 2010 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2011 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2012 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2013 | _version = reader.read("!B")[0] |
| 2014 | assert(_version == 4) |
| 2015 | _type = reader.read("!B")[0] |
| 2016 | assert(_type == 4) |
| 2017 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2018 | orig_reader = reader |
| 2019 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2020 | obj.xid = reader.read("!L")[0] |
| 2021 | _experimenter = reader.read("!L")[0] |
| 2022 | assert(_experimenter == 6035143) |
| 2023 | _subtype = reader.read("!L")[0] |
| 2024 | assert(_subtype == 36) |
| 2025 | obj.enable = reader.read("!L")[0] |
| 2026 | return obj |
| 2027 | |
| 2028 | def __eq__(self, other): |
| 2029 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2030 | if self.xid != other.xid: return False |
| 2031 | if self.enable != other.enable: return False |
| 2032 | return True |
| 2033 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2034 | def pretty_print(self, q): |
| 2035 | q.text("bsn_flow_idle_enable_set_request {") |
| 2036 | with q.group(): |
| 2037 | with q.indent(2): |
| 2038 | q.breakable() |
| 2039 | q.text("xid = "); |
| 2040 | if self.xid != None: |
| 2041 | q.text("%#x" % self.xid) |
| 2042 | else: |
| 2043 | q.text('None') |
| 2044 | q.text(","); q.breakable() |
| 2045 | q.text("enable = "); |
| 2046 | q.text("%#x" % self.enable) |
| 2047 | q.breakable() |
| 2048 | q.text('}') |
| 2049 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2050 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 2051 | |
Rich Lane | 1a82041 | 2014-01-06 14:15:07 -0800 | [diff] [blame^] | 2052 | class experimenter_stats_reply(stats_reply): |
| 2053 | subtypes = {} |
| 2054 | |
| 2055 | @staticmethod |
| 2056 | def unpack(reader): |
| 2057 | subtype, = reader.peek('!L', 16) |
| 2058 | try: |
| 2059 | subclass = experimenter_stats_reply.subtypes[subtype] |
| 2060 | except KeyError: |
| 2061 | raise loxi.ProtocolError("unknown experimenter_stats_reply stats_reply message subtype %#x" % subtype) |
| 2062 | return subclass.unpack(reader) |
| 2063 | |
| 2064 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2065 | |
| 2066 | class bsn_stats_reply(experimenter_stats_reply): |
| 2067 | subtypes = {} |
| 2068 | |
| 2069 | @staticmethod |
| 2070 | def unpack(reader): |
| 2071 | subtype, = reader.peek('!L', 20) |
| 2072 | try: |
| 2073 | subclass = bsn_stats_reply.subtypes[subtype] |
| 2074 | except KeyError: |
| 2075 | raise loxi.ProtocolError("unknown bsn_stats_reply experimenter_stats_reply stats_reply message subtype %#x" % subtype) |
| 2076 | return subclass.unpack(reader) |
| 2077 | |
| 2078 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2079 | |
| 2080 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 2081 | version = 4 |
| 2082 | type = 19 |
| 2083 | stats_type = 65535 |
| 2084 | experimenter = 6035143 |
| 2085 | subtype = 5 |
| 2086 | |
| 2087 | def __init__(self, xid=None, flags=None, entries=None): |
| 2088 | if xid != None: |
| 2089 | self.xid = xid |
| 2090 | else: |
| 2091 | self.xid = None |
| 2092 | if flags != None: |
| 2093 | self.flags = flags |
| 2094 | else: |
| 2095 | self.flags = 0 |
| 2096 | if entries != None: |
| 2097 | self.entries = entries |
| 2098 | else: |
| 2099 | self.entries = [] |
| 2100 | return |
| 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("!H", self.stats_type)) |
| 2109 | packed.append(struct.pack("!H", self.flags)) |
| 2110 | packed.append('\x00' * 4) |
| 2111 | packed.append(struct.pack("!L", self.experimenter)) |
| 2112 | packed.append(struct.pack("!L", self.subtype)) |
| 2113 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2114 | length = sum([len(x) for x in packed]) |
| 2115 | packed[2] = struct.pack("!H", length) |
| 2116 | return ''.join(packed) |
| 2117 | |
| 2118 | @staticmethod |
| 2119 | def unpack(reader): |
| 2120 | obj = bsn_gentable_bucket_stats_reply() |
| 2121 | _version = reader.read("!B")[0] |
| 2122 | assert(_version == 4) |
| 2123 | _type = reader.read("!B")[0] |
| 2124 | assert(_type == 19) |
| 2125 | _length = reader.read("!H")[0] |
| 2126 | orig_reader = reader |
| 2127 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2128 | obj.xid = reader.read("!L")[0] |
| 2129 | _stats_type = reader.read("!H")[0] |
| 2130 | assert(_stats_type == 65535) |
| 2131 | obj.flags = reader.read("!H")[0] |
| 2132 | reader.skip(4) |
| 2133 | _experimenter = reader.read("!L")[0] |
| 2134 | assert(_experimenter == 6035143) |
| 2135 | _subtype = reader.read("!L")[0] |
| 2136 | assert(_subtype == 5) |
| 2137 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack) |
| 2138 | return obj |
| 2139 | |
| 2140 | def __eq__(self, other): |
| 2141 | if type(self) != type(other): return False |
| 2142 | if self.xid != other.xid: return False |
| 2143 | if self.flags != other.flags: return False |
| 2144 | if self.entries != other.entries: return False |
| 2145 | return True |
| 2146 | |
| 2147 | def pretty_print(self, q): |
| 2148 | q.text("bsn_gentable_bucket_stats_reply {") |
| 2149 | with q.group(): |
| 2150 | with q.indent(2): |
| 2151 | q.breakable() |
| 2152 | q.text("xid = "); |
| 2153 | if self.xid != None: |
| 2154 | q.text("%#x" % self.xid) |
| 2155 | else: |
| 2156 | q.text('None') |
| 2157 | q.text(","); q.breakable() |
| 2158 | q.text("flags = "); |
| 2159 | q.text("%#x" % self.flags) |
| 2160 | q.text(","); q.breakable() |
| 2161 | q.text("entries = "); |
| 2162 | q.pp(self.entries) |
| 2163 | q.breakable() |
| 2164 | q.text('}') |
| 2165 | |
| 2166 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 2167 | |
| 2168 | class experimenter_stats_request(stats_request): |
| 2169 | subtypes = {} |
| 2170 | |
| 2171 | @staticmethod |
| 2172 | def unpack(reader): |
| 2173 | subtype, = reader.peek('!L', 16) |
| 2174 | try: |
| 2175 | subclass = experimenter_stats_request.subtypes[subtype] |
| 2176 | except KeyError: |
| 2177 | raise loxi.ProtocolError("unknown experimenter_stats_request stats_request message subtype %#x" % subtype) |
| 2178 | return subclass.unpack(reader) |
| 2179 | |
| 2180 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2181 | |
| 2182 | class bsn_stats_request(experimenter_stats_request): |
| 2183 | subtypes = {} |
| 2184 | |
| 2185 | @staticmethod |
| 2186 | def unpack(reader): |
| 2187 | subtype, = reader.peek('!L', 20) |
| 2188 | try: |
| 2189 | subclass = bsn_stats_request.subtypes[subtype] |
| 2190 | except KeyError: |
| 2191 | raise loxi.ProtocolError("unknown bsn_stats_request experimenter_stats_request stats_request message subtype %#x" % subtype) |
| 2192 | return subclass.unpack(reader) |
| 2193 | |
| 2194 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2195 | |
| 2196 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 2197 | version = 4 |
| 2198 | type = 18 |
| 2199 | stats_type = 65535 |
| 2200 | experimenter = 6035143 |
| 2201 | subtype = 5 |
| 2202 | |
| 2203 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2204 | if xid != None: |
| 2205 | self.xid = xid |
| 2206 | else: |
| 2207 | self.xid = None |
| 2208 | if flags != None: |
| 2209 | self.flags = flags |
| 2210 | else: |
| 2211 | self.flags = 0 |
| 2212 | if table_id != None: |
| 2213 | self.table_id = table_id |
| 2214 | else: |
| 2215 | self.table_id = 0 |
| 2216 | return |
| 2217 | |
| 2218 | def pack(self): |
| 2219 | packed = [] |
| 2220 | packed.append(struct.pack("!B", self.version)) |
| 2221 | packed.append(struct.pack("!B", self.type)) |
| 2222 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2223 | packed.append(struct.pack("!L", self.xid)) |
| 2224 | packed.append(struct.pack("!H", self.stats_type)) |
| 2225 | packed.append(struct.pack("!H", self.flags)) |
| 2226 | packed.append('\x00' * 4) |
| 2227 | packed.append(struct.pack("!L", self.experimenter)) |
| 2228 | packed.append(struct.pack("!L", self.subtype)) |
| 2229 | packed.append(struct.pack("!H", self.table_id)) |
| 2230 | length = sum([len(x) for x in packed]) |
| 2231 | packed[2] = struct.pack("!H", length) |
| 2232 | return ''.join(packed) |
| 2233 | |
| 2234 | @staticmethod |
| 2235 | def unpack(reader): |
| 2236 | obj = bsn_gentable_bucket_stats_request() |
| 2237 | _version = reader.read("!B")[0] |
| 2238 | assert(_version == 4) |
| 2239 | _type = reader.read("!B")[0] |
| 2240 | assert(_type == 18) |
| 2241 | _length = reader.read("!H")[0] |
| 2242 | orig_reader = reader |
| 2243 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2244 | obj.xid = reader.read("!L")[0] |
| 2245 | _stats_type = reader.read("!H")[0] |
| 2246 | assert(_stats_type == 65535) |
| 2247 | obj.flags = reader.read("!H")[0] |
| 2248 | reader.skip(4) |
| 2249 | _experimenter = reader.read("!L")[0] |
| 2250 | assert(_experimenter == 6035143) |
| 2251 | _subtype = reader.read("!L")[0] |
| 2252 | assert(_subtype == 5) |
| 2253 | obj.table_id = reader.read("!H")[0] |
| 2254 | return obj |
| 2255 | |
| 2256 | def __eq__(self, other): |
| 2257 | if type(self) != type(other): return False |
| 2258 | if self.xid != other.xid: return False |
| 2259 | if self.flags != other.flags: return False |
| 2260 | if self.table_id != other.table_id: return False |
| 2261 | return True |
| 2262 | |
| 2263 | def pretty_print(self, q): |
| 2264 | q.text("bsn_gentable_bucket_stats_request {") |
| 2265 | with q.group(): |
| 2266 | with q.indent(2): |
| 2267 | q.breakable() |
| 2268 | q.text("xid = "); |
| 2269 | if self.xid != None: |
| 2270 | q.text("%#x" % self.xid) |
| 2271 | else: |
| 2272 | q.text('None') |
| 2273 | q.text(","); q.breakable() |
| 2274 | q.text("flags = "); |
| 2275 | q.text("%#x" % self.flags) |
| 2276 | q.text(","); q.breakable() |
| 2277 | q.text("table_id = "); |
| 2278 | q.text("%#x" % self.table_id) |
| 2279 | q.breakable() |
| 2280 | q.text('}') |
| 2281 | |
| 2282 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 2283 | |
| 2284 | class bsn_gentable_clear_reply(bsn_header): |
| 2285 | version = 4 |
| 2286 | type = 4 |
| 2287 | experimenter = 6035143 |
| 2288 | subtype = 49 |
| 2289 | |
| 2290 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 2291 | if xid != None: |
| 2292 | self.xid = xid |
| 2293 | else: |
| 2294 | self.xid = None |
| 2295 | if table_id != None: |
| 2296 | self.table_id = table_id |
| 2297 | else: |
| 2298 | self.table_id = 0 |
| 2299 | if deleted_count != None: |
| 2300 | self.deleted_count = deleted_count |
| 2301 | else: |
| 2302 | self.deleted_count = 0 |
| 2303 | if error_count != None: |
| 2304 | self.error_count = error_count |
| 2305 | else: |
| 2306 | self.error_count = 0 |
| 2307 | return |
| 2308 | |
| 2309 | def pack(self): |
| 2310 | packed = [] |
| 2311 | packed.append(struct.pack("!B", self.version)) |
| 2312 | packed.append(struct.pack("!B", self.type)) |
| 2313 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2314 | packed.append(struct.pack("!L", self.xid)) |
| 2315 | packed.append(struct.pack("!L", self.experimenter)) |
| 2316 | packed.append(struct.pack("!L", self.subtype)) |
| 2317 | packed.append(struct.pack("!H", self.table_id)) |
| 2318 | packed.append('\x00' * 2) |
| 2319 | packed.append(struct.pack("!L", self.deleted_count)) |
| 2320 | packed.append(struct.pack("!L", self.error_count)) |
| 2321 | length = sum([len(x) for x in packed]) |
| 2322 | packed[2] = struct.pack("!H", length) |
| 2323 | return ''.join(packed) |
| 2324 | |
| 2325 | @staticmethod |
| 2326 | def unpack(reader): |
| 2327 | obj = bsn_gentable_clear_reply() |
| 2328 | _version = reader.read("!B")[0] |
| 2329 | assert(_version == 4) |
| 2330 | _type = reader.read("!B")[0] |
| 2331 | assert(_type == 4) |
| 2332 | _length = reader.read("!H")[0] |
| 2333 | orig_reader = reader |
| 2334 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2335 | obj.xid = reader.read("!L")[0] |
| 2336 | _experimenter = reader.read("!L")[0] |
| 2337 | assert(_experimenter == 6035143) |
| 2338 | _subtype = reader.read("!L")[0] |
| 2339 | assert(_subtype == 49) |
| 2340 | obj.table_id = reader.read("!H")[0] |
| 2341 | reader.skip(2) |
| 2342 | obj.deleted_count = reader.read("!L")[0] |
| 2343 | obj.error_count = reader.read("!L")[0] |
| 2344 | return obj |
| 2345 | |
| 2346 | def __eq__(self, other): |
| 2347 | if type(self) != type(other): return False |
| 2348 | if self.xid != other.xid: return False |
| 2349 | if self.table_id != other.table_id: return False |
| 2350 | if self.deleted_count != other.deleted_count: return False |
| 2351 | if self.error_count != other.error_count: return False |
| 2352 | return True |
| 2353 | |
| 2354 | def pretty_print(self, q): |
| 2355 | q.text("bsn_gentable_clear_reply {") |
| 2356 | with q.group(): |
| 2357 | with q.indent(2): |
| 2358 | q.breakable() |
| 2359 | q.text("xid = "); |
| 2360 | if self.xid != None: |
| 2361 | q.text("%#x" % self.xid) |
| 2362 | else: |
| 2363 | q.text('None') |
| 2364 | q.text(","); q.breakable() |
| 2365 | q.text("table_id = "); |
| 2366 | q.text("%#x" % self.table_id) |
| 2367 | q.text(","); q.breakable() |
| 2368 | q.text("deleted_count = "); |
| 2369 | q.text("%#x" % self.deleted_count) |
| 2370 | q.text(","); q.breakable() |
| 2371 | q.text("error_count = "); |
| 2372 | q.text("%#x" % self.error_count) |
| 2373 | q.breakable() |
| 2374 | q.text('}') |
| 2375 | |
| 2376 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 2377 | |
| 2378 | class bsn_gentable_clear_request(bsn_header): |
| 2379 | version = 4 |
| 2380 | type = 4 |
| 2381 | experimenter = 6035143 |
| 2382 | subtype = 48 |
| 2383 | |
| 2384 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 2385 | if xid != None: |
| 2386 | self.xid = xid |
| 2387 | else: |
| 2388 | self.xid = None |
| 2389 | if table_id != None: |
| 2390 | self.table_id = table_id |
| 2391 | else: |
| 2392 | self.table_id = 0 |
| 2393 | if checksum != None: |
| 2394 | self.checksum = checksum |
| 2395 | else: |
| 2396 | self.checksum = 0 |
| 2397 | if checksum_mask != None: |
| 2398 | self.checksum_mask = checksum_mask |
| 2399 | else: |
| 2400 | self.checksum_mask = 0 |
| 2401 | return |
| 2402 | |
| 2403 | def pack(self): |
| 2404 | packed = [] |
| 2405 | packed.append(struct.pack("!B", self.version)) |
| 2406 | packed.append(struct.pack("!B", self.type)) |
| 2407 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2408 | packed.append(struct.pack("!L", self.xid)) |
| 2409 | packed.append(struct.pack("!L", self.experimenter)) |
| 2410 | packed.append(struct.pack("!L", self.subtype)) |
| 2411 | packed.append(struct.pack("!H", self.table_id)) |
| 2412 | packed.append('\x00' * 2) |
| 2413 | packed.append(util.pack_checksum_128(self.checksum)) |
| 2414 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 2415 | length = sum([len(x) for x in packed]) |
| 2416 | packed[2] = struct.pack("!H", length) |
| 2417 | return ''.join(packed) |
| 2418 | |
| 2419 | @staticmethod |
| 2420 | def unpack(reader): |
| 2421 | obj = bsn_gentable_clear_request() |
| 2422 | _version = reader.read("!B")[0] |
| 2423 | assert(_version == 4) |
| 2424 | _type = reader.read("!B")[0] |
| 2425 | assert(_type == 4) |
| 2426 | _length = reader.read("!H")[0] |
| 2427 | orig_reader = reader |
| 2428 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2429 | obj.xid = reader.read("!L")[0] |
| 2430 | _experimenter = reader.read("!L")[0] |
| 2431 | assert(_experimenter == 6035143) |
| 2432 | _subtype = reader.read("!L")[0] |
| 2433 | assert(_subtype == 48) |
| 2434 | obj.table_id = reader.read("!H")[0] |
| 2435 | reader.skip(2) |
| 2436 | obj.checksum = util.unpack_checksum_128(reader) |
| 2437 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 2438 | return obj |
| 2439 | |
| 2440 | def __eq__(self, other): |
| 2441 | if type(self) != type(other): return False |
| 2442 | if self.xid != other.xid: return False |
| 2443 | if self.table_id != other.table_id: return False |
| 2444 | if self.checksum != other.checksum: return False |
| 2445 | if self.checksum_mask != other.checksum_mask: return False |
| 2446 | return True |
| 2447 | |
| 2448 | def pretty_print(self, q): |
| 2449 | q.text("bsn_gentable_clear_request {") |
| 2450 | with q.group(): |
| 2451 | with q.indent(2): |
| 2452 | q.breakable() |
| 2453 | q.text("xid = "); |
| 2454 | if self.xid != None: |
| 2455 | q.text("%#x" % self.xid) |
| 2456 | else: |
| 2457 | q.text('None') |
| 2458 | q.text(","); q.breakable() |
| 2459 | q.text("table_id = "); |
| 2460 | q.text("%#x" % self.table_id) |
| 2461 | q.text(","); q.breakable() |
| 2462 | q.text("checksum = "); |
| 2463 | q.pp(self.checksum) |
| 2464 | q.text(","); q.breakable() |
| 2465 | q.text("checksum_mask = "); |
| 2466 | q.pp(self.checksum_mask) |
| 2467 | q.breakable() |
| 2468 | q.text('}') |
| 2469 | |
| 2470 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 2471 | |
| 2472 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 2473 | version = 4 |
| 2474 | type = 19 |
| 2475 | stats_type = 65535 |
| 2476 | experimenter = 6035143 |
| 2477 | subtype = 4 |
| 2478 | |
| 2479 | def __init__(self, xid=None, flags=None, entries=None): |
| 2480 | if xid != None: |
| 2481 | self.xid = xid |
| 2482 | else: |
| 2483 | self.xid = None |
| 2484 | if flags != None: |
| 2485 | self.flags = flags |
| 2486 | else: |
| 2487 | self.flags = 0 |
| 2488 | if entries != None: |
| 2489 | self.entries = entries |
| 2490 | else: |
| 2491 | self.entries = [] |
| 2492 | return |
| 2493 | |
| 2494 | def pack(self): |
| 2495 | packed = [] |
| 2496 | packed.append(struct.pack("!B", self.version)) |
| 2497 | packed.append(struct.pack("!B", self.type)) |
| 2498 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2499 | packed.append(struct.pack("!L", self.xid)) |
| 2500 | packed.append(struct.pack("!H", self.stats_type)) |
| 2501 | packed.append(struct.pack("!H", self.flags)) |
| 2502 | packed.append('\x00' * 4) |
| 2503 | packed.append(struct.pack("!L", self.experimenter)) |
| 2504 | packed.append(struct.pack("!L", self.subtype)) |
| 2505 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2506 | length = sum([len(x) for x in packed]) |
| 2507 | packed[2] = struct.pack("!H", length) |
| 2508 | return ''.join(packed) |
| 2509 | |
| 2510 | @staticmethod |
| 2511 | def unpack(reader): |
| 2512 | obj = bsn_gentable_desc_stats_reply() |
| 2513 | _version = reader.read("!B")[0] |
| 2514 | assert(_version == 4) |
| 2515 | _type = reader.read("!B")[0] |
| 2516 | assert(_type == 19) |
| 2517 | _length = reader.read("!H")[0] |
| 2518 | orig_reader = reader |
| 2519 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2520 | obj.xid = reader.read("!L")[0] |
| 2521 | _stats_type = reader.read("!H")[0] |
| 2522 | assert(_stats_type == 65535) |
| 2523 | obj.flags = reader.read("!H")[0] |
| 2524 | reader.skip(4) |
| 2525 | _experimenter = reader.read("!L")[0] |
| 2526 | assert(_experimenter == 6035143) |
| 2527 | _subtype = reader.read("!L")[0] |
| 2528 | assert(_subtype == 4) |
| 2529 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack) |
| 2530 | return obj |
| 2531 | |
| 2532 | def __eq__(self, other): |
| 2533 | if type(self) != type(other): return False |
| 2534 | if self.xid != other.xid: return False |
| 2535 | if self.flags != other.flags: return False |
| 2536 | if self.entries != other.entries: return False |
| 2537 | return True |
| 2538 | |
| 2539 | def pretty_print(self, q): |
| 2540 | q.text("bsn_gentable_desc_stats_reply {") |
| 2541 | with q.group(): |
| 2542 | with q.indent(2): |
| 2543 | q.breakable() |
| 2544 | q.text("xid = "); |
| 2545 | if self.xid != None: |
| 2546 | q.text("%#x" % self.xid) |
| 2547 | else: |
| 2548 | q.text('None') |
| 2549 | q.text(","); q.breakable() |
| 2550 | q.text("flags = "); |
| 2551 | q.text("%#x" % self.flags) |
| 2552 | q.text(","); q.breakable() |
| 2553 | q.text("entries = "); |
| 2554 | q.pp(self.entries) |
| 2555 | q.breakable() |
| 2556 | q.text('}') |
| 2557 | |
| 2558 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 2559 | |
| 2560 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 2561 | version = 4 |
| 2562 | type = 18 |
| 2563 | stats_type = 65535 |
| 2564 | experimenter = 6035143 |
| 2565 | subtype = 4 |
| 2566 | |
| 2567 | def __init__(self, xid=None, flags=None): |
| 2568 | if xid != None: |
| 2569 | self.xid = xid |
| 2570 | else: |
| 2571 | self.xid = None |
| 2572 | if flags != None: |
| 2573 | self.flags = flags |
| 2574 | else: |
| 2575 | self.flags = 0 |
| 2576 | return |
| 2577 | |
| 2578 | def pack(self): |
| 2579 | packed = [] |
| 2580 | packed.append(struct.pack("!B", self.version)) |
| 2581 | packed.append(struct.pack("!B", self.type)) |
| 2582 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2583 | packed.append(struct.pack("!L", self.xid)) |
| 2584 | packed.append(struct.pack("!H", self.stats_type)) |
| 2585 | packed.append(struct.pack("!H", self.flags)) |
| 2586 | packed.append('\x00' * 4) |
| 2587 | packed.append(struct.pack("!L", self.experimenter)) |
| 2588 | packed.append(struct.pack("!L", self.subtype)) |
| 2589 | length = sum([len(x) for x in packed]) |
| 2590 | packed[2] = struct.pack("!H", length) |
| 2591 | return ''.join(packed) |
| 2592 | |
| 2593 | @staticmethod |
| 2594 | def unpack(reader): |
| 2595 | obj = bsn_gentable_desc_stats_request() |
| 2596 | _version = reader.read("!B")[0] |
| 2597 | assert(_version == 4) |
| 2598 | _type = reader.read("!B")[0] |
| 2599 | assert(_type == 18) |
| 2600 | _length = reader.read("!H")[0] |
| 2601 | orig_reader = reader |
| 2602 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2603 | obj.xid = reader.read("!L")[0] |
| 2604 | _stats_type = reader.read("!H")[0] |
| 2605 | assert(_stats_type == 65535) |
| 2606 | obj.flags = reader.read("!H")[0] |
| 2607 | reader.skip(4) |
| 2608 | _experimenter = reader.read("!L")[0] |
| 2609 | assert(_experimenter == 6035143) |
| 2610 | _subtype = reader.read("!L")[0] |
| 2611 | assert(_subtype == 4) |
| 2612 | return obj |
| 2613 | |
| 2614 | def __eq__(self, other): |
| 2615 | if type(self) != type(other): return False |
| 2616 | if self.xid != other.xid: return False |
| 2617 | if self.flags != other.flags: return False |
| 2618 | return True |
| 2619 | |
| 2620 | def pretty_print(self, q): |
| 2621 | q.text("bsn_gentable_desc_stats_request {") |
| 2622 | with q.group(): |
| 2623 | with q.indent(2): |
| 2624 | q.breakable() |
| 2625 | q.text("xid = "); |
| 2626 | if self.xid != None: |
| 2627 | q.text("%#x" % self.xid) |
| 2628 | else: |
| 2629 | q.text('None') |
| 2630 | q.text(","); q.breakable() |
| 2631 | q.text("flags = "); |
| 2632 | q.text("%#x" % self.flags) |
| 2633 | q.breakable() |
| 2634 | q.text('}') |
| 2635 | |
| 2636 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 2637 | |
| 2638 | class bsn_gentable_entry_add(bsn_header): |
| 2639 | version = 4 |
| 2640 | type = 4 |
| 2641 | experimenter = 6035143 |
| 2642 | subtype = 46 |
| 2643 | |
| 2644 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 2645 | if xid != None: |
| 2646 | self.xid = xid |
| 2647 | else: |
| 2648 | self.xid = None |
| 2649 | if table_id != None: |
| 2650 | self.table_id = table_id |
| 2651 | else: |
| 2652 | self.table_id = 0 |
| 2653 | if checksum != None: |
| 2654 | self.checksum = checksum |
| 2655 | else: |
| 2656 | self.checksum = 0 |
| 2657 | if key != None: |
| 2658 | self.key = key |
| 2659 | else: |
| 2660 | self.key = [] |
| 2661 | if value != None: |
| 2662 | self.value = value |
| 2663 | else: |
| 2664 | self.value = [] |
| 2665 | return |
| 2666 | |
| 2667 | def pack(self): |
| 2668 | packed = [] |
| 2669 | packed.append(struct.pack("!B", self.version)) |
| 2670 | packed.append(struct.pack("!B", self.type)) |
| 2671 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2672 | packed.append(struct.pack("!L", self.xid)) |
| 2673 | packed.append(struct.pack("!L", self.experimenter)) |
| 2674 | packed.append(struct.pack("!L", self.subtype)) |
| 2675 | packed.append(struct.pack("!H", self.table_id)) |
| 2676 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 2677 | packed.append(util.pack_checksum_128(self.checksum)) |
| 2678 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 2679 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 2680 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 2681 | length = sum([len(x) for x in packed]) |
| 2682 | packed[2] = struct.pack("!H", length) |
| 2683 | return ''.join(packed) |
| 2684 | |
| 2685 | @staticmethod |
| 2686 | def unpack(reader): |
| 2687 | obj = bsn_gentable_entry_add() |
| 2688 | _version = reader.read("!B")[0] |
| 2689 | assert(_version == 4) |
| 2690 | _type = reader.read("!B")[0] |
| 2691 | assert(_type == 4) |
| 2692 | _length = reader.read("!H")[0] |
| 2693 | orig_reader = reader |
| 2694 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2695 | obj.xid = reader.read("!L")[0] |
| 2696 | _experimenter = reader.read("!L")[0] |
| 2697 | assert(_experimenter == 6035143) |
| 2698 | _subtype = reader.read("!L")[0] |
| 2699 | assert(_subtype == 46) |
| 2700 | obj.table_id = reader.read("!H")[0] |
| 2701 | _key_length = reader.read("!H")[0] |
| 2702 | obj.checksum = util.unpack_checksum_128(reader) |
| 2703 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack) |
| 2704 | obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 2705 | return obj |
| 2706 | |
| 2707 | def __eq__(self, other): |
| 2708 | if type(self) != type(other): return False |
| 2709 | if self.xid != other.xid: return False |
| 2710 | if self.table_id != other.table_id: return False |
| 2711 | if self.checksum != other.checksum: return False |
| 2712 | if self.key != other.key: return False |
| 2713 | if self.value != other.value: return False |
| 2714 | return True |
| 2715 | |
| 2716 | def pretty_print(self, q): |
| 2717 | q.text("bsn_gentable_entry_add {") |
| 2718 | with q.group(): |
| 2719 | with q.indent(2): |
| 2720 | q.breakable() |
| 2721 | q.text("xid = "); |
| 2722 | if self.xid != None: |
| 2723 | q.text("%#x" % self.xid) |
| 2724 | else: |
| 2725 | q.text('None') |
| 2726 | q.text(","); q.breakable() |
| 2727 | q.text("table_id = "); |
| 2728 | q.text("%#x" % self.table_id) |
| 2729 | q.text(","); q.breakable() |
| 2730 | q.text("checksum = "); |
| 2731 | q.pp(self.checksum) |
| 2732 | q.text(","); q.breakable() |
| 2733 | q.text("key = "); |
| 2734 | q.pp(self.key) |
| 2735 | q.text(","); q.breakable() |
| 2736 | q.text("value = "); |
| 2737 | q.pp(self.value) |
| 2738 | q.breakable() |
| 2739 | q.text('}') |
| 2740 | |
| 2741 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 2742 | |
| 2743 | class bsn_gentable_entry_delete(bsn_header): |
| 2744 | version = 4 |
| 2745 | type = 4 |
| 2746 | experimenter = 6035143 |
| 2747 | subtype = 47 |
| 2748 | |
| 2749 | def __init__(self, xid=None, table_id=None, key=None): |
| 2750 | if xid != None: |
| 2751 | self.xid = xid |
| 2752 | else: |
| 2753 | self.xid = None |
| 2754 | if table_id != None: |
| 2755 | self.table_id = table_id |
| 2756 | else: |
| 2757 | self.table_id = 0 |
| 2758 | if key != None: |
| 2759 | self.key = key |
| 2760 | else: |
| 2761 | self.key = [] |
| 2762 | return |
| 2763 | |
| 2764 | def pack(self): |
| 2765 | packed = [] |
| 2766 | packed.append(struct.pack("!B", self.version)) |
| 2767 | packed.append(struct.pack("!B", self.type)) |
| 2768 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2769 | packed.append(struct.pack("!L", self.xid)) |
| 2770 | packed.append(struct.pack("!L", self.experimenter)) |
| 2771 | packed.append(struct.pack("!L", self.subtype)) |
| 2772 | packed.append(struct.pack("!H", self.table_id)) |
| 2773 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 2774 | length = sum([len(x) for x in packed]) |
| 2775 | packed[2] = struct.pack("!H", length) |
| 2776 | return ''.join(packed) |
| 2777 | |
| 2778 | @staticmethod |
| 2779 | def unpack(reader): |
| 2780 | obj = bsn_gentable_entry_delete() |
| 2781 | _version = reader.read("!B")[0] |
| 2782 | assert(_version == 4) |
| 2783 | _type = reader.read("!B")[0] |
| 2784 | assert(_type == 4) |
| 2785 | _length = reader.read("!H")[0] |
| 2786 | orig_reader = reader |
| 2787 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2788 | obj.xid = reader.read("!L")[0] |
| 2789 | _experimenter = reader.read("!L")[0] |
| 2790 | assert(_experimenter == 6035143) |
| 2791 | _subtype = reader.read("!L")[0] |
| 2792 | assert(_subtype == 47) |
| 2793 | obj.table_id = reader.read("!H")[0] |
| 2794 | obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack) |
| 2795 | return obj |
| 2796 | |
| 2797 | def __eq__(self, other): |
| 2798 | if type(self) != type(other): return False |
| 2799 | if self.xid != other.xid: return False |
| 2800 | if self.table_id != other.table_id: return False |
| 2801 | if self.key != other.key: return False |
| 2802 | return True |
| 2803 | |
| 2804 | def pretty_print(self, q): |
| 2805 | q.text("bsn_gentable_entry_delete {") |
| 2806 | with q.group(): |
| 2807 | with q.indent(2): |
| 2808 | q.breakable() |
| 2809 | q.text("xid = "); |
| 2810 | if self.xid != None: |
| 2811 | q.text("%#x" % self.xid) |
| 2812 | else: |
| 2813 | q.text('None') |
| 2814 | q.text(","); q.breakable() |
| 2815 | q.text("table_id = "); |
| 2816 | q.text("%#x" % self.table_id) |
| 2817 | q.text(","); q.breakable() |
| 2818 | q.text("key = "); |
| 2819 | q.pp(self.key) |
| 2820 | q.breakable() |
| 2821 | q.text('}') |
| 2822 | |
| 2823 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 2824 | |
| 2825 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 2826 | version = 4 |
| 2827 | type = 19 |
| 2828 | stats_type = 65535 |
| 2829 | experimenter = 6035143 |
| 2830 | subtype = 2 |
| 2831 | |
| 2832 | def __init__(self, xid=None, flags=None, entries=None): |
| 2833 | if xid != None: |
| 2834 | self.xid = xid |
| 2835 | else: |
| 2836 | self.xid = None |
| 2837 | if flags != None: |
| 2838 | self.flags = flags |
| 2839 | else: |
| 2840 | self.flags = 0 |
| 2841 | if entries != None: |
| 2842 | self.entries = entries |
| 2843 | else: |
| 2844 | self.entries = [] |
| 2845 | return |
| 2846 | |
| 2847 | def pack(self): |
| 2848 | packed = [] |
| 2849 | packed.append(struct.pack("!B", self.version)) |
| 2850 | packed.append(struct.pack("!B", self.type)) |
| 2851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2852 | packed.append(struct.pack("!L", self.xid)) |
| 2853 | packed.append(struct.pack("!H", self.stats_type)) |
| 2854 | packed.append(struct.pack("!H", self.flags)) |
| 2855 | packed.append('\x00' * 4) |
| 2856 | packed.append(struct.pack("!L", self.experimenter)) |
| 2857 | packed.append(struct.pack("!L", self.subtype)) |
| 2858 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2859 | length = sum([len(x) for x in packed]) |
| 2860 | packed[2] = struct.pack("!H", length) |
| 2861 | return ''.join(packed) |
| 2862 | |
| 2863 | @staticmethod |
| 2864 | def unpack(reader): |
| 2865 | obj = bsn_gentable_entry_desc_stats_reply() |
| 2866 | _version = reader.read("!B")[0] |
| 2867 | assert(_version == 4) |
| 2868 | _type = reader.read("!B")[0] |
| 2869 | assert(_type == 19) |
| 2870 | _length = reader.read("!H")[0] |
| 2871 | orig_reader = reader |
| 2872 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2873 | obj.xid = reader.read("!L")[0] |
| 2874 | _stats_type = reader.read("!H")[0] |
| 2875 | assert(_stats_type == 65535) |
| 2876 | obj.flags = reader.read("!H")[0] |
| 2877 | reader.skip(4) |
| 2878 | _experimenter = reader.read("!L")[0] |
| 2879 | assert(_experimenter == 6035143) |
| 2880 | _subtype = reader.read("!L")[0] |
| 2881 | assert(_subtype == 2) |
| 2882 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack) |
| 2883 | return obj |
| 2884 | |
| 2885 | def __eq__(self, other): |
| 2886 | if type(self) != type(other): return False |
| 2887 | if self.xid != other.xid: return False |
| 2888 | if self.flags != other.flags: return False |
| 2889 | if self.entries != other.entries: return False |
| 2890 | return True |
| 2891 | |
| 2892 | def pretty_print(self, q): |
| 2893 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 2894 | with q.group(): |
| 2895 | with q.indent(2): |
| 2896 | q.breakable() |
| 2897 | q.text("xid = "); |
| 2898 | if self.xid != None: |
| 2899 | q.text("%#x" % self.xid) |
| 2900 | else: |
| 2901 | q.text('None') |
| 2902 | q.text(","); q.breakable() |
| 2903 | q.text("flags = "); |
| 2904 | q.text("%#x" % self.flags) |
| 2905 | q.text(","); q.breakable() |
| 2906 | q.text("entries = "); |
| 2907 | q.pp(self.entries) |
| 2908 | q.breakable() |
| 2909 | q.text('}') |
| 2910 | |
| 2911 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 2912 | |
| 2913 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 2914 | version = 4 |
| 2915 | type = 18 |
| 2916 | stats_type = 65535 |
| 2917 | experimenter = 6035143 |
| 2918 | subtype = 2 |
| 2919 | |
| 2920 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 2921 | if xid != None: |
| 2922 | self.xid = xid |
| 2923 | else: |
| 2924 | self.xid = None |
| 2925 | if flags != None: |
| 2926 | self.flags = flags |
| 2927 | else: |
| 2928 | self.flags = 0 |
| 2929 | if table_id != None: |
| 2930 | self.table_id = table_id |
| 2931 | else: |
| 2932 | self.table_id = 0 |
| 2933 | if checksum != None: |
| 2934 | self.checksum = checksum |
| 2935 | else: |
| 2936 | self.checksum = 0 |
| 2937 | if checksum_mask != None: |
| 2938 | self.checksum_mask = checksum_mask |
| 2939 | else: |
| 2940 | self.checksum_mask = 0 |
| 2941 | return |
| 2942 | |
| 2943 | def pack(self): |
| 2944 | packed = [] |
| 2945 | packed.append(struct.pack("!B", self.version)) |
| 2946 | packed.append(struct.pack("!B", self.type)) |
| 2947 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2948 | packed.append(struct.pack("!L", self.xid)) |
| 2949 | packed.append(struct.pack("!H", self.stats_type)) |
| 2950 | packed.append(struct.pack("!H", self.flags)) |
| 2951 | packed.append('\x00' * 4) |
| 2952 | packed.append(struct.pack("!L", self.experimenter)) |
| 2953 | packed.append(struct.pack("!L", self.subtype)) |
| 2954 | packed.append(struct.pack("!H", self.table_id)) |
| 2955 | packed.append('\x00' * 2) |
| 2956 | packed.append(util.pack_checksum_128(self.checksum)) |
| 2957 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 2958 | length = sum([len(x) for x in packed]) |
| 2959 | packed[2] = struct.pack("!H", length) |
| 2960 | return ''.join(packed) |
| 2961 | |
| 2962 | @staticmethod |
| 2963 | def unpack(reader): |
| 2964 | obj = bsn_gentable_entry_desc_stats_request() |
| 2965 | _version = reader.read("!B")[0] |
| 2966 | assert(_version == 4) |
| 2967 | _type = reader.read("!B")[0] |
| 2968 | assert(_type == 18) |
| 2969 | _length = reader.read("!H")[0] |
| 2970 | orig_reader = reader |
| 2971 | reader = orig_reader.slice(_length - (2 + 2)) |
| 2972 | obj.xid = reader.read("!L")[0] |
| 2973 | _stats_type = reader.read("!H")[0] |
| 2974 | assert(_stats_type == 65535) |
| 2975 | obj.flags = reader.read("!H")[0] |
| 2976 | reader.skip(4) |
| 2977 | _experimenter = reader.read("!L")[0] |
| 2978 | assert(_experimenter == 6035143) |
| 2979 | _subtype = reader.read("!L")[0] |
| 2980 | assert(_subtype == 2) |
| 2981 | obj.table_id = reader.read("!H")[0] |
| 2982 | reader.skip(2) |
| 2983 | obj.checksum = util.unpack_checksum_128(reader) |
| 2984 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 2985 | return obj |
| 2986 | |
| 2987 | def __eq__(self, other): |
| 2988 | if type(self) != type(other): return False |
| 2989 | if self.xid != other.xid: return False |
| 2990 | if self.flags != other.flags: return False |
| 2991 | if self.table_id != other.table_id: return False |
| 2992 | if self.checksum != other.checksum: return False |
| 2993 | if self.checksum_mask != other.checksum_mask: return False |
| 2994 | return True |
| 2995 | |
| 2996 | def pretty_print(self, q): |
| 2997 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 2998 | with q.group(): |
| 2999 | with q.indent(2): |
| 3000 | q.breakable() |
| 3001 | q.text("xid = "); |
| 3002 | if self.xid != None: |
| 3003 | q.text("%#x" % self.xid) |
| 3004 | else: |
| 3005 | q.text('None') |
| 3006 | q.text(","); q.breakable() |
| 3007 | q.text("flags = "); |
| 3008 | q.text("%#x" % self.flags) |
| 3009 | q.text(","); q.breakable() |
| 3010 | q.text("table_id = "); |
| 3011 | q.text("%#x" % self.table_id) |
| 3012 | q.text(","); q.breakable() |
| 3013 | q.text("checksum = "); |
| 3014 | q.pp(self.checksum) |
| 3015 | q.text(","); q.breakable() |
| 3016 | q.text("checksum_mask = "); |
| 3017 | q.pp(self.checksum_mask) |
| 3018 | q.breakable() |
| 3019 | q.text('}') |
| 3020 | |
| 3021 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 3022 | |
| 3023 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 3024 | version = 4 |
| 3025 | type = 19 |
| 3026 | stats_type = 65535 |
| 3027 | experimenter = 6035143 |
| 3028 | subtype = 3 |
| 3029 | |
| 3030 | def __init__(self, xid=None, flags=None, entries=None): |
| 3031 | if xid != None: |
| 3032 | self.xid = xid |
| 3033 | else: |
| 3034 | self.xid = None |
| 3035 | if flags != None: |
| 3036 | self.flags = flags |
| 3037 | else: |
| 3038 | self.flags = 0 |
| 3039 | if entries != None: |
| 3040 | self.entries = entries |
| 3041 | else: |
| 3042 | self.entries = [] |
| 3043 | return |
| 3044 | |
| 3045 | def pack(self): |
| 3046 | packed = [] |
| 3047 | packed.append(struct.pack("!B", self.version)) |
| 3048 | packed.append(struct.pack("!B", self.type)) |
| 3049 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3050 | packed.append(struct.pack("!L", self.xid)) |
| 3051 | packed.append(struct.pack("!H", self.stats_type)) |
| 3052 | packed.append(struct.pack("!H", self.flags)) |
| 3053 | packed.append('\x00' * 4) |
| 3054 | packed.append(struct.pack("!L", self.experimenter)) |
| 3055 | packed.append(struct.pack("!L", self.subtype)) |
| 3056 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3057 | length = sum([len(x) for x in packed]) |
| 3058 | packed[2] = struct.pack("!H", length) |
| 3059 | return ''.join(packed) |
| 3060 | |
| 3061 | @staticmethod |
| 3062 | def unpack(reader): |
| 3063 | obj = bsn_gentable_entry_stats_reply() |
| 3064 | _version = reader.read("!B")[0] |
| 3065 | assert(_version == 4) |
| 3066 | _type = reader.read("!B")[0] |
| 3067 | assert(_type == 19) |
| 3068 | _length = reader.read("!H")[0] |
| 3069 | orig_reader = reader |
| 3070 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3071 | obj.xid = reader.read("!L")[0] |
| 3072 | _stats_type = reader.read("!H")[0] |
| 3073 | assert(_stats_type == 65535) |
| 3074 | obj.flags = reader.read("!H")[0] |
| 3075 | reader.skip(4) |
| 3076 | _experimenter = reader.read("!L")[0] |
| 3077 | assert(_experimenter == 6035143) |
| 3078 | _subtype = reader.read("!L")[0] |
| 3079 | assert(_subtype == 3) |
| 3080 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack) |
| 3081 | return obj |
| 3082 | |
| 3083 | def __eq__(self, other): |
| 3084 | if type(self) != type(other): return False |
| 3085 | if self.xid != other.xid: return False |
| 3086 | if self.flags != other.flags: return False |
| 3087 | if self.entries != other.entries: return False |
| 3088 | return True |
| 3089 | |
| 3090 | def pretty_print(self, q): |
| 3091 | q.text("bsn_gentable_entry_stats_reply {") |
| 3092 | with q.group(): |
| 3093 | with q.indent(2): |
| 3094 | q.breakable() |
| 3095 | q.text("xid = "); |
| 3096 | if self.xid != None: |
| 3097 | q.text("%#x" % self.xid) |
| 3098 | else: |
| 3099 | q.text('None') |
| 3100 | q.text(","); q.breakable() |
| 3101 | q.text("flags = "); |
| 3102 | q.text("%#x" % self.flags) |
| 3103 | q.text(","); q.breakable() |
| 3104 | q.text("entries = "); |
| 3105 | q.pp(self.entries) |
| 3106 | q.breakable() |
| 3107 | q.text('}') |
| 3108 | |
| 3109 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 3110 | |
| 3111 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 3112 | version = 4 |
| 3113 | type = 18 |
| 3114 | stats_type = 65535 |
| 3115 | experimenter = 6035143 |
| 3116 | subtype = 3 |
| 3117 | |
| 3118 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 3119 | if xid != None: |
| 3120 | self.xid = xid |
| 3121 | else: |
| 3122 | self.xid = None |
| 3123 | if flags != None: |
| 3124 | self.flags = flags |
| 3125 | else: |
| 3126 | self.flags = 0 |
| 3127 | if table_id != None: |
| 3128 | self.table_id = table_id |
| 3129 | else: |
| 3130 | self.table_id = 0 |
| 3131 | if checksum != None: |
| 3132 | self.checksum = checksum |
| 3133 | else: |
| 3134 | self.checksum = 0 |
| 3135 | if checksum_mask != None: |
| 3136 | self.checksum_mask = checksum_mask |
| 3137 | else: |
| 3138 | self.checksum_mask = 0 |
| 3139 | return |
| 3140 | |
| 3141 | def pack(self): |
| 3142 | packed = [] |
| 3143 | packed.append(struct.pack("!B", self.version)) |
| 3144 | packed.append(struct.pack("!B", self.type)) |
| 3145 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3146 | packed.append(struct.pack("!L", self.xid)) |
| 3147 | packed.append(struct.pack("!H", self.stats_type)) |
| 3148 | packed.append(struct.pack("!H", self.flags)) |
| 3149 | packed.append('\x00' * 4) |
| 3150 | packed.append(struct.pack("!L", self.experimenter)) |
| 3151 | packed.append(struct.pack("!L", self.subtype)) |
| 3152 | packed.append(struct.pack("!H", self.table_id)) |
| 3153 | packed.append('\x00' * 2) |
| 3154 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3155 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3156 | length = sum([len(x) for x in packed]) |
| 3157 | packed[2] = struct.pack("!H", length) |
| 3158 | return ''.join(packed) |
| 3159 | |
| 3160 | @staticmethod |
| 3161 | def unpack(reader): |
| 3162 | obj = bsn_gentable_entry_stats_request() |
| 3163 | _version = reader.read("!B")[0] |
| 3164 | assert(_version == 4) |
| 3165 | _type = reader.read("!B")[0] |
| 3166 | assert(_type == 18) |
| 3167 | _length = reader.read("!H")[0] |
| 3168 | orig_reader = reader |
| 3169 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3170 | obj.xid = reader.read("!L")[0] |
| 3171 | _stats_type = reader.read("!H")[0] |
| 3172 | assert(_stats_type == 65535) |
| 3173 | obj.flags = reader.read("!H")[0] |
| 3174 | reader.skip(4) |
| 3175 | _experimenter = reader.read("!L")[0] |
| 3176 | assert(_experimenter == 6035143) |
| 3177 | _subtype = reader.read("!L")[0] |
| 3178 | assert(_subtype == 3) |
| 3179 | obj.table_id = reader.read("!H")[0] |
| 3180 | reader.skip(2) |
| 3181 | obj.checksum = util.unpack_checksum_128(reader) |
| 3182 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3183 | return obj |
| 3184 | |
| 3185 | def __eq__(self, other): |
| 3186 | if type(self) != type(other): return False |
| 3187 | if self.xid != other.xid: return False |
| 3188 | if self.flags != other.flags: return False |
| 3189 | if self.table_id != other.table_id: return False |
| 3190 | if self.checksum != other.checksum: return False |
| 3191 | if self.checksum_mask != other.checksum_mask: return False |
| 3192 | return True |
| 3193 | |
| 3194 | def pretty_print(self, q): |
| 3195 | q.text("bsn_gentable_entry_stats_request {") |
| 3196 | with q.group(): |
| 3197 | with q.indent(2): |
| 3198 | q.breakable() |
| 3199 | q.text("xid = "); |
| 3200 | if self.xid != None: |
| 3201 | q.text("%#x" % self.xid) |
| 3202 | else: |
| 3203 | q.text('None') |
| 3204 | q.text(","); q.breakable() |
| 3205 | q.text("flags = "); |
| 3206 | q.text("%#x" % self.flags) |
| 3207 | q.text(","); q.breakable() |
| 3208 | q.text("table_id = "); |
| 3209 | q.text("%#x" % self.table_id) |
| 3210 | q.text(","); q.breakable() |
| 3211 | q.text("checksum = "); |
| 3212 | q.pp(self.checksum) |
| 3213 | q.text(","); q.breakable() |
| 3214 | q.text("checksum_mask = "); |
| 3215 | q.pp(self.checksum_mask) |
| 3216 | q.breakable() |
| 3217 | q.text('}') |
| 3218 | |
| 3219 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 3220 | |
| 3221 | class bsn_gentable_set_buckets_size(bsn_header): |
| 3222 | version = 4 |
| 3223 | type = 4 |
| 3224 | experimenter = 6035143 |
| 3225 | subtype = 50 |
| 3226 | |
| 3227 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 3228 | if xid != None: |
| 3229 | self.xid = xid |
| 3230 | else: |
| 3231 | self.xid = None |
| 3232 | if table_id != None: |
| 3233 | self.table_id = table_id |
| 3234 | else: |
| 3235 | self.table_id = 0 |
| 3236 | if buckets_size != None: |
| 3237 | self.buckets_size = buckets_size |
| 3238 | else: |
| 3239 | self.buckets_size = 0 |
| 3240 | return |
| 3241 | |
| 3242 | def pack(self): |
| 3243 | packed = [] |
| 3244 | packed.append(struct.pack("!B", self.version)) |
| 3245 | packed.append(struct.pack("!B", self.type)) |
| 3246 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3247 | packed.append(struct.pack("!L", self.xid)) |
| 3248 | packed.append(struct.pack("!L", self.experimenter)) |
| 3249 | packed.append(struct.pack("!L", self.subtype)) |
| 3250 | packed.append(struct.pack("!H", self.table_id)) |
| 3251 | packed.append('\x00' * 2) |
| 3252 | packed.append(struct.pack("!L", self.buckets_size)) |
| 3253 | length = sum([len(x) for x in packed]) |
| 3254 | packed[2] = struct.pack("!H", length) |
| 3255 | return ''.join(packed) |
| 3256 | |
| 3257 | @staticmethod |
| 3258 | def unpack(reader): |
| 3259 | obj = bsn_gentable_set_buckets_size() |
| 3260 | _version = reader.read("!B")[0] |
| 3261 | assert(_version == 4) |
| 3262 | _type = reader.read("!B")[0] |
| 3263 | assert(_type == 4) |
| 3264 | _length = reader.read("!H")[0] |
| 3265 | orig_reader = reader |
| 3266 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3267 | obj.xid = reader.read("!L")[0] |
| 3268 | _experimenter = reader.read("!L")[0] |
| 3269 | assert(_experimenter == 6035143) |
| 3270 | _subtype = reader.read("!L")[0] |
| 3271 | assert(_subtype == 50) |
| 3272 | obj.table_id = reader.read("!H")[0] |
| 3273 | reader.skip(2) |
| 3274 | obj.buckets_size = reader.read("!L")[0] |
| 3275 | return obj |
| 3276 | |
| 3277 | def __eq__(self, other): |
| 3278 | if type(self) != type(other): return False |
| 3279 | if self.xid != other.xid: return False |
| 3280 | if self.table_id != other.table_id: return False |
| 3281 | if self.buckets_size != other.buckets_size: return False |
| 3282 | return True |
| 3283 | |
| 3284 | def pretty_print(self, q): |
| 3285 | q.text("bsn_gentable_set_buckets_size {") |
| 3286 | with q.group(): |
| 3287 | with q.indent(2): |
| 3288 | q.breakable() |
| 3289 | q.text("xid = "); |
| 3290 | if self.xid != None: |
| 3291 | q.text("%#x" % self.xid) |
| 3292 | else: |
| 3293 | q.text('None') |
| 3294 | q.text(","); q.breakable() |
| 3295 | q.text("table_id = "); |
| 3296 | q.text("%#x" % self.table_id) |
| 3297 | q.text(","); q.breakable() |
| 3298 | q.text("buckets_size = "); |
| 3299 | q.text("%#x" % self.buckets_size) |
| 3300 | q.breakable() |
| 3301 | q.text('}') |
| 3302 | |
| 3303 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 3304 | |
| 3305 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 3306 | version = 4 |
| 3307 | type = 19 |
| 3308 | stats_type = 65535 |
| 3309 | experimenter = 6035143 |
| 3310 | subtype = 7 |
| 3311 | |
| 3312 | def __init__(self, xid=None, flags=None, entries=None): |
| 3313 | if xid != None: |
| 3314 | self.xid = xid |
| 3315 | else: |
| 3316 | self.xid = None |
| 3317 | if flags != None: |
| 3318 | self.flags = flags |
| 3319 | else: |
| 3320 | self.flags = 0 |
| 3321 | if entries != None: |
| 3322 | self.entries = entries |
| 3323 | else: |
| 3324 | self.entries = [] |
| 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('\x00' * 4) |
| 3336 | packed.append(struct.pack("!L", self.experimenter)) |
| 3337 | packed.append(struct.pack("!L", self.subtype)) |
| 3338 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3339 | length = sum([len(x) for x in packed]) |
| 3340 | packed[2] = struct.pack("!H", length) |
| 3341 | return ''.join(packed) |
| 3342 | |
| 3343 | @staticmethod |
| 3344 | def unpack(reader): |
| 3345 | obj = bsn_gentable_stats_reply() |
| 3346 | _version = reader.read("!B")[0] |
| 3347 | assert(_version == 4) |
| 3348 | _type = reader.read("!B")[0] |
| 3349 | assert(_type == 19) |
| 3350 | _length = reader.read("!H")[0] |
| 3351 | orig_reader = reader |
| 3352 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3353 | obj.xid = reader.read("!L")[0] |
| 3354 | _stats_type = reader.read("!H")[0] |
| 3355 | assert(_stats_type == 65535) |
| 3356 | obj.flags = reader.read("!H")[0] |
| 3357 | reader.skip(4) |
| 3358 | _experimenter = reader.read("!L")[0] |
| 3359 | assert(_experimenter == 6035143) |
| 3360 | _subtype = reader.read("!L")[0] |
| 3361 | assert(_subtype == 7) |
| 3362 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack) |
| 3363 | return obj |
| 3364 | |
| 3365 | def __eq__(self, other): |
| 3366 | if type(self) != type(other): return False |
| 3367 | if self.xid != other.xid: return False |
| 3368 | if self.flags != other.flags: return False |
| 3369 | if self.entries != other.entries: return False |
| 3370 | return True |
| 3371 | |
| 3372 | def pretty_print(self, q): |
| 3373 | q.text("bsn_gentable_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("entries = "); |
| 3387 | q.pp(self.entries) |
| 3388 | q.breakable() |
| 3389 | q.text('}') |
| 3390 | |
| 3391 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 3392 | |
| 3393 | class bsn_gentable_stats_request(bsn_stats_request): |
| 3394 | version = 4 |
| 3395 | type = 18 |
| 3396 | stats_type = 65535 |
| 3397 | experimenter = 6035143 |
| 3398 | subtype = 7 |
| 3399 | |
| 3400 | def __init__(self, xid=None, flags=None): |
| 3401 | if xid != None: |
| 3402 | self.xid = xid |
| 3403 | else: |
| 3404 | self.xid = None |
| 3405 | if flags != None: |
| 3406 | self.flags = flags |
| 3407 | else: |
| 3408 | self.flags = 0 |
| 3409 | return |
| 3410 | |
| 3411 | def pack(self): |
| 3412 | packed = [] |
| 3413 | packed.append(struct.pack("!B", self.version)) |
| 3414 | packed.append(struct.pack("!B", self.type)) |
| 3415 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3416 | packed.append(struct.pack("!L", self.xid)) |
| 3417 | packed.append(struct.pack("!H", self.stats_type)) |
| 3418 | packed.append(struct.pack("!H", self.flags)) |
| 3419 | packed.append('\x00' * 4) |
| 3420 | packed.append(struct.pack("!L", self.experimenter)) |
| 3421 | packed.append(struct.pack("!L", self.subtype)) |
| 3422 | length = sum([len(x) for x in packed]) |
| 3423 | packed[2] = struct.pack("!H", length) |
| 3424 | return ''.join(packed) |
| 3425 | |
| 3426 | @staticmethod |
| 3427 | def unpack(reader): |
| 3428 | obj = bsn_gentable_stats_request() |
| 3429 | _version = reader.read("!B")[0] |
| 3430 | assert(_version == 4) |
| 3431 | _type = reader.read("!B")[0] |
| 3432 | assert(_type == 18) |
| 3433 | _length = reader.read("!H")[0] |
| 3434 | orig_reader = reader |
| 3435 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3436 | obj.xid = reader.read("!L")[0] |
| 3437 | _stats_type = reader.read("!H")[0] |
| 3438 | assert(_stats_type == 65535) |
| 3439 | obj.flags = reader.read("!H")[0] |
| 3440 | reader.skip(4) |
| 3441 | _experimenter = reader.read("!L")[0] |
| 3442 | assert(_experimenter == 6035143) |
| 3443 | _subtype = reader.read("!L")[0] |
| 3444 | assert(_subtype == 7) |
| 3445 | return obj |
| 3446 | |
| 3447 | def __eq__(self, other): |
| 3448 | if type(self) != type(other): return False |
| 3449 | if self.xid != other.xid: return False |
| 3450 | if self.flags != other.flags: return False |
| 3451 | return True |
| 3452 | |
| 3453 | def pretty_print(self, q): |
| 3454 | q.text("bsn_gentable_stats_request {") |
| 3455 | with q.group(): |
| 3456 | with q.indent(2): |
| 3457 | q.breakable() |
| 3458 | q.text("xid = "); |
| 3459 | if self.xid != None: |
| 3460 | q.text("%#x" % self.xid) |
| 3461 | else: |
| 3462 | q.text('None') |
| 3463 | q.text(","); q.breakable() |
| 3464 | q.text("flags = "); |
| 3465 | q.text("%#x" % self.flags) |
| 3466 | q.breakable() |
| 3467 | q.text('}') |
| 3468 | |
| 3469 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 3470 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3471 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3472 | version = 4 |
| 3473 | type = 4 |
| 3474 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3475 | subtype = 10 |
| 3476 | |
| 3477 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3478 | if xid != None: |
| 3479 | self.xid = xid |
| 3480 | else: |
| 3481 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3482 | if interfaces != None: |
| 3483 | self.interfaces = interfaces |
| 3484 | else: |
| 3485 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3486 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3487 | |
| 3488 | def pack(self): |
| 3489 | packed = [] |
| 3490 | packed.append(struct.pack("!B", self.version)) |
| 3491 | packed.append(struct.pack("!B", self.type)) |
| 3492 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3493 | packed.append(struct.pack("!L", self.xid)) |
| 3494 | packed.append(struct.pack("!L", self.experimenter)) |
| 3495 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3496 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3497 | length = sum([len(x) for x in packed]) |
| 3498 | packed[2] = struct.pack("!H", length) |
| 3499 | return ''.join(packed) |
| 3500 | |
| 3501 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3502 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3503 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3504 | _version = reader.read("!B")[0] |
| 3505 | assert(_version == 4) |
| 3506 | _type = reader.read("!B")[0] |
| 3507 | assert(_type == 4) |
| 3508 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3509 | orig_reader = reader |
| 3510 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3511 | obj.xid = reader.read("!L")[0] |
| 3512 | _experimenter = reader.read("!L")[0] |
| 3513 | assert(_experimenter == 6035143) |
| 3514 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3515 | assert(_subtype == 10) |
| 3516 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
| 3517 | return obj |
| 3518 | |
| 3519 | def __eq__(self, other): |
| 3520 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3521 | if self.xid != other.xid: return False |
| 3522 | if self.interfaces != other.interfaces: return False |
| 3523 | return True |
| 3524 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3525 | def pretty_print(self, q): |
| 3526 | q.text("bsn_get_interfaces_reply {") |
| 3527 | with q.group(): |
| 3528 | with q.indent(2): |
| 3529 | q.breakable() |
| 3530 | q.text("xid = "); |
| 3531 | if self.xid != None: |
| 3532 | q.text("%#x" % self.xid) |
| 3533 | else: |
| 3534 | q.text('None') |
| 3535 | q.text(","); q.breakable() |
| 3536 | q.text("interfaces = "); |
| 3537 | q.pp(self.interfaces) |
| 3538 | q.breakable() |
| 3539 | q.text('}') |
| 3540 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3541 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 3542 | |
| 3543 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3544 | version = 4 |
| 3545 | type = 4 |
| 3546 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3547 | subtype = 9 |
| 3548 | |
| 3549 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3550 | if xid != None: |
| 3551 | self.xid = xid |
| 3552 | else: |
| 3553 | self.xid = None |
| 3554 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3555 | |
| 3556 | def pack(self): |
| 3557 | packed = [] |
| 3558 | packed.append(struct.pack("!B", self.version)) |
| 3559 | packed.append(struct.pack("!B", self.type)) |
| 3560 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3561 | packed.append(struct.pack("!L", self.xid)) |
| 3562 | packed.append(struct.pack("!L", self.experimenter)) |
| 3563 | packed.append(struct.pack("!L", self.subtype)) |
| 3564 | length = sum([len(x) for x in packed]) |
| 3565 | packed[2] = struct.pack("!H", length) |
| 3566 | return ''.join(packed) |
| 3567 | |
| 3568 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3569 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3570 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3571 | _version = reader.read("!B")[0] |
| 3572 | assert(_version == 4) |
| 3573 | _type = reader.read("!B")[0] |
| 3574 | assert(_type == 4) |
| 3575 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3576 | orig_reader = reader |
| 3577 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3578 | obj.xid = reader.read("!L")[0] |
| 3579 | _experimenter = reader.read("!L")[0] |
| 3580 | assert(_experimenter == 6035143) |
| 3581 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3582 | assert(_subtype == 9) |
| 3583 | return obj |
| 3584 | |
| 3585 | def __eq__(self, other): |
| 3586 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3587 | if self.xid != other.xid: return False |
| 3588 | return True |
| 3589 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3590 | def pretty_print(self, q): |
| 3591 | q.text("bsn_get_interfaces_request {") |
| 3592 | with q.group(): |
| 3593 | with q.indent(2): |
| 3594 | q.breakable() |
| 3595 | q.text("xid = "); |
| 3596 | if self.xid != None: |
| 3597 | q.text("%#x" % self.xid) |
| 3598 | else: |
| 3599 | q.text('None') |
| 3600 | q.breakable() |
| 3601 | q.text('}') |
| 3602 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3603 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 3604 | |
| 3605 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3606 | version = 4 |
| 3607 | type = 4 |
| 3608 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3609 | subtype = 5 |
| 3610 | |
| 3611 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3612 | if xid != None: |
| 3613 | self.xid = xid |
| 3614 | else: |
| 3615 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3616 | if report_mirror_ports != None: |
| 3617 | self.report_mirror_ports = report_mirror_ports |
| 3618 | else: |
| 3619 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3620 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3621 | |
| 3622 | def pack(self): |
| 3623 | packed = [] |
| 3624 | packed.append(struct.pack("!B", self.version)) |
| 3625 | packed.append(struct.pack("!B", self.type)) |
| 3626 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3627 | packed.append(struct.pack("!L", self.xid)) |
| 3628 | packed.append(struct.pack("!L", self.experimenter)) |
| 3629 | packed.append(struct.pack("!L", self.subtype)) |
| 3630 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 3631 | packed.append('\x00' * 3) |
| 3632 | length = sum([len(x) for x in packed]) |
| 3633 | packed[2] = struct.pack("!H", length) |
| 3634 | return ''.join(packed) |
| 3635 | |
| 3636 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3637 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3638 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3639 | _version = reader.read("!B")[0] |
| 3640 | assert(_version == 4) |
| 3641 | _type = reader.read("!B")[0] |
| 3642 | assert(_type == 4) |
| 3643 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3644 | orig_reader = reader |
| 3645 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3646 | obj.xid = reader.read("!L")[0] |
| 3647 | _experimenter = reader.read("!L")[0] |
| 3648 | assert(_experimenter == 6035143) |
| 3649 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3650 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3651 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3652 | reader.skip(3) |
| 3653 | return obj |
| 3654 | |
| 3655 | def __eq__(self, other): |
| 3656 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3657 | if self.xid != other.xid: return False |
| 3658 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 3659 | return True |
| 3660 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3661 | def pretty_print(self, q): |
| 3662 | q.text("bsn_get_mirroring_reply {") |
| 3663 | with q.group(): |
| 3664 | with q.indent(2): |
| 3665 | q.breakable() |
| 3666 | q.text("xid = "); |
| 3667 | if self.xid != None: |
| 3668 | q.text("%#x" % self.xid) |
| 3669 | else: |
| 3670 | q.text('None') |
| 3671 | q.text(","); q.breakable() |
| 3672 | q.text("report_mirror_ports = "); |
| 3673 | q.text("%#x" % self.report_mirror_ports) |
| 3674 | q.breakable() |
| 3675 | q.text('}') |
| 3676 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3677 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 3678 | |
| 3679 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3680 | version = 4 |
| 3681 | type = 4 |
| 3682 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3683 | subtype = 4 |
| 3684 | |
| 3685 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3686 | if xid != None: |
| 3687 | self.xid = xid |
| 3688 | else: |
| 3689 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3690 | if report_mirror_ports != None: |
| 3691 | self.report_mirror_ports = report_mirror_ports |
| 3692 | else: |
| 3693 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3694 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3695 | |
| 3696 | def pack(self): |
| 3697 | packed = [] |
| 3698 | packed.append(struct.pack("!B", self.version)) |
| 3699 | packed.append(struct.pack("!B", self.type)) |
| 3700 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3701 | packed.append(struct.pack("!L", self.xid)) |
| 3702 | packed.append(struct.pack("!L", self.experimenter)) |
| 3703 | packed.append(struct.pack("!L", self.subtype)) |
| 3704 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 3705 | packed.append('\x00' * 3) |
| 3706 | length = sum([len(x) for x in packed]) |
| 3707 | packed[2] = struct.pack("!H", length) |
| 3708 | return ''.join(packed) |
| 3709 | |
| 3710 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3711 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3712 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3713 | _version = reader.read("!B")[0] |
| 3714 | assert(_version == 4) |
| 3715 | _type = reader.read("!B")[0] |
| 3716 | assert(_type == 4) |
| 3717 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3718 | orig_reader = reader |
| 3719 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3720 | obj.xid = reader.read("!L")[0] |
| 3721 | _experimenter = reader.read("!L")[0] |
| 3722 | assert(_experimenter == 6035143) |
| 3723 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3724 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3725 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3726 | reader.skip(3) |
| 3727 | return obj |
| 3728 | |
| 3729 | def __eq__(self, other): |
| 3730 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3731 | if self.xid != other.xid: return False |
| 3732 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 3733 | return True |
| 3734 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3735 | def pretty_print(self, q): |
| 3736 | q.text("bsn_get_mirroring_request {") |
| 3737 | with q.group(): |
| 3738 | with q.indent(2): |
| 3739 | q.breakable() |
| 3740 | q.text("xid = "); |
| 3741 | if self.xid != None: |
| 3742 | q.text("%#x" % self.xid) |
| 3743 | else: |
| 3744 | q.text('None') |
| 3745 | q.text(","); q.breakable() |
| 3746 | q.text("report_mirror_ports = "); |
| 3747 | q.text("%#x" % self.report_mirror_ports) |
| 3748 | q.breakable() |
| 3749 | q.text('}') |
| 3750 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3751 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 3752 | |
| 3753 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 3754 | version = 4 |
| 3755 | type = 4 |
| 3756 | experimenter = 6035143 |
| 3757 | subtype = 52 |
| 3758 | |
| 3759 | def __init__(self, xid=None, pipeline=None): |
| 3760 | if xid != None: |
| 3761 | self.xid = xid |
| 3762 | else: |
| 3763 | self.xid = None |
| 3764 | if pipeline != None: |
| 3765 | self.pipeline = pipeline |
| 3766 | else: |
| 3767 | self.pipeline = "" |
| 3768 | return |
| 3769 | |
| 3770 | def pack(self): |
| 3771 | packed = [] |
| 3772 | packed.append(struct.pack("!B", self.version)) |
| 3773 | packed.append(struct.pack("!B", self.type)) |
| 3774 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3775 | packed.append(struct.pack("!L", self.xid)) |
| 3776 | packed.append(struct.pack("!L", self.experimenter)) |
| 3777 | packed.append(struct.pack("!L", self.subtype)) |
| 3778 | packed.append(struct.pack("!256s", self.pipeline)) |
| 3779 | length = sum([len(x) for x in packed]) |
| 3780 | packed[2] = struct.pack("!H", length) |
| 3781 | return ''.join(packed) |
| 3782 | |
| 3783 | @staticmethod |
| 3784 | def unpack(reader): |
| 3785 | obj = bsn_get_switch_pipeline_reply() |
| 3786 | _version = reader.read("!B")[0] |
| 3787 | assert(_version == 4) |
| 3788 | _type = reader.read("!B")[0] |
| 3789 | assert(_type == 4) |
| 3790 | _length = reader.read("!H")[0] |
| 3791 | orig_reader = reader |
| 3792 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3793 | obj.xid = reader.read("!L")[0] |
| 3794 | _experimenter = reader.read("!L")[0] |
| 3795 | assert(_experimenter == 6035143) |
| 3796 | _subtype = reader.read("!L")[0] |
| 3797 | assert(_subtype == 52) |
| 3798 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 3799 | return obj |
| 3800 | |
| 3801 | def __eq__(self, other): |
| 3802 | if type(self) != type(other): return False |
| 3803 | if self.xid != other.xid: return False |
| 3804 | if self.pipeline != other.pipeline: return False |
| 3805 | return True |
| 3806 | |
| 3807 | def pretty_print(self, q): |
| 3808 | q.text("bsn_get_switch_pipeline_reply {") |
| 3809 | with q.group(): |
| 3810 | with q.indent(2): |
| 3811 | q.breakable() |
| 3812 | q.text("xid = "); |
| 3813 | if self.xid != None: |
| 3814 | q.text("%#x" % self.xid) |
| 3815 | else: |
| 3816 | q.text('None') |
| 3817 | q.text(","); q.breakable() |
| 3818 | q.text("pipeline = "); |
| 3819 | q.pp(self.pipeline) |
| 3820 | q.breakable() |
| 3821 | q.text('}') |
| 3822 | |
| 3823 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 3824 | |
| 3825 | class bsn_get_switch_pipeline_request(bsn_header): |
| 3826 | version = 4 |
| 3827 | type = 4 |
| 3828 | experimenter = 6035143 |
| 3829 | subtype = 51 |
| 3830 | |
| 3831 | def __init__(self, xid=None): |
| 3832 | if xid != None: |
| 3833 | self.xid = xid |
| 3834 | else: |
| 3835 | self.xid = None |
| 3836 | return |
| 3837 | |
| 3838 | def pack(self): |
| 3839 | packed = [] |
| 3840 | packed.append(struct.pack("!B", self.version)) |
| 3841 | packed.append(struct.pack("!B", self.type)) |
| 3842 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3843 | packed.append(struct.pack("!L", self.xid)) |
| 3844 | packed.append(struct.pack("!L", self.experimenter)) |
| 3845 | packed.append(struct.pack("!L", self.subtype)) |
| 3846 | length = sum([len(x) for x in packed]) |
| 3847 | packed[2] = struct.pack("!H", length) |
| 3848 | return ''.join(packed) |
| 3849 | |
| 3850 | @staticmethod |
| 3851 | def unpack(reader): |
| 3852 | obj = bsn_get_switch_pipeline_request() |
| 3853 | _version = reader.read("!B")[0] |
| 3854 | assert(_version == 4) |
| 3855 | _type = reader.read("!B")[0] |
| 3856 | assert(_type == 4) |
| 3857 | _length = reader.read("!H")[0] |
| 3858 | orig_reader = reader |
| 3859 | reader = orig_reader.slice(_length - (2 + 2)) |
| 3860 | obj.xid = reader.read("!L")[0] |
| 3861 | _experimenter = reader.read("!L")[0] |
| 3862 | assert(_experimenter == 6035143) |
| 3863 | _subtype = reader.read("!L")[0] |
| 3864 | assert(_subtype == 51) |
| 3865 | return obj |
| 3866 | |
| 3867 | def __eq__(self, other): |
| 3868 | if type(self) != type(other): return False |
| 3869 | if self.xid != other.xid: return False |
| 3870 | return True |
| 3871 | |
| 3872 | def pretty_print(self, q): |
| 3873 | q.text("bsn_get_switch_pipeline_request {") |
| 3874 | with q.group(): |
| 3875 | with q.indent(2): |
| 3876 | q.breakable() |
| 3877 | q.text("xid = "); |
| 3878 | if self.xid != None: |
| 3879 | q.text("%#x" % self.xid) |
| 3880 | else: |
| 3881 | q.text('None') |
| 3882 | q.breakable() |
| 3883 | q.text('}') |
| 3884 | |
| 3885 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 3886 | |
| 3887 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3888 | version = 4 |
| 3889 | type = 4 |
| 3890 | experimenter = 6035143 |
| 3891 | subtype = 43 |
| 3892 | |
| 3893 | def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3894 | if xid != None: |
| 3895 | self.xid = xid |
| 3896 | else: |
| 3897 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3898 | if convergence_status != None: |
| 3899 | self.convergence_status = convergence_status |
| 3900 | else: |
| 3901 | self.convergence_status = 0 |
| 3902 | if port_no != None: |
| 3903 | self.port_no = port_no |
| 3904 | else: |
| 3905 | self.port_no = 0 |
| 3906 | if actor_sys_priority != None: |
| 3907 | self.actor_sys_priority = actor_sys_priority |
| 3908 | else: |
| 3909 | self.actor_sys_priority = 0 |
| 3910 | if actor_sys_mac != None: |
| 3911 | self.actor_sys_mac = actor_sys_mac |
| 3912 | else: |
| 3913 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 3914 | if actor_port_priority != None: |
| 3915 | self.actor_port_priority = actor_port_priority |
| 3916 | else: |
| 3917 | self.actor_port_priority = 0 |
| 3918 | if actor_port_num != None: |
| 3919 | self.actor_port_num = actor_port_num |
| 3920 | else: |
| 3921 | self.actor_port_num = 0 |
| 3922 | if actor_key != None: |
| 3923 | self.actor_key = actor_key |
| 3924 | else: |
| 3925 | self.actor_key = 0 |
| 3926 | if partner_sys_priority != None: |
| 3927 | self.partner_sys_priority = partner_sys_priority |
| 3928 | else: |
| 3929 | self.partner_sys_priority = 0 |
| 3930 | if partner_sys_mac != None: |
| 3931 | self.partner_sys_mac = partner_sys_mac |
| 3932 | else: |
| 3933 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 3934 | if partner_port_priority != None: |
| 3935 | self.partner_port_priority = partner_port_priority |
| 3936 | else: |
| 3937 | self.partner_port_priority = 0 |
| 3938 | if partner_port_num != None: |
| 3939 | self.partner_port_num = partner_port_num |
| 3940 | else: |
| 3941 | self.partner_port_num = 0 |
| 3942 | if partner_key != None: |
| 3943 | self.partner_key = partner_key |
| 3944 | else: |
| 3945 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3946 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3947 | |
| 3948 | def pack(self): |
| 3949 | packed = [] |
| 3950 | packed.append(struct.pack("!B", self.version)) |
| 3951 | packed.append(struct.pack("!B", self.type)) |
| 3952 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3953 | packed.append(struct.pack("!L", self.xid)) |
| 3954 | packed.append(struct.pack("!L", self.experimenter)) |
| 3955 | packed.append(struct.pack("!L", self.subtype)) |
| 3956 | packed.append(struct.pack("!B", self.convergence_status)) |
| 3957 | packed.append('\x00' * 3) |
| 3958 | packed.append(util.pack_port_no(self.port_no)) |
| 3959 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 3960 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 3961 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 3962 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 3963 | packed.append(struct.pack("!H", self.actor_key)) |
| 3964 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 3965 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 3966 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 3967 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 3968 | packed.append(struct.pack("!H", self.partner_key)) |
| 3969 | length = sum([len(x) for x in packed]) |
| 3970 | packed[2] = struct.pack("!H", length) |
| 3971 | return ''.join(packed) |
| 3972 | |
| 3973 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3974 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3975 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3976 | _version = reader.read("!B")[0] |
| 3977 | assert(_version == 4) |
| 3978 | _type = reader.read("!B")[0] |
| 3979 | assert(_type == 4) |
| 3980 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3981 | orig_reader = reader |
| 3982 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 3983 | obj.xid = reader.read("!L")[0] |
| 3984 | _experimenter = reader.read("!L")[0] |
| 3985 | assert(_experimenter == 6035143) |
| 3986 | _subtype = reader.read("!L")[0] |
| 3987 | assert(_subtype == 43) |
| 3988 | obj.convergence_status = reader.read("!B")[0] |
| 3989 | reader.skip(3) |
| 3990 | obj.port_no = util.unpack_port_no(reader) |
| 3991 | obj.actor_sys_priority = reader.read("!H")[0] |
| 3992 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 3993 | obj.actor_port_priority = reader.read("!H")[0] |
| 3994 | obj.actor_port_num = reader.read("!H")[0] |
| 3995 | obj.actor_key = reader.read("!H")[0] |
| 3996 | obj.partner_sys_priority = reader.read("!H")[0] |
| 3997 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 3998 | obj.partner_port_priority = reader.read("!H")[0] |
| 3999 | obj.partner_port_num = reader.read("!H")[0] |
| 4000 | obj.partner_key = reader.read("!H")[0] |
| 4001 | return obj |
| 4002 | |
| 4003 | def __eq__(self, other): |
| 4004 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4005 | if self.xid != other.xid: return False |
| 4006 | if self.convergence_status != other.convergence_status: return False |
| 4007 | if self.port_no != other.port_no: return False |
| 4008 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 4009 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 4010 | if self.actor_port_priority != other.actor_port_priority: return False |
| 4011 | if self.actor_port_num != other.actor_port_num: return False |
| 4012 | if self.actor_key != other.actor_key: return False |
| 4013 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 4014 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 4015 | if self.partner_port_priority != other.partner_port_priority: return False |
| 4016 | if self.partner_port_num != other.partner_port_num: return False |
| 4017 | if self.partner_key != other.partner_key: return False |
| 4018 | return True |
| 4019 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4020 | def pretty_print(self, q): |
| 4021 | q.text("bsn_lacp_convergence_notif {") |
| 4022 | with q.group(): |
| 4023 | with q.indent(2): |
| 4024 | q.breakable() |
| 4025 | q.text("xid = "); |
| 4026 | if self.xid != None: |
| 4027 | q.text("%#x" % self.xid) |
| 4028 | else: |
| 4029 | q.text('None') |
| 4030 | q.text(","); q.breakable() |
| 4031 | q.text("convergence_status = "); |
| 4032 | q.text("%#x" % self.convergence_status) |
| 4033 | q.text(","); q.breakable() |
| 4034 | q.text("port_no = "); |
| 4035 | q.text(util.pretty_port(self.port_no)) |
| 4036 | q.text(","); q.breakable() |
| 4037 | q.text("actor_sys_priority = "); |
| 4038 | q.text("%#x" % self.actor_sys_priority) |
| 4039 | q.text(","); q.breakable() |
| 4040 | q.text("actor_sys_mac = "); |
| 4041 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 4042 | q.text(","); q.breakable() |
| 4043 | q.text("actor_port_priority = "); |
| 4044 | q.text("%#x" % self.actor_port_priority) |
| 4045 | q.text(","); q.breakable() |
| 4046 | q.text("actor_port_num = "); |
| 4047 | q.text("%#x" % self.actor_port_num) |
| 4048 | q.text(","); q.breakable() |
| 4049 | q.text("actor_key = "); |
| 4050 | q.text("%#x" % self.actor_key) |
| 4051 | q.text(","); q.breakable() |
| 4052 | q.text("partner_sys_priority = "); |
| 4053 | q.text("%#x" % self.partner_sys_priority) |
| 4054 | q.text(","); q.breakable() |
| 4055 | q.text("partner_sys_mac = "); |
| 4056 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 4057 | q.text(","); q.breakable() |
| 4058 | q.text("partner_port_priority = "); |
| 4059 | q.text("%#x" % self.partner_port_priority) |
| 4060 | q.text(","); q.breakable() |
| 4061 | q.text("partner_port_num = "); |
| 4062 | q.text("%#x" % self.partner_port_num) |
| 4063 | q.text(","); q.breakable() |
| 4064 | q.text("partner_key = "); |
| 4065 | q.text("%#x" % self.partner_key) |
| 4066 | q.breakable() |
| 4067 | q.text('}') |
| 4068 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4069 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 4070 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4071 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4072 | version = 4 |
| 4073 | type = 19 |
| 4074 | stats_type = 65535 |
| 4075 | experimenter = 6035143 |
| 4076 | subtype = 1 |
| 4077 | |
| 4078 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4079 | if xid != None: |
| 4080 | self.xid = xid |
| 4081 | else: |
| 4082 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4083 | if flags != None: |
| 4084 | self.flags = flags |
| 4085 | else: |
| 4086 | self.flags = 0 |
| 4087 | if entries != None: |
| 4088 | self.entries = entries |
| 4089 | else: |
| 4090 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4091 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [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 | packed.append('\x00' * 4) |
| 4102 | packed.append(struct.pack("!L", self.experimenter)) |
| 4103 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4104 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4105 | length = sum([len(x) for x in packed]) |
| 4106 | packed[2] = struct.pack("!H", length) |
| 4107 | return ''.join(packed) |
| 4108 | |
| 4109 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4110 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4111 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4112 | _version = reader.read("!B")[0] |
| 4113 | assert(_version == 4) |
| 4114 | _type = reader.read("!B")[0] |
| 4115 | assert(_type == 19) |
| 4116 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4117 | orig_reader = reader |
| 4118 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4119 | obj.xid = reader.read("!L")[0] |
| 4120 | _stats_type = reader.read("!H")[0] |
| 4121 | assert(_stats_type == 65535) |
| 4122 | obj.flags = reader.read("!H")[0] |
| 4123 | reader.skip(4) |
| 4124 | _experimenter = reader.read("!L")[0] |
| 4125 | assert(_experimenter == 6035143) |
| 4126 | _subtype = reader.read("!L")[0] |
| 4127 | assert(_subtype == 1) |
| 4128 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack) |
| 4129 | return obj |
| 4130 | |
| 4131 | def __eq__(self, other): |
| 4132 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4133 | if self.xid != other.xid: return False |
| 4134 | if self.flags != other.flags: return False |
| 4135 | if self.entries != other.entries: return False |
| 4136 | return True |
| 4137 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4138 | def pretty_print(self, q): |
| 4139 | q.text("bsn_lacp_stats_reply {") |
| 4140 | with q.group(): |
| 4141 | with q.indent(2): |
| 4142 | q.breakable() |
| 4143 | q.text("xid = "); |
| 4144 | if self.xid != None: |
| 4145 | q.text("%#x" % self.xid) |
| 4146 | else: |
| 4147 | q.text('None') |
| 4148 | q.text(","); q.breakable() |
| 4149 | q.text("flags = "); |
| 4150 | q.text("%#x" % self.flags) |
| 4151 | q.text(","); q.breakable() |
| 4152 | q.text("entries = "); |
| 4153 | q.pp(self.entries) |
| 4154 | q.breakable() |
| 4155 | q.text('}') |
| 4156 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4157 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 4158 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4159 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4160 | version = 4 |
| 4161 | type = 18 |
| 4162 | stats_type = 65535 |
| 4163 | experimenter = 6035143 |
| 4164 | subtype = 1 |
| 4165 | |
| 4166 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4167 | if xid != None: |
| 4168 | self.xid = xid |
| 4169 | else: |
| 4170 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4171 | if flags != None: |
| 4172 | self.flags = flags |
| 4173 | else: |
| 4174 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4175 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4176 | |
| 4177 | def pack(self): |
| 4178 | packed = [] |
| 4179 | packed.append(struct.pack("!B", self.version)) |
| 4180 | packed.append(struct.pack("!B", self.type)) |
| 4181 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4182 | packed.append(struct.pack("!L", self.xid)) |
| 4183 | packed.append(struct.pack("!H", self.stats_type)) |
| 4184 | packed.append(struct.pack("!H", self.flags)) |
| 4185 | packed.append('\x00' * 4) |
| 4186 | packed.append(struct.pack("!L", self.experimenter)) |
| 4187 | packed.append(struct.pack("!L", self.subtype)) |
| 4188 | length = sum([len(x) for x in packed]) |
| 4189 | packed[2] = struct.pack("!H", length) |
| 4190 | return ''.join(packed) |
| 4191 | |
| 4192 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4193 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4194 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4195 | _version = reader.read("!B")[0] |
| 4196 | assert(_version == 4) |
| 4197 | _type = reader.read("!B")[0] |
| 4198 | assert(_type == 18) |
| 4199 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4200 | orig_reader = reader |
| 4201 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4202 | obj.xid = reader.read("!L")[0] |
| 4203 | _stats_type = reader.read("!H")[0] |
| 4204 | assert(_stats_type == 65535) |
| 4205 | obj.flags = reader.read("!H")[0] |
| 4206 | reader.skip(4) |
| 4207 | _experimenter = reader.read("!L")[0] |
| 4208 | assert(_experimenter == 6035143) |
| 4209 | _subtype = reader.read("!L")[0] |
| 4210 | assert(_subtype == 1) |
| 4211 | return obj |
| 4212 | |
| 4213 | def __eq__(self, other): |
| 4214 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4215 | if self.xid != other.xid: return False |
| 4216 | if self.flags != other.flags: return False |
| 4217 | return True |
| 4218 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4219 | def pretty_print(self, q): |
| 4220 | q.text("bsn_lacp_stats_request {") |
| 4221 | with q.group(): |
| 4222 | with q.indent(2): |
| 4223 | q.breakable() |
| 4224 | q.text("xid = "); |
| 4225 | if self.xid != None: |
| 4226 | q.text("%#x" % self.xid) |
| 4227 | else: |
| 4228 | q.text('None') |
| 4229 | q.text(","); q.breakable() |
| 4230 | q.text("flags = "); |
| 4231 | q.text("%#x" % self.flags) |
| 4232 | q.breakable() |
| 4233 | q.text('}') |
| 4234 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4235 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 4236 | |
| 4237 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4238 | version = 4 |
| 4239 | type = 4 |
| 4240 | experimenter = 6035143 |
| 4241 | subtype = 34 |
| 4242 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4243 | 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] | 4244 | if xid != None: |
| 4245 | self.xid = xid |
| 4246 | else: |
| 4247 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4248 | if status != None: |
| 4249 | self.status = status |
| 4250 | else: |
| 4251 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4252 | if port_no != None: |
| 4253 | self.port_no = port_no |
| 4254 | else: |
| 4255 | self.port_no = 0 |
| 4256 | if slot_num != None: |
| 4257 | self.slot_num = slot_num |
| 4258 | else: |
| 4259 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4260 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4261 | |
| 4262 | def pack(self): |
| 4263 | packed = [] |
| 4264 | packed.append(struct.pack("!B", self.version)) |
| 4265 | packed.append(struct.pack("!B", self.type)) |
| 4266 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4267 | packed.append(struct.pack("!L", self.xid)) |
| 4268 | packed.append(struct.pack("!L", self.experimenter)) |
| 4269 | packed.append(struct.pack("!L", self.subtype)) |
| 4270 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4271 | packed.append(util.pack_port_no(self.port_no)) |
| 4272 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4273 | length = sum([len(x) for x in packed]) |
| 4274 | packed[2] = struct.pack("!H", length) |
| 4275 | return ''.join(packed) |
| 4276 | |
| 4277 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4278 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4279 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4280 | _version = reader.read("!B")[0] |
| 4281 | assert(_version == 4) |
| 4282 | _type = reader.read("!B")[0] |
| 4283 | assert(_type == 4) |
| 4284 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4285 | orig_reader = reader |
| 4286 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4287 | obj.xid = reader.read("!L")[0] |
| 4288 | _experimenter = reader.read("!L")[0] |
| 4289 | assert(_experimenter == 6035143) |
| 4290 | _subtype = reader.read("!L")[0] |
| 4291 | assert(_subtype == 34) |
| 4292 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4293 | obj.port_no = util.unpack_port_no(reader) |
| 4294 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4295 | return obj |
| 4296 | |
| 4297 | def __eq__(self, other): |
| 4298 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4299 | if self.xid != other.xid: return False |
| 4300 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4301 | if self.port_no != other.port_no: return False |
| 4302 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4303 | return True |
| 4304 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4305 | def pretty_print(self, q): |
| 4306 | q.text("bsn_pdu_rx_reply {") |
| 4307 | with q.group(): |
| 4308 | with q.indent(2): |
| 4309 | q.breakable() |
| 4310 | q.text("xid = "); |
| 4311 | if self.xid != None: |
| 4312 | q.text("%#x" % self.xid) |
| 4313 | else: |
| 4314 | q.text('None') |
| 4315 | q.text(","); q.breakable() |
| 4316 | q.text("status = "); |
| 4317 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4318 | q.text(","); q.breakable() |
| 4319 | q.text("port_no = "); |
| 4320 | q.text(util.pretty_port(self.port_no)) |
| 4321 | q.text(","); q.breakable() |
| 4322 | q.text("slot_num = "); |
| 4323 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4324 | q.breakable() |
| 4325 | q.text('}') |
| 4326 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4327 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 4328 | |
| 4329 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4330 | version = 4 |
| 4331 | type = 4 |
| 4332 | experimenter = 6035143 |
| 4333 | subtype = 33 |
| 4334 | |
| 4335 | 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] | 4336 | if xid != None: |
| 4337 | self.xid = xid |
| 4338 | else: |
| 4339 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4340 | if timeout_ms != None: |
| 4341 | self.timeout_ms = timeout_ms |
| 4342 | else: |
| 4343 | self.timeout_ms = 0 |
| 4344 | if port_no != None: |
| 4345 | self.port_no = port_no |
| 4346 | else: |
| 4347 | self.port_no = 0 |
| 4348 | if slot_num != None: |
| 4349 | self.slot_num = slot_num |
| 4350 | else: |
| 4351 | self.slot_num = 0 |
| 4352 | if data != None: |
| 4353 | self.data = data |
| 4354 | else: |
| 4355 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4356 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4357 | |
| 4358 | def pack(self): |
| 4359 | packed = [] |
| 4360 | packed.append(struct.pack("!B", self.version)) |
| 4361 | packed.append(struct.pack("!B", self.type)) |
| 4362 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4363 | packed.append(struct.pack("!L", self.xid)) |
| 4364 | packed.append(struct.pack("!L", self.experimenter)) |
| 4365 | packed.append(struct.pack("!L", self.subtype)) |
| 4366 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 4367 | packed.append(util.pack_port_no(self.port_no)) |
| 4368 | packed.append(struct.pack("!B", self.slot_num)) |
| 4369 | packed.append('\x00' * 3) |
| 4370 | packed.append(self.data) |
| 4371 | length = sum([len(x) for x in packed]) |
| 4372 | packed[2] = struct.pack("!H", length) |
| 4373 | return ''.join(packed) |
| 4374 | |
| 4375 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4376 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4377 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4378 | _version = reader.read("!B")[0] |
| 4379 | assert(_version == 4) |
| 4380 | _type = reader.read("!B")[0] |
| 4381 | assert(_type == 4) |
| 4382 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4383 | orig_reader = reader |
| 4384 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4385 | obj.xid = reader.read("!L")[0] |
| 4386 | _experimenter = reader.read("!L")[0] |
| 4387 | assert(_experimenter == 6035143) |
| 4388 | _subtype = reader.read("!L")[0] |
| 4389 | assert(_subtype == 33) |
| 4390 | obj.timeout_ms = reader.read("!L")[0] |
| 4391 | obj.port_no = util.unpack_port_no(reader) |
| 4392 | obj.slot_num = reader.read("!B")[0] |
| 4393 | reader.skip(3) |
| 4394 | obj.data = str(reader.read_all()) |
| 4395 | return obj |
| 4396 | |
| 4397 | def __eq__(self, other): |
| 4398 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4399 | if self.xid != other.xid: return False |
| 4400 | if self.timeout_ms != other.timeout_ms: return False |
| 4401 | if self.port_no != other.port_no: return False |
| 4402 | if self.slot_num != other.slot_num: return False |
| 4403 | if self.data != other.data: return False |
| 4404 | return True |
| 4405 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4406 | def pretty_print(self, q): |
| 4407 | q.text("bsn_pdu_rx_request {") |
| 4408 | with q.group(): |
| 4409 | with q.indent(2): |
| 4410 | q.breakable() |
| 4411 | q.text("xid = "); |
| 4412 | if self.xid != None: |
| 4413 | q.text("%#x" % self.xid) |
| 4414 | else: |
| 4415 | q.text('None') |
| 4416 | q.text(","); q.breakable() |
| 4417 | q.text("timeout_ms = "); |
| 4418 | q.text("%#x" % self.timeout_ms) |
| 4419 | q.text(","); q.breakable() |
| 4420 | q.text("port_no = "); |
| 4421 | q.text(util.pretty_port(self.port_no)) |
| 4422 | q.text(","); q.breakable() |
| 4423 | q.text("slot_num = "); |
| 4424 | q.text("%#x" % self.slot_num) |
| 4425 | q.text(","); q.breakable() |
| 4426 | q.text("data = "); |
| 4427 | q.pp(self.data) |
| 4428 | q.breakable() |
| 4429 | q.text('}') |
| 4430 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4431 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 4432 | |
| 4433 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4434 | version = 4 |
| 4435 | type = 4 |
| 4436 | experimenter = 6035143 |
| 4437 | subtype = 35 |
| 4438 | |
| 4439 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4440 | if xid != None: |
| 4441 | self.xid = xid |
| 4442 | else: |
| 4443 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4444 | if port_no != None: |
| 4445 | self.port_no = port_no |
| 4446 | else: |
| 4447 | self.port_no = 0 |
| 4448 | if slot_num != None: |
| 4449 | self.slot_num = slot_num |
| 4450 | else: |
| 4451 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4452 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4453 | |
| 4454 | def pack(self): |
| 4455 | packed = [] |
| 4456 | packed.append(struct.pack("!B", self.version)) |
| 4457 | packed.append(struct.pack("!B", self.type)) |
| 4458 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4459 | packed.append(struct.pack("!L", self.xid)) |
| 4460 | packed.append(struct.pack("!L", self.experimenter)) |
| 4461 | packed.append(struct.pack("!L", self.subtype)) |
| 4462 | packed.append(util.pack_port_no(self.port_no)) |
| 4463 | packed.append(struct.pack("!B", self.slot_num)) |
| 4464 | length = sum([len(x) for x in packed]) |
| 4465 | packed[2] = struct.pack("!H", length) |
| 4466 | return ''.join(packed) |
| 4467 | |
| 4468 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4469 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4470 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4471 | _version = reader.read("!B")[0] |
| 4472 | assert(_version == 4) |
| 4473 | _type = reader.read("!B")[0] |
| 4474 | assert(_type == 4) |
| 4475 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4476 | orig_reader = reader |
| 4477 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4478 | obj.xid = reader.read("!L")[0] |
| 4479 | _experimenter = reader.read("!L")[0] |
| 4480 | assert(_experimenter == 6035143) |
| 4481 | _subtype = reader.read("!L")[0] |
| 4482 | assert(_subtype == 35) |
| 4483 | obj.port_no = util.unpack_port_no(reader) |
| 4484 | obj.slot_num = reader.read("!B")[0] |
| 4485 | return obj |
| 4486 | |
| 4487 | def __eq__(self, other): |
| 4488 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4489 | if self.xid != other.xid: return False |
| 4490 | if self.port_no != other.port_no: return False |
| 4491 | if self.slot_num != other.slot_num: return False |
| 4492 | return True |
| 4493 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4494 | def pretty_print(self, q): |
| 4495 | q.text("bsn_pdu_rx_timeout {") |
| 4496 | with q.group(): |
| 4497 | with q.indent(2): |
| 4498 | q.breakable() |
| 4499 | q.text("xid = "); |
| 4500 | if self.xid != None: |
| 4501 | q.text("%#x" % self.xid) |
| 4502 | else: |
| 4503 | q.text('None') |
| 4504 | q.text(","); q.breakable() |
| 4505 | q.text("port_no = "); |
| 4506 | q.text(util.pretty_port(self.port_no)) |
| 4507 | q.text(","); q.breakable() |
| 4508 | q.text("slot_num = "); |
| 4509 | q.text("%#x" % self.slot_num) |
| 4510 | q.breakable() |
| 4511 | q.text('}') |
| 4512 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4513 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 4514 | |
| 4515 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4516 | version = 4 |
| 4517 | type = 4 |
| 4518 | experimenter = 6035143 |
| 4519 | subtype = 32 |
| 4520 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4521 | 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] | 4522 | if xid != None: |
| 4523 | self.xid = xid |
| 4524 | else: |
| 4525 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4526 | if status != None: |
| 4527 | self.status = status |
| 4528 | else: |
| 4529 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4530 | if port_no != None: |
| 4531 | self.port_no = port_no |
| 4532 | else: |
| 4533 | self.port_no = 0 |
| 4534 | if slot_num != None: |
| 4535 | self.slot_num = slot_num |
| 4536 | else: |
| 4537 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4538 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4539 | |
| 4540 | def pack(self): |
| 4541 | packed = [] |
| 4542 | packed.append(struct.pack("!B", self.version)) |
| 4543 | packed.append(struct.pack("!B", self.type)) |
| 4544 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4545 | packed.append(struct.pack("!L", self.xid)) |
| 4546 | packed.append(struct.pack("!L", self.experimenter)) |
| 4547 | packed.append(struct.pack("!L", self.subtype)) |
| 4548 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4549 | packed.append(util.pack_port_no(self.port_no)) |
| 4550 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4551 | length = sum([len(x) for x in packed]) |
| 4552 | packed[2] = struct.pack("!H", length) |
| 4553 | return ''.join(packed) |
| 4554 | |
| 4555 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4556 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4557 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4558 | _version = reader.read("!B")[0] |
| 4559 | assert(_version == 4) |
| 4560 | _type = reader.read("!B")[0] |
| 4561 | assert(_type == 4) |
| 4562 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4563 | orig_reader = reader |
| 4564 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4565 | obj.xid = reader.read("!L")[0] |
| 4566 | _experimenter = reader.read("!L")[0] |
| 4567 | assert(_experimenter == 6035143) |
| 4568 | _subtype = reader.read("!L")[0] |
| 4569 | assert(_subtype == 32) |
| 4570 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4571 | obj.port_no = util.unpack_port_no(reader) |
| 4572 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4573 | return obj |
| 4574 | |
| 4575 | def __eq__(self, other): |
| 4576 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4577 | if self.xid != other.xid: return False |
| 4578 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4579 | if self.port_no != other.port_no: return False |
| 4580 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4581 | return True |
| 4582 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4583 | def pretty_print(self, q): |
| 4584 | q.text("bsn_pdu_tx_reply {") |
| 4585 | with q.group(): |
| 4586 | with q.indent(2): |
| 4587 | q.breakable() |
| 4588 | q.text("xid = "); |
| 4589 | if self.xid != None: |
| 4590 | q.text("%#x" % self.xid) |
| 4591 | else: |
| 4592 | q.text('None') |
| 4593 | q.text(","); q.breakable() |
| 4594 | q.text("status = "); |
| 4595 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4596 | q.text(","); q.breakable() |
| 4597 | q.text("port_no = "); |
| 4598 | q.text(util.pretty_port(self.port_no)) |
| 4599 | q.text(","); q.breakable() |
| 4600 | q.text("slot_num = "); |
| 4601 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4602 | q.breakable() |
| 4603 | q.text('}') |
| 4604 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4605 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 4606 | |
| 4607 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4608 | version = 4 |
| 4609 | type = 4 |
| 4610 | experimenter = 6035143 |
| 4611 | subtype = 31 |
| 4612 | |
| 4613 | 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] | 4614 | if xid != None: |
| 4615 | self.xid = xid |
| 4616 | else: |
| 4617 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4618 | if tx_interval_ms != None: |
| 4619 | self.tx_interval_ms = tx_interval_ms |
| 4620 | else: |
| 4621 | self.tx_interval_ms = 0 |
| 4622 | if port_no != None: |
| 4623 | self.port_no = port_no |
| 4624 | else: |
| 4625 | self.port_no = 0 |
| 4626 | if slot_num != None: |
| 4627 | self.slot_num = slot_num |
| 4628 | else: |
| 4629 | self.slot_num = 0 |
| 4630 | if data != None: |
| 4631 | self.data = data |
| 4632 | else: |
| 4633 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4634 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4635 | |
| 4636 | def pack(self): |
| 4637 | packed = [] |
| 4638 | packed.append(struct.pack("!B", self.version)) |
| 4639 | packed.append(struct.pack("!B", self.type)) |
| 4640 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4641 | packed.append(struct.pack("!L", self.xid)) |
| 4642 | packed.append(struct.pack("!L", self.experimenter)) |
| 4643 | packed.append(struct.pack("!L", self.subtype)) |
| 4644 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 4645 | packed.append(util.pack_port_no(self.port_no)) |
| 4646 | packed.append(struct.pack("!B", self.slot_num)) |
| 4647 | packed.append('\x00' * 3) |
| 4648 | packed.append(self.data) |
| 4649 | length = sum([len(x) for x in packed]) |
| 4650 | packed[2] = struct.pack("!H", length) |
| 4651 | return ''.join(packed) |
| 4652 | |
| 4653 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4654 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4655 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4656 | _version = reader.read("!B")[0] |
| 4657 | assert(_version == 4) |
| 4658 | _type = reader.read("!B")[0] |
| 4659 | assert(_type == 4) |
| 4660 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4661 | orig_reader = reader |
| 4662 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4663 | obj.xid = reader.read("!L")[0] |
| 4664 | _experimenter = reader.read("!L")[0] |
| 4665 | assert(_experimenter == 6035143) |
| 4666 | _subtype = reader.read("!L")[0] |
| 4667 | assert(_subtype == 31) |
| 4668 | obj.tx_interval_ms = reader.read("!L")[0] |
| 4669 | obj.port_no = util.unpack_port_no(reader) |
| 4670 | obj.slot_num = reader.read("!B")[0] |
| 4671 | reader.skip(3) |
| 4672 | obj.data = str(reader.read_all()) |
| 4673 | return obj |
| 4674 | |
| 4675 | def __eq__(self, other): |
| 4676 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4677 | if self.xid != other.xid: return False |
| 4678 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 4679 | if self.port_no != other.port_no: return False |
| 4680 | if self.slot_num != other.slot_num: return False |
| 4681 | if self.data != other.data: return False |
| 4682 | return True |
| 4683 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4684 | def pretty_print(self, q): |
| 4685 | q.text("bsn_pdu_tx_request {") |
| 4686 | with q.group(): |
| 4687 | with q.indent(2): |
| 4688 | q.breakable() |
| 4689 | q.text("xid = "); |
| 4690 | if self.xid != None: |
| 4691 | q.text("%#x" % self.xid) |
| 4692 | else: |
| 4693 | q.text('None') |
| 4694 | q.text(","); q.breakable() |
| 4695 | q.text("tx_interval_ms = "); |
| 4696 | q.text("%#x" % self.tx_interval_ms) |
| 4697 | q.text(","); q.breakable() |
| 4698 | q.text("port_no = "); |
| 4699 | q.text(util.pretty_port(self.port_no)) |
| 4700 | q.text(","); q.breakable() |
| 4701 | q.text("slot_num = "); |
| 4702 | q.text("%#x" % self.slot_num) |
| 4703 | q.text(","); q.breakable() |
| 4704 | q.text("data = "); |
| 4705 | q.pp(self.data) |
| 4706 | q.breakable() |
| 4707 | q.text('}') |
| 4708 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4709 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 4710 | |
| 4711 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 4712 | version = 4 |
| 4713 | type = 19 |
| 4714 | stats_type = 65535 |
| 4715 | experimenter = 6035143 |
| 4716 | subtype = 8 |
| 4717 | |
| 4718 | def __init__(self, xid=None, flags=None, entries=None): |
| 4719 | if xid != None: |
| 4720 | self.xid = xid |
| 4721 | else: |
| 4722 | self.xid = None |
| 4723 | if flags != None: |
| 4724 | self.flags = flags |
| 4725 | else: |
| 4726 | self.flags = 0 |
| 4727 | if entries != None: |
| 4728 | self.entries = entries |
| 4729 | else: |
| 4730 | self.entries = [] |
| 4731 | return |
| 4732 | |
| 4733 | def pack(self): |
| 4734 | packed = [] |
| 4735 | packed.append(struct.pack("!B", self.version)) |
| 4736 | packed.append(struct.pack("!B", self.type)) |
| 4737 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4738 | packed.append(struct.pack("!L", self.xid)) |
| 4739 | packed.append(struct.pack("!H", self.stats_type)) |
| 4740 | packed.append(struct.pack("!H", self.flags)) |
| 4741 | packed.append('\x00' * 4) |
| 4742 | packed.append(struct.pack("!L", self.experimenter)) |
| 4743 | packed.append(struct.pack("!L", self.subtype)) |
| 4744 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4745 | length = sum([len(x) for x in packed]) |
| 4746 | packed[2] = struct.pack("!H", length) |
| 4747 | return ''.join(packed) |
| 4748 | |
| 4749 | @staticmethod |
| 4750 | def unpack(reader): |
| 4751 | obj = bsn_port_counter_stats_reply() |
| 4752 | _version = reader.read("!B")[0] |
| 4753 | assert(_version == 4) |
| 4754 | _type = reader.read("!B")[0] |
| 4755 | assert(_type == 19) |
| 4756 | _length = reader.read("!H")[0] |
| 4757 | orig_reader = reader |
| 4758 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4759 | obj.xid = reader.read("!L")[0] |
| 4760 | _stats_type = reader.read("!H")[0] |
| 4761 | assert(_stats_type == 65535) |
| 4762 | obj.flags = reader.read("!H")[0] |
| 4763 | reader.skip(4) |
| 4764 | _experimenter = reader.read("!L")[0] |
| 4765 | assert(_experimenter == 6035143) |
| 4766 | _subtype = reader.read("!L")[0] |
| 4767 | assert(_subtype == 8) |
| 4768 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack) |
| 4769 | return obj |
| 4770 | |
| 4771 | def __eq__(self, other): |
| 4772 | if type(self) != type(other): return False |
| 4773 | if self.xid != other.xid: return False |
| 4774 | if self.flags != other.flags: return False |
| 4775 | if self.entries != other.entries: return False |
| 4776 | return True |
| 4777 | |
| 4778 | def pretty_print(self, q): |
| 4779 | q.text("bsn_port_counter_stats_reply {") |
| 4780 | with q.group(): |
| 4781 | with q.indent(2): |
| 4782 | q.breakable() |
| 4783 | q.text("xid = "); |
| 4784 | if self.xid != None: |
| 4785 | q.text("%#x" % self.xid) |
| 4786 | else: |
| 4787 | q.text('None') |
| 4788 | q.text(","); q.breakable() |
| 4789 | q.text("flags = "); |
| 4790 | q.text("%#x" % self.flags) |
| 4791 | q.text(","); q.breakable() |
| 4792 | q.text("entries = "); |
| 4793 | q.pp(self.entries) |
| 4794 | q.breakable() |
| 4795 | q.text('}') |
| 4796 | |
| 4797 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 4798 | |
| 4799 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 4800 | version = 4 |
| 4801 | type = 18 |
| 4802 | stats_type = 65535 |
| 4803 | experimenter = 6035143 |
| 4804 | subtype = 8 |
| 4805 | |
| 4806 | def __init__(self, xid=None, flags=None, port_no=None): |
| 4807 | if xid != None: |
| 4808 | self.xid = xid |
| 4809 | else: |
| 4810 | self.xid = None |
| 4811 | if flags != None: |
| 4812 | self.flags = flags |
| 4813 | else: |
| 4814 | self.flags = 0 |
| 4815 | if port_no != None: |
| 4816 | self.port_no = port_no |
| 4817 | else: |
| 4818 | self.port_no = 0 |
| 4819 | return |
| 4820 | |
| 4821 | def pack(self): |
| 4822 | packed = [] |
| 4823 | packed.append(struct.pack("!B", self.version)) |
| 4824 | packed.append(struct.pack("!B", self.type)) |
| 4825 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4826 | packed.append(struct.pack("!L", self.xid)) |
| 4827 | packed.append(struct.pack("!H", self.stats_type)) |
| 4828 | packed.append(struct.pack("!H", self.flags)) |
| 4829 | packed.append('\x00' * 4) |
| 4830 | packed.append(struct.pack("!L", self.experimenter)) |
| 4831 | packed.append(struct.pack("!L", self.subtype)) |
| 4832 | packed.append(util.pack_port_no(self.port_no)) |
| 4833 | length = sum([len(x) for x in packed]) |
| 4834 | packed[2] = struct.pack("!H", length) |
| 4835 | return ''.join(packed) |
| 4836 | |
| 4837 | @staticmethod |
| 4838 | def unpack(reader): |
| 4839 | obj = bsn_port_counter_stats_request() |
| 4840 | _version = reader.read("!B")[0] |
| 4841 | assert(_version == 4) |
| 4842 | _type = reader.read("!B")[0] |
| 4843 | assert(_type == 18) |
| 4844 | _length = reader.read("!H")[0] |
| 4845 | orig_reader = reader |
| 4846 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4847 | obj.xid = reader.read("!L")[0] |
| 4848 | _stats_type = reader.read("!H")[0] |
| 4849 | assert(_stats_type == 65535) |
| 4850 | obj.flags = reader.read("!H")[0] |
| 4851 | reader.skip(4) |
| 4852 | _experimenter = reader.read("!L")[0] |
| 4853 | assert(_experimenter == 6035143) |
| 4854 | _subtype = reader.read("!L")[0] |
| 4855 | assert(_subtype == 8) |
| 4856 | obj.port_no = util.unpack_port_no(reader) |
| 4857 | return obj |
| 4858 | |
| 4859 | def __eq__(self, other): |
| 4860 | if type(self) != type(other): return False |
| 4861 | if self.xid != other.xid: return False |
| 4862 | if self.flags != other.flags: return False |
| 4863 | if self.port_no != other.port_no: return False |
| 4864 | return True |
| 4865 | |
| 4866 | def pretty_print(self, q): |
| 4867 | q.text("bsn_port_counter_stats_request {") |
| 4868 | with q.group(): |
| 4869 | with q.indent(2): |
| 4870 | q.breakable() |
| 4871 | q.text("xid = "); |
| 4872 | if self.xid != None: |
| 4873 | q.text("%#x" % self.xid) |
| 4874 | else: |
| 4875 | q.text('None') |
| 4876 | q.text(","); q.breakable() |
| 4877 | q.text("flags = "); |
| 4878 | q.text("%#x" % self.flags) |
| 4879 | q.text(","); q.breakable() |
| 4880 | q.text("port_no = "); |
| 4881 | q.text(util.pretty_port(self.port_no)) |
| 4882 | q.breakable() |
| 4883 | q.text('}') |
| 4884 | |
| 4885 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 4886 | |
Rich Lane | 1a82041 | 2014-01-06 14:15:07 -0800 | [diff] [blame^] | 4887 | class bsn_role_status(bsn_header): |
| 4888 | version = 4 |
| 4889 | type = 4 |
| 4890 | experimenter = 6035143 |
| 4891 | subtype = 55 |
| 4892 | |
| 4893 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 4894 | if xid != None: |
| 4895 | self.xid = xid |
| 4896 | else: |
| 4897 | self.xid = None |
| 4898 | if role != None: |
| 4899 | self.role = role |
| 4900 | else: |
| 4901 | self.role = 0 |
| 4902 | if reason != None: |
| 4903 | self.reason = reason |
| 4904 | else: |
| 4905 | self.reason = 0 |
| 4906 | if generation_id != None: |
| 4907 | self.generation_id = generation_id |
| 4908 | else: |
| 4909 | self.generation_id = 0 |
| 4910 | return |
| 4911 | |
| 4912 | def pack(self): |
| 4913 | packed = [] |
| 4914 | packed.append(struct.pack("!B", self.version)) |
| 4915 | packed.append(struct.pack("!B", self.type)) |
| 4916 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4917 | packed.append(struct.pack("!L", self.xid)) |
| 4918 | packed.append(struct.pack("!L", self.experimenter)) |
| 4919 | packed.append(struct.pack("!L", self.subtype)) |
| 4920 | packed.append(struct.pack("!L", self.role)) |
| 4921 | packed.append(struct.pack("!B", self.reason)) |
| 4922 | packed.append('\x00' * 3) |
| 4923 | packed.append(struct.pack("!Q", self.generation_id)) |
| 4924 | length = sum([len(x) for x in packed]) |
| 4925 | packed[2] = struct.pack("!H", length) |
| 4926 | return ''.join(packed) |
| 4927 | |
| 4928 | @staticmethod |
| 4929 | def unpack(reader): |
| 4930 | obj = bsn_role_status() |
| 4931 | _version = reader.read("!B")[0] |
| 4932 | assert(_version == 4) |
| 4933 | _type = reader.read("!B")[0] |
| 4934 | assert(_type == 4) |
| 4935 | _length = reader.read("!H")[0] |
| 4936 | orig_reader = reader |
| 4937 | reader = orig_reader.slice(_length - (2 + 2)) |
| 4938 | obj.xid = reader.read("!L")[0] |
| 4939 | _experimenter = reader.read("!L")[0] |
| 4940 | assert(_experimenter == 6035143) |
| 4941 | _subtype = reader.read("!L")[0] |
| 4942 | assert(_subtype == 55) |
| 4943 | obj.role = reader.read("!L")[0] |
| 4944 | obj.reason = reader.read("!B")[0] |
| 4945 | reader.skip(3) |
| 4946 | obj.generation_id = reader.read("!Q")[0] |
| 4947 | return obj |
| 4948 | |
| 4949 | def __eq__(self, other): |
| 4950 | if type(self) != type(other): return False |
| 4951 | if self.xid != other.xid: return False |
| 4952 | if self.role != other.role: return False |
| 4953 | if self.reason != other.reason: return False |
| 4954 | if self.generation_id != other.generation_id: return False |
| 4955 | return True |
| 4956 | |
| 4957 | def pretty_print(self, q): |
| 4958 | q.text("bsn_role_status {") |
| 4959 | with q.group(): |
| 4960 | with q.indent(2): |
| 4961 | q.breakable() |
| 4962 | q.text("xid = "); |
| 4963 | if self.xid != None: |
| 4964 | q.text("%#x" % self.xid) |
| 4965 | else: |
| 4966 | q.text('None') |
| 4967 | q.text(","); q.breakable() |
| 4968 | q.text("role = "); |
| 4969 | q.text("%#x" % self.role) |
| 4970 | q.text(","); q.breakable() |
| 4971 | q.text("reason = "); |
| 4972 | q.text("%#x" % self.reason) |
| 4973 | q.text(","); q.breakable() |
| 4974 | q.text("generation_id = "); |
| 4975 | q.text("%#x" % self.generation_id) |
| 4976 | q.breakable() |
| 4977 | q.text('}') |
| 4978 | |
| 4979 | bsn_header.subtypes[55] = bsn_role_status |
| 4980 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4981 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4982 | version = 4 |
| 4983 | type = 4 |
| 4984 | experimenter = 6035143 |
| 4985 | subtype = 42 |
| 4986 | |
| 4987 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4988 | if xid != None: |
| 4989 | self.xid = xid |
| 4990 | else: |
| 4991 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 4992 | if status != None: |
| 4993 | self.status = status |
| 4994 | else: |
| 4995 | self.status = 0 |
| 4996 | if port_no != None: |
| 4997 | self.port_no = port_no |
| 4998 | else: |
| 4999 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5000 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5001 | |
| 5002 | def pack(self): |
| 5003 | packed = [] |
| 5004 | packed.append(struct.pack("!B", self.version)) |
| 5005 | packed.append(struct.pack("!B", self.type)) |
| 5006 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5007 | packed.append(struct.pack("!L", self.xid)) |
| 5008 | packed.append(struct.pack("!L", self.experimenter)) |
| 5009 | packed.append(struct.pack("!L", self.subtype)) |
| 5010 | packed.append(struct.pack("!L", self.status)) |
| 5011 | packed.append(util.pack_port_no(self.port_no)) |
| 5012 | length = sum([len(x) for x in packed]) |
| 5013 | packed[2] = struct.pack("!H", length) |
| 5014 | return ''.join(packed) |
| 5015 | |
| 5016 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5017 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5018 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5019 | _version = reader.read("!B")[0] |
| 5020 | assert(_version == 4) |
| 5021 | _type = reader.read("!B")[0] |
| 5022 | assert(_type == 4) |
| 5023 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5024 | orig_reader = reader |
| 5025 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5026 | obj.xid = reader.read("!L")[0] |
| 5027 | _experimenter = reader.read("!L")[0] |
| 5028 | assert(_experimenter == 6035143) |
| 5029 | _subtype = reader.read("!L")[0] |
| 5030 | assert(_subtype == 42) |
| 5031 | obj.status = reader.read("!L")[0] |
| 5032 | obj.port_no = util.unpack_port_no(reader) |
| 5033 | return obj |
| 5034 | |
| 5035 | def __eq__(self, other): |
| 5036 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5037 | if self.xid != other.xid: return False |
| 5038 | if self.status != other.status: return False |
| 5039 | if self.port_no != other.port_no: return False |
| 5040 | return True |
| 5041 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5042 | def pretty_print(self, q): |
| 5043 | q.text("bsn_set_lacp_reply {") |
| 5044 | with q.group(): |
| 5045 | with q.indent(2): |
| 5046 | q.breakable() |
| 5047 | q.text("xid = "); |
| 5048 | if self.xid != None: |
| 5049 | q.text("%#x" % self.xid) |
| 5050 | else: |
| 5051 | q.text('None') |
| 5052 | q.text(","); q.breakable() |
| 5053 | q.text("status = "); |
| 5054 | q.text("%#x" % self.status) |
| 5055 | q.text(","); q.breakable() |
| 5056 | q.text("port_no = "); |
| 5057 | q.text(util.pretty_port(self.port_no)) |
| 5058 | q.breakable() |
| 5059 | q.text('}') |
| 5060 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5061 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 5062 | |
| 5063 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5064 | version = 4 |
| 5065 | type = 4 |
| 5066 | experimenter = 6035143 |
| 5067 | subtype = 41 |
| 5068 | |
| 5069 | def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5070 | if xid != None: |
| 5071 | self.xid = xid |
| 5072 | else: |
| 5073 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5074 | if enabled != None: |
| 5075 | self.enabled = enabled |
| 5076 | else: |
| 5077 | self.enabled = 0 |
| 5078 | if port_no != None: |
| 5079 | self.port_no = port_no |
| 5080 | else: |
| 5081 | self.port_no = 0 |
| 5082 | if actor_sys_priority != None: |
| 5083 | self.actor_sys_priority = actor_sys_priority |
| 5084 | else: |
| 5085 | self.actor_sys_priority = 0 |
| 5086 | if actor_sys_mac != None: |
| 5087 | self.actor_sys_mac = actor_sys_mac |
| 5088 | else: |
| 5089 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5090 | if actor_port_priority != None: |
| 5091 | self.actor_port_priority = actor_port_priority |
| 5092 | else: |
| 5093 | self.actor_port_priority = 0 |
| 5094 | if actor_port_num != None: |
| 5095 | self.actor_port_num = actor_port_num |
| 5096 | else: |
| 5097 | self.actor_port_num = 0 |
| 5098 | if actor_key != None: |
| 5099 | self.actor_key = actor_key |
| 5100 | else: |
| 5101 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5102 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5103 | |
| 5104 | def pack(self): |
| 5105 | packed = [] |
| 5106 | packed.append(struct.pack("!B", self.version)) |
| 5107 | packed.append(struct.pack("!B", self.type)) |
| 5108 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5109 | packed.append(struct.pack("!L", self.xid)) |
| 5110 | packed.append(struct.pack("!L", self.experimenter)) |
| 5111 | packed.append(struct.pack("!L", self.subtype)) |
| 5112 | packed.append(struct.pack("!B", self.enabled)) |
| 5113 | packed.append('\x00' * 3) |
| 5114 | packed.append(util.pack_port_no(self.port_no)) |
| 5115 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5116 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5117 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5118 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5119 | packed.append(struct.pack("!H", self.actor_key)) |
| 5120 | length = sum([len(x) for x in packed]) |
| 5121 | packed[2] = struct.pack("!H", length) |
| 5122 | return ''.join(packed) |
| 5123 | |
| 5124 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5125 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5126 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5127 | _version = reader.read("!B")[0] |
| 5128 | assert(_version == 4) |
| 5129 | _type = reader.read("!B")[0] |
| 5130 | assert(_type == 4) |
| 5131 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5132 | orig_reader = reader |
| 5133 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5134 | obj.xid = reader.read("!L")[0] |
| 5135 | _experimenter = reader.read("!L")[0] |
| 5136 | assert(_experimenter == 6035143) |
| 5137 | _subtype = reader.read("!L")[0] |
| 5138 | assert(_subtype == 41) |
| 5139 | obj.enabled = reader.read("!B")[0] |
| 5140 | reader.skip(3) |
| 5141 | obj.port_no = util.unpack_port_no(reader) |
| 5142 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5143 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5144 | obj.actor_port_priority = reader.read("!H")[0] |
| 5145 | obj.actor_port_num = reader.read("!H")[0] |
| 5146 | obj.actor_key = reader.read("!H")[0] |
| 5147 | return obj |
| 5148 | |
| 5149 | def __eq__(self, other): |
| 5150 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5151 | if self.xid != other.xid: return False |
| 5152 | if self.enabled != other.enabled: return False |
| 5153 | if self.port_no != other.port_no: return False |
| 5154 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5155 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5156 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5157 | if self.actor_port_num != other.actor_port_num: return False |
| 5158 | if self.actor_key != other.actor_key: return False |
| 5159 | return True |
| 5160 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5161 | def pretty_print(self, q): |
| 5162 | q.text("bsn_set_lacp_request {") |
| 5163 | with q.group(): |
| 5164 | with q.indent(2): |
| 5165 | q.breakable() |
| 5166 | q.text("xid = "); |
| 5167 | if self.xid != None: |
| 5168 | q.text("%#x" % self.xid) |
| 5169 | else: |
| 5170 | q.text('None') |
| 5171 | q.text(","); q.breakable() |
| 5172 | q.text("enabled = "); |
| 5173 | q.text("%#x" % self.enabled) |
| 5174 | q.text(","); q.breakable() |
| 5175 | q.text("port_no = "); |
| 5176 | q.text(util.pretty_port(self.port_no)) |
| 5177 | q.text(","); q.breakable() |
| 5178 | q.text("actor_sys_priority = "); |
| 5179 | q.text("%#x" % self.actor_sys_priority) |
| 5180 | q.text(","); q.breakable() |
| 5181 | q.text("actor_sys_mac = "); |
| 5182 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5183 | q.text(","); q.breakable() |
| 5184 | q.text("actor_port_priority = "); |
| 5185 | q.text("%#x" % self.actor_port_priority) |
| 5186 | q.text(","); q.breakable() |
| 5187 | q.text("actor_port_num = "); |
| 5188 | q.text("%#x" % self.actor_port_num) |
| 5189 | q.text(","); q.breakable() |
| 5190 | q.text("actor_key = "); |
| 5191 | q.text("%#x" % self.actor_key) |
| 5192 | q.breakable() |
| 5193 | q.text('}') |
| 5194 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5195 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 5196 | |
| 5197 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5198 | version = 4 |
| 5199 | type = 4 |
| 5200 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5201 | subtype = 3 |
| 5202 | |
| 5203 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5204 | if xid != None: |
| 5205 | self.xid = xid |
| 5206 | else: |
| 5207 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5208 | if report_mirror_ports != None: |
| 5209 | self.report_mirror_ports = report_mirror_ports |
| 5210 | else: |
| 5211 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5212 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5213 | |
| 5214 | def pack(self): |
| 5215 | packed = [] |
| 5216 | packed.append(struct.pack("!B", self.version)) |
| 5217 | packed.append(struct.pack("!B", self.type)) |
| 5218 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5219 | packed.append(struct.pack("!L", self.xid)) |
| 5220 | packed.append(struct.pack("!L", self.experimenter)) |
| 5221 | packed.append(struct.pack("!L", self.subtype)) |
| 5222 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5223 | packed.append('\x00' * 3) |
| 5224 | length = sum([len(x) for x in packed]) |
| 5225 | packed[2] = struct.pack("!H", length) |
| 5226 | return ''.join(packed) |
| 5227 | |
| 5228 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5229 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5230 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5231 | _version = reader.read("!B")[0] |
| 5232 | assert(_version == 4) |
| 5233 | _type = reader.read("!B")[0] |
| 5234 | assert(_type == 4) |
| 5235 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5236 | orig_reader = reader |
| 5237 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5238 | obj.xid = reader.read("!L")[0] |
| 5239 | _experimenter = reader.read("!L")[0] |
| 5240 | assert(_experimenter == 6035143) |
| 5241 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5242 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5243 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5244 | reader.skip(3) |
| 5245 | return obj |
| 5246 | |
| 5247 | def __eq__(self, other): |
| 5248 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5249 | if self.xid != other.xid: return False |
| 5250 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5251 | return True |
| 5252 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5253 | def pretty_print(self, q): |
| 5254 | q.text("bsn_set_mirroring {") |
| 5255 | with q.group(): |
| 5256 | with q.indent(2): |
| 5257 | q.breakable() |
| 5258 | q.text("xid = "); |
| 5259 | if self.xid != None: |
| 5260 | q.text("%#x" % self.xid) |
| 5261 | else: |
| 5262 | q.text('None') |
| 5263 | q.text(","); q.breakable() |
| 5264 | q.text("report_mirror_ports = "); |
| 5265 | q.text("%#x" % self.report_mirror_ports) |
| 5266 | q.breakable() |
| 5267 | q.text('}') |
| 5268 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5269 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 5270 | |
| 5271 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5272 | version = 4 |
| 5273 | type = 4 |
| 5274 | experimenter = 6035143 |
| 5275 | subtype = 25 |
| 5276 | |
| 5277 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5278 | if xid != None: |
| 5279 | self.xid = xid |
| 5280 | else: |
| 5281 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5282 | if status != None: |
| 5283 | self.status = status |
| 5284 | else: |
| 5285 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5286 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5287 | |
| 5288 | def pack(self): |
| 5289 | packed = [] |
| 5290 | packed.append(struct.pack("!B", self.version)) |
| 5291 | packed.append(struct.pack("!B", self.type)) |
| 5292 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5293 | packed.append(struct.pack("!L", self.xid)) |
| 5294 | packed.append(struct.pack("!L", self.experimenter)) |
| 5295 | packed.append(struct.pack("!L", self.subtype)) |
| 5296 | packed.append(struct.pack("!L", self.status)) |
| 5297 | length = sum([len(x) for x in packed]) |
| 5298 | packed[2] = struct.pack("!H", length) |
| 5299 | return ''.join(packed) |
| 5300 | |
| 5301 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5302 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5303 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5304 | _version = reader.read("!B")[0] |
| 5305 | assert(_version == 4) |
| 5306 | _type = reader.read("!B")[0] |
| 5307 | assert(_type == 4) |
| 5308 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5309 | orig_reader = reader |
| 5310 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5311 | obj.xid = reader.read("!L")[0] |
| 5312 | _experimenter = reader.read("!L")[0] |
| 5313 | assert(_experimenter == 6035143) |
| 5314 | _subtype = reader.read("!L")[0] |
| 5315 | assert(_subtype == 25) |
| 5316 | obj.status = reader.read("!L")[0] |
| 5317 | return obj |
| 5318 | |
| 5319 | def __eq__(self, other): |
| 5320 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5321 | if self.xid != other.xid: return False |
| 5322 | if self.status != other.status: return False |
| 5323 | return True |
| 5324 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5325 | def pretty_print(self, q): |
| 5326 | q.text("bsn_set_pktin_suppression_reply {") |
| 5327 | with q.group(): |
| 5328 | with q.indent(2): |
| 5329 | q.breakable() |
| 5330 | q.text("xid = "); |
| 5331 | if self.xid != None: |
| 5332 | q.text("%#x" % self.xid) |
| 5333 | else: |
| 5334 | q.text('None') |
| 5335 | q.text(","); q.breakable() |
| 5336 | q.text("status = "); |
| 5337 | q.text("%#x" % self.status) |
| 5338 | q.breakable() |
| 5339 | q.text('}') |
| 5340 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5341 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 5342 | |
| 5343 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5344 | version = 4 |
| 5345 | type = 4 |
| 5346 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5347 | subtype = 11 |
| 5348 | |
| 5349 | 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] | 5350 | if xid != None: |
| 5351 | self.xid = xid |
| 5352 | else: |
| 5353 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5354 | if enabled != None: |
| 5355 | self.enabled = enabled |
| 5356 | else: |
| 5357 | self.enabled = 0 |
| 5358 | if idle_timeout != None: |
| 5359 | self.idle_timeout = idle_timeout |
| 5360 | else: |
| 5361 | self.idle_timeout = 0 |
| 5362 | if hard_timeout != None: |
| 5363 | self.hard_timeout = hard_timeout |
| 5364 | else: |
| 5365 | self.hard_timeout = 0 |
| 5366 | if priority != None: |
| 5367 | self.priority = priority |
| 5368 | else: |
| 5369 | self.priority = 0 |
| 5370 | if cookie != None: |
| 5371 | self.cookie = cookie |
| 5372 | else: |
| 5373 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5374 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5375 | |
| 5376 | def pack(self): |
| 5377 | packed = [] |
| 5378 | packed.append(struct.pack("!B", self.version)) |
| 5379 | packed.append(struct.pack("!B", self.type)) |
| 5380 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5381 | packed.append(struct.pack("!L", self.xid)) |
| 5382 | packed.append(struct.pack("!L", self.experimenter)) |
| 5383 | packed.append(struct.pack("!L", self.subtype)) |
| 5384 | packed.append(struct.pack("!B", self.enabled)) |
| 5385 | packed.append('\x00' * 1) |
| 5386 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5387 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5388 | packed.append(struct.pack("!H", self.priority)) |
| 5389 | packed.append(struct.pack("!Q", self.cookie)) |
| 5390 | length = sum([len(x) for x in packed]) |
| 5391 | packed[2] = struct.pack("!H", length) |
| 5392 | return ''.join(packed) |
| 5393 | |
| 5394 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5395 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5396 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5397 | _version = reader.read("!B")[0] |
| 5398 | assert(_version == 4) |
| 5399 | _type = reader.read("!B")[0] |
| 5400 | assert(_type == 4) |
| 5401 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5402 | orig_reader = reader |
| 5403 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5404 | obj.xid = reader.read("!L")[0] |
| 5405 | _experimenter = reader.read("!L")[0] |
| 5406 | assert(_experimenter == 6035143) |
| 5407 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5408 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5409 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5410 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5411 | obj.idle_timeout = reader.read("!H")[0] |
| 5412 | obj.hard_timeout = reader.read("!H")[0] |
| 5413 | obj.priority = reader.read("!H")[0] |
| 5414 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5415 | return obj |
| 5416 | |
| 5417 | def __eq__(self, other): |
| 5418 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5419 | if self.xid != other.xid: return False |
| 5420 | if self.enabled != other.enabled: return False |
| 5421 | if self.idle_timeout != other.idle_timeout: return False |
| 5422 | if self.hard_timeout != other.hard_timeout: return False |
| 5423 | if self.priority != other.priority: return False |
| 5424 | if self.cookie != other.cookie: return False |
| 5425 | return True |
| 5426 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5427 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5428 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5429 | with q.group(): |
| 5430 | with q.indent(2): |
| 5431 | q.breakable() |
| 5432 | q.text("xid = "); |
| 5433 | if self.xid != None: |
| 5434 | q.text("%#x" % self.xid) |
| 5435 | else: |
| 5436 | q.text('None') |
| 5437 | q.text(","); q.breakable() |
| 5438 | q.text("enabled = "); |
| 5439 | q.text("%#x" % self.enabled) |
| 5440 | q.text(","); q.breakable() |
| 5441 | q.text("idle_timeout = "); |
| 5442 | q.text("%#x" % self.idle_timeout) |
| 5443 | q.text(","); q.breakable() |
| 5444 | q.text("hard_timeout = "); |
| 5445 | q.text("%#x" % self.hard_timeout) |
| 5446 | q.text(","); q.breakable() |
| 5447 | q.text("priority = "); |
| 5448 | q.text("%#x" % self.priority) |
| 5449 | q.text(","); q.breakable() |
| 5450 | q.text("cookie = "); |
| 5451 | q.text("%#x" % self.cookie) |
| 5452 | q.breakable() |
| 5453 | q.text('}') |
| 5454 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5455 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 5456 | |
| 5457 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 5458 | version = 4 |
| 5459 | type = 4 |
| 5460 | experimenter = 6035143 |
| 5461 | subtype = 54 |
| 5462 | |
| 5463 | def __init__(self, xid=None, status=None): |
| 5464 | if xid != None: |
| 5465 | self.xid = xid |
| 5466 | else: |
| 5467 | self.xid = None |
| 5468 | if status != None: |
| 5469 | self.status = status |
| 5470 | else: |
| 5471 | self.status = 0 |
| 5472 | return |
| 5473 | |
| 5474 | def pack(self): |
| 5475 | packed = [] |
| 5476 | packed.append(struct.pack("!B", self.version)) |
| 5477 | packed.append(struct.pack("!B", self.type)) |
| 5478 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5479 | packed.append(struct.pack("!L", self.xid)) |
| 5480 | packed.append(struct.pack("!L", self.experimenter)) |
| 5481 | packed.append(struct.pack("!L", self.subtype)) |
| 5482 | packed.append(struct.pack("!L", self.status)) |
| 5483 | length = sum([len(x) for x in packed]) |
| 5484 | packed[2] = struct.pack("!H", length) |
| 5485 | return ''.join(packed) |
| 5486 | |
| 5487 | @staticmethod |
| 5488 | def unpack(reader): |
| 5489 | obj = bsn_set_switch_pipeline_reply() |
| 5490 | _version = reader.read("!B")[0] |
| 5491 | assert(_version == 4) |
| 5492 | _type = reader.read("!B")[0] |
| 5493 | assert(_type == 4) |
| 5494 | _length = reader.read("!H")[0] |
| 5495 | orig_reader = reader |
| 5496 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5497 | obj.xid = reader.read("!L")[0] |
| 5498 | _experimenter = reader.read("!L")[0] |
| 5499 | assert(_experimenter == 6035143) |
| 5500 | _subtype = reader.read("!L")[0] |
| 5501 | assert(_subtype == 54) |
| 5502 | obj.status = reader.read("!L")[0] |
| 5503 | return obj |
| 5504 | |
| 5505 | def __eq__(self, other): |
| 5506 | if type(self) != type(other): return False |
| 5507 | if self.xid != other.xid: return False |
| 5508 | if self.status != other.status: return False |
| 5509 | return True |
| 5510 | |
| 5511 | def pretty_print(self, q): |
| 5512 | q.text("bsn_set_switch_pipeline_reply {") |
| 5513 | with q.group(): |
| 5514 | with q.indent(2): |
| 5515 | q.breakable() |
| 5516 | q.text("xid = "); |
| 5517 | if self.xid != None: |
| 5518 | q.text("%#x" % self.xid) |
| 5519 | else: |
| 5520 | q.text('None') |
| 5521 | q.text(","); q.breakable() |
| 5522 | q.text("status = "); |
| 5523 | q.text("%#x" % self.status) |
| 5524 | q.breakable() |
| 5525 | q.text('}') |
| 5526 | |
| 5527 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 5528 | |
| 5529 | class bsn_set_switch_pipeline_request(bsn_header): |
| 5530 | version = 4 |
| 5531 | type = 4 |
| 5532 | experimenter = 6035143 |
| 5533 | subtype = 53 |
| 5534 | |
| 5535 | def __init__(self, xid=None, pipeline=None): |
| 5536 | if xid != None: |
| 5537 | self.xid = xid |
| 5538 | else: |
| 5539 | self.xid = None |
| 5540 | if pipeline != None: |
| 5541 | self.pipeline = pipeline |
| 5542 | else: |
| 5543 | self.pipeline = "" |
| 5544 | return |
| 5545 | |
| 5546 | def pack(self): |
| 5547 | packed = [] |
| 5548 | packed.append(struct.pack("!B", self.version)) |
| 5549 | packed.append(struct.pack("!B", self.type)) |
| 5550 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5551 | packed.append(struct.pack("!L", self.xid)) |
| 5552 | packed.append(struct.pack("!L", self.experimenter)) |
| 5553 | packed.append(struct.pack("!L", self.subtype)) |
| 5554 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5555 | length = sum([len(x) for x in packed]) |
| 5556 | packed[2] = struct.pack("!H", length) |
| 5557 | return ''.join(packed) |
| 5558 | |
| 5559 | @staticmethod |
| 5560 | def unpack(reader): |
| 5561 | obj = bsn_set_switch_pipeline_request() |
| 5562 | _version = reader.read("!B")[0] |
| 5563 | assert(_version == 4) |
| 5564 | _type = reader.read("!B")[0] |
| 5565 | assert(_type == 4) |
| 5566 | _length = reader.read("!H")[0] |
| 5567 | orig_reader = reader |
| 5568 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5569 | obj.xid = reader.read("!L")[0] |
| 5570 | _experimenter = reader.read("!L")[0] |
| 5571 | assert(_experimenter == 6035143) |
| 5572 | _subtype = reader.read("!L")[0] |
| 5573 | assert(_subtype == 53) |
| 5574 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5575 | return obj |
| 5576 | |
| 5577 | def __eq__(self, other): |
| 5578 | if type(self) != type(other): return False |
| 5579 | if self.xid != other.xid: return False |
| 5580 | if self.pipeline != other.pipeline: return False |
| 5581 | return True |
| 5582 | |
| 5583 | def pretty_print(self, q): |
| 5584 | q.text("bsn_set_switch_pipeline_request {") |
| 5585 | with q.group(): |
| 5586 | with q.indent(2): |
| 5587 | q.breakable() |
| 5588 | q.text("xid = "); |
| 5589 | if self.xid != None: |
| 5590 | q.text("%#x" % self.xid) |
| 5591 | else: |
| 5592 | q.text('None') |
| 5593 | q.text(","); q.breakable() |
| 5594 | q.text("pipeline = "); |
| 5595 | q.pp(self.pipeline) |
| 5596 | q.breakable() |
| 5597 | q.text('}') |
| 5598 | |
| 5599 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 5600 | |
| 5601 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 5602 | version = 4 |
| 5603 | type = 19 |
| 5604 | stats_type = 65535 |
| 5605 | experimenter = 6035143 |
| 5606 | subtype = 6 |
| 5607 | |
| 5608 | def __init__(self, xid=None, flags=None, entries=None): |
| 5609 | if xid != None: |
| 5610 | self.xid = xid |
| 5611 | else: |
| 5612 | self.xid = None |
| 5613 | if flags != None: |
| 5614 | self.flags = flags |
| 5615 | else: |
| 5616 | self.flags = 0 |
| 5617 | if entries != None: |
| 5618 | self.entries = entries |
| 5619 | else: |
| 5620 | self.entries = [] |
| 5621 | return |
| 5622 | |
| 5623 | def pack(self): |
| 5624 | packed = [] |
| 5625 | packed.append(struct.pack("!B", self.version)) |
| 5626 | packed.append(struct.pack("!B", self.type)) |
| 5627 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5628 | packed.append(struct.pack("!L", self.xid)) |
| 5629 | packed.append(struct.pack("!H", self.stats_type)) |
| 5630 | packed.append(struct.pack("!H", self.flags)) |
| 5631 | packed.append('\x00' * 4) |
| 5632 | packed.append(struct.pack("!L", self.experimenter)) |
| 5633 | packed.append(struct.pack("!L", self.subtype)) |
| 5634 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 5635 | length = sum([len(x) for x in packed]) |
| 5636 | packed[2] = struct.pack("!H", length) |
| 5637 | return ''.join(packed) |
| 5638 | |
| 5639 | @staticmethod |
| 5640 | def unpack(reader): |
| 5641 | obj = bsn_switch_pipeline_stats_reply() |
| 5642 | _version = reader.read("!B")[0] |
| 5643 | assert(_version == 4) |
| 5644 | _type = reader.read("!B")[0] |
| 5645 | assert(_type == 19) |
| 5646 | _length = reader.read("!H")[0] |
| 5647 | orig_reader = reader |
| 5648 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5649 | obj.xid = reader.read("!L")[0] |
| 5650 | _stats_type = reader.read("!H")[0] |
| 5651 | assert(_stats_type == 65535) |
| 5652 | obj.flags = reader.read("!H")[0] |
| 5653 | reader.skip(4) |
| 5654 | _experimenter = reader.read("!L")[0] |
| 5655 | assert(_experimenter == 6035143) |
| 5656 | _subtype = reader.read("!L")[0] |
| 5657 | assert(_subtype == 6) |
| 5658 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack) |
| 5659 | return obj |
| 5660 | |
| 5661 | def __eq__(self, other): |
| 5662 | if type(self) != type(other): return False |
| 5663 | if self.xid != other.xid: return False |
| 5664 | if self.flags != other.flags: return False |
| 5665 | if self.entries != other.entries: return False |
| 5666 | return True |
| 5667 | |
| 5668 | def pretty_print(self, q): |
| 5669 | q.text("bsn_switch_pipeline_stats_reply {") |
| 5670 | with q.group(): |
| 5671 | with q.indent(2): |
| 5672 | q.breakable() |
| 5673 | q.text("xid = "); |
| 5674 | if self.xid != None: |
| 5675 | q.text("%#x" % self.xid) |
| 5676 | else: |
| 5677 | q.text('None') |
| 5678 | q.text(","); q.breakable() |
| 5679 | q.text("flags = "); |
| 5680 | q.text("%#x" % self.flags) |
| 5681 | q.text(","); q.breakable() |
| 5682 | q.text("entries = "); |
| 5683 | q.pp(self.entries) |
| 5684 | q.breakable() |
| 5685 | q.text('}') |
| 5686 | |
| 5687 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 5688 | |
| 5689 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 5690 | version = 4 |
| 5691 | type = 18 |
| 5692 | stats_type = 65535 |
| 5693 | experimenter = 6035143 |
| 5694 | subtype = 6 |
| 5695 | |
| 5696 | def __init__(self, xid=None, flags=None): |
| 5697 | if xid != None: |
| 5698 | self.xid = xid |
| 5699 | else: |
| 5700 | self.xid = None |
| 5701 | if flags != None: |
| 5702 | self.flags = flags |
| 5703 | else: |
| 5704 | self.flags = 0 |
| 5705 | return |
| 5706 | |
| 5707 | def pack(self): |
| 5708 | packed = [] |
| 5709 | packed.append(struct.pack("!B", self.version)) |
| 5710 | packed.append(struct.pack("!B", self.type)) |
| 5711 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5712 | packed.append(struct.pack("!L", self.xid)) |
| 5713 | packed.append(struct.pack("!H", self.stats_type)) |
| 5714 | packed.append(struct.pack("!H", self.flags)) |
| 5715 | packed.append('\x00' * 4) |
| 5716 | packed.append(struct.pack("!L", self.experimenter)) |
| 5717 | packed.append(struct.pack("!L", self.subtype)) |
| 5718 | length = sum([len(x) for x in packed]) |
| 5719 | packed[2] = struct.pack("!H", length) |
| 5720 | return ''.join(packed) |
| 5721 | |
| 5722 | @staticmethod |
| 5723 | def unpack(reader): |
| 5724 | obj = bsn_switch_pipeline_stats_request() |
| 5725 | _version = reader.read("!B")[0] |
| 5726 | assert(_version == 4) |
| 5727 | _type = reader.read("!B")[0] |
| 5728 | assert(_type == 18) |
| 5729 | _length = reader.read("!H")[0] |
| 5730 | orig_reader = reader |
| 5731 | reader = orig_reader.slice(_length - (2 + 2)) |
| 5732 | obj.xid = reader.read("!L")[0] |
| 5733 | _stats_type = reader.read("!H")[0] |
| 5734 | assert(_stats_type == 65535) |
| 5735 | obj.flags = reader.read("!H")[0] |
| 5736 | reader.skip(4) |
| 5737 | _experimenter = reader.read("!L")[0] |
| 5738 | assert(_experimenter == 6035143) |
| 5739 | _subtype = reader.read("!L")[0] |
| 5740 | assert(_subtype == 6) |
| 5741 | return obj |
| 5742 | |
| 5743 | def __eq__(self, other): |
| 5744 | if type(self) != type(other): return False |
| 5745 | if self.xid != other.xid: return False |
| 5746 | if self.flags != other.flags: return False |
| 5747 | return True |
| 5748 | |
| 5749 | def pretty_print(self, q): |
| 5750 | q.text("bsn_switch_pipeline_stats_request {") |
| 5751 | with q.group(): |
| 5752 | with q.indent(2): |
| 5753 | q.breakable() |
| 5754 | q.text("xid = "); |
| 5755 | if self.xid != None: |
| 5756 | q.text("%#x" % self.xid) |
| 5757 | else: |
| 5758 | q.text('None') |
| 5759 | q.text(","); q.breakable() |
| 5760 | q.text("flags = "); |
| 5761 | q.text("%#x" % self.flags) |
| 5762 | q.breakable() |
| 5763 | q.text('}') |
| 5764 | |
| 5765 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 5766 | |
| 5767 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5768 | version = 4 |
| 5769 | type = 4 |
| 5770 | experimenter = 6035143 |
| 5771 | subtype = 45 |
| 5772 | |
| 5773 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5774 | if xid != None: |
| 5775 | self.xid = xid |
| 5776 | else: |
| 5777 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5778 | if time_ms != None: |
| 5779 | self.time_ms = time_ms |
| 5780 | else: |
| 5781 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5782 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5783 | |
| 5784 | def pack(self): |
| 5785 | packed = [] |
| 5786 | packed.append(struct.pack("!B", self.version)) |
| 5787 | packed.append(struct.pack("!B", self.type)) |
| 5788 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5789 | packed.append(struct.pack("!L", self.xid)) |
| 5790 | packed.append(struct.pack("!L", self.experimenter)) |
| 5791 | packed.append(struct.pack("!L", self.subtype)) |
| 5792 | packed.append(struct.pack("!Q", self.time_ms)) |
| 5793 | length = sum([len(x) for x in packed]) |
| 5794 | packed[2] = struct.pack("!H", length) |
| 5795 | return ''.join(packed) |
| 5796 | |
| 5797 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5798 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5799 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5800 | _version = reader.read("!B")[0] |
| 5801 | assert(_version == 4) |
| 5802 | _type = reader.read("!B")[0] |
| 5803 | assert(_type == 4) |
| 5804 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5805 | orig_reader = reader |
| 5806 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5807 | obj.xid = reader.read("!L")[0] |
| 5808 | _experimenter = reader.read("!L")[0] |
| 5809 | assert(_experimenter == 6035143) |
| 5810 | _subtype = reader.read("!L")[0] |
| 5811 | assert(_subtype == 45) |
| 5812 | obj.time_ms = reader.read("!Q")[0] |
| 5813 | return obj |
| 5814 | |
| 5815 | def __eq__(self, other): |
| 5816 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5817 | if self.xid != other.xid: return False |
| 5818 | if self.time_ms != other.time_ms: return False |
| 5819 | return True |
| 5820 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5821 | def pretty_print(self, q): |
| 5822 | q.text("bsn_time_reply {") |
| 5823 | with q.group(): |
| 5824 | with q.indent(2): |
| 5825 | q.breakable() |
| 5826 | q.text("xid = "); |
| 5827 | if self.xid != None: |
| 5828 | q.text("%#x" % self.xid) |
| 5829 | else: |
| 5830 | q.text('None') |
| 5831 | q.text(","); q.breakable() |
| 5832 | q.text("time_ms = "); |
| 5833 | q.text("%#x" % self.time_ms) |
| 5834 | q.breakable() |
| 5835 | q.text('}') |
| 5836 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5837 | bsn_header.subtypes[45] = bsn_time_reply |
| 5838 | |
| 5839 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5840 | version = 4 |
| 5841 | type = 4 |
| 5842 | experimenter = 6035143 |
| 5843 | subtype = 44 |
| 5844 | |
| 5845 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5846 | if xid != None: |
| 5847 | self.xid = xid |
| 5848 | else: |
| 5849 | self.xid = None |
| 5850 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5851 | |
| 5852 | def pack(self): |
| 5853 | packed = [] |
| 5854 | packed.append(struct.pack("!B", self.version)) |
| 5855 | packed.append(struct.pack("!B", self.type)) |
| 5856 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5857 | packed.append(struct.pack("!L", self.xid)) |
| 5858 | packed.append(struct.pack("!L", self.experimenter)) |
| 5859 | packed.append(struct.pack("!L", self.subtype)) |
| 5860 | length = sum([len(x) for x in packed]) |
| 5861 | packed[2] = struct.pack("!H", length) |
| 5862 | return ''.join(packed) |
| 5863 | |
| 5864 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5865 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5866 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5867 | _version = reader.read("!B")[0] |
| 5868 | assert(_version == 4) |
| 5869 | _type = reader.read("!B")[0] |
| 5870 | assert(_type == 4) |
| 5871 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5872 | orig_reader = reader |
| 5873 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5874 | obj.xid = reader.read("!L")[0] |
| 5875 | _experimenter = reader.read("!L")[0] |
| 5876 | assert(_experimenter == 6035143) |
| 5877 | _subtype = reader.read("!L")[0] |
| 5878 | assert(_subtype == 44) |
| 5879 | return obj |
| 5880 | |
| 5881 | def __eq__(self, other): |
| 5882 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5883 | if self.xid != other.xid: return False |
| 5884 | return True |
| 5885 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5886 | def pretty_print(self, q): |
| 5887 | q.text("bsn_time_request {") |
| 5888 | with q.group(): |
| 5889 | with q.indent(2): |
| 5890 | q.breakable() |
| 5891 | q.text("xid = "); |
| 5892 | if self.xid != None: |
| 5893 | q.text("%#x" % self.xid) |
| 5894 | else: |
| 5895 | q.text('None') |
| 5896 | q.breakable() |
| 5897 | q.text('}') |
| 5898 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5899 | bsn_header.subtypes[44] = bsn_time_request |
| 5900 | |
| 5901 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5902 | version = 4 |
| 5903 | type = 4 |
| 5904 | experimenter = 6035143 |
| 5905 | subtype = 16 |
| 5906 | |
| 5907 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5908 | if xid != None: |
| 5909 | self.xid = xid |
| 5910 | else: |
| 5911 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5912 | if status != None: |
| 5913 | self.status = status |
| 5914 | else: |
| 5915 | self.status = 0 |
| 5916 | if vport_no != None: |
| 5917 | self.vport_no = vport_no |
| 5918 | else: |
| 5919 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5920 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5921 | |
| 5922 | def pack(self): |
| 5923 | packed = [] |
| 5924 | packed.append(struct.pack("!B", self.version)) |
| 5925 | packed.append(struct.pack("!B", self.type)) |
| 5926 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5927 | packed.append(struct.pack("!L", self.xid)) |
| 5928 | packed.append(struct.pack("!L", self.experimenter)) |
| 5929 | packed.append(struct.pack("!L", self.subtype)) |
| 5930 | packed.append(struct.pack("!L", self.status)) |
| 5931 | packed.append(struct.pack("!L", self.vport_no)) |
| 5932 | length = sum([len(x) for x in packed]) |
| 5933 | packed[2] = struct.pack("!H", length) |
| 5934 | return ''.join(packed) |
| 5935 | |
| 5936 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5937 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5938 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5939 | _version = reader.read("!B")[0] |
| 5940 | assert(_version == 4) |
| 5941 | _type = reader.read("!B")[0] |
| 5942 | assert(_type == 4) |
| 5943 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5944 | orig_reader = reader |
| 5945 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5946 | obj.xid = reader.read("!L")[0] |
| 5947 | _experimenter = reader.read("!L")[0] |
| 5948 | assert(_experimenter == 6035143) |
| 5949 | _subtype = reader.read("!L")[0] |
| 5950 | assert(_subtype == 16) |
| 5951 | obj.status = reader.read("!L")[0] |
| 5952 | obj.vport_no = reader.read("!L")[0] |
| 5953 | return obj |
| 5954 | |
| 5955 | def __eq__(self, other): |
| 5956 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5957 | if self.xid != other.xid: return False |
| 5958 | if self.status != other.status: return False |
| 5959 | if self.vport_no != other.vport_no: return False |
| 5960 | return True |
| 5961 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5962 | def pretty_print(self, q): |
| 5963 | q.text("bsn_virtual_port_create_reply {") |
| 5964 | with q.group(): |
| 5965 | with q.indent(2): |
| 5966 | q.breakable() |
| 5967 | q.text("xid = "); |
| 5968 | if self.xid != None: |
| 5969 | q.text("%#x" % self.xid) |
| 5970 | else: |
| 5971 | q.text('None') |
| 5972 | q.text(","); q.breakable() |
| 5973 | q.text("status = "); |
| 5974 | q.text("%#x" % self.status) |
| 5975 | q.text(","); q.breakable() |
| 5976 | q.text("vport_no = "); |
| 5977 | q.text("%#x" % self.vport_no) |
| 5978 | q.breakable() |
| 5979 | q.text('}') |
| 5980 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5981 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 5982 | |
| 5983 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5984 | version = 4 |
| 5985 | type = 4 |
| 5986 | experimenter = 6035143 |
| 5987 | subtype = 15 |
| 5988 | |
| 5989 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5990 | if xid != None: |
| 5991 | self.xid = xid |
| 5992 | else: |
| 5993 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5994 | if vport != None: |
| 5995 | self.vport = vport |
| 5996 | else: |
| 5997 | self.vport = common.bsn_vport_q_in_q() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5998 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5999 | |
| 6000 | def pack(self): |
| 6001 | packed = [] |
| 6002 | packed.append(struct.pack("!B", self.version)) |
| 6003 | packed.append(struct.pack("!B", self.type)) |
| 6004 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6005 | packed.append(struct.pack("!L", self.xid)) |
| 6006 | packed.append(struct.pack("!L", self.experimenter)) |
| 6007 | packed.append(struct.pack("!L", self.subtype)) |
| 6008 | packed.append(self.vport.pack()) |
| 6009 | length = sum([len(x) for x in packed]) |
| 6010 | packed[2] = struct.pack("!H", length) |
| 6011 | return ''.join(packed) |
| 6012 | |
| 6013 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6014 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6015 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6016 | _version = reader.read("!B")[0] |
| 6017 | assert(_version == 4) |
| 6018 | _type = reader.read("!B")[0] |
| 6019 | assert(_type == 4) |
| 6020 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6021 | orig_reader = reader |
| 6022 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6023 | obj.xid = reader.read("!L")[0] |
| 6024 | _experimenter = reader.read("!L")[0] |
| 6025 | assert(_experimenter == 6035143) |
| 6026 | _subtype = reader.read("!L")[0] |
| 6027 | assert(_subtype == 15) |
| 6028 | obj.vport = common.bsn_vport_q_in_q.unpack(reader) |
| 6029 | return obj |
| 6030 | |
| 6031 | def __eq__(self, other): |
| 6032 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6033 | if self.xid != other.xid: return False |
| 6034 | if self.vport != other.vport: return False |
| 6035 | return True |
| 6036 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6037 | def pretty_print(self, q): |
| 6038 | q.text("bsn_virtual_port_create_request {") |
| 6039 | with q.group(): |
| 6040 | with q.indent(2): |
| 6041 | q.breakable() |
| 6042 | q.text("xid = "); |
| 6043 | if self.xid != None: |
| 6044 | q.text("%#x" % self.xid) |
| 6045 | else: |
| 6046 | q.text('None') |
| 6047 | q.text(","); q.breakable() |
| 6048 | q.text("vport = "); |
| 6049 | q.pp(self.vport) |
| 6050 | q.breakable() |
| 6051 | q.text('}') |
| 6052 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6053 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 6054 | |
| 6055 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6056 | version = 4 |
| 6057 | type = 4 |
| 6058 | experimenter = 6035143 |
| 6059 | subtype = 26 |
| 6060 | |
| 6061 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6062 | if xid != None: |
| 6063 | self.xid = xid |
| 6064 | else: |
| 6065 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6066 | if status != None: |
| 6067 | self.status = status |
| 6068 | else: |
| 6069 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6070 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6071 | |
| 6072 | def pack(self): |
| 6073 | packed = [] |
| 6074 | packed.append(struct.pack("!B", self.version)) |
| 6075 | packed.append(struct.pack("!B", self.type)) |
| 6076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6077 | packed.append(struct.pack("!L", self.xid)) |
| 6078 | packed.append(struct.pack("!L", self.experimenter)) |
| 6079 | packed.append(struct.pack("!L", self.subtype)) |
| 6080 | packed.append(struct.pack("!L", self.status)) |
| 6081 | length = sum([len(x) for x in packed]) |
| 6082 | packed[2] = struct.pack("!H", length) |
| 6083 | return ''.join(packed) |
| 6084 | |
| 6085 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6086 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6087 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6088 | _version = reader.read("!B")[0] |
| 6089 | assert(_version == 4) |
| 6090 | _type = reader.read("!B")[0] |
| 6091 | assert(_type == 4) |
| 6092 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6093 | orig_reader = reader |
| 6094 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6095 | obj.xid = reader.read("!L")[0] |
| 6096 | _experimenter = reader.read("!L")[0] |
| 6097 | assert(_experimenter == 6035143) |
| 6098 | _subtype = reader.read("!L")[0] |
| 6099 | assert(_subtype == 26) |
| 6100 | obj.status = reader.read("!L")[0] |
| 6101 | return obj |
| 6102 | |
| 6103 | def __eq__(self, other): |
| 6104 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6105 | if self.xid != other.xid: return False |
| 6106 | if self.status != other.status: return False |
| 6107 | return True |
| 6108 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6109 | def pretty_print(self, q): |
| 6110 | q.text("bsn_virtual_port_remove_reply {") |
| 6111 | with q.group(): |
| 6112 | with q.indent(2): |
| 6113 | q.breakable() |
| 6114 | q.text("xid = "); |
| 6115 | if self.xid != None: |
| 6116 | q.text("%#x" % self.xid) |
| 6117 | else: |
| 6118 | q.text('None') |
| 6119 | q.text(","); q.breakable() |
| 6120 | q.text("status = "); |
| 6121 | q.text("%#x" % self.status) |
| 6122 | q.breakable() |
| 6123 | q.text('}') |
| 6124 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6125 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 6126 | |
| 6127 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6128 | version = 4 |
| 6129 | type = 4 |
| 6130 | experimenter = 6035143 |
| 6131 | subtype = 17 |
| 6132 | |
| 6133 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6134 | if xid != None: |
| 6135 | self.xid = xid |
| 6136 | else: |
| 6137 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6138 | if vport_no != None: |
| 6139 | self.vport_no = vport_no |
| 6140 | else: |
| 6141 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6142 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6143 | |
| 6144 | def pack(self): |
| 6145 | packed = [] |
| 6146 | packed.append(struct.pack("!B", self.version)) |
| 6147 | packed.append(struct.pack("!B", self.type)) |
| 6148 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6149 | packed.append(struct.pack("!L", self.xid)) |
| 6150 | packed.append(struct.pack("!L", self.experimenter)) |
| 6151 | packed.append(struct.pack("!L", self.subtype)) |
| 6152 | packed.append(struct.pack("!L", self.vport_no)) |
| 6153 | length = sum([len(x) for x in packed]) |
| 6154 | packed[2] = struct.pack("!H", length) |
| 6155 | return ''.join(packed) |
| 6156 | |
| 6157 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6158 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6159 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6160 | _version = reader.read("!B")[0] |
| 6161 | assert(_version == 4) |
| 6162 | _type = reader.read("!B")[0] |
| 6163 | assert(_type == 4) |
| 6164 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6165 | orig_reader = reader |
| 6166 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6167 | obj.xid = reader.read("!L")[0] |
| 6168 | _experimenter = reader.read("!L")[0] |
| 6169 | assert(_experimenter == 6035143) |
| 6170 | _subtype = reader.read("!L")[0] |
| 6171 | assert(_subtype == 17) |
| 6172 | obj.vport_no = reader.read("!L")[0] |
| 6173 | return obj |
| 6174 | |
| 6175 | def __eq__(self, other): |
| 6176 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6177 | if self.xid != other.xid: return False |
| 6178 | if self.vport_no != other.vport_no: return False |
| 6179 | return True |
| 6180 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6181 | def pretty_print(self, q): |
| 6182 | q.text("bsn_virtual_port_remove_request {") |
| 6183 | with q.group(): |
| 6184 | with q.indent(2): |
| 6185 | q.breakable() |
| 6186 | q.text("xid = "); |
| 6187 | if self.xid != None: |
| 6188 | q.text("%#x" % self.xid) |
| 6189 | else: |
| 6190 | q.text('None') |
| 6191 | q.text(","); q.breakable() |
| 6192 | q.text("vport_no = "); |
| 6193 | q.text("%#x" % self.vport_no) |
| 6194 | q.breakable() |
| 6195 | q.text('}') |
| 6196 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6197 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 6198 | |
| 6199 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 6200 | version = 4 |
| 6201 | type = 19 |
| 6202 | stats_type = 65535 |
| 6203 | experimenter = 6035143 |
| 6204 | subtype = 9 |
| 6205 | |
| 6206 | def __init__(self, xid=None, flags=None, entries=None): |
| 6207 | if xid != None: |
| 6208 | self.xid = xid |
| 6209 | else: |
| 6210 | self.xid = None |
| 6211 | if flags != None: |
| 6212 | self.flags = flags |
| 6213 | else: |
| 6214 | self.flags = 0 |
| 6215 | if entries != None: |
| 6216 | self.entries = entries |
| 6217 | else: |
| 6218 | self.entries = [] |
| 6219 | return |
| 6220 | |
| 6221 | def pack(self): |
| 6222 | packed = [] |
| 6223 | packed.append(struct.pack("!B", self.version)) |
| 6224 | packed.append(struct.pack("!B", self.type)) |
| 6225 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6226 | packed.append(struct.pack("!L", self.xid)) |
| 6227 | packed.append(struct.pack("!H", self.stats_type)) |
| 6228 | packed.append(struct.pack("!H", self.flags)) |
| 6229 | packed.append('\x00' * 4) |
| 6230 | packed.append(struct.pack("!L", self.experimenter)) |
| 6231 | packed.append(struct.pack("!L", self.subtype)) |
| 6232 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6233 | length = sum([len(x) for x in packed]) |
| 6234 | packed[2] = struct.pack("!H", length) |
| 6235 | return ''.join(packed) |
| 6236 | |
| 6237 | @staticmethod |
| 6238 | def unpack(reader): |
| 6239 | obj = bsn_vlan_counter_stats_reply() |
| 6240 | _version = reader.read("!B")[0] |
| 6241 | assert(_version == 4) |
| 6242 | _type = reader.read("!B")[0] |
| 6243 | assert(_type == 19) |
| 6244 | _length = reader.read("!H")[0] |
| 6245 | orig_reader = reader |
| 6246 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6247 | obj.xid = reader.read("!L")[0] |
| 6248 | _stats_type = reader.read("!H")[0] |
| 6249 | assert(_stats_type == 65535) |
| 6250 | obj.flags = reader.read("!H")[0] |
| 6251 | reader.skip(4) |
| 6252 | _experimenter = reader.read("!L")[0] |
| 6253 | assert(_experimenter == 6035143) |
| 6254 | _subtype = reader.read("!L")[0] |
| 6255 | assert(_subtype == 9) |
| 6256 | obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack) |
| 6257 | return obj |
| 6258 | |
| 6259 | def __eq__(self, other): |
| 6260 | if type(self) != type(other): return False |
| 6261 | if self.xid != other.xid: return False |
| 6262 | if self.flags != other.flags: return False |
| 6263 | if self.entries != other.entries: return False |
| 6264 | return True |
| 6265 | |
| 6266 | def pretty_print(self, q): |
| 6267 | q.text("bsn_vlan_counter_stats_reply {") |
| 6268 | with q.group(): |
| 6269 | with q.indent(2): |
| 6270 | q.breakable() |
| 6271 | q.text("xid = "); |
| 6272 | if self.xid != None: |
| 6273 | q.text("%#x" % self.xid) |
| 6274 | else: |
| 6275 | q.text('None') |
| 6276 | q.text(","); q.breakable() |
| 6277 | q.text("flags = "); |
| 6278 | q.text("%#x" % self.flags) |
| 6279 | q.text(","); q.breakable() |
| 6280 | q.text("entries = "); |
| 6281 | q.pp(self.entries) |
| 6282 | q.breakable() |
| 6283 | q.text('}') |
| 6284 | |
| 6285 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 6286 | |
| 6287 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 6288 | version = 4 |
| 6289 | type = 18 |
| 6290 | stats_type = 65535 |
| 6291 | experimenter = 6035143 |
| 6292 | subtype = 9 |
| 6293 | |
| 6294 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 6295 | if xid != None: |
| 6296 | self.xid = xid |
| 6297 | else: |
| 6298 | self.xid = None |
| 6299 | if flags != None: |
| 6300 | self.flags = flags |
| 6301 | else: |
| 6302 | self.flags = 0 |
| 6303 | if vlan_vid != None: |
| 6304 | self.vlan_vid = vlan_vid |
| 6305 | else: |
| 6306 | self.vlan_vid = 0 |
| 6307 | return |
| 6308 | |
| 6309 | def pack(self): |
| 6310 | packed = [] |
| 6311 | packed.append(struct.pack("!B", self.version)) |
| 6312 | packed.append(struct.pack("!B", self.type)) |
| 6313 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6314 | packed.append(struct.pack("!L", self.xid)) |
| 6315 | packed.append(struct.pack("!H", self.stats_type)) |
| 6316 | packed.append(struct.pack("!H", self.flags)) |
| 6317 | packed.append('\x00' * 4) |
| 6318 | packed.append(struct.pack("!L", self.experimenter)) |
| 6319 | packed.append(struct.pack("!L", self.subtype)) |
| 6320 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 6321 | length = sum([len(x) for x in packed]) |
| 6322 | packed[2] = struct.pack("!H", length) |
| 6323 | return ''.join(packed) |
| 6324 | |
| 6325 | @staticmethod |
| 6326 | def unpack(reader): |
| 6327 | obj = bsn_vlan_counter_stats_request() |
| 6328 | _version = reader.read("!B")[0] |
| 6329 | assert(_version == 4) |
| 6330 | _type = reader.read("!B")[0] |
| 6331 | assert(_type == 18) |
| 6332 | _length = reader.read("!H")[0] |
| 6333 | orig_reader = reader |
| 6334 | reader = orig_reader.slice(_length - (2 + 2)) |
| 6335 | obj.xid = reader.read("!L")[0] |
| 6336 | _stats_type = reader.read("!H")[0] |
| 6337 | assert(_stats_type == 65535) |
| 6338 | obj.flags = reader.read("!H")[0] |
| 6339 | reader.skip(4) |
| 6340 | _experimenter = reader.read("!L")[0] |
| 6341 | assert(_experimenter == 6035143) |
| 6342 | _subtype = reader.read("!L")[0] |
| 6343 | assert(_subtype == 9) |
| 6344 | obj.vlan_vid = reader.read("!H")[0] |
| 6345 | return obj |
| 6346 | |
| 6347 | def __eq__(self, other): |
| 6348 | if type(self) != type(other): return False |
| 6349 | if self.xid != other.xid: return False |
| 6350 | if self.flags != other.flags: return False |
| 6351 | if self.vlan_vid != other.vlan_vid: return False |
| 6352 | return True |
| 6353 | |
| 6354 | def pretty_print(self, q): |
| 6355 | q.text("bsn_vlan_counter_stats_request {") |
| 6356 | with q.group(): |
| 6357 | with q.indent(2): |
| 6358 | q.breakable() |
| 6359 | q.text("xid = "); |
| 6360 | if self.xid != None: |
| 6361 | q.text("%#x" % self.xid) |
| 6362 | else: |
| 6363 | q.text('None') |
| 6364 | q.text(","); q.breakable() |
| 6365 | q.text("flags = "); |
| 6366 | q.text("%#x" % self.flags) |
| 6367 | q.text(","); q.breakable() |
| 6368 | q.text("vlan_vid = "); |
| 6369 | q.text("%#x" % self.vlan_vid) |
| 6370 | q.breakable() |
| 6371 | q.text('}') |
| 6372 | |
| 6373 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 6374 | |
| 6375 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6376 | version = 4 |
| 6377 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6378 | stats_type = 0 |
| 6379 | |
| 6380 | 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] | 6381 | if xid != None: |
| 6382 | self.xid = xid |
| 6383 | else: |
| 6384 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6385 | if flags != None: |
| 6386 | self.flags = flags |
| 6387 | else: |
| 6388 | self.flags = 0 |
| 6389 | if mfr_desc != None: |
| 6390 | self.mfr_desc = mfr_desc |
| 6391 | else: |
| 6392 | self.mfr_desc = "" |
| 6393 | if hw_desc != None: |
| 6394 | self.hw_desc = hw_desc |
| 6395 | else: |
| 6396 | self.hw_desc = "" |
| 6397 | if sw_desc != None: |
| 6398 | self.sw_desc = sw_desc |
| 6399 | else: |
| 6400 | self.sw_desc = "" |
| 6401 | if serial_num != None: |
| 6402 | self.serial_num = serial_num |
| 6403 | else: |
| 6404 | self.serial_num = "" |
| 6405 | if dp_desc != None: |
| 6406 | self.dp_desc = dp_desc |
| 6407 | else: |
| 6408 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6409 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6410 | |
| 6411 | def pack(self): |
| 6412 | packed = [] |
| 6413 | packed.append(struct.pack("!B", self.version)) |
| 6414 | packed.append(struct.pack("!B", self.type)) |
| 6415 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6416 | packed.append(struct.pack("!L", self.xid)) |
| 6417 | packed.append(struct.pack("!H", self.stats_type)) |
| 6418 | packed.append(struct.pack("!H", self.flags)) |
| 6419 | packed.append('\x00' * 4) |
| 6420 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 6421 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 6422 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 6423 | packed.append(struct.pack("!32s", self.serial_num)) |
| 6424 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 6425 | length = sum([len(x) for x in packed]) |
| 6426 | packed[2] = struct.pack("!H", length) |
| 6427 | return ''.join(packed) |
| 6428 | |
| 6429 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6430 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6431 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6432 | _version = reader.read("!B")[0] |
| 6433 | assert(_version == 4) |
| 6434 | _type = reader.read("!B")[0] |
| 6435 | assert(_type == 19) |
| 6436 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6437 | orig_reader = reader |
| 6438 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6439 | obj.xid = reader.read("!L")[0] |
| 6440 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6441 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6442 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6443 | reader.skip(4) |
| 6444 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 6445 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 6446 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 6447 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 6448 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 6449 | return obj |
| 6450 | |
| 6451 | def __eq__(self, other): |
| 6452 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6453 | if self.xid != other.xid: return False |
| 6454 | if self.flags != other.flags: return False |
| 6455 | if self.mfr_desc != other.mfr_desc: return False |
| 6456 | if self.hw_desc != other.hw_desc: return False |
| 6457 | if self.sw_desc != other.sw_desc: return False |
| 6458 | if self.serial_num != other.serial_num: return False |
| 6459 | if self.dp_desc != other.dp_desc: return False |
| 6460 | return True |
| 6461 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6462 | def pretty_print(self, q): |
| 6463 | q.text("desc_stats_reply {") |
| 6464 | with q.group(): |
| 6465 | with q.indent(2): |
| 6466 | q.breakable() |
| 6467 | q.text("xid = "); |
| 6468 | if self.xid != None: |
| 6469 | q.text("%#x" % self.xid) |
| 6470 | else: |
| 6471 | q.text('None') |
| 6472 | q.text(","); q.breakable() |
| 6473 | q.text("flags = "); |
| 6474 | q.text("%#x" % self.flags) |
| 6475 | q.text(","); q.breakable() |
| 6476 | q.text("mfr_desc = "); |
| 6477 | q.pp(self.mfr_desc) |
| 6478 | q.text(","); q.breakable() |
| 6479 | q.text("hw_desc = "); |
| 6480 | q.pp(self.hw_desc) |
| 6481 | q.text(","); q.breakable() |
| 6482 | q.text("sw_desc = "); |
| 6483 | q.pp(self.sw_desc) |
| 6484 | q.text(","); q.breakable() |
| 6485 | q.text("serial_num = "); |
| 6486 | q.pp(self.serial_num) |
| 6487 | q.text(","); q.breakable() |
| 6488 | q.text("dp_desc = "); |
| 6489 | q.pp(self.dp_desc) |
| 6490 | q.breakable() |
| 6491 | q.text('}') |
| 6492 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6493 | stats_reply.subtypes[0] = desc_stats_reply |
| 6494 | |
| 6495 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6496 | version = 4 |
| 6497 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6498 | stats_type = 0 |
| 6499 | |
| 6500 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6501 | if xid != None: |
| 6502 | self.xid = xid |
| 6503 | else: |
| 6504 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6505 | if flags != None: |
| 6506 | self.flags = flags |
| 6507 | else: |
| 6508 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6509 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6510 | |
| 6511 | def pack(self): |
| 6512 | packed = [] |
| 6513 | packed.append(struct.pack("!B", self.version)) |
| 6514 | packed.append(struct.pack("!B", self.type)) |
| 6515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6516 | packed.append(struct.pack("!L", self.xid)) |
| 6517 | packed.append(struct.pack("!H", self.stats_type)) |
| 6518 | packed.append(struct.pack("!H", self.flags)) |
| 6519 | packed.append('\x00' * 4) |
| 6520 | length = sum([len(x) for x in packed]) |
| 6521 | packed[2] = struct.pack("!H", length) |
| 6522 | return ''.join(packed) |
| 6523 | |
| 6524 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6525 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6526 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6527 | _version = reader.read("!B")[0] |
| 6528 | assert(_version == 4) |
| 6529 | _type = reader.read("!B")[0] |
| 6530 | assert(_type == 18) |
| 6531 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6532 | orig_reader = reader |
| 6533 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6534 | obj.xid = reader.read("!L")[0] |
| 6535 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6536 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6537 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6538 | reader.skip(4) |
| 6539 | return obj |
| 6540 | |
| 6541 | def __eq__(self, other): |
| 6542 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6543 | if self.xid != other.xid: return False |
| 6544 | if self.flags != other.flags: return False |
| 6545 | return True |
| 6546 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6547 | def pretty_print(self, q): |
| 6548 | q.text("desc_stats_request {") |
| 6549 | with q.group(): |
| 6550 | with q.indent(2): |
| 6551 | q.breakable() |
| 6552 | q.text("xid = "); |
| 6553 | if self.xid != None: |
| 6554 | q.text("%#x" % self.xid) |
| 6555 | else: |
| 6556 | q.text('None') |
| 6557 | q.text(","); q.breakable() |
| 6558 | q.text("flags = "); |
| 6559 | q.text("%#x" % self.flags) |
| 6560 | q.breakable() |
| 6561 | q.text('}') |
| 6562 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6563 | stats_request.subtypes[0] = desc_stats_request |
| 6564 | |
| 6565 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6566 | version = 4 |
| 6567 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6568 | |
| 6569 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6570 | if xid != None: |
| 6571 | self.xid = xid |
| 6572 | else: |
| 6573 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6574 | if data != None: |
| 6575 | self.data = data |
| 6576 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6577 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6578 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6579 | |
| 6580 | def pack(self): |
| 6581 | packed = [] |
| 6582 | packed.append(struct.pack("!B", self.version)) |
| 6583 | packed.append(struct.pack("!B", self.type)) |
| 6584 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6585 | packed.append(struct.pack("!L", self.xid)) |
| 6586 | packed.append(self.data) |
| 6587 | length = sum([len(x) for x in packed]) |
| 6588 | packed[2] = struct.pack("!H", length) |
| 6589 | return ''.join(packed) |
| 6590 | |
| 6591 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6592 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6593 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6594 | _version = reader.read("!B")[0] |
| 6595 | assert(_version == 4) |
| 6596 | _type = reader.read("!B")[0] |
| 6597 | assert(_type == 3) |
| 6598 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6599 | orig_reader = reader |
| 6600 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6601 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6602 | obj.data = str(reader.read_all()) |
| 6603 | return obj |
| 6604 | |
| 6605 | def __eq__(self, other): |
| 6606 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6607 | if self.xid != other.xid: return False |
| 6608 | if self.data != other.data: return False |
| 6609 | return True |
| 6610 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6611 | def pretty_print(self, q): |
| 6612 | q.text("echo_reply {") |
| 6613 | with q.group(): |
| 6614 | with q.indent(2): |
| 6615 | q.breakable() |
| 6616 | q.text("xid = "); |
| 6617 | if self.xid != None: |
| 6618 | q.text("%#x" % self.xid) |
| 6619 | else: |
| 6620 | q.text('None') |
| 6621 | q.text(","); q.breakable() |
| 6622 | q.text("data = "); |
| 6623 | q.pp(self.data) |
| 6624 | q.breakable() |
| 6625 | q.text('}') |
| 6626 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6627 | message.subtypes[3] = echo_reply |
| 6628 | |
| 6629 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6630 | version = 4 |
| 6631 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6632 | |
| 6633 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6634 | if xid != None: |
| 6635 | self.xid = xid |
| 6636 | else: |
| 6637 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6638 | if data != None: |
| 6639 | self.data = data |
| 6640 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6641 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6642 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6643 | |
| 6644 | def pack(self): |
| 6645 | packed = [] |
| 6646 | packed.append(struct.pack("!B", self.version)) |
| 6647 | packed.append(struct.pack("!B", self.type)) |
| 6648 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6649 | packed.append(struct.pack("!L", self.xid)) |
| 6650 | packed.append(self.data) |
| 6651 | length = sum([len(x) for x in packed]) |
| 6652 | packed[2] = struct.pack("!H", length) |
| 6653 | return ''.join(packed) |
| 6654 | |
| 6655 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6656 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6657 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6658 | _version = reader.read("!B")[0] |
| 6659 | assert(_version == 4) |
| 6660 | _type = reader.read("!B")[0] |
| 6661 | assert(_type == 2) |
| 6662 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6663 | orig_reader = reader |
| 6664 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6665 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6666 | obj.data = str(reader.read_all()) |
| 6667 | return obj |
| 6668 | |
| 6669 | def __eq__(self, other): |
| 6670 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6671 | if self.xid != other.xid: return False |
| 6672 | if self.data != other.data: return False |
| 6673 | return True |
| 6674 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6675 | def pretty_print(self, q): |
| 6676 | q.text("echo_request {") |
| 6677 | with q.group(): |
| 6678 | with q.indent(2): |
| 6679 | q.breakable() |
| 6680 | q.text("xid = "); |
| 6681 | if self.xid != None: |
| 6682 | q.text("%#x" % self.xid) |
| 6683 | else: |
| 6684 | q.text('None') |
| 6685 | q.text(","); q.breakable() |
| 6686 | q.text("data = "); |
| 6687 | q.pp(self.data) |
| 6688 | q.breakable() |
| 6689 | q.text('}') |
| 6690 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6691 | message.subtypes[2] = echo_request |
| 6692 | |
| 6693 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6694 | version = 4 |
| 6695 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6696 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6697 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6698 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6699 | if xid != None: |
| 6700 | self.xid = xid |
| 6701 | else: |
| 6702 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6703 | if subtype != None: |
| 6704 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6705 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6706 | self.subtype = 0 |
| 6707 | if experimenter != None: |
| 6708 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6709 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6710 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6711 | if data != None: |
| 6712 | self.data = data |
| 6713 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6714 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6715 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6716 | |
| 6717 | def pack(self): |
| 6718 | packed = [] |
| 6719 | packed.append(struct.pack("!B", self.version)) |
| 6720 | packed.append(struct.pack("!B", self.type)) |
| 6721 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6722 | packed.append(struct.pack("!L", self.xid)) |
| 6723 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6724 | packed.append(struct.pack("!H", self.subtype)) |
| 6725 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6726 | packed.append(self.data) |
| 6727 | length = sum([len(x) for x in packed]) |
| 6728 | packed[2] = struct.pack("!H", length) |
| 6729 | return ''.join(packed) |
| 6730 | |
| 6731 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6732 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6733 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6734 | _version = reader.read("!B")[0] |
| 6735 | assert(_version == 4) |
| 6736 | _type = reader.read("!B")[0] |
| 6737 | assert(_type == 1) |
| 6738 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6739 | orig_reader = reader |
| 6740 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6741 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6742 | _err_type = reader.read("!H")[0] |
| 6743 | assert(_err_type == 65535) |
| 6744 | obj.subtype = reader.read("!H")[0] |
| 6745 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6746 | obj.data = str(reader.read_all()) |
| 6747 | return obj |
| 6748 | |
| 6749 | def __eq__(self, other): |
| 6750 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6751 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6752 | if self.subtype != other.subtype: return False |
| 6753 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6754 | if self.data != other.data: return False |
| 6755 | return True |
| 6756 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6757 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6758 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6759 | with q.group(): |
| 6760 | with q.indent(2): |
| 6761 | q.breakable() |
| 6762 | q.text("xid = "); |
| 6763 | if self.xid != None: |
| 6764 | q.text("%#x" % self.xid) |
| 6765 | else: |
| 6766 | q.text('None') |
| 6767 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6768 | q.text("subtype = "); |
| 6769 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6770 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6771 | q.text("experimenter = "); |
| 6772 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6773 | q.text(","); q.breakable() |
| 6774 | q.text("data = "); |
| 6775 | q.pp(self.data) |
| 6776 | q.breakable() |
| 6777 | q.text('}') |
| 6778 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6779 | error_msg.subtypes[65535] = experimenter_error_msg |
| 6780 | |
| 6781 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6782 | version = 4 |
| 6783 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6784 | |
| 6785 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6786 | if xid != None: |
| 6787 | self.xid = xid |
| 6788 | else: |
| 6789 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6790 | if datapath_id != None: |
| 6791 | self.datapath_id = datapath_id |
| 6792 | else: |
| 6793 | self.datapath_id = 0 |
| 6794 | if n_buffers != None: |
| 6795 | self.n_buffers = n_buffers |
| 6796 | else: |
| 6797 | self.n_buffers = 0 |
| 6798 | if n_tables != None: |
| 6799 | self.n_tables = n_tables |
| 6800 | else: |
| 6801 | self.n_tables = 0 |
| 6802 | if auxiliary_id != None: |
| 6803 | self.auxiliary_id = auxiliary_id |
| 6804 | else: |
| 6805 | self.auxiliary_id = 0 |
| 6806 | if capabilities != None: |
| 6807 | self.capabilities = capabilities |
| 6808 | else: |
| 6809 | self.capabilities = 0 |
| 6810 | if reserved != None: |
| 6811 | self.reserved = reserved |
| 6812 | else: |
| 6813 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6814 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6815 | |
| 6816 | def pack(self): |
| 6817 | packed = [] |
| 6818 | packed.append(struct.pack("!B", self.version)) |
| 6819 | packed.append(struct.pack("!B", self.type)) |
| 6820 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6821 | packed.append(struct.pack("!L", self.xid)) |
| 6822 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 6823 | packed.append(struct.pack("!L", self.n_buffers)) |
| 6824 | packed.append(struct.pack("!B", self.n_tables)) |
| 6825 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 6826 | packed.append('\x00' * 2) |
| 6827 | packed.append(struct.pack("!L", self.capabilities)) |
| 6828 | packed.append(struct.pack("!L", self.reserved)) |
| 6829 | length = sum([len(x) for x in packed]) |
| 6830 | packed[2] = struct.pack("!H", length) |
| 6831 | return ''.join(packed) |
| 6832 | |
| 6833 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6834 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6835 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6836 | _version = reader.read("!B")[0] |
| 6837 | assert(_version == 4) |
| 6838 | _type = reader.read("!B")[0] |
| 6839 | assert(_type == 6) |
| 6840 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6841 | orig_reader = reader |
| 6842 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6843 | obj.xid = reader.read("!L")[0] |
| 6844 | obj.datapath_id = reader.read("!Q")[0] |
| 6845 | obj.n_buffers = reader.read("!L")[0] |
| 6846 | obj.n_tables = reader.read("!B")[0] |
| 6847 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6848 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6849 | obj.capabilities = reader.read("!L")[0] |
| 6850 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6851 | return obj |
| 6852 | |
| 6853 | def __eq__(self, other): |
| 6854 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6855 | if self.xid != other.xid: return False |
| 6856 | if self.datapath_id != other.datapath_id: return False |
| 6857 | if self.n_buffers != other.n_buffers: return False |
| 6858 | if self.n_tables != other.n_tables: return False |
| 6859 | if self.auxiliary_id != other.auxiliary_id: return False |
| 6860 | if self.capabilities != other.capabilities: return False |
| 6861 | if self.reserved != other.reserved: return False |
| 6862 | return True |
| 6863 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6864 | def pretty_print(self, q): |
| 6865 | q.text("features_reply {") |
| 6866 | with q.group(): |
| 6867 | with q.indent(2): |
| 6868 | q.breakable() |
| 6869 | q.text("xid = "); |
| 6870 | if self.xid != None: |
| 6871 | q.text("%#x" % self.xid) |
| 6872 | else: |
| 6873 | q.text('None') |
| 6874 | q.text(","); q.breakable() |
| 6875 | q.text("datapath_id = "); |
| 6876 | q.text("%#x" % self.datapath_id) |
| 6877 | q.text(","); q.breakable() |
| 6878 | q.text("n_buffers = "); |
| 6879 | q.text("%#x" % self.n_buffers) |
| 6880 | q.text(","); q.breakable() |
| 6881 | q.text("n_tables = "); |
| 6882 | q.text("%#x" % self.n_tables) |
| 6883 | q.text(","); q.breakable() |
| 6884 | q.text("auxiliary_id = "); |
| 6885 | q.text("%#x" % self.auxiliary_id) |
| 6886 | q.text(","); q.breakable() |
| 6887 | q.text("capabilities = "); |
| 6888 | q.text("%#x" % self.capabilities) |
| 6889 | q.text(","); q.breakable() |
| 6890 | q.text("reserved = "); |
| 6891 | q.text("%#x" % self.reserved) |
| 6892 | q.breakable() |
| 6893 | q.text('}') |
| 6894 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6895 | message.subtypes[6] = features_reply |
| 6896 | |
| 6897 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6898 | version = 4 |
| 6899 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6900 | |
| 6901 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6902 | if xid != None: |
| 6903 | self.xid = xid |
| 6904 | else: |
| 6905 | self.xid = None |
| 6906 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6907 | |
| 6908 | def pack(self): |
| 6909 | packed = [] |
| 6910 | packed.append(struct.pack("!B", self.version)) |
| 6911 | packed.append(struct.pack("!B", self.type)) |
| 6912 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6913 | packed.append(struct.pack("!L", self.xid)) |
| 6914 | length = sum([len(x) for x in packed]) |
| 6915 | packed[2] = struct.pack("!H", length) |
| 6916 | return ''.join(packed) |
| 6917 | |
| 6918 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6919 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6920 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6921 | _version = reader.read("!B")[0] |
| 6922 | assert(_version == 4) |
| 6923 | _type = reader.read("!B")[0] |
| 6924 | assert(_type == 5) |
| 6925 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6926 | orig_reader = reader |
| 6927 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6928 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6929 | return obj |
| 6930 | |
| 6931 | def __eq__(self, other): |
| 6932 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6933 | if self.xid != other.xid: return False |
| 6934 | return True |
| 6935 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6936 | def pretty_print(self, q): |
| 6937 | q.text("features_request {") |
| 6938 | with q.group(): |
| 6939 | with q.indent(2): |
| 6940 | q.breakable() |
| 6941 | q.text("xid = "); |
| 6942 | if self.xid != None: |
| 6943 | q.text("%#x" % self.xid) |
| 6944 | else: |
| 6945 | q.text('None') |
| 6946 | q.breakable() |
| 6947 | q.text('}') |
| 6948 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6949 | message.subtypes[5] = features_request |
| 6950 | |
| 6951 | class flow_mod(message): |
| 6952 | subtypes = {} |
| 6953 | |
| 6954 | @staticmethod |
| 6955 | def unpack(reader): |
| 6956 | subtype, = reader.peek('B', 25) |
| 6957 | try: |
| 6958 | subclass = flow_mod.subtypes[subtype] |
| 6959 | except KeyError: |
| 6960 | raise loxi.ProtocolError("unknown flow_mod message subtype %#x" % subtype) |
| 6961 | return subclass.unpack(reader) |
| 6962 | |
| 6963 | message.subtypes[14] = flow_mod |
| 6964 | |
| 6965 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6966 | version = 4 |
| 6967 | type = 14 |
| 6968 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6969 | |
| 6970 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6971 | if xid != None: |
| 6972 | self.xid = xid |
| 6973 | else: |
| 6974 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6975 | if cookie != None: |
| 6976 | self.cookie = cookie |
| 6977 | else: |
| 6978 | self.cookie = 0 |
| 6979 | if cookie_mask != None: |
| 6980 | self.cookie_mask = cookie_mask |
| 6981 | else: |
| 6982 | self.cookie_mask = 0 |
| 6983 | if table_id != None: |
| 6984 | self.table_id = table_id |
| 6985 | else: |
| 6986 | self.table_id = 0 |
| 6987 | if idle_timeout != None: |
| 6988 | self.idle_timeout = idle_timeout |
| 6989 | else: |
| 6990 | self.idle_timeout = 0 |
| 6991 | if hard_timeout != None: |
| 6992 | self.hard_timeout = hard_timeout |
| 6993 | else: |
| 6994 | self.hard_timeout = 0 |
| 6995 | if priority != None: |
| 6996 | self.priority = priority |
| 6997 | else: |
| 6998 | self.priority = 0 |
| 6999 | if buffer_id != None: |
| 7000 | self.buffer_id = buffer_id |
| 7001 | else: |
| 7002 | self.buffer_id = 0 |
| 7003 | if out_port != None: |
| 7004 | self.out_port = out_port |
| 7005 | else: |
| 7006 | self.out_port = 0 |
| 7007 | if out_group != None: |
| 7008 | self.out_group = out_group |
| 7009 | else: |
| 7010 | self.out_group = 0 |
| 7011 | if flags != None: |
| 7012 | self.flags = flags |
| 7013 | else: |
| 7014 | self.flags = 0 |
| 7015 | if match != None: |
| 7016 | self.match = match |
| 7017 | else: |
| 7018 | self.match = common.match() |
| 7019 | if instructions != None: |
| 7020 | self.instructions = instructions |
| 7021 | else: |
| 7022 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7023 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7024 | |
| 7025 | def pack(self): |
| 7026 | packed = [] |
| 7027 | packed.append(struct.pack("!B", self.version)) |
| 7028 | packed.append(struct.pack("!B", self.type)) |
| 7029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7030 | packed.append(struct.pack("!L", self.xid)) |
| 7031 | packed.append(struct.pack("!Q", self.cookie)) |
| 7032 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7033 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7034 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7035 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7036 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7037 | packed.append(struct.pack("!H", self.priority)) |
| 7038 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7039 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7040 | packed.append(struct.pack("!L", self.out_group)) |
| 7041 | packed.append(struct.pack("!H", self.flags)) |
| 7042 | packed.append('\x00' * 2) |
| 7043 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7044 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7045 | length = sum([len(x) for x in packed]) |
| 7046 | packed[2] = struct.pack("!H", length) |
| 7047 | return ''.join(packed) |
| 7048 | |
| 7049 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7050 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7051 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7052 | _version = reader.read("!B")[0] |
| 7053 | assert(_version == 4) |
| 7054 | _type = reader.read("!B")[0] |
| 7055 | assert(_type == 14) |
| 7056 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7057 | orig_reader = reader |
| 7058 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7059 | obj.xid = reader.read("!L")[0] |
| 7060 | obj.cookie = reader.read("!Q")[0] |
| 7061 | obj.cookie_mask = reader.read("!Q")[0] |
| 7062 | obj.table_id = reader.read("!B")[0] |
| 7063 | __command = util.unpack_fm_cmd(reader) |
| 7064 | assert(__command == 0) |
| 7065 | obj.idle_timeout = reader.read("!H")[0] |
| 7066 | obj.hard_timeout = reader.read("!H")[0] |
| 7067 | obj.priority = reader.read("!H")[0] |
| 7068 | obj.buffer_id = reader.read("!L")[0] |
| 7069 | obj.out_port = util.unpack_port_no(reader) |
| 7070 | obj.out_group = reader.read("!L")[0] |
| 7071 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7072 | reader.skip(2) |
| 7073 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7074 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7075 | return obj |
| 7076 | |
| 7077 | def __eq__(self, other): |
| 7078 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7079 | if self.xid != other.xid: return False |
| 7080 | if self.cookie != other.cookie: return False |
| 7081 | if self.cookie_mask != other.cookie_mask: return False |
| 7082 | if self.table_id != other.table_id: return False |
| 7083 | if self.idle_timeout != other.idle_timeout: return False |
| 7084 | if self.hard_timeout != other.hard_timeout: return False |
| 7085 | if self.priority != other.priority: return False |
| 7086 | if self.buffer_id != other.buffer_id: return False |
| 7087 | if self.out_port != other.out_port: return False |
| 7088 | if self.out_group != other.out_group: return False |
| 7089 | if self.flags != other.flags: return False |
| 7090 | if self.match != other.match: return False |
| 7091 | if self.instructions != other.instructions: return False |
| 7092 | return True |
| 7093 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7094 | def pretty_print(self, q): |
| 7095 | q.text("flow_add {") |
| 7096 | with q.group(): |
| 7097 | with q.indent(2): |
| 7098 | q.breakable() |
| 7099 | q.text("xid = "); |
| 7100 | if self.xid != None: |
| 7101 | q.text("%#x" % self.xid) |
| 7102 | else: |
| 7103 | q.text('None') |
| 7104 | q.text(","); q.breakable() |
| 7105 | q.text("cookie = "); |
| 7106 | q.text("%#x" % self.cookie) |
| 7107 | q.text(","); q.breakable() |
| 7108 | q.text("cookie_mask = "); |
| 7109 | q.text("%#x" % self.cookie_mask) |
| 7110 | q.text(","); q.breakable() |
| 7111 | q.text("table_id = "); |
| 7112 | q.text("%#x" % self.table_id) |
| 7113 | q.text(","); q.breakable() |
| 7114 | q.text("idle_timeout = "); |
| 7115 | q.text("%#x" % self.idle_timeout) |
| 7116 | q.text(","); q.breakable() |
| 7117 | q.text("hard_timeout = "); |
| 7118 | q.text("%#x" % self.hard_timeout) |
| 7119 | q.text(","); q.breakable() |
| 7120 | q.text("priority = "); |
| 7121 | q.text("%#x" % self.priority) |
| 7122 | q.text(","); q.breakable() |
| 7123 | q.text("buffer_id = "); |
| 7124 | q.text("%#x" % self.buffer_id) |
| 7125 | q.text(","); q.breakable() |
| 7126 | q.text("out_port = "); |
| 7127 | q.text(util.pretty_port(self.out_port)) |
| 7128 | q.text(","); q.breakable() |
| 7129 | q.text("out_group = "); |
| 7130 | q.text("%#x" % self.out_group) |
| 7131 | q.text(","); q.breakable() |
| 7132 | q.text("flags = "); |
| 7133 | q.text("%#x" % self.flags) |
| 7134 | q.text(","); q.breakable() |
| 7135 | q.text("match = "); |
| 7136 | q.pp(self.match) |
| 7137 | q.text(","); q.breakable() |
| 7138 | q.text("instructions = "); |
| 7139 | q.pp(self.instructions) |
| 7140 | q.breakable() |
| 7141 | q.text('}') |
| 7142 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7143 | flow_mod.subtypes[0] = flow_add |
| 7144 | |
| 7145 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7146 | version = 4 |
| 7147 | type = 14 |
| 7148 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7149 | |
| 7150 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7151 | if xid != None: |
| 7152 | self.xid = xid |
| 7153 | else: |
| 7154 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7155 | if cookie != None: |
| 7156 | self.cookie = cookie |
| 7157 | else: |
| 7158 | self.cookie = 0 |
| 7159 | if cookie_mask != None: |
| 7160 | self.cookie_mask = cookie_mask |
| 7161 | else: |
| 7162 | self.cookie_mask = 0 |
| 7163 | if table_id != None: |
| 7164 | self.table_id = table_id |
| 7165 | else: |
| 7166 | self.table_id = 0 |
| 7167 | if idle_timeout != None: |
| 7168 | self.idle_timeout = idle_timeout |
| 7169 | else: |
| 7170 | self.idle_timeout = 0 |
| 7171 | if hard_timeout != None: |
| 7172 | self.hard_timeout = hard_timeout |
| 7173 | else: |
| 7174 | self.hard_timeout = 0 |
| 7175 | if priority != None: |
| 7176 | self.priority = priority |
| 7177 | else: |
| 7178 | self.priority = 0 |
| 7179 | if buffer_id != None: |
| 7180 | self.buffer_id = buffer_id |
| 7181 | else: |
| 7182 | self.buffer_id = 0 |
| 7183 | if out_port != None: |
| 7184 | self.out_port = out_port |
| 7185 | else: |
| 7186 | self.out_port = 0 |
| 7187 | if out_group != None: |
| 7188 | self.out_group = out_group |
| 7189 | else: |
| 7190 | self.out_group = 0 |
| 7191 | if flags != None: |
| 7192 | self.flags = flags |
| 7193 | else: |
| 7194 | self.flags = 0 |
| 7195 | if match != None: |
| 7196 | self.match = match |
| 7197 | else: |
| 7198 | self.match = common.match() |
| 7199 | if instructions != None: |
| 7200 | self.instructions = instructions |
| 7201 | else: |
| 7202 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7203 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7204 | |
| 7205 | def pack(self): |
| 7206 | packed = [] |
| 7207 | packed.append(struct.pack("!B", self.version)) |
| 7208 | packed.append(struct.pack("!B", self.type)) |
| 7209 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7210 | packed.append(struct.pack("!L", self.xid)) |
| 7211 | packed.append(struct.pack("!Q", self.cookie)) |
| 7212 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7213 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7214 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7215 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7216 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7217 | packed.append(struct.pack("!H", self.priority)) |
| 7218 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7219 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7220 | packed.append(struct.pack("!L", self.out_group)) |
| 7221 | packed.append(struct.pack("!H", self.flags)) |
| 7222 | packed.append('\x00' * 2) |
| 7223 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7224 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7225 | length = sum([len(x) for x in packed]) |
| 7226 | packed[2] = struct.pack("!H", length) |
| 7227 | return ''.join(packed) |
| 7228 | |
| 7229 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7230 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7231 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7232 | _version = reader.read("!B")[0] |
| 7233 | assert(_version == 4) |
| 7234 | _type = reader.read("!B")[0] |
| 7235 | assert(_type == 14) |
| 7236 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7237 | orig_reader = reader |
| 7238 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7239 | obj.xid = reader.read("!L")[0] |
| 7240 | obj.cookie = reader.read("!Q")[0] |
| 7241 | obj.cookie_mask = reader.read("!Q")[0] |
| 7242 | obj.table_id = reader.read("!B")[0] |
| 7243 | __command = util.unpack_fm_cmd(reader) |
| 7244 | assert(__command == 3) |
| 7245 | obj.idle_timeout = reader.read("!H")[0] |
| 7246 | obj.hard_timeout = reader.read("!H")[0] |
| 7247 | obj.priority = reader.read("!H")[0] |
| 7248 | obj.buffer_id = reader.read("!L")[0] |
| 7249 | obj.out_port = util.unpack_port_no(reader) |
| 7250 | obj.out_group = reader.read("!L")[0] |
| 7251 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7252 | reader.skip(2) |
| 7253 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7254 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7255 | return obj |
| 7256 | |
| 7257 | def __eq__(self, other): |
| 7258 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7259 | if self.xid != other.xid: return False |
| 7260 | if self.cookie != other.cookie: return False |
| 7261 | if self.cookie_mask != other.cookie_mask: return False |
| 7262 | if self.table_id != other.table_id: return False |
| 7263 | if self.idle_timeout != other.idle_timeout: return False |
| 7264 | if self.hard_timeout != other.hard_timeout: return False |
| 7265 | if self.priority != other.priority: return False |
| 7266 | if self.buffer_id != other.buffer_id: return False |
| 7267 | if self.out_port != other.out_port: return False |
| 7268 | if self.out_group != other.out_group: return False |
| 7269 | if self.flags != other.flags: return False |
| 7270 | if self.match != other.match: return False |
| 7271 | if self.instructions != other.instructions: return False |
| 7272 | return True |
| 7273 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7274 | def pretty_print(self, q): |
| 7275 | q.text("flow_delete {") |
| 7276 | with q.group(): |
| 7277 | with q.indent(2): |
| 7278 | q.breakable() |
| 7279 | q.text("xid = "); |
| 7280 | if self.xid != None: |
| 7281 | q.text("%#x" % self.xid) |
| 7282 | else: |
| 7283 | q.text('None') |
| 7284 | q.text(","); q.breakable() |
| 7285 | q.text("cookie = "); |
| 7286 | q.text("%#x" % self.cookie) |
| 7287 | q.text(","); q.breakable() |
| 7288 | q.text("cookie_mask = "); |
| 7289 | q.text("%#x" % self.cookie_mask) |
| 7290 | q.text(","); q.breakable() |
| 7291 | q.text("table_id = "); |
| 7292 | q.text("%#x" % self.table_id) |
| 7293 | q.text(","); q.breakable() |
| 7294 | q.text("idle_timeout = "); |
| 7295 | q.text("%#x" % self.idle_timeout) |
| 7296 | q.text(","); q.breakable() |
| 7297 | q.text("hard_timeout = "); |
| 7298 | q.text("%#x" % self.hard_timeout) |
| 7299 | q.text(","); q.breakable() |
| 7300 | q.text("priority = "); |
| 7301 | q.text("%#x" % self.priority) |
| 7302 | q.text(","); q.breakable() |
| 7303 | q.text("buffer_id = "); |
| 7304 | q.text("%#x" % self.buffer_id) |
| 7305 | q.text(","); q.breakable() |
| 7306 | q.text("out_port = "); |
| 7307 | q.text(util.pretty_port(self.out_port)) |
| 7308 | q.text(","); q.breakable() |
| 7309 | q.text("out_group = "); |
| 7310 | q.text("%#x" % self.out_group) |
| 7311 | q.text(","); q.breakable() |
| 7312 | q.text("flags = "); |
| 7313 | q.text("%#x" % self.flags) |
| 7314 | q.text(","); q.breakable() |
| 7315 | q.text("match = "); |
| 7316 | q.pp(self.match) |
| 7317 | q.text(","); q.breakable() |
| 7318 | q.text("instructions = "); |
| 7319 | q.pp(self.instructions) |
| 7320 | q.breakable() |
| 7321 | q.text('}') |
| 7322 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7323 | flow_mod.subtypes[3] = flow_delete |
| 7324 | |
| 7325 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7326 | version = 4 |
| 7327 | type = 14 |
| 7328 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7329 | |
| 7330 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7331 | if xid != None: |
| 7332 | self.xid = xid |
| 7333 | else: |
| 7334 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7335 | if cookie != None: |
| 7336 | self.cookie = cookie |
| 7337 | else: |
| 7338 | self.cookie = 0 |
| 7339 | if cookie_mask != None: |
| 7340 | self.cookie_mask = cookie_mask |
| 7341 | else: |
| 7342 | self.cookie_mask = 0 |
| 7343 | if table_id != None: |
| 7344 | self.table_id = table_id |
| 7345 | else: |
| 7346 | self.table_id = 0 |
| 7347 | if idle_timeout != None: |
| 7348 | self.idle_timeout = idle_timeout |
| 7349 | else: |
| 7350 | self.idle_timeout = 0 |
| 7351 | if hard_timeout != None: |
| 7352 | self.hard_timeout = hard_timeout |
| 7353 | else: |
| 7354 | self.hard_timeout = 0 |
| 7355 | if priority != None: |
| 7356 | self.priority = priority |
| 7357 | else: |
| 7358 | self.priority = 0 |
| 7359 | if buffer_id != None: |
| 7360 | self.buffer_id = buffer_id |
| 7361 | else: |
| 7362 | self.buffer_id = 0 |
| 7363 | if out_port != None: |
| 7364 | self.out_port = out_port |
| 7365 | else: |
| 7366 | self.out_port = 0 |
| 7367 | if out_group != None: |
| 7368 | self.out_group = out_group |
| 7369 | else: |
| 7370 | self.out_group = 0 |
| 7371 | if flags != None: |
| 7372 | self.flags = flags |
| 7373 | else: |
| 7374 | self.flags = 0 |
| 7375 | if match != None: |
| 7376 | self.match = match |
| 7377 | else: |
| 7378 | self.match = common.match() |
| 7379 | if instructions != None: |
| 7380 | self.instructions = instructions |
| 7381 | else: |
| 7382 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7383 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7384 | |
| 7385 | def pack(self): |
| 7386 | packed = [] |
| 7387 | packed.append(struct.pack("!B", self.version)) |
| 7388 | packed.append(struct.pack("!B", self.type)) |
| 7389 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7390 | packed.append(struct.pack("!L", self.xid)) |
| 7391 | packed.append(struct.pack("!Q", self.cookie)) |
| 7392 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7393 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7394 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7395 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7396 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7397 | packed.append(struct.pack("!H", self.priority)) |
| 7398 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7399 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7400 | packed.append(struct.pack("!L", self.out_group)) |
| 7401 | packed.append(struct.pack("!H", self.flags)) |
| 7402 | packed.append('\x00' * 2) |
| 7403 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7404 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7405 | length = sum([len(x) for x in packed]) |
| 7406 | packed[2] = struct.pack("!H", length) |
| 7407 | return ''.join(packed) |
| 7408 | |
| 7409 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7410 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7411 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7412 | _version = reader.read("!B")[0] |
| 7413 | assert(_version == 4) |
| 7414 | _type = reader.read("!B")[0] |
| 7415 | assert(_type == 14) |
| 7416 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7417 | orig_reader = reader |
| 7418 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7419 | obj.xid = reader.read("!L")[0] |
| 7420 | obj.cookie = reader.read("!Q")[0] |
| 7421 | obj.cookie_mask = reader.read("!Q")[0] |
| 7422 | obj.table_id = reader.read("!B")[0] |
| 7423 | __command = util.unpack_fm_cmd(reader) |
| 7424 | assert(__command == 4) |
| 7425 | obj.idle_timeout = reader.read("!H")[0] |
| 7426 | obj.hard_timeout = reader.read("!H")[0] |
| 7427 | obj.priority = reader.read("!H")[0] |
| 7428 | obj.buffer_id = reader.read("!L")[0] |
| 7429 | obj.out_port = util.unpack_port_no(reader) |
| 7430 | obj.out_group = reader.read("!L")[0] |
| 7431 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7432 | reader.skip(2) |
| 7433 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7434 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7435 | return obj |
| 7436 | |
| 7437 | def __eq__(self, other): |
| 7438 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7439 | if self.xid != other.xid: return False |
| 7440 | if self.cookie != other.cookie: return False |
| 7441 | if self.cookie_mask != other.cookie_mask: return False |
| 7442 | if self.table_id != other.table_id: return False |
| 7443 | if self.idle_timeout != other.idle_timeout: return False |
| 7444 | if self.hard_timeout != other.hard_timeout: return False |
| 7445 | if self.priority != other.priority: return False |
| 7446 | if self.buffer_id != other.buffer_id: return False |
| 7447 | if self.out_port != other.out_port: return False |
| 7448 | if self.out_group != other.out_group: return False |
| 7449 | if self.flags != other.flags: return False |
| 7450 | if self.match != other.match: return False |
| 7451 | if self.instructions != other.instructions: return False |
| 7452 | return True |
| 7453 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7454 | def pretty_print(self, q): |
| 7455 | q.text("flow_delete_strict {") |
| 7456 | with q.group(): |
| 7457 | with q.indent(2): |
| 7458 | q.breakable() |
| 7459 | q.text("xid = "); |
| 7460 | if self.xid != None: |
| 7461 | q.text("%#x" % self.xid) |
| 7462 | else: |
| 7463 | q.text('None') |
| 7464 | q.text(","); q.breakable() |
| 7465 | q.text("cookie = "); |
| 7466 | q.text("%#x" % self.cookie) |
| 7467 | q.text(","); q.breakable() |
| 7468 | q.text("cookie_mask = "); |
| 7469 | q.text("%#x" % self.cookie_mask) |
| 7470 | q.text(","); q.breakable() |
| 7471 | q.text("table_id = "); |
| 7472 | q.text("%#x" % self.table_id) |
| 7473 | q.text(","); q.breakable() |
| 7474 | q.text("idle_timeout = "); |
| 7475 | q.text("%#x" % self.idle_timeout) |
| 7476 | q.text(","); q.breakable() |
| 7477 | q.text("hard_timeout = "); |
| 7478 | q.text("%#x" % self.hard_timeout) |
| 7479 | q.text(","); q.breakable() |
| 7480 | q.text("priority = "); |
| 7481 | q.text("%#x" % self.priority) |
| 7482 | q.text(","); q.breakable() |
| 7483 | q.text("buffer_id = "); |
| 7484 | q.text("%#x" % self.buffer_id) |
| 7485 | q.text(","); q.breakable() |
| 7486 | q.text("out_port = "); |
| 7487 | q.text(util.pretty_port(self.out_port)) |
| 7488 | q.text(","); q.breakable() |
| 7489 | q.text("out_group = "); |
| 7490 | q.text("%#x" % self.out_group) |
| 7491 | q.text(","); q.breakable() |
| 7492 | q.text("flags = "); |
| 7493 | q.text("%#x" % self.flags) |
| 7494 | q.text(","); q.breakable() |
| 7495 | q.text("match = "); |
| 7496 | q.pp(self.match) |
| 7497 | q.text(","); q.breakable() |
| 7498 | q.text("instructions = "); |
| 7499 | q.pp(self.instructions) |
| 7500 | q.breakable() |
| 7501 | q.text('}') |
| 7502 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7503 | flow_mod.subtypes[4] = flow_delete_strict |
| 7504 | |
| 7505 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7506 | version = 4 |
| 7507 | type = 1 |
| 7508 | err_type = 5 |
| 7509 | |
| 7510 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7511 | if xid != None: |
| 7512 | self.xid = xid |
| 7513 | else: |
| 7514 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7515 | if code != None: |
| 7516 | self.code = code |
| 7517 | else: |
| 7518 | self.code = 0 |
| 7519 | if data != None: |
| 7520 | self.data = data |
| 7521 | else: |
| 7522 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7523 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7524 | |
| 7525 | def pack(self): |
| 7526 | packed = [] |
| 7527 | packed.append(struct.pack("!B", self.version)) |
| 7528 | packed.append(struct.pack("!B", self.type)) |
| 7529 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7530 | packed.append(struct.pack("!L", self.xid)) |
| 7531 | packed.append(struct.pack("!H", self.err_type)) |
| 7532 | packed.append(struct.pack("!H", self.code)) |
| 7533 | packed.append(self.data) |
| 7534 | length = sum([len(x) for x in packed]) |
| 7535 | packed[2] = struct.pack("!H", length) |
| 7536 | return ''.join(packed) |
| 7537 | |
| 7538 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7539 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7540 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7541 | _version = reader.read("!B")[0] |
| 7542 | assert(_version == 4) |
| 7543 | _type = reader.read("!B")[0] |
| 7544 | assert(_type == 1) |
| 7545 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7546 | orig_reader = reader |
| 7547 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7548 | obj.xid = reader.read("!L")[0] |
| 7549 | _err_type = reader.read("!H")[0] |
| 7550 | assert(_err_type == 5) |
| 7551 | obj.code = reader.read("!H")[0] |
| 7552 | obj.data = str(reader.read_all()) |
| 7553 | return obj |
| 7554 | |
| 7555 | def __eq__(self, other): |
| 7556 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7557 | if self.xid != other.xid: return False |
| 7558 | if self.code != other.code: return False |
| 7559 | if self.data != other.data: return False |
| 7560 | return True |
| 7561 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7562 | def pretty_print(self, q): |
| 7563 | q.text("flow_mod_failed_error_msg {") |
| 7564 | with q.group(): |
| 7565 | with q.indent(2): |
| 7566 | q.breakable() |
| 7567 | q.text("xid = "); |
| 7568 | if self.xid != None: |
| 7569 | q.text("%#x" % self.xid) |
| 7570 | else: |
| 7571 | q.text('None') |
| 7572 | q.text(","); q.breakable() |
| 7573 | q.text("code = "); |
| 7574 | q.text("%#x" % self.code) |
| 7575 | q.text(","); q.breakable() |
| 7576 | q.text("data = "); |
| 7577 | q.pp(self.data) |
| 7578 | q.breakable() |
| 7579 | q.text('}') |
| 7580 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7581 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 7582 | |
| 7583 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7584 | version = 4 |
| 7585 | type = 14 |
| 7586 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7587 | |
| 7588 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7589 | if xid != None: |
| 7590 | self.xid = xid |
| 7591 | else: |
| 7592 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7593 | if cookie != None: |
| 7594 | self.cookie = cookie |
| 7595 | else: |
| 7596 | self.cookie = 0 |
| 7597 | if cookie_mask != None: |
| 7598 | self.cookie_mask = cookie_mask |
| 7599 | else: |
| 7600 | self.cookie_mask = 0 |
| 7601 | if table_id != None: |
| 7602 | self.table_id = table_id |
| 7603 | else: |
| 7604 | self.table_id = 0 |
| 7605 | if idle_timeout != None: |
| 7606 | self.idle_timeout = idle_timeout |
| 7607 | else: |
| 7608 | self.idle_timeout = 0 |
| 7609 | if hard_timeout != None: |
| 7610 | self.hard_timeout = hard_timeout |
| 7611 | else: |
| 7612 | self.hard_timeout = 0 |
| 7613 | if priority != None: |
| 7614 | self.priority = priority |
| 7615 | else: |
| 7616 | self.priority = 0 |
| 7617 | if buffer_id != None: |
| 7618 | self.buffer_id = buffer_id |
| 7619 | else: |
| 7620 | self.buffer_id = 0 |
| 7621 | if out_port != None: |
| 7622 | self.out_port = out_port |
| 7623 | else: |
| 7624 | self.out_port = 0 |
| 7625 | if out_group != None: |
| 7626 | self.out_group = out_group |
| 7627 | else: |
| 7628 | self.out_group = 0 |
| 7629 | if flags != None: |
| 7630 | self.flags = flags |
| 7631 | else: |
| 7632 | self.flags = 0 |
| 7633 | if match != None: |
| 7634 | self.match = match |
| 7635 | else: |
| 7636 | self.match = common.match() |
| 7637 | if instructions != None: |
| 7638 | self.instructions = instructions |
| 7639 | else: |
| 7640 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7641 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7642 | |
| 7643 | def pack(self): |
| 7644 | packed = [] |
| 7645 | packed.append(struct.pack("!B", self.version)) |
| 7646 | packed.append(struct.pack("!B", self.type)) |
| 7647 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7648 | packed.append(struct.pack("!L", self.xid)) |
| 7649 | packed.append(struct.pack("!Q", self.cookie)) |
| 7650 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7651 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7652 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7653 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7654 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7655 | packed.append(struct.pack("!H", self.priority)) |
| 7656 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7657 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7658 | packed.append(struct.pack("!L", self.out_group)) |
| 7659 | packed.append(struct.pack("!H", self.flags)) |
| 7660 | packed.append('\x00' * 2) |
| 7661 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7662 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7663 | length = sum([len(x) for x in packed]) |
| 7664 | packed[2] = struct.pack("!H", length) |
| 7665 | return ''.join(packed) |
| 7666 | |
| 7667 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7668 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7669 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7670 | _version = reader.read("!B")[0] |
| 7671 | assert(_version == 4) |
| 7672 | _type = reader.read("!B")[0] |
| 7673 | assert(_type == 14) |
| 7674 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7675 | orig_reader = reader |
| 7676 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7677 | obj.xid = reader.read("!L")[0] |
| 7678 | obj.cookie = reader.read("!Q")[0] |
| 7679 | obj.cookie_mask = reader.read("!Q")[0] |
| 7680 | obj.table_id = reader.read("!B")[0] |
| 7681 | __command = util.unpack_fm_cmd(reader) |
| 7682 | assert(__command == 1) |
| 7683 | obj.idle_timeout = reader.read("!H")[0] |
| 7684 | obj.hard_timeout = reader.read("!H")[0] |
| 7685 | obj.priority = reader.read("!H")[0] |
| 7686 | obj.buffer_id = reader.read("!L")[0] |
| 7687 | obj.out_port = util.unpack_port_no(reader) |
| 7688 | obj.out_group = reader.read("!L")[0] |
| 7689 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7690 | reader.skip(2) |
| 7691 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7692 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7693 | return obj |
| 7694 | |
| 7695 | def __eq__(self, other): |
| 7696 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7697 | if self.xid != other.xid: return False |
| 7698 | if self.cookie != other.cookie: return False |
| 7699 | if self.cookie_mask != other.cookie_mask: return False |
| 7700 | if self.table_id != other.table_id: return False |
| 7701 | if self.idle_timeout != other.idle_timeout: return False |
| 7702 | if self.hard_timeout != other.hard_timeout: return False |
| 7703 | if self.priority != other.priority: return False |
| 7704 | if self.buffer_id != other.buffer_id: return False |
| 7705 | if self.out_port != other.out_port: return False |
| 7706 | if self.out_group != other.out_group: return False |
| 7707 | if self.flags != other.flags: return False |
| 7708 | if self.match != other.match: return False |
| 7709 | if self.instructions != other.instructions: return False |
| 7710 | return True |
| 7711 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7712 | def pretty_print(self, q): |
| 7713 | q.text("flow_modify {") |
| 7714 | with q.group(): |
| 7715 | with q.indent(2): |
| 7716 | q.breakable() |
| 7717 | q.text("xid = "); |
| 7718 | if self.xid != None: |
| 7719 | q.text("%#x" % self.xid) |
| 7720 | else: |
| 7721 | q.text('None') |
| 7722 | q.text(","); q.breakable() |
| 7723 | q.text("cookie = "); |
| 7724 | q.text("%#x" % self.cookie) |
| 7725 | q.text(","); q.breakable() |
| 7726 | q.text("cookie_mask = "); |
| 7727 | q.text("%#x" % self.cookie_mask) |
| 7728 | q.text(","); q.breakable() |
| 7729 | q.text("table_id = "); |
| 7730 | q.text("%#x" % self.table_id) |
| 7731 | q.text(","); q.breakable() |
| 7732 | q.text("idle_timeout = "); |
| 7733 | q.text("%#x" % self.idle_timeout) |
| 7734 | q.text(","); q.breakable() |
| 7735 | q.text("hard_timeout = "); |
| 7736 | q.text("%#x" % self.hard_timeout) |
| 7737 | q.text(","); q.breakable() |
| 7738 | q.text("priority = "); |
| 7739 | q.text("%#x" % self.priority) |
| 7740 | q.text(","); q.breakable() |
| 7741 | q.text("buffer_id = "); |
| 7742 | q.text("%#x" % self.buffer_id) |
| 7743 | q.text(","); q.breakable() |
| 7744 | q.text("out_port = "); |
| 7745 | q.text(util.pretty_port(self.out_port)) |
| 7746 | q.text(","); q.breakable() |
| 7747 | q.text("out_group = "); |
| 7748 | q.text("%#x" % self.out_group) |
| 7749 | q.text(","); q.breakable() |
| 7750 | q.text("flags = "); |
| 7751 | q.text("%#x" % self.flags) |
| 7752 | q.text(","); q.breakable() |
| 7753 | q.text("match = "); |
| 7754 | q.pp(self.match) |
| 7755 | q.text(","); q.breakable() |
| 7756 | q.text("instructions = "); |
| 7757 | q.pp(self.instructions) |
| 7758 | q.breakable() |
| 7759 | q.text('}') |
| 7760 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7761 | flow_mod.subtypes[1] = flow_modify |
| 7762 | |
| 7763 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7764 | version = 4 |
| 7765 | type = 14 |
| 7766 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7767 | |
| 7768 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7769 | if xid != None: |
| 7770 | self.xid = xid |
| 7771 | else: |
| 7772 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7773 | if cookie != None: |
| 7774 | self.cookie = cookie |
| 7775 | else: |
| 7776 | self.cookie = 0 |
| 7777 | if cookie_mask != None: |
| 7778 | self.cookie_mask = cookie_mask |
| 7779 | else: |
| 7780 | self.cookie_mask = 0 |
| 7781 | if table_id != None: |
| 7782 | self.table_id = table_id |
| 7783 | else: |
| 7784 | self.table_id = 0 |
| 7785 | if idle_timeout != None: |
| 7786 | self.idle_timeout = idle_timeout |
| 7787 | else: |
| 7788 | self.idle_timeout = 0 |
| 7789 | if hard_timeout != None: |
| 7790 | self.hard_timeout = hard_timeout |
| 7791 | else: |
| 7792 | self.hard_timeout = 0 |
| 7793 | if priority != None: |
| 7794 | self.priority = priority |
| 7795 | else: |
| 7796 | self.priority = 0 |
| 7797 | if buffer_id != None: |
| 7798 | self.buffer_id = buffer_id |
| 7799 | else: |
| 7800 | self.buffer_id = 0 |
| 7801 | if out_port != None: |
| 7802 | self.out_port = out_port |
| 7803 | else: |
| 7804 | self.out_port = 0 |
| 7805 | if out_group != None: |
| 7806 | self.out_group = out_group |
| 7807 | else: |
| 7808 | self.out_group = 0 |
| 7809 | if flags != None: |
| 7810 | self.flags = flags |
| 7811 | else: |
| 7812 | self.flags = 0 |
| 7813 | if match != None: |
| 7814 | self.match = match |
| 7815 | else: |
| 7816 | self.match = common.match() |
| 7817 | if instructions != None: |
| 7818 | self.instructions = instructions |
| 7819 | else: |
| 7820 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7821 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7822 | |
| 7823 | def pack(self): |
| 7824 | packed = [] |
| 7825 | packed.append(struct.pack("!B", self.version)) |
| 7826 | packed.append(struct.pack("!B", self.type)) |
| 7827 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7828 | packed.append(struct.pack("!L", self.xid)) |
| 7829 | packed.append(struct.pack("!Q", self.cookie)) |
| 7830 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 7831 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7832 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7833 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7834 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7835 | packed.append(struct.pack("!H", self.priority)) |
| 7836 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7837 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7838 | packed.append(struct.pack("!L", self.out_group)) |
| 7839 | packed.append(struct.pack("!H", self.flags)) |
| 7840 | packed.append('\x00' * 2) |
| 7841 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7842 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7843 | length = sum([len(x) for x in packed]) |
| 7844 | packed[2] = struct.pack("!H", length) |
| 7845 | return ''.join(packed) |
| 7846 | |
| 7847 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7848 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7849 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7850 | _version = reader.read("!B")[0] |
| 7851 | assert(_version == 4) |
| 7852 | _type = reader.read("!B")[0] |
| 7853 | assert(_type == 14) |
| 7854 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7855 | orig_reader = reader |
| 7856 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7857 | obj.xid = reader.read("!L")[0] |
| 7858 | obj.cookie = reader.read("!Q")[0] |
| 7859 | obj.cookie_mask = reader.read("!Q")[0] |
| 7860 | obj.table_id = reader.read("!B")[0] |
| 7861 | __command = util.unpack_fm_cmd(reader) |
| 7862 | assert(__command == 2) |
| 7863 | obj.idle_timeout = reader.read("!H")[0] |
| 7864 | obj.hard_timeout = reader.read("!H")[0] |
| 7865 | obj.priority = reader.read("!H")[0] |
| 7866 | obj.buffer_id = reader.read("!L")[0] |
| 7867 | obj.out_port = util.unpack_port_no(reader) |
| 7868 | obj.out_group = reader.read("!L")[0] |
| 7869 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7870 | reader.skip(2) |
| 7871 | obj.match = common.match.unpack(reader) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7872 | obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7873 | return obj |
| 7874 | |
| 7875 | def __eq__(self, other): |
| 7876 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7877 | if self.xid != other.xid: return False |
| 7878 | if self.cookie != other.cookie: return False |
| 7879 | if self.cookie_mask != other.cookie_mask: return False |
| 7880 | if self.table_id != other.table_id: return False |
| 7881 | if self.idle_timeout != other.idle_timeout: return False |
| 7882 | if self.hard_timeout != other.hard_timeout: return False |
| 7883 | if self.priority != other.priority: return False |
| 7884 | if self.buffer_id != other.buffer_id: return False |
| 7885 | if self.out_port != other.out_port: return False |
| 7886 | if self.out_group != other.out_group: return False |
| 7887 | if self.flags != other.flags: return False |
| 7888 | if self.match != other.match: return False |
| 7889 | if self.instructions != other.instructions: return False |
| 7890 | return True |
| 7891 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7892 | def pretty_print(self, q): |
| 7893 | q.text("flow_modify_strict {") |
| 7894 | with q.group(): |
| 7895 | with q.indent(2): |
| 7896 | q.breakable() |
| 7897 | q.text("xid = "); |
| 7898 | if self.xid != None: |
| 7899 | q.text("%#x" % self.xid) |
| 7900 | else: |
| 7901 | q.text('None') |
| 7902 | q.text(","); q.breakable() |
| 7903 | q.text("cookie = "); |
| 7904 | q.text("%#x" % self.cookie) |
| 7905 | q.text(","); q.breakable() |
| 7906 | q.text("cookie_mask = "); |
| 7907 | q.text("%#x" % self.cookie_mask) |
| 7908 | q.text(","); q.breakable() |
| 7909 | q.text("table_id = "); |
| 7910 | q.text("%#x" % self.table_id) |
| 7911 | q.text(","); q.breakable() |
| 7912 | q.text("idle_timeout = "); |
| 7913 | q.text("%#x" % self.idle_timeout) |
| 7914 | q.text(","); q.breakable() |
| 7915 | q.text("hard_timeout = "); |
| 7916 | q.text("%#x" % self.hard_timeout) |
| 7917 | q.text(","); q.breakable() |
| 7918 | q.text("priority = "); |
| 7919 | q.text("%#x" % self.priority) |
| 7920 | q.text(","); q.breakable() |
| 7921 | q.text("buffer_id = "); |
| 7922 | q.text("%#x" % self.buffer_id) |
| 7923 | q.text(","); q.breakable() |
| 7924 | q.text("out_port = "); |
| 7925 | q.text(util.pretty_port(self.out_port)) |
| 7926 | q.text(","); q.breakable() |
| 7927 | q.text("out_group = "); |
| 7928 | q.text("%#x" % self.out_group) |
| 7929 | q.text(","); q.breakable() |
| 7930 | q.text("flags = "); |
| 7931 | q.text("%#x" % self.flags) |
| 7932 | q.text(","); q.breakable() |
| 7933 | q.text("match = "); |
| 7934 | q.pp(self.match) |
| 7935 | q.text(","); q.breakable() |
| 7936 | q.text("instructions = "); |
| 7937 | q.pp(self.instructions) |
| 7938 | q.breakable() |
| 7939 | q.text('}') |
| 7940 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7941 | flow_mod.subtypes[2] = flow_modify_strict |
| 7942 | |
| 7943 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7944 | version = 4 |
| 7945 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7946 | |
| 7947 | def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7948 | if xid != None: |
| 7949 | self.xid = xid |
| 7950 | else: |
| 7951 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7952 | if cookie != None: |
| 7953 | self.cookie = cookie |
| 7954 | else: |
| 7955 | self.cookie = 0 |
| 7956 | if priority != None: |
| 7957 | self.priority = priority |
| 7958 | else: |
| 7959 | self.priority = 0 |
| 7960 | if reason != None: |
| 7961 | self.reason = reason |
| 7962 | else: |
| 7963 | self.reason = 0 |
| 7964 | if table_id != None: |
| 7965 | self.table_id = table_id |
| 7966 | else: |
| 7967 | self.table_id = 0 |
| 7968 | if duration_sec != None: |
| 7969 | self.duration_sec = duration_sec |
| 7970 | else: |
| 7971 | self.duration_sec = 0 |
| 7972 | if duration_nsec != None: |
| 7973 | self.duration_nsec = duration_nsec |
| 7974 | else: |
| 7975 | self.duration_nsec = 0 |
| 7976 | if idle_timeout != None: |
| 7977 | self.idle_timeout = idle_timeout |
| 7978 | else: |
| 7979 | self.idle_timeout = 0 |
| 7980 | if hard_timeout != None: |
| 7981 | self.hard_timeout = hard_timeout |
| 7982 | else: |
| 7983 | self.hard_timeout = 0 |
| 7984 | if packet_count != None: |
| 7985 | self.packet_count = packet_count |
| 7986 | else: |
| 7987 | self.packet_count = 0 |
| 7988 | if byte_count != None: |
| 7989 | self.byte_count = byte_count |
| 7990 | else: |
| 7991 | self.byte_count = 0 |
| 7992 | if match != None: |
| 7993 | self.match = match |
| 7994 | else: |
| 7995 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7996 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7997 | |
| 7998 | def pack(self): |
| 7999 | packed = [] |
| 8000 | packed.append(struct.pack("!B", self.version)) |
| 8001 | packed.append(struct.pack("!B", self.type)) |
| 8002 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8003 | packed.append(struct.pack("!L", self.xid)) |
| 8004 | packed.append(struct.pack("!Q", self.cookie)) |
| 8005 | packed.append(struct.pack("!H", self.priority)) |
| 8006 | packed.append(struct.pack("!B", self.reason)) |
| 8007 | packed.append(struct.pack("!B", self.table_id)) |
| 8008 | packed.append(struct.pack("!L", self.duration_sec)) |
| 8009 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 8010 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 8011 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 8012 | packed.append(struct.pack("!Q", self.packet_count)) |
| 8013 | packed.append(struct.pack("!Q", self.byte_count)) |
| 8014 | packed.append(self.match.pack()) |
| 8015 | length = sum([len(x) for x in packed]) |
| 8016 | packed[2] = struct.pack("!H", length) |
| 8017 | return ''.join(packed) |
| 8018 | |
| 8019 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8020 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8021 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8022 | _version = reader.read("!B")[0] |
| 8023 | assert(_version == 4) |
| 8024 | _type = reader.read("!B")[0] |
| 8025 | assert(_type == 11) |
| 8026 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8027 | orig_reader = reader |
| 8028 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8029 | obj.xid = reader.read("!L")[0] |
| 8030 | obj.cookie = reader.read("!Q")[0] |
| 8031 | obj.priority = reader.read("!H")[0] |
| 8032 | obj.reason = reader.read("!B")[0] |
| 8033 | obj.table_id = reader.read("!B")[0] |
| 8034 | obj.duration_sec = reader.read("!L")[0] |
| 8035 | obj.duration_nsec = reader.read("!L")[0] |
| 8036 | obj.idle_timeout = reader.read("!H")[0] |
| 8037 | obj.hard_timeout = reader.read("!H")[0] |
| 8038 | obj.packet_count = reader.read("!Q")[0] |
| 8039 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8040 | obj.match = common.match.unpack(reader) |
| 8041 | return obj |
| 8042 | |
| 8043 | def __eq__(self, other): |
| 8044 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8045 | if self.xid != other.xid: return False |
| 8046 | if self.cookie != other.cookie: return False |
| 8047 | if self.priority != other.priority: return False |
| 8048 | if self.reason != other.reason: return False |
| 8049 | if self.table_id != other.table_id: return False |
| 8050 | if self.duration_sec != other.duration_sec: return False |
| 8051 | if self.duration_nsec != other.duration_nsec: return False |
| 8052 | if self.idle_timeout != other.idle_timeout: return False |
| 8053 | if self.hard_timeout != other.hard_timeout: return False |
| 8054 | if self.packet_count != other.packet_count: return False |
| 8055 | if self.byte_count != other.byte_count: return False |
| 8056 | if self.match != other.match: return False |
| 8057 | return True |
| 8058 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8059 | def pretty_print(self, q): |
| 8060 | q.text("flow_removed {") |
| 8061 | with q.group(): |
| 8062 | with q.indent(2): |
| 8063 | q.breakable() |
| 8064 | q.text("xid = "); |
| 8065 | if self.xid != None: |
| 8066 | q.text("%#x" % self.xid) |
| 8067 | else: |
| 8068 | q.text('None') |
| 8069 | q.text(","); q.breakable() |
| 8070 | q.text("cookie = "); |
| 8071 | q.text("%#x" % self.cookie) |
| 8072 | q.text(","); q.breakable() |
| 8073 | q.text("priority = "); |
| 8074 | q.text("%#x" % self.priority) |
| 8075 | q.text(","); q.breakable() |
| 8076 | q.text("reason = "); |
| 8077 | q.text("%#x" % self.reason) |
| 8078 | q.text(","); q.breakable() |
| 8079 | q.text("table_id = "); |
| 8080 | q.text("%#x" % self.table_id) |
| 8081 | q.text(","); q.breakable() |
| 8082 | q.text("duration_sec = "); |
| 8083 | q.text("%#x" % self.duration_sec) |
| 8084 | q.text(","); q.breakable() |
| 8085 | q.text("duration_nsec = "); |
| 8086 | q.text("%#x" % self.duration_nsec) |
| 8087 | q.text(","); q.breakable() |
| 8088 | q.text("idle_timeout = "); |
| 8089 | q.text("%#x" % self.idle_timeout) |
| 8090 | q.text(","); q.breakable() |
| 8091 | q.text("hard_timeout = "); |
| 8092 | q.text("%#x" % self.hard_timeout) |
| 8093 | q.text(","); q.breakable() |
| 8094 | q.text("packet_count = "); |
| 8095 | q.text("%#x" % self.packet_count) |
| 8096 | q.text(","); q.breakable() |
| 8097 | q.text("byte_count = "); |
| 8098 | q.text("%#x" % self.byte_count) |
| 8099 | q.text(","); q.breakable() |
| 8100 | q.text("match = "); |
| 8101 | q.pp(self.match) |
| 8102 | q.breakable() |
| 8103 | q.text('}') |
| 8104 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8105 | message.subtypes[11] = flow_removed |
| 8106 | |
| 8107 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8108 | version = 4 |
| 8109 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8110 | stats_type = 1 |
| 8111 | |
| 8112 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8113 | if xid != None: |
| 8114 | self.xid = xid |
| 8115 | else: |
| 8116 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8117 | if flags != None: |
| 8118 | self.flags = flags |
| 8119 | else: |
| 8120 | self.flags = 0 |
| 8121 | if entries != None: |
| 8122 | self.entries = entries |
| 8123 | else: |
| 8124 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8125 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8126 | |
| 8127 | def pack(self): |
| 8128 | packed = [] |
| 8129 | packed.append(struct.pack("!B", self.version)) |
| 8130 | packed.append(struct.pack("!B", self.type)) |
| 8131 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8132 | packed.append(struct.pack("!L", self.xid)) |
| 8133 | packed.append(struct.pack("!H", self.stats_type)) |
| 8134 | packed.append(struct.pack("!H", self.flags)) |
| 8135 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8136 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8137 | length = sum([len(x) for x in packed]) |
| 8138 | packed[2] = struct.pack("!H", length) |
| 8139 | return ''.join(packed) |
| 8140 | |
| 8141 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8142 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8143 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8144 | _version = reader.read("!B")[0] |
| 8145 | assert(_version == 4) |
| 8146 | _type = reader.read("!B")[0] |
| 8147 | assert(_type == 19) |
| 8148 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8149 | orig_reader = reader |
| 8150 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8151 | obj.xid = reader.read("!L")[0] |
| 8152 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8153 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8154 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8155 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8156 | obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8157 | return obj |
| 8158 | |
| 8159 | def __eq__(self, other): |
| 8160 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8161 | if self.xid != other.xid: return False |
| 8162 | if self.flags != other.flags: return False |
| 8163 | if self.entries != other.entries: return False |
| 8164 | return True |
| 8165 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8166 | def pretty_print(self, q): |
| 8167 | q.text("flow_stats_reply {") |
| 8168 | with q.group(): |
| 8169 | with q.indent(2): |
| 8170 | q.breakable() |
| 8171 | q.text("xid = "); |
| 8172 | if self.xid != None: |
| 8173 | q.text("%#x" % self.xid) |
| 8174 | else: |
| 8175 | q.text('None') |
| 8176 | q.text(","); q.breakable() |
| 8177 | q.text("flags = "); |
| 8178 | q.text("%#x" % self.flags) |
| 8179 | q.text(","); q.breakable() |
| 8180 | q.text("entries = "); |
| 8181 | q.pp(self.entries) |
| 8182 | q.breakable() |
| 8183 | q.text('}') |
| 8184 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8185 | stats_reply.subtypes[1] = flow_stats_reply |
| 8186 | |
| 8187 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8188 | version = 4 |
| 8189 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8190 | stats_type = 1 |
| 8191 | |
| 8192 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8193 | if xid != None: |
| 8194 | self.xid = xid |
| 8195 | else: |
| 8196 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8197 | if flags != None: |
| 8198 | self.flags = flags |
| 8199 | else: |
| 8200 | self.flags = 0 |
| 8201 | if table_id != None: |
| 8202 | self.table_id = table_id |
| 8203 | else: |
| 8204 | self.table_id = 0 |
| 8205 | if out_port != None: |
| 8206 | self.out_port = out_port |
| 8207 | else: |
| 8208 | self.out_port = 0 |
| 8209 | if out_group != None: |
| 8210 | self.out_group = out_group |
| 8211 | else: |
| 8212 | self.out_group = 0 |
| 8213 | if cookie != None: |
| 8214 | self.cookie = cookie |
| 8215 | else: |
| 8216 | self.cookie = 0 |
| 8217 | if cookie_mask != None: |
| 8218 | self.cookie_mask = cookie_mask |
| 8219 | else: |
| 8220 | self.cookie_mask = 0 |
| 8221 | if match != None: |
| 8222 | self.match = match |
| 8223 | else: |
| 8224 | self.match = common.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8225 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8226 | |
| 8227 | def pack(self): |
| 8228 | packed = [] |
| 8229 | packed.append(struct.pack("!B", self.version)) |
| 8230 | packed.append(struct.pack("!B", self.type)) |
| 8231 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8232 | packed.append(struct.pack("!L", self.xid)) |
| 8233 | packed.append(struct.pack("!H", self.stats_type)) |
| 8234 | packed.append(struct.pack("!H", self.flags)) |
| 8235 | packed.append('\x00' * 4) |
| 8236 | packed.append(struct.pack("!B", self.table_id)) |
| 8237 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8238 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8239 | packed.append(struct.pack("!L", self.out_group)) |
| 8240 | packed.append('\x00' * 4) |
| 8241 | packed.append(struct.pack("!Q", self.cookie)) |
| 8242 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 8243 | packed.append(self.match.pack()) |
| 8244 | length = sum([len(x) for x in packed]) |
| 8245 | packed[2] = struct.pack("!H", length) |
| 8246 | return ''.join(packed) |
| 8247 | |
| 8248 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8249 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8250 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8251 | _version = reader.read("!B")[0] |
| 8252 | assert(_version == 4) |
| 8253 | _type = reader.read("!B")[0] |
| 8254 | assert(_type == 18) |
| 8255 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8256 | orig_reader = reader |
| 8257 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8258 | obj.xid = reader.read("!L")[0] |
| 8259 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8260 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8261 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8262 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8263 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8264 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8265 | obj.out_port = util.unpack_port_no(reader) |
| 8266 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8267 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8268 | obj.cookie = reader.read("!Q")[0] |
| 8269 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8270 | obj.match = common.match.unpack(reader) |
| 8271 | return obj |
| 8272 | |
| 8273 | def __eq__(self, other): |
| 8274 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8275 | if self.xid != other.xid: return False |
| 8276 | if self.flags != other.flags: return False |
| 8277 | if self.table_id != other.table_id: return False |
| 8278 | if self.out_port != other.out_port: return False |
| 8279 | if self.out_group != other.out_group: return False |
| 8280 | if self.cookie != other.cookie: return False |
| 8281 | if self.cookie_mask != other.cookie_mask: return False |
| 8282 | if self.match != other.match: return False |
| 8283 | return True |
| 8284 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8285 | def pretty_print(self, q): |
| 8286 | q.text("flow_stats_request {") |
| 8287 | with q.group(): |
| 8288 | with q.indent(2): |
| 8289 | q.breakable() |
| 8290 | q.text("xid = "); |
| 8291 | if self.xid != None: |
| 8292 | q.text("%#x" % self.xid) |
| 8293 | else: |
| 8294 | q.text('None') |
| 8295 | q.text(","); q.breakable() |
| 8296 | q.text("flags = "); |
| 8297 | q.text("%#x" % self.flags) |
| 8298 | q.text(","); q.breakable() |
| 8299 | q.text("table_id = "); |
| 8300 | q.text("%#x" % self.table_id) |
| 8301 | q.text(","); q.breakable() |
| 8302 | q.text("out_port = "); |
| 8303 | q.text(util.pretty_port(self.out_port)) |
| 8304 | q.text(","); q.breakable() |
| 8305 | q.text("out_group = "); |
| 8306 | q.text("%#x" % self.out_group) |
| 8307 | q.text(","); q.breakable() |
| 8308 | q.text("cookie = "); |
| 8309 | q.text("%#x" % self.cookie) |
| 8310 | q.text(","); q.breakable() |
| 8311 | q.text("cookie_mask = "); |
| 8312 | q.text("%#x" % self.cookie_mask) |
| 8313 | q.text(","); q.breakable() |
| 8314 | q.text("match = "); |
| 8315 | q.pp(self.match) |
| 8316 | q.breakable() |
| 8317 | q.text('}') |
| 8318 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8319 | stats_request.subtypes[1] = flow_stats_request |
| 8320 | |
| 8321 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8322 | version = 4 |
| 8323 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8324 | |
| 8325 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8326 | if xid != None: |
| 8327 | self.xid = xid |
| 8328 | else: |
| 8329 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8330 | if flags != None: |
| 8331 | self.flags = flags |
| 8332 | else: |
| 8333 | self.flags = 0 |
| 8334 | if miss_send_len != None: |
| 8335 | self.miss_send_len = miss_send_len |
| 8336 | else: |
| 8337 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8338 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8339 | |
| 8340 | def pack(self): |
| 8341 | packed = [] |
| 8342 | packed.append(struct.pack("!B", self.version)) |
| 8343 | packed.append(struct.pack("!B", self.type)) |
| 8344 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8345 | packed.append(struct.pack("!L", self.xid)) |
| 8346 | packed.append(struct.pack("!H", self.flags)) |
| 8347 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 8348 | length = sum([len(x) for x in packed]) |
| 8349 | packed[2] = struct.pack("!H", length) |
| 8350 | return ''.join(packed) |
| 8351 | |
| 8352 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8353 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8354 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8355 | _version = reader.read("!B")[0] |
| 8356 | assert(_version == 4) |
| 8357 | _type = reader.read("!B")[0] |
| 8358 | assert(_type == 8) |
| 8359 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8360 | orig_reader = reader |
| 8361 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8362 | obj.xid = reader.read("!L")[0] |
| 8363 | obj.flags = reader.read("!H")[0] |
| 8364 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8365 | return obj |
| 8366 | |
| 8367 | def __eq__(self, other): |
| 8368 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8369 | if self.xid != other.xid: return False |
| 8370 | if self.flags != other.flags: return False |
| 8371 | if self.miss_send_len != other.miss_send_len: return False |
| 8372 | return True |
| 8373 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8374 | def pretty_print(self, q): |
| 8375 | q.text("get_config_reply {") |
| 8376 | with q.group(): |
| 8377 | with q.indent(2): |
| 8378 | q.breakable() |
| 8379 | q.text("xid = "); |
| 8380 | if self.xid != None: |
| 8381 | q.text("%#x" % self.xid) |
| 8382 | else: |
| 8383 | q.text('None') |
| 8384 | q.text(","); q.breakable() |
| 8385 | q.text("flags = "); |
| 8386 | q.text("%#x" % self.flags) |
| 8387 | q.text(","); q.breakable() |
| 8388 | q.text("miss_send_len = "); |
| 8389 | q.text("%#x" % self.miss_send_len) |
| 8390 | q.breakable() |
| 8391 | q.text('}') |
| 8392 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8393 | message.subtypes[8] = get_config_reply |
| 8394 | |
| 8395 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8396 | version = 4 |
| 8397 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8398 | |
| 8399 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8400 | if xid != None: |
| 8401 | self.xid = xid |
| 8402 | else: |
| 8403 | self.xid = None |
| 8404 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8405 | |
| 8406 | def pack(self): |
| 8407 | packed = [] |
| 8408 | packed.append(struct.pack("!B", self.version)) |
| 8409 | packed.append(struct.pack("!B", self.type)) |
| 8410 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8411 | packed.append(struct.pack("!L", self.xid)) |
| 8412 | length = sum([len(x) for x in packed]) |
| 8413 | packed[2] = struct.pack("!H", length) |
| 8414 | return ''.join(packed) |
| 8415 | |
| 8416 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8417 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8418 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8419 | _version = reader.read("!B")[0] |
| 8420 | assert(_version == 4) |
| 8421 | _type = reader.read("!B")[0] |
| 8422 | assert(_type == 7) |
| 8423 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8424 | orig_reader = reader |
| 8425 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8426 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8427 | return obj |
| 8428 | |
| 8429 | def __eq__(self, other): |
| 8430 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8431 | if self.xid != other.xid: return False |
| 8432 | return True |
| 8433 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8434 | def pretty_print(self, q): |
| 8435 | q.text("get_config_request {") |
| 8436 | with q.group(): |
| 8437 | with q.indent(2): |
| 8438 | q.breakable() |
| 8439 | q.text("xid = "); |
| 8440 | if self.xid != None: |
| 8441 | q.text("%#x" % self.xid) |
| 8442 | else: |
| 8443 | q.text('None') |
| 8444 | q.breakable() |
| 8445 | q.text('}') |
| 8446 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8447 | message.subtypes[7] = get_config_request |
| 8448 | |
| 8449 | class group_mod(message): |
| 8450 | subtypes = {} |
| 8451 | |
| 8452 | @staticmethod |
| 8453 | def unpack(reader): |
| 8454 | subtype, = reader.peek('!H', 8) |
| 8455 | try: |
| 8456 | subclass = group_mod.subtypes[subtype] |
| 8457 | except KeyError: |
| 8458 | raise loxi.ProtocolError("unknown group_mod message subtype %#x" % subtype) |
| 8459 | return subclass.unpack(reader) |
| 8460 | |
| 8461 | message.subtypes[15] = group_mod |
| 8462 | |
| 8463 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8464 | version = 4 |
| 8465 | type = 15 |
| 8466 | command = 0 |
| 8467 | |
| 8468 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8469 | if xid != None: |
| 8470 | self.xid = xid |
| 8471 | else: |
| 8472 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8473 | if group_type != None: |
| 8474 | self.group_type = group_type |
| 8475 | else: |
| 8476 | self.group_type = 0 |
| 8477 | if group_id != None: |
| 8478 | self.group_id = group_id |
| 8479 | else: |
| 8480 | self.group_id = 0 |
| 8481 | if buckets != None: |
| 8482 | self.buckets = buckets |
| 8483 | else: |
| 8484 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8485 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8486 | |
| 8487 | def pack(self): |
| 8488 | packed = [] |
| 8489 | packed.append(struct.pack("!B", self.version)) |
| 8490 | packed.append(struct.pack("!B", self.type)) |
| 8491 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8492 | packed.append(struct.pack("!L", self.xid)) |
| 8493 | packed.append(struct.pack("!H", self.command)) |
| 8494 | packed.append(struct.pack("!B", self.group_type)) |
| 8495 | packed.append('\x00' * 1) |
| 8496 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8497 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8498 | length = sum([len(x) for x in packed]) |
| 8499 | packed[2] = struct.pack("!H", length) |
| 8500 | return ''.join(packed) |
| 8501 | |
| 8502 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8503 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8504 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8505 | _version = reader.read("!B")[0] |
| 8506 | assert(_version == 4) |
| 8507 | _type = reader.read("!B")[0] |
| 8508 | assert(_type == 15) |
| 8509 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8510 | orig_reader = reader |
| 8511 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8512 | obj.xid = reader.read("!L")[0] |
| 8513 | _command = reader.read("!H")[0] |
| 8514 | assert(_command == 0) |
| 8515 | obj.group_type = reader.read("!B")[0] |
| 8516 | reader.skip(1) |
| 8517 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8518 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8519 | return obj |
| 8520 | |
| 8521 | def __eq__(self, other): |
| 8522 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8523 | if self.xid != other.xid: return False |
| 8524 | if self.group_type != other.group_type: return False |
| 8525 | if self.group_id != other.group_id: return False |
| 8526 | if self.buckets != other.buckets: return False |
| 8527 | return True |
| 8528 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8529 | def pretty_print(self, q): |
| 8530 | q.text("group_add {") |
| 8531 | with q.group(): |
| 8532 | with q.indent(2): |
| 8533 | q.breakable() |
| 8534 | q.text("xid = "); |
| 8535 | if self.xid != None: |
| 8536 | q.text("%#x" % self.xid) |
| 8537 | else: |
| 8538 | q.text('None') |
| 8539 | q.text(","); q.breakable() |
| 8540 | q.text("group_type = "); |
| 8541 | q.text("%#x" % self.group_type) |
| 8542 | q.text(","); q.breakable() |
| 8543 | q.text("group_id = "); |
| 8544 | q.text("%#x" % self.group_id) |
| 8545 | q.text(","); q.breakable() |
| 8546 | q.text("buckets = "); |
| 8547 | q.pp(self.buckets) |
| 8548 | q.breakable() |
| 8549 | q.text('}') |
| 8550 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8551 | group_mod.subtypes[0] = group_add |
| 8552 | |
| 8553 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8554 | version = 4 |
| 8555 | type = 15 |
| 8556 | command = 2 |
| 8557 | |
| 8558 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8559 | if xid != None: |
| 8560 | self.xid = xid |
| 8561 | else: |
| 8562 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8563 | if group_type != None: |
| 8564 | self.group_type = group_type |
| 8565 | else: |
| 8566 | self.group_type = 0 |
| 8567 | if group_id != None: |
| 8568 | self.group_id = group_id |
| 8569 | else: |
| 8570 | self.group_id = 0 |
| 8571 | if buckets != None: |
| 8572 | self.buckets = buckets |
| 8573 | else: |
| 8574 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8575 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8576 | |
| 8577 | def pack(self): |
| 8578 | packed = [] |
| 8579 | packed.append(struct.pack("!B", self.version)) |
| 8580 | packed.append(struct.pack("!B", self.type)) |
| 8581 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8582 | packed.append(struct.pack("!L", self.xid)) |
| 8583 | packed.append(struct.pack("!H", self.command)) |
| 8584 | packed.append(struct.pack("!B", self.group_type)) |
| 8585 | packed.append('\x00' * 1) |
| 8586 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8587 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8588 | length = sum([len(x) for x in packed]) |
| 8589 | packed[2] = struct.pack("!H", length) |
| 8590 | return ''.join(packed) |
| 8591 | |
| 8592 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8593 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8594 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8595 | _version = reader.read("!B")[0] |
| 8596 | assert(_version == 4) |
| 8597 | _type = reader.read("!B")[0] |
| 8598 | assert(_type == 15) |
| 8599 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8600 | orig_reader = reader |
| 8601 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8602 | obj.xid = reader.read("!L")[0] |
| 8603 | _command = reader.read("!H")[0] |
| 8604 | assert(_command == 2) |
| 8605 | obj.group_type = reader.read("!B")[0] |
| 8606 | reader.skip(1) |
| 8607 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8608 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8609 | return obj |
| 8610 | |
| 8611 | def __eq__(self, other): |
| 8612 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8613 | if self.xid != other.xid: return False |
| 8614 | if self.group_type != other.group_type: return False |
| 8615 | if self.group_id != other.group_id: return False |
| 8616 | if self.buckets != other.buckets: return False |
| 8617 | return True |
| 8618 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8619 | def pretty_print(self, q): |
| 8620 | q.text("group_delete {") |
| 8621 | with q.group(): |
| 8622 | with q.indent(2): |
| 8623 | q.breakable() |
| 8624 | q.text("xid = "); |
| 8625 | if self.xid != None: |
| 8626 | q.text("%#x" % self.xid) |
| 8627 | else: |
| 8628 | q.text('None') |
| 8629 | q.text(","); q.breakable() |
| 8630 | q.text("group_type = "); |
| 8631 | q.text("%#x" % self.group_type) |
| 8632 | q.text(","); q.breakable() |
| 8633 | q.text("group_id = "); |
| 8634 | q.text("%#x" % self.group_id) |
| 8635 | q.text(","); q.breakable() |
| 8636 | q.text("buckets = "); |
| 8637 | q.pp(self.buckets) |
| 8638 | q.breakable() |
| 8639 | q.text('}') |
| 8640 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8641 | group_mod.subtypes[2] = group_delete |
| 8642 | |
| 8643 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8644 | version = 4 |
| 8645 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8646 | stats_type = 7 |
| 8647 | |
| 8648 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8649 | if xid != None: |
| 8650 | self.xid = xid |
| 8651 | else: |
| 8652 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8653 | if flags != None: |
| 8654 | self.flags = flags |
| 8655 | else: |
| 8656 | self.flags = 0 |
| 8657 | if entries != None: |
| 8658 | self.entries = entries |
| 8659 | else: |
| 8660 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8661 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8662 | |
| 8663 | def pack(self): |
| 8664 | packed = [] |
| 8665 | packed.append(struct.pack("!B", self.version)) |
| 8666 | packed.append(struct.pack("!B", self.type)) |
| 8667 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8668 | packed.append(struct.pack("!L", self.xid)) |
| 8669 | packed.append(struct.pack("!H", self.stats_type)) |
| 8670 | packed.append(struct.pack("!H", self.flags)) |
| 8671 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8672 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8673 | length = sum([len(x) for x in packed]) |
| 8674 | packed[2] = struct.pack("!H", length) |
| 8675 | return ''.join(packed) |
| 8676 | |
| 8677 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8678 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8679 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8680 | _version = reader.read("!B")[0] |
| 8681 | assert(_version == 4) |
| 8682 | _type = reader.read("!B")[0] |
| 8683 | assert(_type == 19) |
| 8684 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8685 | orig_reader = reader |
| 8686 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8687 | obj.xid = reader.read("!L")[0] |
| 8688 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8689 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8690 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8691 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8692 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8693 | return obj |
| 8694 | |
| 8695 | def __eq__(self, other): |
| 8696 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8697 | if self.xid != other.xid: return False |
| 8698 | if self.flags != other.flags: return False |
| 8699 | if self.entries != other.entries: return False |
| 8700 | return True |
| 8701 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8702 | def pretty_print(self, q): |
| 8703 | q.text("group_desc_stats_reply {") |
| 8704 | with q.group(): |
| 8705 | with q.indent(2): |
| 8706 | q.breakable() |
| 8707 | q.text("xid = "); |
| 8708 | if self.xid != None: |
| 8709 | q.text("%#x" % self.xid) |
| 8710 | else: |
| 8711 | q.text('None') |
| 8712 | q.text(","); q.breakable() |
| 8713 | q.text("flags = "); |
| 8714 | q.text("%#x" % self.flags) |
| 8715 | q.text(","); q.breakable() |
| 8716 | q.text("entries = "); |
| 8717 | q.pp(self.entries) |
| 8718 | q.breakable() |
| 8719 | q.text('}') |
| 8720 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8721 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 8722 | |
| 8723 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8724 | version = 4 |
| 8725 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8726 | stats_type = 7 |
| 8727 | |
| 8728 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8729 | if xid != None: |
| 8730 | self.xid = xid |
| 8731 | else: |
| 8732 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8733 | if flags != None: |
| 8734 | self.flags = flags |
| 8735 | else: |
| 8736 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8737 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8738 | |
| 8739 | def pack(self): |
| 8740 | packed = [] |
| 8741 | packed.append(struct.pack("!B", self.version)) |
| 8742 | packed.append(struct.pack("!B", self.type)) |
| 8743 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8744 | packed.append(struct.pack("!L", self.xid)) |
| 8745 | packed.append(struct.pack("!H", self.stats_type)) |
| 8746 | packed.append(struct.pack("!H", self.flags)) |
| 8747 | packed.append('\x00' * 4) |
| 8748 | length = sum([len(x) for x in packed]) |
| 8749 | packed[2] = struct.pack("!H", length) |
| 8750 | return ''.join(packed) |
| 8751 | |
| 8752 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8753 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8754 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8755 | _version = reader.read("!B")[0] |
| 8756 | assert(_version == 4) |
| 8757 | _type = reader.read("!B")[0] |
| 8758 | assert(_type == 18) |
| 8759 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8760 | orig_reader = reader |
| 8761 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8762 | obj.xid = reader.read("!L")[0] |
| 8763 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8764 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8765 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8766 | reader.skip(4) |
| 8767 | return obj |
| 8768 | |
| 8769 | def __eq__(self, other): |
| 8770 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8771 | if self.xid != other.xid: return False |
| 8772 | if self.flags != other.flags: return False |
| 8773 | return True |
| 8774 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8775 | def pretty_print(self, q): |
| 8776 | q.text("group_desc_stats_request {") |
| 8777 | with q.group(): |
| 8778 | with q.indent(2): |
| 8779 | q.breakable() |
| 8780 | q.text("xid = "); |
| 8781 | if self.xid != None: |
| 8782 | q.text("%#x" % self.xid) |
| 8783 | else: |
| 8784 | q.text('None') |
| 8785 | q.text(","); q.breakable() |
| 8786 | q.text("flags = "); |
| 8787 | q.text("%#x" % self.flags) |
| 8788 | q.breakable() |
| 8789 | q.text('}') |
| 8790 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8791 | stats_request.subtypes[7] = group_desc_stats_request |
| 8792 | |
| 8793 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8794 | version = 4 |
| 8795 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8796 | stats_type = 8 |
| 8797 | |
| 8798 | def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8799 | if xid != None: |
| 8800 | self.xid = xid |
| 8801 | else: |
| 8802 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8803 | if flags != None: |
| 8804 | self.flags = flags |
| 8805 | else: |
| 8806 | self.flags = 0 |
| 8807 | if types != None: |
| 8808 | self.types = types |
| 8809 | else: |
| 8810 | self.types = 0 |
| 8811 | if capabilities != None: |
| 8812 | self.capabilities = capabilities |
| 8813 | else: |
| 8814 | self.capabilities = 0 |
| 8815 | if max_groups_all != None: |
| 8816 | self.max_groups_all = max_groups_all |
| 8817 | else: |
| 8818 | self.max_groups_all = 0 |
| 8819 | if max_groups_select != None: |
| 8820 | self.max_groups_select = max_groups_select |
| 8821 | else: |
| 8822 | self.max_groups_select = 0 |
| 8823 | if max_groups_indirect != None: |
| 8824 | self.max_groups_indirect = max_groups_indirect |
| 8825 | else: |
| 8826 | self.max_groups_indirect = 0 |
| 8827 | if max_groups_ff != None: |
| 8828 | self.max_groups_ff = max_groups_ff |
| 8829 | else: |
| 8830 | self.max_groups_ff = 0 |
| 8831 | if actions_all != None: |
| 8832 | self.actions_all = actions_all |
| 8833 | else: |
| 8834 | self.actions_all = 0 |
| 8835 | if actions_select != None: |
| 8836 | self.actions_select = actions_select |
| 8837 | else: |
| 8838 | self.actions_select = 0 |
| 8839 | if actions_indirect != None: |
| 8840 | self.actions_indirect = actions_indirect |
| 8841 | else: |
| 8842 | self.actions_indirect = 0 |
| 8843 | if actions_ff != None: |
| 8844 | self.actions_ff = actions_ff |
| 8845 | else: |
| 8846 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8847 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8848 | |
| 8849 | def pack(self): |
| 8850 | packed = [] |
| 8851 | packed.append(struct.pack("!B", self.version)) |
| 8852 | packed.append(struct.pack("!B", self.type)) |
| 8853 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8854 | packed.append(struct.pack("!L", self.xid)) |
| 8855 | packed.append(struct.pack("!H", self.stats_type)) |
| 8856 | packed.append(struct.pack("!H", self.flags)) |
| 8857 | packed.append('\x00' * 4) |
| 8858 | packed.append(struct.pack("!L", self.types)) |
| 8859 | packed.append(struct.pack("!L", self.capabilities)) |
| 8860 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 8861 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 8862 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 8863 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 8864 | packed.append(struct.pack("!L", self.actions_all)) |
| 8865 | packed.append(struct.pack("!L", self.actions_select)) |
| 8866 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 8867 | packed.append(struct.pack("!L", self.actions_ff)) |
| 8868 | length = sum([len(x) for x in packed]) |
| 8869 | packed[2] = struct.pack("!H", length) |
| 8870 | return ''.join(packed) |
| 8871 | |
| 8872 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8873 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8874 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8875 | _version = reader.read("!B")[0] |
| 8876 | assert(_version == 4) |
| 8877 | _type = reader.read("!B")[0] |
| 8878 | assert(_type == 19) |
| 8879 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8880 | orig_reader = reader |
| 8881 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8882 | obj.xid = reader.read("!L")[0] |
| 8883 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8884 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8885 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8886 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8887 | obj.types = reader.read("!L")[0] |
| 8888 | obj.capabilities = reader.read("!L")[0] |
| 8889 | obj.max_groups_all = reader.read("!L")[0] |
| 8890 | obj.max_groups_select = reader.read("!L")[0] |
| 8891 | obj.max_groups_indirect = reader.read("!L")[0] |
| 8892 | obj.max_groups_ff = reader.read("!L")[0] |
| 8893 | obj.actions_all = reader.read("!L")[0] |
| 8894 | obj.actions_select = reader.read("!L")[0] |
| 8895 | obj.actions_indirect = reader.read("!L")[0] |
| 8896 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8897 | return obj |
| 8898 | |
| 8899 | def __eq__(self, other): |
| 8900 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8901 | if self.xid != other.xid: return False |
| 8902 | if self.flags != other.flags: return False |
| 8903 | if self.types != other.types: return False |
| 8904 | if self.capabilities != other.capabilities: return False |
| 8905 | if self.max_groups_all != other.max_groups_all: return False |
| 8906 | if self.max_groups_select != other.max_groups_select: return False |
| 8907 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 8908 | if self.max_groups_ff != other.max_groups_ff: return False |
| 8909 | if self.actions_all != other.actions_all: return False |
| 8910 | if self.actions_select != other.actions_select: return False |
| 8911 | if self.actions_indirect != other.actions_indirect: return False |
| 8912 | if self.actions_ff != other.actions_ff: return False |
| 8913 | return True |
| 8914 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8915 | def pretty_print(self, q): |
| 8916 | q.text("group_features_stats_reply {") |
| 8917 | with q.group(): |
| 8918 | with q.indent(2): |
| 8919 | q.breakable() |
| 8920 | q.text("xid = "); |
| 8921 | if self.xid != None: |
| 8922 | q.text("%#x" % self.xid) |
| 8923 | else: |
| 8924 | q.text('None') |
| 8925 | q.text(","); q.breakable() |
| 8926 | q.text("flags = "); |
| 8927 | q.text("%#x" % self.flags) |
| 8928 | q.text(","); q.breakable() |
| 8929 | q.text("types = "); |
| 8930 | q.text("%#x" % self.types) |
| 8931 | q.text(","); q.breakable() |
| 8932 | q.text("capabilities = "); |
| 8933 | q.text("%#x" % self.capabilities) |
| 8934 | q.text(","); q.breakable() |
| 8935 | q.text("max_groups_all = "); |
| 8936 | q.text("%#x" % self.max_groups_all) |
| 8937 | q.text(","); q.breakable() |
| 8938 | q.text("max_groups_select = "); |
| 8939 | q.text("%#x" % self.max_groups_select) |
| 8940 | q.text(","); q.breakable() |
| 8941 | q.text("max_groups_indirect = "); |
| 8942 | q.text("%#x" % self.max_groups_indirect) |
| 8943 | q.text(","); q.breakable() |
| 8944 | q.text("max_groups_ff = "); |
| 8945 | q.text("%#x" % self.max_groups_ff) |
| 8946 | q.text(","); q.breakable() |
| 8947 | q.text("actions_all = "); |
| 8948 | q.text("%#x" % self.actions_all) |
| 8949 | q.text(","); q.breakable() |
| 8950 | q.text("actions_select = "); |
| 8951 | q.text("%#x" % self.actions_select) |
| 8952 | q.text(","); q.breakable() |
| 8953 | q.text("actions_indirect = "); |
| 8954 | q.text("%#x" % self.actions_indirect) |
| 8955 | q.text(","); q.breakable() |
| 8956 | q.text("actions_ff = "); |
| 8957 | q.text("%#x" % self.actions_ff) |
| 8958 | q.breakable() |
| 8959 | q.text('}') |
| 8960 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8961 | stats_reply.subtypes[8] = group_features_stats_reply |
| 8962 | |
| 8963 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8964 | version = 4 |
| 8965 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8966 | stats_type = 8 |
| 8967 | |
| 8968 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8969 | if xid != None: |
| 8970 | self.xid = xid |
| 8971 | else: |
| 8972 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8973 | if flags != None: |
| 8974 | self.flags = flags |
| 8975 | else: |
| 8976 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8977 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8978 | |
| 8979 | def pack(self): |
| 8980 | packed = [] |
| 8981 | packed.append(struct.pack("!B", self.version)) |
| 8982 | packed.append(struct.pack("!B", self.type)) |
| 8983 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8984 | packed.append(struct.pack("!L", self.xid)) |
| 8985 | packed.append(struct.pack("!H", self.stats_type)) |
| 8986 | packed.append(struct.pack("!H", self.flags)) |
| 8987 | packed.append('\x00' * 4) |
| 8988 | length = sum([len(x) for x in packed]) |
| 8989 | packed[2] = struct.pack("!H", length) |
| 8990 | return ''.join(packed) |
| 8991 | |
| 8992 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8993 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8994 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8995 | _version = reader.read("!B")[0] |
| 8996 | assert(_version == 4) |
| 8997 | _type = reader.read("!B")[0] |
| 8998 | assert(_type == 18) |
| 8999 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9000 | orig_reader = reader |
| 9001 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9002 | obj.xid = reader.read("!L")[0] |
| 9003 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9004 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9005 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9006 | reader.skip(4) |
| 9007 | return obj |
| 9008 | |
| 9009 | def __eq__(self, other): |
| 9010 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9011 | if self.xid != other.xid: return False |
| 9012 | if self.flags != other.flags: return False |
| 9013 | return True |
| 9014 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9015 | def pretty_print(self, q): |
| 9016 | q.text("group_features_stats_request {") |
| 9017 | with q.group(): |
| 9018 | with q.indent(2): |
| 9019 | q.breakable() |
| 9020 | q.text("xid = "); |
| 9021 | if self.xid != None: |
| 9022 | q.text("%#x" % self.xid) |
| 9023 | else: |
| 9024 | q.text('None') |
| 9025 | q.text(","); q.breakable() |
| 9026 | q.text("flags = "); |
| 9027 | q.text("%#x" % self.flags) |
| 9028 | q.breakable() |
| 9029 | q.text('}') |
| 9030 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9031 | stats_request.subtypes[8] = group_features_stats_request |
| 9032 | |
| 9033 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9034 | version = 4 |
| 9035 | type = 1 |
| 9036 | err_type = 6 |
| 9037 | |
| 9038 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9039 | if xid != None: |
| 9040 | self.xid = xid |
| 9041 | else: |
| 9042 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9043 | if code != None: |
| 9044 | self.code = code |
| 9045 | else: |
| 9046 | self.code = 0 |
| 9047 | if data != None: |
| 9048 | self.data = data |
| 9049 | else: |
| 9050 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9051 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9052 | |
| 9053 | def pack(self): |
| 9054 | packed = [] |
| 9055 | packed.append(struct.pack("!B", self.version)) |
| 9056 | packed.append(struct.pack("!B", self.type)) |
| 9057 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9058 | packed.append(struct.pack("!L", self.xid)) |
| 9059 | packed.append(struct.pack("!H", self.err_type)) |
| 9060 | packed.append(struct.pack("!H", self.code)) |
| 9061 | packed.append(self.data) |
| 9062 | length = sum([len(x) for x in packed]) |
| 9063 | packed[2] = struct.pack("!H", length) |
| 9064 | return ''.join(packed) |
| 9065 | |
| 9066 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9067 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9068 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9069 | _version = reader.read("!B")[0] |
| 9070 | assert(_version == 4) |
| 9071 | _type = reader.read("!B")[0] |
| 9072 | assert(_type == 1) |
| 9073 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9074 | orig_reader = reader |
| 9075 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9076 | obj.xid = reader.read("!L")[0] |
| 9077 | _err_type = reader.read("!H")[0] |
| 9078 | assert(_err_type == 6) |
| 9079 | obj.code = reader.read("!H")[0] |
| 9080 | obj.data = str(reader.read_all()) |
| 9081 | return obj |
| 9082 | |
| 9083 | def __eq__(self, other): |
| 9084 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9085 | if self.xid != other.xid: return False |
| 9086 | if self.code != other.code: return False |
| 9087 | if self.data != other.data: return False |
| 9088 | return True |
| 9089 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9090 | def pretty_print(self, q): |
| 9091 | q.text("group_mod_failed_error_msg {") |
| 9092 | with q.group(): |
| 9093 | with q.indent(2): |
| 9094 | q.breakable() |
| 9095 | q.text("xid = "); |
| 9096 | if self.xid != None: |
| 9097 | q.text("%#x" % self.xid) |
| 9098 | else: |
| 9099 | q.text('None') |
| 9100 | q.text(","); q.breakable() |
| 9101 | q.text("code = "); |
| 9102 | q.text("%#x" % self.code) |
| 9103 | q.text(","); q.breakable() |
| 9104 | q.text("data = "); |
| 9105 | q.pp(self.data) |
| 9106 | q.breakable() |
| 9107 | q.text('}') |
| 9108 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9109 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 9110 | |
| 9111 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9112 | version = 4 |
| 9113 | type = 15 |
| 9114 | command = 1 |
| 9115 | |
| 9116 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9117 | if xid != None: |
| 9118 | self.xid = xid |
| 9119 | else: |
| 9120 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9121 | if group_type != None: |
| 9122 | self.group_type = group_type |
| 9123 | else: |
| 9124 | self.group_type = 0 |
| 9125 | if group_id != None: |
| 9126 | self.group_id = group_id |
| 9127 | else: |
| 9128 | self.group_id = 0 |
| 9129 | if buckets != None: |
| 9130 | self.buckets = buckets |
| 9131 | else: |
| 9132 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9133 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9134 | |
| 9135 | def pack(self): |
| 9136 | packed = [] |
| 9137 | packed.append(struct.pack("!B", self.version)) |
| 9138 | packed.append(struct.pack("!B", self.type)) |
| 9139 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9140 | packed.append(struct.pack("!L", self.xid)) |
| 9141 | packed.append(struct.pack("!H", self.command)) |
| 9142 | packed.append(struct.pack("!B", self.group_type)) |
| 9143 | packed.append('\x00' * 1) |
| 9144 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9145 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9146 | length = sum([len(x) for x in packed]) |
| 9147 | packed[2] = struct.pack("!H", length) |
| 9148 | return ''.join(packed) |
| 9149 | |
| 9150 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9151 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9152 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9153 | _version = reader.read("!B")[0] |
| 9154 | assert(_version == 4) |
| 9155 | _type = reader.read("!B")[0] |
| 9156 | assert(_type == 15) |
| 9157 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9158 | orig_reader = reader |
| 9159 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9160 | obj.xid = reader.read("!L")[0] |
| 9161 | _command = reader.read("!H")[0] |
| 9162 | assert(_command == 1) |
| 9163 | obj.group_type = reader.read("!B")[0] |
| 9164 | reader.skip(1) |
| 9165 | obj.group_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9166 | obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9167 | return obj |
| 9168 | |
| 9169 | def __eq__(self, other): |
| 9170 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9171 | if self.xid != other.xid: return False |
| 9172 | if self.group_type != other.group_type: return False |
| 9173 | if self.group_id != other.group_id: return False |
| 9174 | if self.buckets != other.buckets: return False |
| 9175 | return True |
| 9176 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 9177 | def pretty_print(self, q): |
| 9178 | q.text("group_modify {") |
| 9179 | with q.group(): |
| 9180 | with q.indent(2): |
| 9181 | q.breakable() |
| 9182 | q.text("xid = "); |
| 9183 | if self.xid != None: |
| 9184 | q.text("%#x" % self.xid) |
| 9185 | else: |
| 9186 | q.text('None') |
| 9187 | q.text(","); q.breakable() |
| 9188 | q.text("group_type = "); |
| 9189 | q.text("%#x" % self.group_type) |
| 9190 | q.text(","); q.breakable() |
| 9191 | q.text("group_id = "); |
| 9192 | q.text("%#x" % self.group_id) |
| 9193 | q.text(","); q.breakable() |
| 9194 | q.text("buckets = "); |
| 9195 | q.pp(self.buckets) |
| 9196 | q.breakable() |
| 9197 | q.text('}') |
| 9198 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9199 | group_mod.subtypes[1] = group_modify |
| 9200 | |
| 9201 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9202 | version = 4 |
| 9203 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9204 | stats_type = 6 |
| 9205 | |
| 9206 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9207 | if xid != None: |
| 9208 | self.xid = xid |
| 9209 | else: |
| 9210 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9211 | if flags != None: |
| 9212 | self.flags = flags |
| 9213 | else: |
| 9214 | self.flags = 0 |
| 9215 | if entries != None: |
| 9216 | self.entries = entries |
| 9217 | else: |
| 9218 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9219 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9220 | |
| 9221 | def pack(self): |
| 9222 | packed = [] |
| 9223 | packed.append(struct.pack("!B", self.version)) |
| 9224 | packed.append(struct.pack("!B", self.type)) |
| 9225 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9226 | packed.append(struct.pack("!L", self.xid)) |
| 9227 | packed.append(struct.pack("!H", self.stats_type)) |
| 9228 | packed.append(struct.pack("!H", self.flags)) |
| 9229 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9230 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9231 | length = sum([len(x) for x in packed]) |
| 9232 | packed[2] = struct.pack("!H", length) |
| 9233 | return ''.join(packed) |
| 9234 | |
| 9235 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9236 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9237 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9238 | _version = reader.read("!B")[0] |
| 9239 | assert(_version == 4) |
| 9240 | _type = reader.read("!B")[0] |
| 9241 | assert(_type == 19) |
| 9242 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9243 | orig_reader = reader |
| 9244 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9245 | obj.xid = reader.read("!L")[0] |
| 9246 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9247 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9248 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9249 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9250 | obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9251 | return obj |
| 9252 | |
| 9253 | def __eq__(self, other): |
| 9254 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9255 | if self.xid != other.xid: return False |
| 9256 | if self.flags != other.flags: return False |
| 9257 | if self.entries != other.entries: return False |
| 9258 | return True |
| 9259 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9260 | def pretty_print(self, q): |
| 9261 | q.text("group_stats_reply {") |
| 9262 | with q.group(): |
| 9263 | with q.indent(2): |
| 9264 | q.breakable() |
| 9265 | q.text("xid = "); |
| 9266 | if self.xid != None: |
| 9267 | q.text("%#x" % self.xid) |
| 9268 | else: |
| 9269 | q.text('None') |
| 9270 | q.text(","); q.breakable() |
| 9271 | q.text("flags = "); |
| 9272 | q.text("%#x" % self.flags) |
| 9273 | q.text(","); q.breakable() |
| 9274 | q.text("entries = "); |
| 9275 | q.pp(self.entries) |
| 9276 | q.breakable() |
| 9277 | q.text('}') |
| 9278 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9279 | stats_reply.subtypes[6] = group_stats_reply |
| 9280 | |
| 9281 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9282 | version = 4 |
| 9283 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9284 | stats_type = 6 |
| 9285 | |
| 9286 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9287 | if xid != None: |
| 9288 | self.xid = xid |
| 9289 | else: |
| 9290 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9291 | if flags != None: |
| 9292 | self.flags = flags |
| 9293 | else: |
| 9294 | self.flags = 0 |
| 9295 | if group_id != None: |
| 9296 | self.group_id = group_id |
| 9297 | else: |
| 9298 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9299 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9300 | |
| 9301 | def pack(self): |
| 9302 | packed = [] |
| 9303 | packed.append(struct.pack("!B", self.version)) |
| 9304 | packed.append(struct.pack("!B", self.type)) |
| 9305 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9306 | packed.append(struct.pack("!L", self.xid)) |
| 9307 | packed.append(struct.pack("!H", self.stats_type)) |
| 9308 | packed.append(struct.pack("!H", self.flags)) |
| 9309 | packed.append('\x00' * 4) |
| 9310 | packed.append(struct.pack("!L", self.group_id)) |
| 9311 | packed.append('\x00' * 4) |
| 9312 | length = sum([len(x) for x in packed]) |
| 9313 | packed[2] = struct.pack("!H", length) |
| 9314 | return ''.join(packed) |
| 9315 | |
| 9316 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9317 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9318 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9319 | _version = reader.read("!B")[0] |
| 9320 | assert(_version == 4) |
| 9321 | _type = reader.read("!B")[0] |
| 9322 | assert(_type == 18) |
| 9323 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9324 | orig_reader = reader |
| 9325 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9326 | obj.xid = reader.read("!L")[0] |
| 9327 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9328 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9329 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9330 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9331 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9332 | reader.skip(4) |
| 9333 | return obj |
| 9334 | |
| 9335 | def __eq__(self, other): |
| 9336 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9337 | if self.xid != other.xid: return False |
| 9338 | if self.flags != other.flags: return False |
| 9339 | if self.group_id != other.group_id: return False |
| 9340 | return True |
| 9341 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9342 | def pretty_print(self, q): |
| 9343 | q.text("group_stats_request {") |
| 9344 | with q.group(): |
| 9345 | with q.indent(2): |
| 9346 | q.breakable() |
| 9347 | q.text("xid = "); |
| 9348 | if self.xid != None: |
| 9349 | q.text("%#x" % self.xid) |
| 9350 | else: |
| 9351 | q.text('None') |
| 9352 | q.text(","); q.breakable() |
| 9353 | q.text("flags = "); |
| 9354 | q.text("%#x" % self.flags) |
| 9355 | q.text(","); q.breakable() |
| 9356 | q.text("group_id = "); |
| 9357 | q.text("%#x" % self.group_id) |
| 9358 | q.breakable() |
| 9359 | q.text('}') |
| 9360 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9361 | stats_request.subtypes[6] = group_stats_request |
| 9362 | |
| 9363 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9364 | version = 4 |
| 9365 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9366 | |
| 9367 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9368 | if xid != None: |
| 9369 | self.xid = xid |
| 9370 | else: |
| 9371 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9372 | if elements != None: |
| 9373 | self.elements = elements |
| 9374 | else: |
| 9375 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9376 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9377 | |
| 9378 | def pack(self): |
| 9379 | packed = [] |
| 9380 | packed.append(struct.pack("!B", self.version)) |
| 9381 | packed.append(struct.pack("!B", self.type)) |
| 9382 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9383 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9384 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9385 | length = sum([len(x) for x in packed]) |
| 9386 | packed[2] = struct.pack("!H", length) |
| 9387 | return ''.join(packed) |
| 9388 | |
| 9389 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9390 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9391 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9392 | _version = reader.read("!B")[0] |
| 9393 | assert(_version == 4) |
| 9394 | _type = reader.read("!B")[0] |
| 9395 | assert(_type == 0) |
| 9396 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9397 | orig_reader = reader |
| 9398 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9399 | obj.xid = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9400 | obj.elements = util.unpack_list_hello_elem(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9401 | return obj |
| 9402 | |
| 9403 | def __eq__(self, other): |
| 9404 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9405 | if self.xid != other.xid: return False |
| 9406 | if self.elements != other.elements: return False |
| 9407 | return True |
| 9408 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9409 | def pretty_print(self, q): |
| 9410 | q.text("hello {") |
| 9411 | with q.group(): |
| 9412 | with q.indent(2): |
| 9413 | q.breakable() |
| 9414 | q.text("xid = "); |
| 9415 | if self.xid != None: |
| 9416 | q.text("%#x" % self.xid) |
| 9417 | else: |
| 9418 | q.text('None') |
| 9419 | q.text(","); q.breakable() |
| 9420 | q.text("elements = "); |
| 9421 | q.pp(self.elements) |
| 9422 | q.breakable() |
| 9423 | q.text('}') |
| 9424 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9425 | message.subtypes[0] = hello |
| 9426 | |
| 9427 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9428 | version = 4 |
| 9429 | type = 1 |
| 9430 | err_type = 0 |
| 9431 | |
| 9432 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9433 | if xid != None: |
| 9434 | self.xid = xid |
| 9435 | else: |
| 9436 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9437 | if code != None: |
| 9438 | self.code = code |
| 9439 | else: |
| 9440 | self.code = 0 |
| 9441 | if data != None: |
| 9442 | self.data = data |
| 9443 | else: |
| 9444 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9445 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9446 | |
| 9447 | def pack(self): |
| 9448 | packed = [] |
| 9449 | packed.append(struct.pack("!B", self.version)) |
| 9450 | packed.append(struct.pack("!B", self.type)) |
| 9451 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9452 | packed.append(struct.pack("!L", self.xid)) |
| 9453 | packed.append(struct.pack("!H", self.err_type)) |
| 9454 | packed.append(struct.pack("!H", self.code)) |
| 9455 | packed.append(self.data) |
| 9456 | length = sum([len(x) for x in packed]) |
| 9457 | packed[2] = struct.pack("!H", length) |
| 9458 | return ''.join(packed) |
| 9459 | |
| 9460 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9461 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9462 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9463 | _version = reader.read("!B")[0] |
| 9464 | assert(_version == 4) |
| 9465 | _type = reader.read("!B")[0] |
| 9466 | assert(_type == 1) |
| 9467 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9468 | orig_reader = reader |
| 9469 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9470 | obj.xid = reader.read("!L")[0] |
| 9471 | _err_type = reader.read("!H")[0] |
| 9472 | assert(_err_type == 0) |
| 9473 | obj.code = reader.read("!H")[0] |
| 9474 | obj.data = str(reader.read_all()) |
| 9475 | return obj |
| 9476 | |
| 9477 | def __eq__(self, other): |
| 9478 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9479 | if self.xid != other.xid: return False |
| 9480 | if self.code != other.code: return False |
| 9481 | if self.data != other.data: return False |
| 9482 | return True |
| 9483 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9484 | def pretty_print(self, q): |
| 9485 | q.text("hello_failed_error_msg {") |
| 9486 | with q.group(): |
| 9487 | with q.indent(2): |
| 9488 | q.breakable() |
| 9489 | q.text("xid = "); |
| 9490 | if self.xid != None: |
| 9491 | q.text("%#x" % self.xid) |
| 9492 | else: |
| 9493 | q.text('None') |
| 9494 | q.text(","); q.breakable() |
| 9495 | q.text("code = "); |
| 9496 | q.text("%#x" % self.code) |
| 9497 | q.text(","); q.breakable() |
| 9498 | q.text("data = "); |
| 9499 | q.pp(self.data) |
| 9500 | q.breakable() |
| 9501 | q.text('}') |
| 9502 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9503 | error_msg.subtypes[0] = hello_failed_error_msg |
| 9504 | |
| 9505 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9506 | version = 4 |
| 9507 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9508 | stats_type = 10 |
| 9509 | |
| 9510 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9511 | if xid != None: |
| 9512 | self.xid = xid |
| 9513 | else: |
| 9514 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9515 | if flags != None: |
| 9516 | self.flags = flags |
| 9517 | else: |
| 9518 | self.flags = 0 |
| 9519 | if entries != None: |
| 9520 | self.entries = entries |
| 9521 | else: |
| 9522 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9523 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9524 | |
| 9525 | def pack(self): |
| 9526 | packed = [] |
| 9527 | packed.append(struct.pack("!B", self.version)) |
| 9528 | packed.append(struct.pack("!B", self.type)) |
| 9529 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9530 | packed.append(struct.pack("!L", self.xid)) |
| 9531 | packed.append(struct.pack("!H", self.stats_type)) |
| 9532 | packed.append(struct.pack("!H", self.flags)) |
| 9533 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9534 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9535 | length = sum([len(x) for x in packed]) |
| 9536 | packed[2] = struct.pack("!H", length) |
| 9537 | return ''.join(packed) |
| 9538 | |
| 9539 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9540 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9541 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9542 | _version = reader.read("!B")[0] |
| 9543 | assert(_version == 4) |
| 9544 | _type = reader.read("!B")[0] |
| 9545 | assert(_type == 19) |
| 9546 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9547 | orig_reader = reader |
| 9548 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9549 | obj.xid = reader.read("!L")[0] |
| 9550 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9551 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9552 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9553 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9554 | obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9555 | return obj |
| 9556 | |
| 9557 | def __eq__(self, other): |
| 9558 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9559 | if self.xid != other.xid: return False |
| 9560 | if self.flags != other.flags: return False |
| 9561 | if self.entries != other.entries: return False |
| 9562 | return True |
| 9563 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9564 | def pretty_print(self, q): |
| 9565 | q.text("meter_config_stats_reply {") |
| 9566 | with q.group(): |
| 9567 | with q.indent(2): |
| 9568 | q.breakable() |
| 9569 | q.text("xid = "); |
| 9570 | if self.xid != None: |
| 9571 | q.text("%#x" % self.xid) |
| 9572 | else: |
| 9573 | q.text('None') |
| 9574 | q.text(","); q.breakable() |
| 9575 | q.text("flags = "); |
| 9576 | q.text("%#x" % self.flags) |
| 9577 | q.text(","); q.breakable() |
| 9578 | q.text("entries = "); |
| 9579 | q.pp(self.entries) |
| 9580 | q.breakable() |
| 9581 | q.text('}') |
| 9582 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9583 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 9584 | |
| 9585 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9586 | version = 4 |
| 9587 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9588 | stats_type = 10 |
| 9589 | |
| 9590 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9591 | if xid != None: |
| 9592 | self.xid = xid |
| 9593 | else: |
| 9594 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9595 | if flags != None: |
| 9596 | self.flags = flags |
| 9597 | else: |
| 9598 | self.flags = 0 |
| 9599 | if meter_id != None: |
| 9600 | self.meter_id = meter_id |
| 9601 | else: |
| 9602 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9603 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9604 | |
| 9605 | def pack(self): |
| 9606 | packed = [] |
| 9607 | packed.append(struct.pack("!B", self.version)) |
| 9608 | packed.append(struct.pack("!B", self.type)) |
| 9609 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9610 | packed.append(struct.pack("!L", self.xid)) |
| 9611 | packed.append(struct.pack("!H", self.stats_type)) |
| 9612 | packed.append(struct.pack("!H", self.flags)) |
| 9613 | packed.append('\x00' * 4) |
| 9614 | packed.append(struct.pack("!L", self.meter_id)) |
| 9615 | packed.append('\x00' * 4) |
| 9616 | length = sum([len(x) for x in packed]) |
| 9617 | packed[2] = struct.pack("!H", length) |
| 9618 | return ''.join(packed) |
| 9619 | |
| 9620 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9621 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9622 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9623 | _version = reader.read("!B")[0] |
| 9624 | assert(_version == 4) |
| 9625 | _type = reader.read("!B")[0] |
| 9626 | assert(_type == 18) |
| 9627 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9628 | orig_reader = reader |
| 9629 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9630 | obj.xid = reader.read("!L")[0] |
| 9631 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9632 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9633 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9634 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9635 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9636 | reader.skip(4) |
| 9637 | return obj |
| 9638 | |
| 9639 | def __eq__(self, other): |
| 9640 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9641 | if self.xid != other.xid: return False |
| 9642 | if self.flags != other.flags: return False |
| 9643 | if self.meter_id != other.meter_id: return False |
| 9644 | return True |
| 9645 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9646 | def pretty_print(self, q): |
| 9647 | q.text("meter_config_stats_request {") |
| 9648 | with q.group(): |
| 9649 | with q.indent(2): |
| 9650 | q.breakable() |
| 9651 | q.text("xid = "); |
| 9652 | if self.xid != None: |
| 9653 | q.text("%#x" % self.xid) |
| 9654 | else: |
| 9655 | q.text('None') |
| 9656 | q.text(","); q.breakable() |
| 9657 | q.text("flags = "); |
| 9658 | q.text("%#x" % self.flags) |
| 9659 | q.text(","); q.breakable() |
| 9660 | q.text("meter_id = "); |
| 9661 | q.text("%#x" % self.meter_id) |
| 9662 | q.breakable() |
| 9663 | q.text('}') |
| 9664 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9665 | stats_request.subtypes[10] = meter_config_stats_request |
| 9666 | |
| 9667 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9668 | version = 4 |
| 9669 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9670 | stats_type = 11 |
| 9671 | |
| 9672 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9673 | if xid != None: |
| 9674 | self.xid = xid |
| 9675 | else: |
| 9676 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9677 | if flags != None: |
| 9678 | self.flags = flags |
| 9679 | else: |
| 9680 | self.flags = 0 |
| 9681 | if features != None: |
| 9682 | self.features = features |
| 9683 | else: |
| 9684 | self.features = common.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9685 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9686 | |
| 9687 | def pack(self): |
| 9688 | packed = [] |
| 9689 | packed.append(struct.pack("!B", self.version)) |
| 9690 | packed.append(struct.pack("!B", self.type)) |
| 9691 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9692 | packed.append(struct.pack("!L", self.xid)) |
| 9693 | packed.append(struct.pack("!H", self.stats_type)) |
| 9694 | packed.append(struct.pack("!H", self.flags)) |
| 9695 | packed.append('\x00' * 4) |
| 9696 | packed.append(self.features.pack()) |
| 9697 | length = sum([len(x) for x in packed]) |
| 9698 | packed[2] = struct.pack("!H", length) |
| 9699 | return ''.join(packed) |
| 9700 | |
| 9701 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9702 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9703 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9704 | _version = reader.read("!B")[0] |
| 9705 | assert(_version == 4) |
| 9706 | _type = reader.read("!B")[0] |
| 9707 | assert(_type == 19) |
| 9708 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9709 | orig_reader = reader |
| 9710 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9711 | obj.xid = reader.read("!L")[0] |
| 9712 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9713 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9714 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9715 | reader.skip(4) |
| 9716 | obj.features = common.meter_features.unpack(reader) |
| 9717 | return obj |
| 9718 | |
| 9719 | def __eq__(self, other): |
| 9720 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9721 | if self.xid != other.xid: return False |
| 9722 | if self.flags != other.flags: return False |
| 9723 | if self.features != other.features: return False |
| 9724 | return True |
| 9725 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9726 | def pretty_print(self, q): |
| 9727 | q.text("meter_features_stats_reply {") |
| 9728 | with q.group(): |
| 9729 | with q.indent(2): |
| 9730 | q.breakable() |
| 9731 | q.text("xid = "); |
| 9732 | if self.xid != None: |
| 9733 | q.text("%#x" % self.xid) |
| 9734 | else: |
| 9735 | q.text('None') |
| 9736 | q.text(","); q.breakable() |
| 9737 | q.text("flags = "); |
| 9738 | q.text("%#x" % self.flags) |
| 9739 | q.text(","); q.breakable() |
| 9740 | q.text("features = "); |
| 9741 | q.pp(self.features) |
| 9742 | q.breakable() |
| 9743 | q.text('}') |
| 9744 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9745 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 9746 | |
| 9747 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9748 | version = 4 |
| 9749 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9750 | stats_type = 11 |
| 9751 | |
| 9752 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9753 | if xid != None: |
| 9754 | self.xid = xid |
| 9755 | else: |
| 9756 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9757 | if flags != None: |
| 9758 | self.flags = flags |
| 9759 | else: |
| 9760 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9761 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9762 | |
| 9763 | def pack(self): |
| 9764 | packed = [] |
| 9765 | packed.append(struct.pack("!B", self.version)) |
| 9766 | packed.append(struct.pack("!B", self.type)) |
| 9767 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9768 | packed.append(struct.pack("!L", self.xid)) |
| 9769 | packed.append(struct.pack("!H", self.stats_type)) |
| 9770 | packed.append(struct.pack("!H", self.flags)) |
| 9771 | packed.append('\x00' * 4) |
| 9772 | length = sum([len(x) for x in packed]) |
| 9773 | packed[2] = struct.pack("!H", length) |
| 9774 | return ''.join(packed) |
| 9775 | |
| 9776 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9777 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9778 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9779 | _version = reader.read("!B")[0] |
| 9780 | assert(_version == 4) |
| 9781 | _type = reader.read("!B")[0] |
| 9782 | assert(_type == 18) |
| 9783 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9784 | orig_reader = reader |
| 9785 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9786 | obj.xid = reader.read("!L")[0] |
| 9787 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9788 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9789 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9790 | reader.skip(4) |
| 9791 | return obj |
| 9792 | |
| 9793 | def __eq__(self, other): |
| 9794 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9795 | if self.xid != other.xid: return False |
| 9796 | if self.flags != other.flags: return False |
| 9797 | return True |
| 9798 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9799 | def pretty_print(self, q): |
| 9800 | q.text("meter_features_stats_request {") |
| 9801 | with q.group(): |
| 9802 | with q.indent(2): |
| 9803 | q.breakable() |
| 9804 | q.text("xid = "); |
| 9805 | if self.xid != None: |
| 9806 | q.text("%#x" % self.xid) |
| 9807 | else: |
| 9808 | q.text('None') |
| 9809 | q.text(","); q.breakable() |
| 9810 | q.text("flags = "); |
| 9811 | q.text("%#x" % self.flags) |
| 9812 | q.breakable() |
| 9813 | q.text('}') |
| 9814 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9815 | stats_request.subtypes[11] = meter_features_stats_request |
| 9816 | |
| 9817 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9818 | version = 4 |
| 9819 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9820 | |
| 9821 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9822 | if xid != None: |
| 9823 | self.xid = xid |
| 9824 | else: |
| 9825 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9826 | if command != None: |
| 9827 | self.command = command |
| 9828 | else: |
| 9829 | self.command = 0 |
| 9830 | if flags != None: |
| 9831 | self.flags = flags |
| 9832 | else: |
| 9833 | self.flags = 0 |
| 9834 | if meter_id != None: |
| 9835 | self.meter_id = meter_id |
| 9836 | else: |
| 9837 | self.meter_id = 0 |
| 9838 | if meters != None: |
| 9839 | self.meters = meters |
| 9840 | else: |
| 9841 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9842 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9843 | |
| 9844 | def pack(self): |
| 9845 | packed = [] |
| 9846 | packed.append(struct.pack("!B", self.version)) |
| 9847 | packed.append(struct.pack("!B", self.type)) |
| 9848 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9849 | packed.append(struct.pack("!L", self.xid)) |
| 9850 | packed.append(struct.pack("!H", self.command)) |
| 9851 | packed.append(struct.pack("!H", self.flags)) |
| 9852 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9853 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9854 | length = sum([len(x) for x in packed]) |
| 9855 | packed[2] = struct.pack("!H", length) |
| 9856 | return ''.join(packed) |
| 9857 | |
| 9858 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9859 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9860 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9861 | _version = reader.read("!B")[0] |
| 9862 | assert(_version == 4) |
| 9863 | _type = reader.read("!B")[0] |
| 9864 | assert(_type == 29) |
| 9865 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9866 | orig_reader = reader |
| 9867 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9868 | obj.xid = reader.read("!L")[0] |
| 9869 | obj.command = reader.read("!H")[0] |
| 9870 | obj.flags = reader.read("!H")[0] |
| 9871 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9872 | obj.meters = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9873 | return obj |
| 9874 | |
| 9875 | def __eq__(self, other): |
| 9876 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9877 | if self.xid != other.xid: return False |
| 9878 | if self.command != other.command: return False |
| 9879 | if self.flags != other.flags: return False |
| 9880 | if self.meter_id != other.meter_id: return False |
| 9881 | if self.meters != other.meters: return False |
| 9882 | return True |
| 9883 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9884 | def pretty_print(self, q): |
| 9885 | q.text("meter_mod {") |
| 9886 | with q.group(): |
| 9887 | with q.indent(2): |
| 9888 | q.breakable() |
| 9889 | q.text("xid = "); |
| 9890 | if self.xid != None: |
| 9891 | q.text("%#x" % self.xid) |
| 9892 | else: |
| 9893 | q.text('None') |
| 9894 | q.text(","); q.breakable() |
| 9895 | q.text("command = "); |
| 9896 | q.text("%#x" % self.command) |
| 9897 | q.text(","); q.breakable() |
| 9898 | q.text("flags = "); |
| 9899 | q.text("%#x" % self.flags) |
| 9900 | q.text(","); q.breakable() |
| 9901 | q.text("meter_id = "); |
| 9902 | q.text("%#x" % self.meter_id) |
| 9903 | q.text(","); q.breakable() |
| 9904 | q.text("meters = "); |
| 9905 | q.pp(self.meters) |
| 9906 | q.breakable() |
| 9907 | q.text('}') |
| 9908 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9909 | message.subtypes[29] = meter_mod |
| 9910 | |
| 9911 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9912 | version = 4 |
| 9913 | type = 1 |
| 9914 | err_type = 12 |
| 9915 | |
| 9916 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9917 | if xid != None: |
| 9918 | self.xid = xid |
| 9919 | else: |
| 9920 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9921 | if code != None: |
| 9922 | self.code = code |
| 9923 | else: |
| 9924 | self.code = 0 |
| 9925 | if data != None: |
| 9926 | self.data = data |
| 9927 | else: |
| 9928 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9929 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9930 | |
| 9931 | def pack(self): |
| 9932 | packed = [] |
| 9933 | packed.append(struct.pack("!B", self.version)) |
| 9934 | packed.append(struct.pack("!B", self.type)) |
| 9935 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9936 | packed.append(struct.pack("!L", self.xid)) |
| 9937 | packed.append(struct.pack("!H", self.err_type)) |
| 9938 | packed.append(struct.pack("!H", self.code)) |
| 9939 | packed.append(self.data) |
| 9940 | length = sum([len(x) for x in packed]) |
| 9941 | packed[2] = struct.pack("!H", length) |
| 9942 | return ''.join(packed) |
| 9943 | |
| 9944 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9945 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9946 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9947 | _version = reader.read("!B")[0] |
| 9948 | assert(_version == 4) |
| 9949 | _type = reader.read("!B")[0] |
| 9950 | assert(_type == 1) |
| 9951 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9952 | orig_reader = reader |
| 9953 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9954 | obj.xid = reader.read("!L")[0] |
| 9955 | _err_type = reader.read("!H")[0] |
| 9956 | assert(_err_type == 12) |
| 9957 | obj.code = reader.read("!H")[0] |
| 9958 | obj.data = str(reader.read_all()) |
| 9959 | return obj |
| 9960 | |
| 9961 | def __eq__(self, other): |
| 9962 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9963 | if self.xid != other.xid: return False |
| 9964 | if self.code != other.code: return False |
| 9965 | if self.data != other.data: return False |
| 9966 | return True |
| 9967 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9968 | def pretty_print(self, q): |
| 9969 | q.text("meter_mod_failed_error_msg {") |
| 9970 | with q.group(): |
| 9971 | with q.indent(2): |
| 9972 | q.breakable() |
| 9973 | q.text("xid = "); |
| 9974 | if self.xid != None: |
| 9975 | q.text("%#x" % self.xid) |
| 9976 | else: |
| 9977 | q.text('None') |
| 9978 | q.text(","); q.breakable() |
| 9979 | q.text("code = "); |
| 9980 | q.text("%#x" % self.code) |
| 9981 | q.text(","); q.breakable() |
| 9982 | q.text("data = "); |
| 9983 | q.pp(self.data) |
| 9984 | q.breakable() |
| 9985 | q.text('}') |
| 9986 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9987 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 9988 | |
| 9989 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9990 | version = 4 |
| 9991 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9992 | stats_type = 9 |
| 9993 | |
| 9994 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9995 | if xid != None: |
| 9996 | self.xid = xid |
| 9997 | else: |
| 9998 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9999 | if flags != None: |
| 10000 | self.flags = flags |
| 10001 | else: |
| 10002 | self.flags = 0 |
| 10003 | if entries != None: |
| 10004 | self.entries = entries |
| 10005 | else: |
| 10006 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10007 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10008 | |
| 10009 | def pack(self): |
| 10010 | packed = [] |
| 10011 | packed.append(struct.pack("!B", self.version)) |
| 10012 | packed.append(struct.pack("!B", self.type)) |
| 10013 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10014 | packed.append(struct.pack("!L", self.xid)) |
| 10015 | packed.append(struct.pack("!H", self.stats_type)) |
| 10016 | packed.append(struct.pack("!H", self.flags)) |
| 10017 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10018 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10019 | length = sum([len(x) for x in packed]) |
| 10020 | packed[2] = struct.pack("!H", length) |
| 10021 | return ''.join(packed) |
| 10022 | |
| 10023 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10024 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10025 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10026 | _version = reader.read("!B")[0] |
| 10027 | assert(_version == 4) |
| 10028 | _type = reader.read("!B")[0] |
| 10029 | assert(_type == 19) |
| 10030 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10031 | orig_reader = reader |
| 10032 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10033 | obj.xid = reader.read("!L")[0] |
| 10034 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10035 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10036 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10037 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10038 | obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10039 | return obj |
| 10040 | |
| 10041 | def __eq__(self, other): |
| 10042 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10043 | if self.xid != other.xid: return False |
| 10044 | if self.flags != other.flags: return False |
| 10045 | if self.entries != other.entries: return False |
| 10046 | return True |
| 10047 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10048 | def pretty_print(self, q): |
| 10049 | q.text("meter_stats_reply {") |
| 10050 | with q.group(): |
| 10051 | with q.indent(2): |
| 10052 | q.breakable() |
| 10053 | q.text("xid = "); |
| 10054 | if self.xid != None: |
| 10055 | q.text("%#x" % self.xid) |
| 10056 | else: |
| 10057 | q.text('None') |
| 10058 | q.text(","); q.breakable() |
| 10059 | q.text("flags = "); |
| 10060 | q.text("%#x" % self.flags) |
| 10061 | q.text(","); q.breakable() |
| 10062 | q.text("entries = "); |
| 10063 | q.pp(self.entries) |
| 10064 | q.breakable() |
| 10065 | q.text('}') |
| 10066 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10067 | stats_reply.subtypes[9] = meter_stats_reply |
| 10068 | |
| 10069 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10070 | version = 4 |
| 10071 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10072 | stats_type = 9 |
| 10073 | |
| 10074 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10075 | if xid != None: |
| 10076 | self.xid = xid |
| 10077 | else: |
| 10078 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10079 | if flags != None: |
| 10080 | self.flags = flags |
| 10081 | else: |
| 10082 | self.flags = 0 |
| 10083 | if meter_id != None: |
| 10084 | self.meter_id = meter_id |
| 10085 | else: |
| 10086 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10087 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10088 | |
| 10089 | def pack(self): |
| 10090 | packed = [] |
| 10091 | packed.append(struct.pack("!B", self.version)) |
| 10092 | packed.append(struct.pack("!B", self.type)) |
| 10093 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10094 | packed.append(struct.pack("!L", self.xid)) |
| 10095 | packed.append(struct.pack("!H", self.stats_type)) |
| 10096 | packed.append(struct.pack("!H", self.flags)) |
| 10097 | packed.append('\x00' * 4) |
| 10098 | packed.append(struct.pack("!L", self.meter_id)) |
| 10099 | packed.append('\x00' * 4) |
| 10100 | length = sum([len(x) for x in packed]) |
| 10101 | packed[2] = struct.pack("!H", length) |
| 10102 | return ''.join(packed) |
| 10103 | |
| 10104 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10105 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10106 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10107 | _version = reader.read("!B")[0] |
| 10108 | assert(_version == 4) |
| 10109 | _type = reader.read("!B")[0] |
| 10110 | assert(_type == 18) |
| 10111 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10112 | orig_reader = reader |
| 10113 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10114 | obj.xid = reader.read("!L")[0] |
| 10115 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10116 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10117 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10118 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10119 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10120 | reader.skip(4) |
| 10121 | return obj |
| 10122 | |
| 10123 | def __eq__(self, other): |
| 10124 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10125 | if self.xid != other.xid: return False |
| 10126 | if self.flags != other.flags: return False |
| 10127 | if self.meter_id != other.meter_id: return False |
| 10128 | return True |
| 10129 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10130 | def pretty_print(self, q): |
| 10131 | q.text("meter_stats_request {") |
| 10132 | with q.group(): |
| 10133 | with q.indent(2): |
| 10134 | q.breakable() |
| 10135 | q.text("xid = "); |
| 10136 | if self.xid != None: |
| 10137 | q.text("%#x" % self.xid) |
| 10138 | else: |
| 10139 | q.text('None') |
| 10140 | q.text(","); q.breakable() |
| 10141 | q.text("flags = "); |
| 10142 | q.text("%#x" % self.flags) |
| 10143 | q.text(","); q.breakable() |
| 10144 | q.text("meter_id = "); |
| 10145 | q.text("%#x" % self.meter_id) |
| 10146 | q.breakable() |
| 10147 | q.text('}') |
| 10148 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10149 | stats_request.subtypes[9] = meter_stats_request |
| 10150 | |
| 10151 | class nicira_header(experimenter): |
| 10152 | subtypes = {} |
| 10153 | |
| 10154 | @staticmethod |
| 10155 | def unpack(reader): |
| 10156 | subtype, = reader.peek('!L', 12) |
| 10157 | try: |
| 10158 | subclass = nicira_header.subtypes[subtype] |
| 10159 | except KeyError: |
| 10160 | raise loxi.ProtocolError("unknown nicira_header experimenter message subtype %#x" % subtype) |
| 10161 | return subclass.unpack(reader) |
| 10162 | |
| 10163 | experimenter.subtypes[8992] = nicira_header |
| 10164 | |
| 10165 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10166 | version = 4 |
| 10167 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10168 | |
| 10169 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10170 | if xid != None: |
| 10171 | self.xid = xid |
| 10172 | else: |
| 10173 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10174 | if buffer_id != None: |
| 10175 | self.buffer_id = buffer_id |
| 10176 | else: |
| 10177 | self.buffer_id = 0 |
| 10178 | if total_len != None: |
| 10179 | self.total_len = total_len |
| 10180 | else: |
| 10181 | self.total_len = 0 |
| 10182 | if reason != None: |
| 10183 | self.reason = reason |
| 10184 | else: |
| 10185 | self.reason = 0 |
| 10186 | if table_id != None: |
| 10187 | self.table_id = table_id |
| 10188 | else: |
| 10189 | self.table_id = 0 |
| 10190 | if cookie != None: |
| 10191 | self.cookie = cookie |
| 10192 | else: |
| 10193 | self.cookie = 0 |
| 10194 | if match != None: |
| 10195 | self.match = match |
| 10196 | else: |
| 10197 | self.match = common.match() |
| 10198 | if data != None: |
| 10199 | self.data = data |
| 10200 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10201 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10202 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10203 | |
| 10204 | def pack(self): |
| 10205 | packed = [] |
| 10206 | packed.append(struct.pack("!B", self.version)) |
| 10207 | packed.append(struct.pack("!B", self.type)) |
| 10208 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10209 | packed.append(struct.pack("!L", self.xid)) |
| 10210 | packed.append(struct.pack("!L", self.buffer_id)) |
| 10211 | packed.append(struct.pack("!H", self.total_len)) |
| 10212 | packed.append(struct.pack("!B", self.reason)) |
| 10213 | packed.append(struct.pack("!B", self.table_id)) |
| 10214 | packed.append(struct.pack("!Q", self.cookie)) |
| 10215 | packed.append(self.match.pack()) |
| 10216 | packed.append('\x00' * 2) |
| 10217 | packed.append(self.data) |
| 10218 | length = sum([len(x) for x in packed]) |
| 10219 | packed[2] = struct.pack("!H", length) |
| 10220 | return ''.join(packed) |
| 10221 | |
| 10222 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10223 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10224 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10225 | _version = reader.read("!B")[0] |
| 10226 | assert(_version == 4) |
| 10227 | _type = reader.read("!B")[0] |
| 10228 | assert(_type == 10) |
| 10229 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10230 | orig_reader = reader |
| 10231 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10232 | obj.xid = reader.read("!L")[0] |
| 10233 | obj.buffer_id = reader.read("!L")[0] |
| 10234 | obj.total_len = reader.read("!H")[0] |
| 10235 | obj.reason = reader.read("!B")[0] |
| 10236 | obj.table_id = reader.read("!B")[0] |
| 10237 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10238 | obj.match = common.match.unpack(reader) |
| 10239 | reader.skip(2) |
| 10240 | obj.data = str(reader.read_all()) |
| 10241 | return obj |
| 10242 | |
| 10243 | def __eq__(self, other): |
| 10244 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10245 | if self.xid != other.xid: return False |
| 10246 | if self.buffer_id != other.buffer_id: return False |
| 10247 | if self.total_len != other.total_len: return False |
| 10248 | if self.reason != other.reason: return False |
| 10249 | if self.table_id != other.table_id: return False |
| 10250 | if self.cookie != other.cookie: return False |
| 10251 | if self.match != other.match: return False |
| 10252 | if self.data != other.data: return False |
| 10253 | return True |
| 10254 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10255 | def pretty_print(self, q): |
| 10256 | q.text("packet_in {") |
| 10257 | with q.group(): |
| 10258 | with q.indent(2): |
| 10259 | q.breakable() |
| 10260 | q.text("xid = "); |
| 10261 | if self.xid != None: |
| 10262 | q.text("%#x" % self.xid) |
| 10263 | else: |
| 10264 | q.text('None') |
| 10265 | q.text(","); q.breakable() |
| 10266 | q.text("buffer_id = "); |
| 10267 | q.text("%#x" % self.buffer_id) |
| 10268 | q.text(","); q.breakable() |
| 10269 | q.text("total_len = "); |
| 10270 | q.text("%#x" % self.total_len) |
| 10271 | q.text(","); q.breakable() |
| 10272 | q.text("reason = "); |
| 10273 | q.text("%#x" % self.reason) |
| 10274 | q.text(","); q.breakable() |
| 10275 | q.text("table_id = "); |
| 10276 | q.text("%#x" % self.table_id) |
| 10277 | q.text(","); q.breakable() |
| 10278 | q.text("cookie = "); |
| 10279 | q.text("%#x" % self.cookie) |
| 10280 | q.text(","); q.breakable() |
| 10281 | q.text("match = "); |
| 10282 | q.pp(self.match) |
| 10283 | q.text(","); q.breakable() |
| 10284 | q.text("data = "); |
| 10285 | q.pp(self.data) |
| 10286 | q.breakable() |
| 10287 | q.text('}') |
| 10288 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10289 | message.subtypes[10] = packet_in |
| 10290 | |
| 10291 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10292 | version = 4 |
| 10293 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10294 | |
| 10295 | 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] | 10296 | if xid != None: |
| 10297 | self.xid = xid |
| 10298 | else: |
| 10299 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10300 | if buffer_id != None: |
| 10301 | self.buffer_id = buffer_id |
| 10302 | else: |
| 10303 | self.buffer_id = 0 |
| 10304 | if in_port != None: |
| 10305 | self.in_port = in_port |
| 10306 | else: |
| 10307 | self.in_port = 0 |
| 10308 | if actions != None: |
| 10309 | self.actions = actions |
| 10310 | else: |
| 10311 | self.actions = [] |
| 10312 | if data != None: |
| 10313 | self.data = data |
| 10314 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10315 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10316 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10317 | |
| 10318 | def pack(self): |
| 10319 | packed = [] |
| 10320 | packed.append(struct.pack("!B", self.version)) |
| 10321 | packed.append(struct.pack("!B", self.type)) |
| 10322 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10323 | packed.append(struct.pack("!L", self.xid)) |
| 10324 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10325 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10326 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 10327 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10328 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10329 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 10330 | packed.append(self.data) |
| 10331 | length = sum([len(x) for x in packed]) |
| 10332 | packed[2] = struct.pack("!H", length) |
| 10333 | return ''.join(packed) |
| 10334 | |
| 10335 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10336 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10337 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10338 | _version = reader.read("!B")[0] |
| 10339 | assert(_version == 4) |
| 10340 | _type = reader.read("!B")[0] |
| 10341 | assert(_type == 13) |
| 10342 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10343 | orig_reader = reader |
| 10344 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10345 | obj.xid = reader.read("!L")[0] |
| 10346 | obj.buffer_id = reader.read("!L")[0] |
| 10347 | obj.in_port = util.unpack_port_no(reader) |
| 10348 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10349 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10350 | 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] | 10351 | obj.data = str(reader.read_all()) |
| 10352 | return obj |
| 10353 | |
| 10354 | def __eq__(self, other): |
| 10355 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10356 | if self.xid != other.xid: return False |
| 10357 | if self.buffer_id != other.buffer_id: return False |
| 10358 | if self.in_port != other.in_port: return False |
| 10359 | if self.actions != other.actions: return False |
| 10360 | if self.data != other.data: return False |
| 10361 | return True |
| 10362 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10363 | def pretty_print(self, q): |
| 10364 | q.text("packet_out {") |
| 10365 | with q.group(): |
| 10366 | with q.indent(2): |
| 10367 | q.breakable() |
| 10368 | q.text("xid = "); |
| 10369 | if self.xid != None: |
| 10370 | q.text("%#x" % self.xid) |
| 10371 | else: |
| 10372 | q.text('None') |
| 10373 | q.text(","); q.breakable() |
| 10374 | q.text("buffer_id = "); |
| 10375 | q.text("%#x" % self.buffer_id) |
| 10376 | q.text(","); q.breakable() |
| 10377 | q.text("in_port = "); |
| 10378 | q.text(util.pretty_port(self.in_port)) |
| 10379 | q.text(","); q.breakable() |
| 10380 | q.text("actions = "); |
| 10381 | q.pp(self.actions) |
| 10382 | q.text(","); q.breakable() |
| 10383 | q.text("data = "); |
| 10384 | q.pp(self.data) |
| 10385 | q.breakable() |
| 10386 | q.text('}') |
| 10387 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10388 | message.subtypes[13] = packet_out |
| 10389 | |
| 10390 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10391 | version = 4 |
| 10392 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10393 | stats_type = 13 |
| 10394 | |
| 10395 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10396 | if xid != None: |
| 10397 | self.xid = xid |
| 10398 | else: |
| 10399 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10400 | if flags != None: |
| 10401 | self.flags = flags |
| 10402 | else: |
| 10403 | self.flags = 0 |
| 10404 | if entries != None: |
| 10405 | self.entries = entries |
| 10406 | else: |
| 10407 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10408 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10409 | |
| 10410 | def pack(self): |
| 10411 | packed = [] |
| 10412 | packed.append(struct.pack("!B", self.version)) |
| 10413 | packed.append(struct.pack("!B", self.type)) |
| 10414 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10415 | packed.append(struct.pack("!L", self.xid)) |
| 10416 | packed.append(struct.pack("!H", self.stats_type)) |
| 10417 | packed.append(struct.pack("!H", self.flags)) |
| 10418 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10419 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10420 | length = sum([len(x) for x in packed]) |
| 10421 | packed[2] = struct.pack("!H", length) |
| 10422 | return ''.join(packed) |
| 10423 | |
| 10424 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10425 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10426 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10427 | _version = reader.read("!B")[0] |
| 10428 | assert(_version == 4) |
| 10429 | _type = reader.read("!B")[0] |
| 10430 | assert(_type == 19) |
| 10431 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10432 | orig_reader = reader |
| 10433 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10434 | obj.xid = reader.read("!L")[0] |
| 10435 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10436 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10437 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10438 | reader.skip(4) |
| 10439 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
| 10440 | return obj |
| 10441 | |
| 10442 | def __eq__(self, other): |
| 10443 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10444 | if self.xid != other.xid: return False |
| 10445 | if self.flags != other.flags: return False |
| 10446 | if self.entries != other.entries: return False |
| 10447 | return True |
| 10448 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10449 | def pretty_print(self, q): |
| 10450 | q.text("port_desc_stats_reply {") |
| 10451 | with q.group(): |
| 10452 | with q.indent(2): |
| 10453 | q.breakable() |
| 10454 | q.text("xid = "); |
| 10455 | if self.xid != None: |
| 10456 | q.text("%#x" % self.xid) |
| 10457 | else: |
| 10458 | q.text('None') |
| 10459 | q.text(","); q.breakable() |
| 10460 | q.text("flags = "); |
| 10461 | q.text("%#x" % self.flags) |
| 10462 | q.text(","); q.breakable() |
| 10463 | q.text("entries = "); |
| 10464 | q.pp(self.entries) |
| 10465 | q.breakable() |
| 10466 | q.text('}') |
| 10467 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10468 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 10469 | |
| 10470 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10471 | version = 4 |
| 10472 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10473 | stats_type = 13 |
| 10474 | |
| 10475 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10476 | if xid != None: |
| 10477 | self.xid = xid |
| 10478 | else: |
| 10479 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10480 | if flags != None: |
| 10481 | self.flags = flags |
| 10482 | else: |
| 10483 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10484 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10485 | |
| 10486 | def pack(self): |
| 10487 | packed = [] |
| 10488 | packed.append(struct.pack("!B", self.version)) |
| 10489 | packed.append(struct.pack("!B", self.type)) |
| 10490 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10491 | packed.append(struct.pack("!L", self.xid)) |
| 10492 | packed.append(struct.pack("!H", self.stats_type)) |
| 10493 | packed.append(struct.pack("!H", self.flags)) |
| 10494 | packed.append('\x00' * 4) |
| 10495 | length = sum([len(x) for x in packed]) |
| 10496 | packed[2] = struct.pack("!H", length) |
| 10497 | return ''.join(packed) |
| 10498 | |
| 10499 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10500 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10501 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10502 | _version = reader.read("!B")[0] |
| 10503 | assert(_version == 4) |
| 10504 | _type = reader.read("!B")[0] |
| 10505 | assert(_type == 18) |
| 10506 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10507 | orig_reader = reader |
| 10508 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10509 | obj.xid = reader.read("!L")[0] |
| 10510 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10511 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10512 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10513 | reader.skip(4) |
| 10514 | return obj |
| 10515 | |
| 10516 | def __eq__(self, other): |
| 10517 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10518 | if self.xid != other.xid: return False |
| 10519 | if self.flags != other.flags: return False |
| 10520 | return True |
| 10521 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10522 | def pretty_print(self, q): |
| 10523 | q.text("port_desc_stats_request {") |
| 10524 | with q.group(): |
| 10525 | with q.indent(2): |
| 10526 | q.breakable() |
| 10527 | q.text("xid = "); |
| 10528 | if self.xid != None: |
| 10529 | q.text("%#x" % self.xid) |
| 10530 | else: |
| 10531 | q.text('None') |
| 10532 | q.text(","); q.breakable() |
| 10533 | q.text("flags = "); |
| 10534 | q.text("%#x" % self.flags) |
| 10535 | q.breakable() |
| 10536 | q.text('}') |
| 10537 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10538 | stats_request.subtypes[13] = port_desc_stats_request |
| 10539 | |
| 10540 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10541 | version = 4 |
| 10542 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10543 | |
| 10544 | 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] | 10545 | if xid != None: |
| 10546 | self.xid = xid |
| 10547 | else: |
| 10548 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10549 | if port_no != None: |
| 10550 | self.port_no = port_no |
| 10551 | else: |
| 10552 | self.port_no = 0 |
| 10553 | if hw_addr != None: |
| 10554 | self.hw_addr = hw_addr |
| 10555 | else: |
| 10556 | self.hw_addr = [0,0,0,0,0,0] |
| 10557 | if config != None: |
| 10558 | self.config = config |
| 10559 | else: |
| 10560 | self.config = 0 |
| 10561 | if mask != None: |
| 10562 | self.mask = mask |
| 10563 | else: |
| 10564 | self.mask = 0 |
| 10565 | if advertise != None: |
| 10566 | self.advertise = advertise |
| 10567 | else: |
| 10568 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10569 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10570 | |
| 10571 | def pack(self): |
| 10572 | packed = [] |
| 10573 | packed.append(struct.pack("!B", self.version)) |
| 10574 | packed.append(struct.pack("!B", self.type)) |
| 10575 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10576 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10577 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10578 | packed.append('\x00' * 4) |
| 10579 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 10580 | packed.append('\x00' * 2) |
| 10581 | packed.append(struct.pack("!L", self.config)) |
| 10582 | packed.append(struct.pack("!L", self.mask)) |
| 10583 | packed.append(struct.pack("!L", self.advertise)) |
| 10584 | packed.append('\x00' * 4) |
| 10585 | length = sum([len(x) for x in packed]) |
| 10586 | packed[2] = struct.pack("!H", length) |
| 10587 | return ''.join(packed) |
| 10588 | |
| 10589 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10590 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10591 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10592 | _version = reader.read("!B")[0] |
| 10593 | assert(_version == 4) |
| 10594 | _type = reader.read("!B")[0] |
| 10595 | assert(_type == 16) |
| 10596 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10597 | orig_reader = reader |
| 10598 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10599 | obj.xid = reader.read("!L")[0] |
| 10600 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10601 | reader.skip(4) |
| 10602 | obj.hw_addr = list(reader.read('!6B')) |
| 10603 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10604 | obj.config = reader.read("!L")[0] |
| 10605 | obj.mask = reader.read("!L")[0] |
| 10606 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10607 | reader.skip(4) |
| 10608 | return obj |
| 10609 | |
| 10610 | def __eq__(self, other): |
| 10611 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10612 | if self.xid != other.xid: return False |
| 10613 | if self.port_no != other.port_no: return False |
| 10614 | if self.hw_addr != other.hw_addr: return False |
| 10615 | if self.config != other.config: return False |
| 10616 | if self.mask != other.mask: return False |
| 10617 | if self.advertise != other.advertise: return False |
| 10618 | return True |
| 10619 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10620 | def pretty_print(self, q): |
| 10621 | q.text("port_mod {") |
| 10622 | with q.group(): |
| 10623 | with q.indent(2): |
| 10624 | q.breakable() |
| 10625 | q.text("xid = "); |
| 10626 | if self.xid != None: |
| 10627 | q.text("%#x" % self.xid) |
| 10628 | else: |
| 10629 | q.text('None') |
| 10630 | q.text(","); q.breakable() |
| 10631 | q.text("port_no = "); |
| 10632 | q.text(util.pretty_port(self.port_no)) |
| 10633 | q.text(","); q.breakable() |
| 10634 | q.text("hw_addr = "); |
| 10635 | q.text(util.pretty_mac(self.hw_addr)) |
| 10636 | q.text(","); q.breakable() |
| 10637 | q.text("config = "); |
| 10638 | q.text("%#x" % self.config) |
| 10639 | q.text(","); q.breakable() |
| 10640 | q.text("mask = "); |
| 10641 | q.text("%#x" % self.mask) |
| 10642 | q.text(","); q.breakable() |
| 10643 | q.text("advertise = "); |
| 10644 | q.text("%#x" % self.advertise) |
| 10645 | q.breakable() |
| 10646 | q.text('}') |
| 10647 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10648 | message.subtypes[16] = port_mod |
| 10649 | |
| 10650 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10651 | version = 4 |
| 10652 | type = 1 |
| 10653 | err_type = 7 |
| 10654 | |
| 10655 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10656 | if xid != None: |
| 10657 | self.xid = xid |
| 10658 | else: |
| 10659 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10660 | if code != None: |
| 10661 | self.code = code |
| 10662 | else: |
| 10663 | self.code = 0 |
| 10664 | if data != None: |
| 10665 | self.data = data |
| 10666 | else: |
| 10667 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10668 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10669 | |
| 10670 | def pack(self): |
| 10671 | packed = [] |
| 10672 | packed.append(struct.pack("!B", self.version)) |
| 10673 | packed.append(struct.pack("!B", self.type)) |
| 10674 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10675 | packed.append(struct.pack("!L", self.xid)) |
| 10676 | packed.append(struct.pack("!H", self.err_type)) |
| 10677 | packed.append(struct.pack("!H", self.code)) |
| 10678 | packed.append(self.data) |
| 10679 | length = sum([len(x) for x in packed]) |
| 10680 | packed[2] = struct.pack("!H", length) |
| 10681 | return ''.join(packed) |
| 10682 | |
| 10683 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10684 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10685 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10686 | _version = reader.read("!B")[0] |
| 10687 | assert(_version == 4) |
| 10688 | _type = reader.read("!B")[0] |
| 10689 | assert(_type == 1) |
| 10690 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10691 | orig_reader = reader |
| 10692 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10693 | obj.xid = reader.read("!L")[0] |
| 10694 | _err_type = reader.read("!H")[0] |
| 10695 | assert(_err_type == 7) |
| 10696 | obj.code = reader.read("!H")[0] |
| 10697 | obj.data = str(reader.read_all()) |
| 10698 | return obj |
| 10699 | |
| 10700 | def __eq__(self, other): |
| 10701 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10702 | if self.xid != other.xid: return False |
| 10703 | if self.code != other.code: return False |
| 10704 | if self.data != other.data: return False |
| 10705 | return True |
| 10706 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10707 | def pretty_print(self, q): |
| 10708 | q.text("port_mod_failed_error_msg {") |
| 10709 | with q.group(): |
| 10710 | with q.indent(2): |
| 10711 | q.breakable() |
| 10712 | q.text("xid = "); |
| 10713 | if self.xid != None: |
| 10714 | q.text("%#x" % self.xid) |
| 10715 | else: |
| 10716 | q.text('None') |
| 10717 | q.text(","); q.breakable() |
| 10718 | q.text("code = "); |
| 10719 | q.text("%#x" % self.code) |
| 10720 | q.text(","); q.breakable() |
| 10721 | q.text("data = "); |
| 10722 | q.pp(self.data) |
| 10723 | q.breakable() |
| 10724 | q.text('}') |
| 10725 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10726 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 10727 | |
| 10728 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10729 | version = 4 |
| 10730 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10731 | stats_type = 4 |
| 10732 | |
| 10733 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10734 | if xid != None: |
| 10735 | self.xid = xid |
| 10736 | else: |
| 10737 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10738 | if flags != None: |
| 10739 | self.flags = flags |
| 10740 | else: |
| 10741 | self.flags = 0 |
| 10742 | if entries != None: |
| 10743 | self.entries = entries |
| 10744 | else: |
| 10745 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10746 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10747 | |
| 10748 | def pack(self): |
| 10749 | packed = [] |
| 10750 | packed.append(struct.pack("!B", self.version)) |
| 10751 | packed.append(struct.pack("!B", self.type)) |
| 10752 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10753 | packed.append(struct.pack("!L", self.xid)) |
| 10754 | packed.append(struct.pack("!H", self.stats_type)) |
| 10755 | packed.append(struct.pack("!H", self.flags)) |
| 10756 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10757 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10758 | length = sum([len(x) for x in packed]) |
| 10759 | packed[2] = struct.pack("!H", length) |
| 10760 | return ''.join(packed) |
| 10761 | |
| 10762 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10763 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10764 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10765 | _version = reader.read("!B")[0] |
| 10766 | assert(_version == 4) |
| 10767 | _type = reader.read("!B")[0] |
| 10768 | assert(_type == 19) |
| 10769 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10770 | orig_reader = reader |
| 10771 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10772 | obj.xid = reader.read("!L")[0] |
| 10773 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10774 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10775 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10776 | reader.skip(4) |
| 10777 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
| 10778 | return obj |
| 10779 | |
| 10780 | def __eq__(self, other): |
| 10781 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10782 | if self.xid != other.xid: return False |
| 10783 | if self.flags != other.flags: return False |
| 10784 | if self.entries != other.entries: return False |
| 10785 | return True |
| 10786 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10787 | def pretty_print(self, q): |
| 10788 | q.text("port_stats_reply {") |
| 10789 | with q.group(): |
| 10790 | with q.indent(2): |
| 10791 | q.breakable() |
| 10792 | q.text("xid = "); |
| 10793 | if self.xid != None: |
| 10794 | q.text("%#x" % self.xid) |
| 10795 | else: |
| 10796 | q.text('None') |
| 10797 | q.text(","); q.breakable() |
| 10798 | q.text("flags = "); |
| 10799 | q.text("%#x" % self.flags) |
| 10800 | q.text(","); q.breakable() |
| 10801 | q.text("entries = "); |
| 10802 | q.pp(self.entries) |
| 10803 | q.breakable() |
| 10804 | q.text('}') |
| 10805 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10806 | stats_reply.subtypes[4] = port_stats_reply |
| 10807 | |
| 10808 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10809 | version = 4 |
| 10810 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10811 | stats_type = 4 |
| 10812 | |
| 10813 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10814 | if xid != None: |
| 10815 | self.xid = xid |
| 10816 | else: |
| 10817 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10818 | if flags != None: |
| 10819 | self.flags = flags |
| 10820 | else: |
| 10821 | self.flags = 0 |
| 10822 | if port_no != None: |
| 10823 | self.port_no = port_no |
| 10824 | else: |
| 10825 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10826 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10827 | |
| 10828 | def pack(self): |
| 10829 | packed = [] |
| 10830 | packed.append(struct.pack("!B", self.version)) |
| 10831 | packed.append(struct.pack("!B", self.type)) |
| 10832 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10833 | packed.append(struct.pack("!L", self.xid)) |
| 10834 | packed.append(struct.pack("!H", self.stats_type)) |
| 10835 | packed.append(struct.pack("!H", self.flags)) |
| 10836 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10837 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10838 | packed.append('\x00' * 4) |
| 10839 | length = sum([len(x) for x in packed]) |
| 10840 | packed[2] = struct.pack("!H", length) |
| 10841 | return ''.join(packed) |
| 10842 | |
| 10843 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10844 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10845 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10846 | _version = reader.read("!B")[0] |
| 10847 | assert(_version == 4) |
| 10848 | _type = reader.read("!B")[0] |
| 10849 | assert(_type == 18) |
| 10850 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10851 | orig_reader = reader |
| 10852 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10853 | obj.xid = reader.read("!L")[0] |
| 10854 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10855 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10856 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10857 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10858 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10859 | reader.skip(4) |
| 10860 | return obj |
| 10861 | |
| 10862 | def __eq__(self, other): |
| 10863 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10864 | if self.xid != other.xid: return False |
| 10865 | if self.flags != other.flags: return False |
| 10866 | if self.port_no != other.port_no: return False |
| 10867 | return True |
| 10868 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10869 | def pretty_print(self, q): |
| 10870 | q.text("port_stats_request {") |
| 10871 | with q.group(): |
| 10872 | with q.indent(2): |
| 10873 | q.breakable() |
| 10874 | q.text("xid = "); |
| 10875 | if self.xid != None: |
| 10876 | q.text("%#x" % self.xid) |
| 10877 | else: |
| 10878 | q.text('None') |
| 10879 | q.text(","); q.breakable() |
| 10880 | q.text("flags = "); |
| 10881 | q.text("%#x" % self.flags) |
| 10882 | q.text(","); q.breakable() |
| 10883 | q.text("port_no = "); |
| 10884 | q.text(util.pretty_port(self.port_no)) |
| 10885 | q.breakable() |
| 10886 | q.text('}') |
| 10887 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10888 | stats_request.subtypes[4] = port_stats_request |
| 10889 | |
| 10890 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10891 | version = 4 |
| 10892 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10893 | |
| 10894 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10895 | if xid != None: |
| 10896 | self.xid = xid |
| 10897 | else: |
| 10898 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10899 | if reason != None: |
| 10900 | self.reason = reason |
| 10901 | else: |
| 10902 | self.reason = 0 |
| 10903 | if desc != None: |
| 10904 | self.desc = desc |
| 10905 | else: |
| 10906 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10907 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10908 | |
| 10909 | def pack(self): |
| 10910 | packed = [] |
| 10911 | packed.append(struct.pack("!B", self.version)) |
| 10912 | packed.append(struct.pack("!B", self.type)) |
| 10913 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10914 | packed.append(struct.pack("!L", self.xid)) |
| 10915 | packed.append(struct.pack("!B", self.reason)) |
| 10916 | packed.append('\x00' * 7) |
| 10917 | packed.append(self.desc.pack()) |
| 10918 | length = sum([len(x) for x in packed]) |
| 10919 | packed[2] = struct.pack("!H", length) |
| 10920 | return ''.join(packed) |
| 10921 | |
| 10922 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10923 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10924 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10925 | _version = reader.read("!B")[0] |
| 10926 | assert(_version == 4) |
| 10927 | _type = reader.read("!B")[0] |
| 10928 | assert(_type == 12) |
| 10929 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10930 | orig_reader = reader |
| 10931 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10932 | obj.xid = reader.read("!L")[0] |
| 10933 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10934 | reader.skip(7) |
| 10935 | obj.desc = common.port_desc.unpack(reader) |
| 10936 | return obj |
| 10937 | |
| 10938 | def __eq__(self, other): |
| 10939 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10940 | if self.xid != other.xid: return False |
| 10941 | if self.reason != other.reason: return False |
| 10942 | if self.desc != other.desc: return False |
| 10943 | return True |
| 10944 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10945 | def pretty_print(self, q): |
| 10946 | q.text("port_status {") |
| 10947 | with q.group(): |
| 10948 | with q.indent(2): |
| 10949 | q.breakable() |
| 10950 | q.text("xid = "); |
| 10951 | if self.xid != None: |
| 10952 | q.text("%#x" % self.xid) |
| 10953 | else: |
| 10954 | q.text('None') |
| 10955 | q.text(","); q.breakable() |
| 10956 | q.text("reason = "); |
| 10957 | q.text("%#x" % self.reason) |
| 10958 | q.text(","); q.breakable() |
| 10959 | q.text("desc = "); |
| 10960 | q.pp(self.desc) |
| 10961 | q.breakable() |
| 10962 | q.text('}') |
| 10963 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10964 | message.subtypes[12] = port_status |
| 10965 | |
| 10966 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10967 | version = 4 |
| 10968 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10969 | |
| 10970 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10971 | if xid != None: |
| 10972 | self.xid = xid |
| 10973 | else: |
| 10974 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10975 | if port != None: |
| 10976 | self.port = port |
| 10977 | else: |
| 10978 | self.port = 0 |
| 10979 | if queues != None: |
| 10980 | self.queues = queues |
| 10981 | else: |
| 10982 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10983 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10984 | |
| 10985 | def pack(self): |
| 10986 | packed = [] |
| 10987 | packed.append(struct.pack("!B", self.version)) |
| 10988 | packed.append(struct.pack("!B", self.type)) |
| 10989 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10990 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10991 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10992 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10993 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10994 | length = sum([len(x) for x in packed]) |
| 10995 | packed[2] = struct.pack("!H", length) |
| 10996 | return ''.join(packed) |
| 10997 | |
| 10998 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10999 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11000 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11001 | _version = reader.read("!B")[0] |
| 11002 | assert(_version == 4) |
| 11003 | _type = reader.read("!B")[0] |
| 11004 | assert(_type == 23) |
| 11005 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11006 | orig_reader = reader |
| 11007 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11008 | obj.xid = reader.read("!L")[0] |
| 11009 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11010 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11011 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11012 | return obj |
| 11013 | |
| 11014 | def __eq__(self, other): |
| 11015 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11016 | if self.xid != other.xid: return False |
| 11017 | if self.port != other.port: return False |
| 11018 | if self.queues != other.queues: return False |
| 11019 | return True |
| 11020 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11021 | def pretty_print(self, q): |
| 11022 | q.text("queue_get_config_reply {") |
| 11023 | with q.group(): |
| 11024 | with q.indent(2): |
| 11025 | q.breakable() |
| 11026 | q.text("xid = "); |
| 11027 | if self.xid != None: |
| 11028 | q.text("%#x" % self.xid) |
| 11029 | else: |
| 11030 | q.text('None') |
| 11031 | q.text(","); q.breakable() |
| 11032 | q.text("port = "); |
| 11033 | q.text(util.pretty_port(self.port)) |
| 11034 | q.text(","); q.breakable() |
| 11035 | q.text("queues = "); |
| 11036 | q.pp(self.queues) |
| 11037 | q.breakable() |
| 11038 | q.text('}') |
| 11039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11040 | message.subtypes[23] = queue_get_config_reply |
| 11041 | |
| 11042 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11043 | version = 4 |
| 11044 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11045 | |
| 11046 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11047 | if xid != None: |
| 11048 | self.xid = xid |
| 11049 | else: |
| 11050 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11051 | if port != None: |
| 11052 | self.port = port |
| 11053 | else: |
| 11054 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11055 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11056 | |
| 11057 | def pack(self): |
| 11058 | packed = [] |
| 11059 | packed.append(struct.pack("!B", self.version)) |
| 11060 | packed.append(struct.pack("!B", self.type)) |
| 11061 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11062 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11063 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11064 | packed.append('\x00' * 4) |
| 11065 | length = sum([len(x) for x in packed]) |
| 11066 | packed[2] = struct.pack("!H", length) |
| 11067 | return ''.join(packed) |
| 11068 | |
| 11069 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11070 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11071 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11072 | _version = reader.read("!B")[0] |
| 11073 | assert(_version == 4) |
| 11074 | _type = reader.read("!B")[0] |
| 11075 | assert(_type == 22) |
| 11076 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11077 | orig_reader = reader |
| 11078 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11079 | obj.xid = reader.read("!L")[0] |
| 11080 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11081 | reader.skip(4) |
| 11082 | return obj |
| 11083 | |
| 11084 | def __eq__(self, other): |
| 11085 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11086 | if self.xid != other.xid: return False |
| 11087 | if self.port != other.port: return False |
| 11088 | return True |
| 11089 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11090 | def pretty_print(self, q): |
| 11091 | q.text("queue_get_config_request {") |
| 11092 | with q.group(): |
| 11093 | with q.indent(2): |
| 11094 | q.breakable() |
| 11095 | q.text("xid = "); |
| 11096 | if self.xid != None: |
| 11097 | q.text("%#x" % self.xid) |
| 11098 | else: |
| 11099 | q.text('None') |
| 11100 | q.text(","); q.breakable() |
| 11101 | q.text("port = "); |
| 11102 | q.text(util.pretty_port(self.port)) |
| 11103 | q.breakable() |
| 11104 | q.text('}') |
| 11105 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11106 | message.subtypes[22] = queue_get_config_request |
| 11107 | |
| 11108 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11109 | version = 4 |
| 11110 | type = 1 |
| 11111 | err_type = 9 |
| 11112 | |
| 11113 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11114 | if xid != None: |
| 11115 | self.xid = xid |
| 11116 | else: |
| 11117 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11118 | if code != None: |
| 11119 | self.code = code |
| 11120 | else: |
| 11121 | self.code = 0 |
| 11122 | if data != None: |
| 11123 | self.data = data |
| 11124 | else: |
| 11125 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11126 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11127 | |
| 11128 | def pack(self): |
| 11129 | packed = [] |
| 11130 | packed.append(struct.pack("!B", self.version)) |
| 11131 | packed.append(struct.pack("!B", self.type)) |
| 11132 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11133 | packed.append(struct.pack("!L", self.xid)) |
| 11134 | packed.append(struct.pack("!H", self.err_type)) |
| 11135 | packed.append(struct.pack("!H", self.code)) |
| 11136 | packed.append(self.data) |
| 11137 | length = sum([len(x) for x in packed]) |
| 11138 | packed[2] = struct.pack("!H", length) |
| 11139 | return ''.join(packed) |
| 11140 | |
| 11141 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11142 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11143 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11144 | _version = reader.read("!B")[0] |
| 11145 | assert(_version == 4) |
| 11146 | _type = reader.read("!B")[0] |
| 11147 | assert(_type == 1) |
| 11148 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11149 | orig_reader = reader |
| 11150 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11151 | obj.xid = reader.read("!L")[0] |
| 11152 | _err_type = reader.read("!H")[0] |
| 11153 | assert(_err_type == 9) |
| 11154 | obj.code = reader.read("!H")[0] |
| 11155 | obj.data = str(reader.read_all()) |
| 11156 | return obj |
| 11157 | |
| 11158 | def __eq__(self, other): |
| 11159 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11160 | if self.xid != other.xid: return False |
| 11161 | if self.code != other.code: return False |
| 11162 | if self.data != other.data: return False |
| 11163 | return True |
| 11164 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11165 | def pretty_print(self, q): |
| 11166 | q.text("queue_op_failed_error_msg {") |
| 11167 | with q.group(): |
| 11168 | with q.indent(2): |
| 11169 | q.breakable() |
| 11170 | q.text("xid = "); |
| 11171 | if self.xid != None: |
| 11172 | q.text("%#x" % self.xid) |
| 11173 | else: |
| 11174 | q.text('None') |
| 11175 | q.text(","); q.breakable() |
| 11176 | q.text("code = "); |
| 11177 | q.text("%#x" % self.code) |
| 11178 | q.text(","); q.breakable() |
| 11179 | q.text("data = "); |
| 11180 | q.pp(self.data) |
| 11181 | q.breakable() |
| 11182 | q.text('}') |
| 11183 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11184 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 11185 | |
| 11186 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11187 | version = 4 |
| 11188 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11189 | stats_type = 5 |
| 11190 | |
| 11191 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11192 | if xid != None: |
| 11193 | self.xid = xid |
| 11194 | else: |
| 11195 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11196 | if flags != None: |
| 11197 | self.flags = flags |
| 11198 | else: |
| 11199 | self.flags = 0 |
| 11200 | if entries != None: |
| 11201 | self.entries = entries |
| 11202 | else: |
| 11203 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11204 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11205 | |
| 11206 | def pack(self): |
| 11207 | packed = [] |
| 11208 | packed.append(struct.pack("!B", self.version)) |
| 11209 | packed.append(struct.pack("!B", self.type)) |
| 11210 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11211 | packed.append(struct.pack("!L", self.xid)) |
| 11212 | packed.append(struct.pack("!H", self.stats_type)) |
| 11213 | packed.append(struct.pack("!H", self.flags)) |
| 11214 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11215 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11216 | length = sum([len(x) for x in packed]) |
| 11217 | packed[2] = struct.pack("!H", length) |
| 11218 | return ''.join(packed) |
| 11219 | |
| 11220 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11221 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11222 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11223 | _version = reader.read("!B")[0] |
| 11224 | assert(_version == 4) |
| 11225 | _type = reader.read("!B")[0] |
| 11226 | assert(_type == 19) |
| 11227 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11228 | orig_reader = reader |
| 11229 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11230 | obj.xid = reader.read("!L")[0] |
| 11231 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11232 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11233 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11234 | reader.skip(4) |
| 11235 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
| 11236 | return obj |
| 11237 | |
| 11238 | def __eq__(self, other): |
| 11239 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11240 | if self.xid != other.xid: return False |
| 11241 | if self.flags != other.flags: return False |
| 11242 | if self.entries != other.entries: return False |
| 11243 | return True |
| 11244 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11245 | def pretty_print(self, q): |
| 11246 | q.text("queue_stats_reply {") |
| 11247 | with q.group(): |
| 11248 | with q.indent(2): |
| 11249 | q.breakable() |
| 11250 | q.text("xid = "); |
| 11251 | if self.xid != None: |
| 11252 | q.text("%#x" % self.xid) |
| 11253 | else: |
| 11254 | q.text('None') |
| 11255 | q.text(","); q.breakable() |
| 11256 | q.text("flags = "); |
| 11257 | q.text("%#x" % self.flags) |
| 11258 | q.text(","); q.breakable() |
| 11259 | q.text("entries = "); |
| 11260 | q.pp(self.entries) |
| 11261 | q.breakable() |
| 11262 | q.text('}') |
| 11263 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11264 | stats_reply.subtypes[5] = queue_stats_reply |
| 11265 | |
| 11266 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11267 | version = 4 |
| 11268 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11269 | stats_type = 5 |
| 11270 | |
| 11271 | 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] | 11272 | if xid != None: |
| 11273 | self.xid = xid |
| 11274 | else: |
| 11275 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11276 | if flags != None: |
| 11277 | self.flags = flags |
| 11278 | else: |
| 11279 | self.flags = 0 |
| 11280 | if port_no != None: |
| 11281 | self.port_no = port_no |
| 11282 | else: |
| 11283 | self.port_no = 0 |
| 11284 | if queue_id != None: |
| 11285 | self.queue_id = queue_id |
| 11286 | else: |
| 11287 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11288 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11289 | |
| 11290 | def pack(self): |
| 11291 | packed = [] |
| 11292 | packed.append(struct.pack("!B", self.version)) |
| 11293 | packed.append(struct.pack("!B", self.type)) |
| 11294 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11295 | packed.append(struct.pack("!L", self.xid)) |
| 11296 | packed.append(struct.pack("!H", self.stats_type)) |
| 11297 | packed.append(struct.pack("!H", self.flags)) |
| 11298 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11299 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11300 | packed.append(struct.pack("!L", self.queue_id)) |
| 11301 | length = sum([len(x) for x in packed]) |
| 11302 | packed[2] = struct.pack("!H", length) |
| 11303 | return ''.join(packed) |
| 11304 | |
| 11305 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11306 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11307 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11308 | _version = reader.read("!B")[0] |
| 11309 | assert(_version == 4) |
| 11310 | _type = reader.read("!B")[0] |
| 11311 | assert(_type == 18) |
| 11312 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11313 | orig_reader = reader |
| 11314 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11315 | obj.xid = reader.read("!L")[0] |
| 11316 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11317 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11318 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11319 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11320 | obj.port_no = util.unpack_port_no(reader) |
| 11321 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11322 | return obj |
| 11323 | |
| 11324 | def __eq__(self, other): |
| 11325 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11326 | if self.xid != other.xid: return False |
| 11327 | if self.flags != other.flags: return False |
| 11328 | if self.port_no != other.port_no: return False |
| 11329 | if self.queue_id != other.queue_id: return False |
| 11330 | return True |
| 11331 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11332 | def pretty_print(self, q): |
| 11333 | q.text("queue_stats_request {") |
| 11334 | with q.group(): |
| 11335 | with q.indent(2): |
| 11336 | q.breakable() |
| 11337 | q.text("xid = "); |
| 11338 | if self.xid != None: |
| 11339 | q.text("%#x" % self.xid) |
| 11340 | else: |
| 11341 | q.text('None') |
| 11342 | q.text(","); q.breakable() |
| 11343 | q.text("flags = "); |
| 11344 | q.text("%#x" % self.flags) |
| 11345 | q.text(","); q.breakable() |
| 11346 | q.text("port_no = "); |
| 11347 | q.text(util.pretty_port(self.port_no)) |
| 11348 | q.text(","); q.breakable() |
| 11349 | q.text("queue_id = "); |
| 11350 | q.text("%#x" % self.queue_id) |
| 11351 | q.breakable() |
| 11352 | q.text('}') |
| 11353 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11354 | stats_request.subtypes[5] = queue_stats_request |
| 11355 | |
| 11356 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11357 | version = 4 |
| 11358 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11359 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11360 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11361 | if xid != None: |
| 11362 | self.xid = xid |
| 11363 | else: |
| 11364 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11365 | if role != None: |
| 11366 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11367 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11368 | self.role = 0 |
| 11369 | if generation_id != None: |
| 11370 | self.generation_id = generation_id |
| 11371 | else: |
| 11372 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11373 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11374 | |
| 11375 | def pack(self): |
| 11376 | packed = [] |
| 11377 | packed.append(struct.pack("!B", self.version)) |
| 11378 | packed.append(struct.pack("!B", self.type)) |
| 11379 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11380 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11381 | packed.append(struct.pack("!L", self.role)) |
| 11382 | packed.append('\x00' * 4) |
| 11383 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11384 | length = sum([len(x) for x in packed]) |
| 11385 | packed[2] = struct.pack("!H", length) |
| 11386 | return ''.join(packed) |
| 11387 | |
| 11388 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11389 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11390 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11391 | _version = reader.read("!B")[0] |
| 11392 | assert(_version == 4) |
| 11393 | _type = reader.read("!B")[0] |
| 11394 | assert(_type == 25) |
| 11395 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11396 | orig_reader = reader |
| 11397 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11398 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11399 | obj.role = reader.read("!L")[0] |
| 11400 | reader.skip(4) |
| 11401 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11402 | return obj |
| 11403 | |
| 11404 | def __eq__(self, other): |
| 11405 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11406 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11407 | if self.role != other.role: return False |
| 11408 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11409 | return True |
| 11410 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11411 | def pretty_print(self, q): |
| 11412 | q.text("role_reply {") |
| 11413 | with q.group(): |
| 11414 | with q.indent(2): |
| 11415 | q.breakable() |
| 11416 | q.text("xid = "); |
| 11417 | if self.xid != None: |
| 11418 | q.text("%#x" % self.xid) |
| 11419 | else: |
| 11420 | q.text('None') |
| 11421 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 11422 | q.text("role = "); |
| 11423 | q.text("%#x" % self.role) |
| 11424 | q.text(","); q.breakable() |
| 11425 | q.text("generation_id = "); |
| 11426 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11427 | q.breakable() |
| 11428 | q.text('}') |
| 11429 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11430 | message.subtypes[25] = role_reply |
| 11431 | |
| 11432 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11433 | version = 4 |
| 11434 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11435 | |
| 11436 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11437 | if xid != None: |
| 11438 | self.xid = xid |
| 11439 | else: |
| 11440 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11441 | if role != None: |
| 11442 | self.role = role |
| 11443 | else: |
| 11444 | self.role = 0 |
| 11445 | if generation_id != None: |
| 11446 | self.generation_id = generation_id |
| 11447 | else: |
| 11448 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11449 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11450 | |
| 11451 | def pack(self): |
| 11452 | packed = [] |
| 11453 | packed.append(struct.pack("!B", self.version)) |
| 11454 | packed.append(struct.pack("!B", self.type)) |
| 11455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11456 | packed.append(struct.pack("!L", self.xid)) |
| 11457 | packed.append(struct.pack("!L", self.role)) |
| 11458 | packed.append('\x00' * 4) |
| 11459 | packed.append(struct.pack("!Q", self.generation_id)) |
| 11460 | length = sum([len(x) for x in packed]) |
| 11461 | packed[2] = struct.pack("!H", length) |
| 11462 | return ''.join(packed) |
| 11463 | |
| 11464 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11465 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11466 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11467 | _version = reader.read("!B")[0] |
| 11468 | assert(_version == 4) |
| 11469 | _type = reader.read("!B")[0] |
| 11470 | assert(_type == 24) |
| 11471 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11472 | orig_reader = reader |
| 11473 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11474 | obj.xid = reader.read("!L")[0] |
| 11475 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11476 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11477 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11478 | return obj |
| 11479 | |
| 11480 | def __eq__(self, other): |
| 11481 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11482 | if self.xid != other.xid: return False |
| 11483 | if self.role != other.role: return False |
| 11484 | if self.generation_id != other.generation_id: return False |
| 11485 | return True |
| 11486 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11487 | def pretty_print(self, q): |
| 11488 | q.text("role_request {") |
| 11489 | with q.group(): |
| 11490 | with q.indent(2): |
| 11491 | q.breakable() |
| 11492 | q.text("xid = "); |
| 11493 | if self.xid != None: |
| 11494 | q.text("%#x" % self.xid) |
| 11495 | else: |
| 11496 | q.text('None') |
| 11497 | q.text(","); q.breakable() |
| 11498 | q.text("role = "); |
| 11499 | q.text("%#x" % self.role) |
| 11500 | q.text(","); q.breakable() |
| 11501 | q.text("generation_id = "); |
| 11502 | q.text("%#x" % self.generation_id) |
| 11503 | q.breakable() |
| 11504 | q.text('}') |
| 11505 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11506 | message.subtypes[24] = role_request |
| 11507 | |
| 11508 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11509 | version = 4 |
| 11510 | type = 1 |
| 11511 | err_type = 11 |
| 11512 | |
| 11513 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11514 | if xid != None: |
| 11515 | self.xid = xid |
| 11516 | else: |
| 11517 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11518 | if code != None: |
| 11519 | self.code = code |
| 11520 | else: |
| 11521 | self.code = 0 |
| 11522 | if data != None: |
| 11523 | self.data = data |
| 11524 | else: |
| 11525 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11526 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11527 | |
| 11528 | def pack(self): |
| 11529 | packed = [] |
| 11530 | packed.append(struct.pack("!B", self.version)) |
| 11531 | packed.append(struct.pack("!B", self.type)) |
| 11532 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11533 | packed.append(struct.pack("!L", self.xid)) |
| 11534 | packed.append(struct.pack("!H", self.err_type)) |
| 11535 | packed.append(struct.pack("!H", self.code)) |
| 11536 | packed.append(self.data) |
| 11537 | length = sum([len(x) for x in packed]) |
| 11538 | packed[2] = struct.pack("!H", length) |
| 11539 | return ''.join(packed) |
| 11540 | |
| 11541 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11542 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11543 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11544 | _version = reader.read("!B")[0] |
| 11545 | assert(_version == 4) |
| 11546 | _type = reader.read("!B")[0] |
| 11547 | assert(_type == 1) |
| 11548 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11549 | orig_reader = reader |
| 11550 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11551 | obj.xid = reader.read("!L")[0] |
| 11552 | _err_type = reader.read("!H")[0] |
| 11553 | assert(_err_type == 11) |
| 11554 | obj.code = reader.read("!H")[0] |
| 11555 | obj.data = str(reader.read_all()) |
| 11556 | return obj |
| 11557 | |
| 11558 | def __eq__(self, other): |
| 11559 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11560 | if self.xid != other.xid: return False |
| 11561 | if self.code != other.code: return False |
| 11562 | if self.data != other.data: return False |
| 11563 | return True |
| 11564 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11565 | def pretty_print(self, q): |
| 11566 | q.text("role_request_failed_error_msg {") |
| 11567 | with q.group(): |
| 11568 | with q.indent(2): |
| 11569 | q.breakable() |
| 11570 | q.text("xid = "); |
| 11571 | if self.xid != None: |
| 11572 | q.text("%#x" % self.xid) |
| 11573 | else: |
| 11574 | q.text('None') |
| 11575 | q.text(","); q.breakable() |
| 11576 | q.text("code = "); |
| 11577 | q.text("%#x" % self.code) |
| 11578 | q.text(","); q.breakable() |
| 11579 | q.text("data = "); |
| 11580 | q.pp(self.data) |
| 11581 | q.breakable() |
| 11582 | q.text('}') |
| 11583 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11584 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 11585 | |
| 11586 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11587 | version = 4 |
| 11588 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11589 | |
| 11590 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11591 | if xid != None: |
| 11592 | self.xid = xid |
| 11593 | else: |
| 11594 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11595 | if flags != None: |
| 11596 | self.flags = flags |
| 11597 | else: |
| 11598 | self.flags = 0 |
| 11599 | if miss_send_len != None: |
| 11600 | self.miss_send_len = miss_send_len |
| 11601 | else: |
| 11602 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11603 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11604 | |
| 11605 | def pack(self): |
| 11606 | packed = [] |
| 11607 | packed.append(struct.pack("!B", self.version)) |
| 11608 | packed.append(struct.pack("!B", self.type)) |
| 11609 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11610 | packed.append(struct.pack("!L", self.xid)) |
| 11611 | packed.append(struct.pack("!H", self.flags)) |
| 11612 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 11613 | length = sum([len(x) for x in packed]) |
| 11614 | packed[2] = struct.pack("!H", length) |
| 11615 | return ''.join(packed) |
| 11616 | |
| 11617 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11618 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11619 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11620 | _version = reader.read("!B")[0] |
| 11621 | assert(_version == 4) |
| 11622 | _type = reader.read("!B")[0] |
| 11623 | assert(_type == 9) |
| 11624 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11625 | orig_reader = reader |
| 11626 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11627 | obj.xid = reader.read("!L")[0] |
| 11628 | obj.flags = reader.read("!H")[0] |
| 11629 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11630 | return obj |
| 11631 | |
| 11632 | def __eq__(self, other): |
| 11633 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11634 | if self.xid != other.xid: return False |
| 11635 | if self.flags != other.flags: return False |
| 11636 | if self.miss_send_len != other.miss_send_len: return False |
| 11637 | return True |
| 11638 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11639 | def pretty_print(self, q): |
| 11640 | q.text("set_config {") |
| 11641 | with q.group(): |
| 11642 | with q.indent(2): |
| 11643 | q.breakable() |
| 11644 | q.text("xid = "); |
| 11645 | if self.xid != None: |
| 11646 | q.text("%#x" % self.xid) |
| 11647 | else: |
| 11648 | q.text('None') |
| 11649 | q.text(","); q.breakable() |
| 11650 | q.text("flags = "); |
| 11651 | q.text("%#x" % self.flags) |
| 11652 | q.text(","); q.breakable() |
| 11653 | q.text("miss_send_len = "); |
| 11654 | q.text("%#x" % self.miss_send_len) |
| 11655 | q.breakable() |
| 11656 | q.text('}') |
| 11657 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11658 | message.subtypes[9] = set_config |
| 11659 | |
| 11660 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11661 | version = 4 |
| 11662 | type = 1 |
| 11663 | err_type = 10 |
| 11664 | |
| 11665 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11666 | if xid != None: |
| 11667 | self.xid = xid |
| 11668 | else: |
| 11669 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11670 | if code != None: |
| 11671 | self.code = code |
| 11672 | else: |
| 11673 | self.code = 0 |
| 11674 | if data != None: |
| 11675 | self.data = data |
| 11676 | else: |
| 11677 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11678 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11679 | |
| 11680 | def pack(self): |
| 11681 | packed = [] |
| 11682 | packed.append(struct.pack("!B", self.version)) |
| 11683 | packed.append(struct.pack("!B", self.type)) |
| 11684 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11685 | packed.append(struct.pack("!L", self.xid)) |
| 11686 | packed.append(struct.pack("!H", self.err_type)) |
| 11687 | packed.append(struct.pack("!H", self.code)) |
| 11688 | packed.append(self.data) |
| 11689 | length = sum([len(x) for x in packed]) |
| 11690 | packed[2] = struct.pack("!H", length) |
| 11691 | return ''.join(packed) |
| 11692 | |
| 11693 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11694 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11695 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11696 | _version = reader.read("!B")[0] |
| 11697 | assert(_version == 4) |
| 11698 | _type = reader.read("!B")[0] |
| 11699 | assert(_type == 1) |
| 11700 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11701 | orig_reader = reader |
| 11702 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11703 | obj.xid = reader.read("!L")[0] |
| 11704 | _err_type = reader.read("!H")[0] |
| 11705 | assert(_err_type == 10) |
| 11706 | obj.code = reader.read("!H")[0] |
| 11707 | obj.data = str(reader.read_all()) |
| 11708 | return obj |
| 11709 | |
| 11710 | def __eq__(self, other): |
| 11711 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11712 | if self.xid != other.xid: return False |
| 11713 | if self.code != other.code: return False |
| 11714 | if self.data != other.data: return False |
| 11715 | return True |
| 11716 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11717 | def pretty_print(self, q): |
| 11718 | q.text("switch_config_failed_error_msg {") |
| 11719 | with q.group(): |
| 11720 | with q.indent(2): |
| 11721 | q.breakable() |
| 11722 | q.text("xid = "); |
| 11723 | if self.xid != None: |
| 11724 | q.text("%#x" % self.xid) |
| 11725 | else: |
| 11726 | q.text('None') |
| 11727 | q.text(","); q.breakable() |
| 11728 | q.text("code = "); |
| 11729 | q.text("%#x" % self.code) |
| 11730 | q.text(","); q.breakable() |
| 11731 | q.text("data = "); |
| 11732 | q.pp(self.data) |
| 11733 | q.breakable() |
| 11734 | q.text('}') |
| 11735 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11736 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 11737 | |
| 11738 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11739 | version = 4 |
| 11740 | type = 1 |
| 11741 | err_type = 13 |
| 11742 | |
| 11743 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11744 | if xid != None: |
| 11745 | self.xid = xid |
| 11746 | else: |
| 11747 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11748 | if code != None: |
| 11749 | self.code = code |
| 11750 | else: |
| 11751 | self.code = 0 |
| 11752 | if data != None: |
| 11753 | self.data = data |
| 11754 | else: |
| 11755 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11756 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11757 | |
| 11758 | def pack(self): |
| 11759 | packed = [] |
| 11760 | packed.append(struct.pack("!B", self.version)) |
| 11761 | packed.append(struct.pack("!B", self.type)) |
| 11762 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11763 | packed.append(struct.pack("!L", self.xid)) |
| 11764 | packed.append(struct.pack("!H", self.err_type)) |
| 11765 | packed.append(struct.pack("!H", self.code)) |
| 11766 | packed.append(self.data) |
| 11767 | length = sum([len(x) for x in packed]) |
| 11768 | packed[2] = struct.pack("!H", length) |
| 11769 | return ''.join(packed) |
| 11770 | |
| 11771 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11772 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11773 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11774 | _version = reader.read("!B")[0] |
| 11775 | assert(_version == 4) |
| 11776 | _type = reader.read("!B")[0] |
| 11777 | assert(_type == 1) |
| 11778 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11779 | orig_reader = reader |
| 11780 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11781 | obj.xid = reader.read("!L")[0] |
| 11782 | _err_type = reader.read("!H")[0] |
| 11783 | assert(_err_type == 13) |
| 11784 | obj.code = reader.read("!H")[0] |
| 11785 | obj.data = str(reader.read_all()) |
| 11786 | return obj |
| 11787 | |
| 11788 | def __eq__(self, other): |
| 11789 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11790 | if self.xid != other.xid: return False |
| 11791 | if self.code != other.code: return False |
| 11792 | if self.data != other.data: return False |
| 11793 | return True |
| 11794 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11795 | def pretty_print(self, q): |
| 11796 | q.text("table_features_failed_error_msg {") |
| 11797 | with q.group(): |
| 11798 | with q.indent(2): |
| 11799 | q.breakable() |
| 11800 | q.text("xid = "); |
| 11801 | if self.xid != None: |
| 11802 | q.text("%#x" % self.xid) |
| 11803 | else: |
| 11804 | q.text('None') |
| 11805 | q.text(","); q.breakable() |
| 11806 | q.text("code = "); |
| 11807 | q.text("%#x" % self.code) |
| 11808 | q.text(","); q.breakable() |
| 11809 | q.text("data = "); |
| 11810 | q.pp(self.data) |
| 11811 | q.breakable() |
| 11812 | q.text('}') |
| 11813 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11814 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 11815 | |
| 11816 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11817 | version = 4 |
| 11818 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11819 | stats_type = 12 |
| 11820 | |
| 11821 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11822 | if xid != None: |
| 11823 | self.xid = xid |
| 11824 | else: |
| 11825 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11826 | if flags != None: |
| 11827 | self.flags = flags |
| 11828 | else: |
| 11829 | self.flags = 0 |
| 11830 | if entries != None: |
| 11831 | self.entries = entries |
| 11832 | else: |
| 11833 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11834 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11835 | |
| 11836 | def pack(self): |
| 11837 | packed = [] |
| 11838 | packed.append(struct.pack("!B", self.version)) |
| 11839 | packed.append(struct.pack("!B", self.type)) |
| 11840 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11841 | packed.append(struct.pack("!L", self.xid)) |
| 11842 | packed.append(struct.pack("!H", self.stats_type)) |
| 11843 | packed.append(struct.pack("!H", self.flags)) |
| 11844 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11845 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11846 | length = sum([len(x) for x in packed]) |
| 11847 | packed[2] = struct.pack("!H", length) |
| 11848 | return ''.join(packed) |
| 11849 | |
| 11850 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11851 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11852 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11853 | _version = reader.read("!B")[0] |
| 11854 | assert(_version == 4) |
| 11855 | _type = reader.read("!B")[0] |
| 11856 | assert(_type == 19) |
| 11857 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11858 | orig_reader = reader |
| 11859 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11860 | obj.xid = reader.read("!L")[0] |
| 11861 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11862 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11863 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11864 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11865 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11866 | return obj |
| 11867 | |
| 11868 | def __eq__(self, other): |
| 11869 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11870 | if self.xid != other.xid: return False |
| 11871 | if self.flags != other.flags: return False |
| 11872 | if self.entries != other.entries: return False |
| 11873 | return True |
| 11874 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11875 | def pretty_print(self, q): |
| 11876 | q.text("table_features_stats_reply {") |
| 11877 | with q.group(): |
| 11878 | with q.indent(2): |
| 11879 | q.breakable() |
| 11880 | q.text("xid = "); |
| 11881 | if self.xid != None: |
| 11882 | q.text("%#x" % self.xid) |
| 11883 | else: |
| 11884 | q.text('None') |
| 11885 | q.text(","); q.breakable() |
| 11886 | q.text("flags = "); |
| 11887 | q.text("%#x" % self.flags) |
| 11888 | q.text(","); q.breakable() |
| 11889 | q.text("entries = "); |
| 11890 | q.pp(self.entries) |
| 11891 | q.breakable() |
| 11892 | q.text('}') |
| 11893 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11894 | stats_reply.subtypes[12] = table_features_stats_reply |
| 11895 | |
| 11896 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11897 | version = 4 |
| 11898 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11899 | stats_type = 12 |
| 11900 | |
| 11901 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11902 | if xid != None: |
| 11903 | self.xid = xid |
| 11904 | else: |
| 11905 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11906 | if flags != None: |
| 11907 | self.flags = flags |
| 11908 | else: |
| 11909 | self.flags = 0 |
| 11910 | if entries != None: |
| 11911 | self.entries = entries |
| 11912 | else: |
| 11913 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11914 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11915 | |
| 11916 | def pack(self): |
| 11917 | packed = [] |
| 11918 | packed.append(struct.pack("!B", self.version)) |
| 11919 | packed.append(struct.pack("!B", self.type)) |
| 11920 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11921 | packed.append(struct.pack("!L", self.xid)) |
| 11922 | packed.append(struct.pack("!H", self.stats_type)) |
| 11923 | packed.append(struct.pack("!H", self.flags)) |
| 11924 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11926 | length = sum([len(x) for x in packed]) |
| 11927 | packed[2] = struct.pack("!H", length) |
| 11928 | return ''.join(packed) |
| 11929 | |
| 11930 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11931 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11932 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11933 | _version = reader.read("!B")[0] |
| 11934 | assert(_version == 4) |
| 11935 | _type = reader.read("!B")[0] |
| 11936 | assert(_type == 18) |
| 11937 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11938 | orig_reader = reader |
| 11939 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11940 | obj.xid = reader.read("!L")[0] |
| 11941 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11942 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11943 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11944 | reader.skip(4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11945 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11946 | return obj |
| 11947 | |
| 11948 | def __eq__(self, other): |
| 11949 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11950 | if self.xid != other.xid: return False |
| 11951 | if self.flags != other.flags: return False |
| 11952 | if self.entries != other.entries: return False |
| 11953 | return True |
| 11954 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11955 | def pretty_print(self, q): |
| 11956 | q.text("table_features_stats_request {") |
| 11957 | with q.group(): |
| 11958 | with q.indent(2): |
| 11959 | q.breakable() |
| 11960 | q.text("xid = "); |
| 11961 | if self.xid != None: |
| 11962 | q.text("%#x" % self.xid) |
| 11963 | else: |
| 11964 | q.text('None') |
| 11965 | q.text(","); q.breakable() |
| 11966 | q.text("flags = "); |
| 11967 | q.text("%#x" % self.flags) |
| 11968 | q.text(","); q.breakable() |
| 11969 | q.text("entries = "); |
| 11970 | q.pp(self.entries) |
| 11971 | q.breakable() |
| 11972 | q.text('}') |
| 11973 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11974 | stats_request.subtypes[12] = table_features_stats_request |
| 11975 | |
| 11976 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11977 | version = 4 |
| 11978 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11979 | |
| 11980 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11981 | if xid != None: |
| 11982 | self.xid = xid |
| 11983 | else: |
| 11984 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11985 | if table_id != None: |
| 11986 | self.table_id = table_id |
| 11987 | else: |
| 11988 | self.table_id = 0 |
| 11989 | if config != None: |
| 11990 | self.config = config |
| 11991 | else: |
| 11992 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11993 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11994 | |
| 11995 | def pack(self): |
| 11996 | packed = [] |
| 11997 | packed.append(struct.pack("!B", self.version)) |
| 11998 | packed.append(struct.pack("!B", self.type)) |
| 11999 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12000 | packed.append(struct.pack("!L", self.xid)) |
| 12001 | packed.append(struct.pack("!B", self.table_id)) |
| 12002 | packed.append('\x00' * 3) |
| 12003 | packed.append(struct.pack("!L", self.config)) |
| 12004 | length = sum([len(x) for x in packed]) |
| 12005 | packed[2] = struct.pack("!H", length) |
| 12006 | return ''.join(packed) |
| 12007 | |
| 12008 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12009 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12010 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12011 | _version = reader.read("!B")[0] |
| 12012 | assert(_version == 4) |
| 12013 | _type = reader.read("!B")[0] |
| 12014 | assert(_type == 17) |
| 12015 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12016 | orig_reader = reader |
| 12017 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12018 | obj.xid = reader.read("!L")[0] |
| 12019 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12020 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12021 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12022 | return obj |
| 12023 | |
| 12024 | def __eq__(self, other): |
| 12025 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12026 | if self.xid != other.xid: return False |
| 12027 | if self.table_id != other.table_id: return False |
| 12028 | if self.config != other.config: return False |
| 12029 | return True |
| 12030 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12031 | def pretty_print(self, q): |
| 12032 | q.text("table_mod {") |
| 12033 | with q.group(): |
| 12034 | with q.indent(2): |
| 12035 | q.breakable() |
| 12036 | q.text("xid = "); |
| 12037 | if self.xid != None: |
| 12038 | q.text("%#x" % self.xid) |
| 12039 | else: |
| 12040 | q.text('None') |
| 12041 | q.text(","); q.breakable() |
| 12042 | q.text("table_id = "); |
| 12043 | q.text("%#x" % self.table_id) |
| 12044 | q.text(","); q.breakable() |
| 12045 | q.text("config = "); |
| 12046 | q.text("%#x" % self.config) |
| 12047 | q.breakable() |
| 12048 | q.text('}') |
| 12049 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12050 | message.subtypes[17] = table_mod |
| 12051 | |
| 12052 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12053 | version = 4 |
| 12054 | type = 1 |
| 12055 | err_type = 8 |
| 12056 | |
| 12057 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12058 | if xid != None: |
| 12059 | self.xid = xid |
| 12060 | else: |
| 12061 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12062 | if code != None: |
| 12063 | self.code = code |
| 12064 | else: |
| 12065 | self.code = 0 |
| 12066 | if data != None: |
| 12067 | self.data = data |
| 12068 | else: |
| 12069 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12070 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12071 | |
| 12072 | def pack(self): |
| 12073 | packed = [] |
| 12074 | packed.append(struct.pack("!B", self.version)) |
| 12075 | packed.append(struct.pack("!B", self.type)) |
| 12076 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12077 | packed.append(struct.pack("!L", self.xid)) |
| 12078 | packed.append(struct.pack("!H", self.err_type)) |
| 12079 | packed.append(struct.pack("!H", self.code)) |
| 12080 | packed.append(self.data) |
| 12081 | length = sum([len(x) for x in packed]) |
| 12082 | packed[2] = struct.pack("!H", length) |
| 12083 | return ''.join(packed) |
| 12084 | |
| 12085 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12086 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12087 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12088 | _version = reader.read("!B")[0] |
| 12089 | assert(_version == 4) |
| 12090 | _type = reader.read("!B")[0] |
| 12091 | assert(_type == 1) |
| 12092 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12093 | orig_reader = reader |
| 12094 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12095 | obj.xid = reader.read("!L")[0] |
| 12096 | _err_type = reader.read("!H")[0] |
| 12097 | assert(_err_type == 8) |
| 12098 | obj.code = reader.read("!H")[0] |
| 12099 | obj.data = str(reader.read_all()) |
| 12100 | return obj |
| 12101 | |
| 12102 | def __eq__(self, other): |
| 12103 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12104 | if self.xid != other.xid: return False |
| 12105 | if self.code != other.code: return False |
| 12106 | if self.data != other.data: return False |
| 12107 | return True |
| 12108 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12109 | def pretty_print(self, q): |
| 12110 | q.text("table_mod_failed_error_msg {") |
| 12111 | with q.group(): |
| 12112 | with q.indent(2): |
| 12113 | q.breakable() |
| 12114 | q.text("xid = "); |
| 12115 | if self.xid != None: |
| 12116 | q.text("%#x" % self.xid) |
| 12117 | else: |
| 12118 | q.text('None') |
| 12119 | q.text(","); q.breakable() |
| 12120 | q.text("code = "); |
| 12121 | q.text("%#x" % self.code) |
| 12122 | q.text(","); q.breakable() |
| 12123 | q.text("data = "); |
| 12124 | q.pp(self.data) |
| 12125 | q.breakable() |
| 12126 | q.text('}') |
| 12127 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12128 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 12129 | |
| 12130 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12131 | version = 4 |
| 12132 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12133 | stats_type = 3 |
| 12134 | |
| 12135 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12136 | if xid != None: |
| 12137 | self.xid = xid |
| 12138 | else: |
| 12139 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12140 | if flags != None: |
| 12141 | self.flags = flags |
| 12142 | else: |
| 12143 | self.flags = 0 |
| 12144 | if entries != None: |
| 12145 | self.entries = entries |
| 12146 | else: |
| 12147 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12148 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12149 | |
| 12150 | def pack(self): |
| 12151 | packed = [] |
| 12152 | packed.append(struct.pack("!B", self.version)) |
| 12153 | packed.append(struct.pack("!B", self.type)) |
| 12154 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12155 | packed.append(struct.pack("!L", self.xid)) |
| 12156 | packed.append(struct.pack("!H", self.stats_type)) |
| 12157 | packed.append(struct.pack("!H", self.flags)) |
| 12158 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12159 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12160 | length = sum([len(x) for x in packed]) |
| 12161 | packed[2] = struct.pack("!H", length) |
| 12162 | return ''.join(packed) |
| 12163 | |
| 12164 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12165 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12166 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12167 | _version = reader.read("!B")[0] |
| 12168 | assert(_version == 4) |
| 12169 | _type = reader.read("!B")[0] |
| 12170 | assert(_type == 19) |
| 12171 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12172 | orig_reader = reader |
| 12173 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12174 | obj.xid = reader.read("!L")[0] |
| 12175 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12176 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12177 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12178 | reader.skip(4) |
| 12179 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
| 12180 | return obj |
| 12181 | |
| 12182 | def __eq__(self, other): |
| 12183 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12184 | if self.xid != other.xid: return False |
| 12185 | if self.flags != other.flags: return False |
| 12186 | if self.entries != other.entries: return False |
| 12187 | return True |
| 12188 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12189 | def pretty_print(self, q): |
| 12190 | q.text("table_stats_reply {") |
| 12191 | with q.group(): |
| 12192 | with q.indent(2): |
| 12193 | q.breakable() |
| 12194 | q.text("xid = "); |
| 12195 | if self.xid != None: |
| 12196 | q.text("%#x" % self.xid) |
| 12197 | else: |
| 12198 | q.text('None') |
| 12199 | q.text(","); q.breakable() |
| 12200 | q.text("flags = "); |
| 12201 | q.text("%#x" % self.flags) |
| 12202 | q.text(","); q.breakable() |
| 12203 | q.text("entries = "); |
| 12204 | q.pp(self.entries) |
| 12205 | q.breakable() |
| 12206 | q.text('}') |
| 12207 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12208 | stats_reply.subtypes[3] = table_stats_reply |
| 12209 | |
| 12210 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12211 | version = 4 |
| 12212 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12213 | stats_type = 3 |
| 12214 | |
| 12215 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12216 | if xid != None: |
| 12217 | self.xid = xid |
| 12218 | else: |
| 12219 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12220 | if flags != None: |
| 12221 | self.flags = flags |
| 12222 | else: |
| 12223 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12224 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12225 | |
| 12226 | def pack(self): |
| 12227 | packed = [] |
| 12228 | packed.append(struct.pack("!B", self.version)) |
| 12229 | packed.append(struct.pack("!B", self.type)) |
| 12230 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12231 | packed.append(struct.pack("!L", self.xid)) |
| 12232 | packed.append(struct.pack("!H", self.stats_type)) |
| 12233 | packed.append(struct.pack("!H", self.flags)) |
| 12234 | packed.append('\x00' * 4) |
| 12235 | length = sum([len(x) for x in packed]) |
| 12236 | packed[2] = struct.pack("!H", length) |
| 12237 | return ''.join(packed) |
| 12238 | |
| 12239 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12240 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12241 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12242 | _version = reader.read("!B")[0] |
| 12243 | assert(_version == 4) |
| 12244 | _type = reader.read("!B")[0] |
| 12245 | assert(_type == 18) |
| 12246 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12247 | orig_reader = reader |
| 12248 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12249 | obj.xid = reader.read("!L")[0] |
| 12250 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12251 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12252 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12253 | reader.skip(4) |
| 12254 | return obj |
| 12255 | |
| 12256 | def __eq__(self, other): |
| 12257 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12258 | if self.xid != other.xid: return False |
| 12259 | if self.flags != other.flags: return False |
| 12260 | return True |
| 12261 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12262 | def pretty_print(self, q): |
| 12263 | q.text("table_stats_request {") |
| 12264 | with q.group(): |
| 12265 | with q.indent(2): |
| 12266 | q.breakable() |
| 12267 | q.text("xid = "); |
| 12268 | if self.xid != None: |
| 12269 | q.text("%#x" % self.xid) |
| 12270 | else: |
| 12271 | q.text('None') |
| 12272 | q.text(","); q.breakable() |
| 12273 | q.text("flags = "); |
| 12274 | q.text("%#x" % self.flags) |
| 12275 | q.breakable() |
| 12276 | q.text('}') |
| 12277 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12278 | stats_request.subtypes[3] = table_stats_request |
| 12279 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12280 | |
| 12281 | def parse_header(buf): |
| 12282 | if len(buf) < 8: |
| 12283 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 12284 | return struct.unpack_from("!BBHL", buf) |
| 12285 | |
| 12286 | def parse_message(buf): |
| 12287 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 12288 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 12289 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12290 | if len(buf) != msg_len: |
| 12291 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12292 | return message.unpack(loxi.generic_util.OFReader(buf)) |