Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
| 11 | import const |
| 12 | import common |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13 | import action |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 14 | import util |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15 | import loxi.generic_util |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 16 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 17 | class message(loxi.OFObject): |
| 18 | subtypes = {} |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 19 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 20 | @staticmethod |
| 21 | def unpack(reader): |
| 22 | subtype, = reader.peek('B', 1) |
| 23 | try: |
| 24 | subclass = message.subtypes[subtype] |
| 25 | except KeyError: |
| 26 | raise loxi.ProtocolError("unknown message subtype %#x" % subtype) |
| 27 | return subclass.unpack(reader) |
| 28 | |
| 29 | |
| 30 | class stats_reply(message): |
| 31 | subtypes = {} |
| 32 | |
| 33 | @staticmethod |
| 34 | def unpack(reader): |
| 35 | subtype, = reader.peek('!H', 8) |
| 36 | try: |
| 37 | subclass = stats_reply.subtypes[subtype] |
| 38 | except KeyError: |
| 39 | raise loxi.ProtocolError("unknown stats_reply message subtype %#x" % subtype) |
| 40 | return subclass.unpack(reader) |
| 41 | |
| 42 | message.subtypes[17] = stats_reply |
| 43 | |
| 44 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 45 | version = 1 |
| 46 | type = 17 |
| 47 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 48 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 49 | 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] | 50 | if xid != None: |
| 51 | self.xid = xid |
| 52 | else: |
| 53 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 54 | if flags != None: |
| 55 | self.flags = flags |
| 56 | else: |
| 57 | self.flags = 0 |
| 58 | if packet_count != None: |
| 59 | self.packet_count = packet_count |
| 60 | else: |
| 61 | self.packet_count = 0 |
| 62 | if byte_count != None: |
| 63 | self.byte_count = byte_count |
| 64 | else: |
| 65 | self.byte_count = 0 |
| 66 | if flow_count != None: |
| 67 | self.flow_count = flow_count |
| 68 | else: |
| 69 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 70 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 71 | |
| 72 | def pack(self): |
| 73 | packed = [] |
| 74 | packed.append(struct.pack("!B", self.version)) |
| 75 | packed.append(struct.pack("!B", self.type)) |
| 76 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 77 | packed.append(struct.pack("!L", self.xid)) |
| 78 | packed.append(struct.pack("!H", self.stats_type)) |
| 79 | packed.append(struct.pack("!H", self.flags)) |
| 80 | packed.append(struct.pack("!Q", self.packet_count)) |
| 81 | packed.append(struct.pack("!Q", self.byte_count)) |
| 82 | packed.append(struct.pack("!L", self.flow_count)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 83 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 84 | length = sum([len(x) for x in packed]) |
| 85 | packed[2] = struct.pack("!H", length) |
| 86 | return ''.join(packed) |
| 87 | |
| 88 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 89 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 90 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 91 | _version = reader.read("!B")[0] |
| 92 | assert(_version == 1) |
| 93 | _type = reader.read("!B")[0] |
| 94 | assert(_type == 17) |
| 95 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 96 | orig_reader = reader |
| 97 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 98 | obj.xid = reader.read("!L")[0] |
| 99 | _stats_type = reader.read("!H")[0] |
| 100 | assert(_stats_type == 2) |
| 101 | obj.flags = reader.read("!H")[0] |
| 102 | obj.packet_count = reader.read("!Q")[0] |
| 103 | obj.byte_count = reader.read("!Q")[0] |
| 104 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 105 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 106 | return obj |
| 107 | |
| 108 | def __eq__(self, other): |
| 109 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 110 | if self.xid != other.xid: return False |
| 111 | if self.flags != other.flags: return False |
| 112 | if self.packet_count != other.packet_count: return False |
| 113 | if self.byte_count != other.byte_count: return False |
| 114 | if self.flow_count != other.flow_count: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 115 | return True |
| 116 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 117 | def pretty_print(self, q): |
| 118 | q.text("aggregate_stats_reply {") |
| 119 | with q.group(): |
| 120 | with q.indent(2): |
| 121 | q.breakable() |
| 122 | q.text("xid = "); |
| 123 | if self.xid != None: |
| 124 | q.text("%#x" % self.xid) |
| 125 | else: |
| 126 | q.text('None') |
| 127 | q.text(","); q.breakable() |
| 128 | q.text("flags = "); |
| 129 | q.text("%#x" % self.flags) |
| 130 | q.text(","); q.breakable() |
| 131 | q.text("packet_count = "); |
| 132 | q.text("%#x" % self.packet_count) |
| 133 | q.text(","); q.breakable() |
| 134 | q.text("byte_count = "); |
| 135 | q.text("%#x" % self.byte_count) |
| 136 | q.text(","); q.breakable() |
| 137 | q.text("flow_count = "); |
| 138 | q.text("%#x" % self.flow_count) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 139 | q.breakable() |
| 140 | q.text('}') |
| 141 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 142 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 143 | |
| 144 | class stats_request(message): |
| 145 | subtypes = {} |
| 146 | |
| 147 | @staticmethod |
| 148 | def unpack(reader): |
| 149 | subtype, = reader.peek('!H', 8) |
| 150 | try: |
| 151 | subclass = stats_request.subtypes[subtype] |
| 152 | except KeyError: |
| 153 | raise loxi.ProtocolError("unknown stats_request message subtype %#x" % subtype) |
| 154 | return subclass.unpack(reader) |
| 155 | |
| 156 | message.subtypes[16] = stats_request |
| 157 | |
| 158 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 159 | version = 1 |
| 160 | type = 16 |
| 161 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 162 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 163 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 164 | if xid != None: |
| 165 | self.xid = xid |
| 166 | else: |
| 167 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 168 | if flags != None: |
| 169 | self.flags = flags |
| 170 | else: |
| 171 | self.flags = 0 |
| 172 | if match != None: |
| 173 | self.match = match |
| 174 | else: |
| 175 | self.match = common.match() |
| 176 | if table_id != None: |
| 177 | self.table_id = table_id |
| 178 | else: |
| 179 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 180 | if out_port != None: |
| 181 | self.out_port = out_port |
| 182 | else: |
| 183 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 184 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 185 | |
| 186 | def pack(self): |
| 187 | packed = [] |
| 188 | packed.append(struct.pack("!B", self.version)) |
| 189 | packed.append(struct.pack("!B", self.type)) |
| 190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 191 | packed.append(struct.pack("!L", self.xid)) |
| 192 | packed.append(struct.pack("!H", self.stats_type)) |
| 193 | packed.append(struct.pack("!H", self.flags)) |
| 194 | packed.append(self.match.pack()) |
| 195 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 196 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 197 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 198 | length = sum([len(x) for x in packed]) |
| 199 | packed[2] = struct.pack("!H", length) |
| 200 | return ''.join(packed) |
| 201 | |
| 202 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 203 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 204 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 205 | _version = reader.read("!B")[0] |
| 206 | assert(_version == 1) |
| 207 | _type = reader.read("!B")[0] |
| 208 | assert(_type == 16) |
| 209 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 210 | orig_reader = reader |
| 211 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 212 | obj.xid = reader.read("!L")[0] |
| 213 | _stats_type = reader.read("!H")[0] |
| 214 | assert(_stats_type == 2) |
| 215 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 216 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 217 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 218 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 219 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 220 | return obj |
| 221 | |
| 222 | def __eq__(self, other): |
| 223 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 224 | if self.xid != other.xid: return False |
| 225 | if self.flags != other.flags: return False |
| 226 | if self.match != other.match: return False |
| 227 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 228 | if self.out_port != other.out_port: return False |
| 229 | return True |
| 230 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 231 | def pretty_print(self, q): |
| 232 | q.text("aggregate_stats_request {") |
| 233 | with q.group(): |
| 234 | with q.indent(2): |
| 235 | q.breakable() |
| 236 | q.text("xid = "); |
| 237 | if self.xid != None: |
| 238 | q.text("%#x" % self.xid) |
| 239 | else: |
| 240 | q.text('None') |
| 241 | q.text(","); q.breakable() |
| 242 | q.text("flags = "); |
| 243 | q.text("%#x" % self.flags) |
| 244 | q.text(","); q.breakable() |
| 245 | q.text("match = "); |
| 246 | q.pp(self.match) |
| 247 | q.text(","); q.breakable() |
| 248 | q.text("table_id = "); |
| 249 | q.text("%#x" % self.table_id) |
| 250 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 251 | q.text("out_port = "); |
| 252 | q.text(util.pretty_port(self.out_port)) |
| 253 | q.breakable() |
| 254 | q.text('}') |
| 255 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 256 | stats_request.subtypes[2] = aggregate_stats_request |
| 257 | |
| 258 | class error_msg(message): |
| 259 | subtypes = {} |
| 260 | |
| 261 | @staticmethod |
| 262 | def unpack(reader): |
| 263 | subtype, = reader.peek('!H', 8) |
| 264 | try: |
| 265 | subclass = error_msg.subtypes[subtype] |
| 266 | except KeyError: |
| 267 | raise loxi.ProtocolError("unknown error_msg message subtype %#x" % subtype) |
| 268 | return subclass.unpack(reader) |
| 269 | |
| 270 | message.subtypes[1] = error_msg |
| 271 | |
| 272 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 273 | version = 1 |
| 274 | type = 1 |
| 275 | err_type = 2 |
| 276 | |
| 277 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 278 | if xid != None: |
| 279 | self.xid = xid |
| 280 | else: |
| 281 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 282 | if code != None: |
| 283 | self.code = code |
| 284 | else: |
| 285 | self.code = 0 |
| 286 | if data != None: |
| 287 | self.data = data |
| 288 | else: |
| 289 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 290 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 291 | |
| 292 | def pack(self): |
| 293 | packed = [] |
| 294 | packed.append(struct.pack("!B", self.version)) |
| 295 | packed.append(struct.pack("!B", self.type)) |
| 296 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 297 | packed.append(struct.pack("!L", self.xid)) |
| 298 | packed.append(struct.pack("!H", self.err_type)) |
| 299 | packed.append(struct.pack("!H", self.code)) |
| 300 | packed.append(self.data) |
| 301 | length = sum([len(x) for x in packed]) |
| 302 | packed[2] = struct.pack("!H", length) |
| 303 | return ''.join(packed) |
| 304 | |
| 305 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 306 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 307 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 308 | _version = reader.read("!B")[0] |
| 309 | assert(_version == 1) |
| 310 | _type = reader.read("!B")[0] |
| 311 | assert(_type == 1) |
| 312 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 313 | orig_reader = reader |
| 314 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 315 | obj.xid = reader.read("!L")[0] |
| 316 | _err_type = reader.read("!H")[0] |
| 317 | assert(_err_type == 2) |
| 318 | obj.code = reader.read("!H")[0] |
| 319 | obj.data = str(reader.read_all()) |
| 320 | return obj |
| 321 | |
| 322 | def __eq__(self, other): |
| 323 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 324 | if self.xid != other.xid: return False |
| 325 | if self.code != other.code: return False |
| 326 | if self.data != other.data: return False |
| 327 | return True |
| 328 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 329 | def pretty_print(self, q): |
| 330 | q.text("bad_action_error_msg {") |
| 331 | with q.group(): |
| 332 | with q.indent(2): |
| 333 | q.breakable() |
| 334 | q.text("xid = "); |
| 335 | if self.xid != None: |
| 336 | q.text("%#x" % self.xid) |
| 337 | else: |
| 338 | q.text('None') |
| 339 | q.text(","); q.breakable() |
| 340 | q.text("code = "); |
| 341 | q.text("%#x" % self.code) |
| 342 | q.text(","); q.breakable() |
| 343 | q.text("data = "); |
| 344 | q.pp(self.data) |
| 345 | q.breakable() |
| 346 | q.text('}') |
| 347 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 348 | error_msg.subtypes[2] = bad_action_error_msg |
| 349 | |
| 350 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 351 | version = 1 |
| 352 | type = 1 |
| 353 | err_type = 1 |
| 354 | |
| 355 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 356 | if xid != None: |
| 357 | self.xid = xid |
| 358 | else: |
| 359 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 360 | if code != None: |
| 361 | self.code = code |
| 362 | else: |
| 363 | self.code = 0 |
| 364 | if data != None: |
| 365 | self.data = data |
| 366 | else: |
| 367 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 368 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 369 | |
| 370 | def pack(self): |
| 371 | packed = [] |
| 372 | packed.append(struct.pack("!B", self.version)) |
| 373 | packed.append(struct.pack("!B", self.type)) |
| 374 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 375 | packed.append(struct.pack("!L", self.xid)) |
| 376 | packed.append(struct.pack("!H", self.err_type)) |
| 377 | packed.append(struct.pack("!H", self.code)) |
| 378 | packed.append(self.data) |
| 379 | length = sum([len(x) for x in packed]) |
| 380 | packed[2] = struct.pack("!H", length) |
| 381 | return ''.join(packed) |
| 382 | |
| 383 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 384 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 385 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 386 | _version = reader.read("!B")[0] |
| 387 | assert(_version == 1) |
| 388 | _type = reader.read("!B")[0] |
| 389 | assert(_type == 1) |
| 390 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 391 | orig_reader = reader |
| 392 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 393 | obj.xid = reader.read("!L")[0] |
| 394 | _err_type = reader.read("!H")[0] |
| 395 | assert(_err_type == 1) |
| 396 | obj.code = reader.read("!H")[0] |
| 397 | obj.data = str(reader.read_all()) |
| 398 | return obj |
| 399 | |
| 400 | def __eq__(self, other): |
| 401 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 402 | if self.xid != other.xid: return False |
| 403 | if self.code != other.code: return False |
| 404 | if self.data != other.data: return False |
| 405 | return True |
| 406 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 407 | def pretty_print(self, q): |
| 408 | q.text("bad_request_error_msg {") |
| 409 | with q.group(): |
| 410 | with q.indent(2): |
| 411 | q.breakable() |
| 412 | q.text("xid = "); |
| 413 | if self.xid != None: |
| 414 | q.text("%#x" % self.xid) |
| 415 | else: |
| 416 | q.text('None') |
| 417 | q.text(","); q.breakable() |
| 418 | q.text("code = "); |
| 419 | q.text("%#x" % self.code) |
| 420 | q.text(","); q.breakable() |
| 421 | q.text("data = "); |
| 422 | q.pp(self.data) |
| 423 | q.breakable() |
| 424 | q.text('}') |
| 425 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 426 | error_msg.subtypes[1] = bad_request_error_msg |
| 427 | |
| 428 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 429 | version = 1 |
| 430 | type = 19 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 431 | |
| 432 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 433 | if xid != None: |
| 434 | self.xid = xid |
| 435 | else: |
| 436 | self.xid = None |
| 437 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 438 | |
| 439 | def pack(self): |
| 440 | packed = [] |
| 441 | packed.append(struct.pack("!B", self.version)) |
| 442 | packed.append(struct.pack("!B", self.type)) |
| 443 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 444 | packed.append(struct.pack("!L", self.xid)) |
| 445 | length = sum([len(x) for x in packed]) |
| 446 | packed[2] = struct.pack("!H", length) |
| 447 | return ''.join(packed) |
| 448 | |
| 449 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 450 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 451 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 452 | _version = reader.read("!B")[0] |
| 453 | assert(_version == 1) |
| 454 | _type = reader.read("!B")[0] |
| 455 | assert(_type == 19) |
| 456 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 457 | orig_reader = reader |
| 458 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 459 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 460 | return obj |
| 461 | |
| 462 | def __eq__(self, other): |
| 463 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 464 | if self.xid != other.xid: return False |
| 465 | return True |
| 466 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 467 | def pretty_print(self, q): |
| 468 | q.text("barrier_reply {") |
| 469 | with q.group(): |
| 470 | with q.indent(2): |
| 471 | q.breakable() |
| 472 | q.text("xid = "); |
| 473 | if self.xid != None: |
| 474 | q.text("%#x" % self.xid) |
| 475 | else: |
| 476 | q.text('None') |
| 477 | q.breakable() |
| 478 | q.text('}') |
| 479 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 480 | message.subtypes[19] = barrier_reply |
| 481 | |
| 482 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 483 | version = 1 |
| 484 | type = 18 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 485 | |
| 486 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 487 | if xid != None: |
| 488 | self.xid = xid |
| 489 | else: |
| 490 | self.xid = None |
| 491 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 492 | |
| 493 | def pack(self): |
| 494 | packed = [] |
| 495 | packed.append(struct.pack("!B", self.version)) |
| 496 | packed.append(struct.pack("!B", self.type)) |
| 497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 498 | packed.append(struct.pack("!L", self.xid)) |
| 499 | length = sum([len(x) for x in packed]) |
| 500 | packed[2] = struct.pack("!H", length) |
| 501 | return ''.join(packed) |
| 502 | |
| 503 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 504 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 505 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 506 | _version = reader.read("!B")[0] |
| 507 | assert(_version == 1) |
| 508 | _type = reader.read("!B")[0] |
| 509 | assert(_type == 18) |
| 510 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 511 | orig_reader = reader |
| 512 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 513 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 514 | return obj |
| 515 | |
| 516 | def __eq__(self, other): |
| 517 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 518 | if self.xid != other.xid: return False |
| 519 | return True |
| 520 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 521 | def pretty_print(self, q): |
| 522 | q.text("barrier_request {") |
| 523 | with q.group(): |
| 524 | with q.indent(2): |
| 525 | q.breakable() |
| 526 | q.text("xid = "); |
| 527 | if self.xid != None: |
| 528 | q.text("%#x" % self.xid) |
| 529 | else: |
| 530 | q.text('None') |
| 531 | q.breakable() |
| 532 | q.text('}') |
| 533 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 534 | message.subtypes[18] = barrier_request |
| 535 | |
| 536 | class experimenter(message): |
| 537 | subtypes = {} |
| 538 | |
| 539 | @staticmethod |
| 540 | def unpack(reader): |
| 541 | subtype, = reader.peek('!L', 8) |
| 542 | try: |
| 543 | subclass = experimenter.subtypes[subtype] |
| 544 | except KeyError: |
| 545 | raise loxi.ProtocolError("unknown experimenter message subtype %#x" % subtype) |
| 546 | return subclass.unpack(reader) |
| 547 | |
| 548 | message.subtypes[4] = experimenter |
| 549 | |
| 550 | class bsn_header(experimenter): |
| 551 | subtypes = {} |
| 552 | |
| 553 | @staticmethod |
| 554 | def unpack(reader): |
| 555 | subtype, = reader.peek('!L', 12) |
| 556 | try: |
| 557 | subclass = bsn_header.subtypes[subtype] |
| 558 | except KeyError: |
| 559 | raise loxi.ProtocolError("unknown bsn_header experimenter message subtype %#x" % subtype) |
| 560 | return subclass.unpack(reader) |
| 561 | |
| 562 | experimenter.subtypes[6035143] = bsn_header |
| 563 | |
| 564 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 565 | version = 1 |
| 566 | type = 4 |
| 567 | experimenter = 6035143 |
| 568 | subtype = 22 |
| 569 | |
| 570 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 571 | if xid != None: |
| 572 | self.xid = xid |
| 573 | else: |
| 574 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 575 | if status != None: |
| 576 | self.status = status |
| 577 | else: |
| 578 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 579 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 580 | |
| 581 | def pack(self): |
| 582 | packed = [] |
| 583 | packed.append(struct.pack("!B", self.version)) |
| 584 | packed.append(struct.pack("!B", self.type)) |
| 585 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 586 | packed.append(struct.pack("!L", self.xid)) |
| 587 | packed.append(struct.pack("!L", self.experimenter)) |
| 588 | packed.append(struct.pack("!L", self.subtype)) |
| 589 | packed.append(struct.pack("!L", self.status)) |
| 590 | length = sum([len(x) for x in packed]) |
| 591 | packed[2] = struct.pack("!H", length) |
| 592 | return ''.join(packed) |
| 593 | |
| 594 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 595 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 596 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 597 | _version = reader.read("!B")[0] |
| 598 | assert(_version == 1) |
| 599 | _type = reader.read("!B")[0] |
| 600 | assert(_type == 4) |
| 601 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 602 | orig_reader = reader |
| 603 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 604 | obj.xid = reader.read("!L")[0] |
| 605 | _experimenter = reader.read("!L")[0] |
| 606 | assert(_experimenter == 6035143) |
| 607 | _subtype = reader.read("!L")[0] |
| 608 | assert(_subtype == 22) |
| 609 | obj.status = reader.read("!L")[0] |
| 610 | return obj |
| 611 | |
| 612 | def __eq__(self, other): |
| 613 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 614 | if self.xid != other.xid: return False |
| 615 | if self.status != other.status: return False |
| 616 | return True |
| 617 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 618 | def pretty_print(self, q): |
| 619 | q.text("bsn_bw_clear_data_reply {") |
| 620 | with q.group(): |
| 621 | with q.indent(2): |
| 622 | q.breakable() |
| 623 | q.text("xid = "); |
| 624 | if self.xid != None: |
| 625 | q.text("%#x" % self.xid) |
| 626 | else: |
| 627 | q.text('None') |
| 628 | q.text(","); q.breakable() |
| 629 | q.text("status = "); |
| 630 | q.text("%#x" % self.status) |
| 631 | q.breakable() |
| 632 | q.text('}') |
| 633 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 634 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 635 | |
| 636 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 637 | version = 1 |
| 638 | type = 4 |
| 639 | experimenter = 6035143 |
| 640 | subtype = 21 |
| 641 | |
| 642 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 643 | if xid != None: |
| 644 | self.xid = xid |
| 645 | else: |
| 646 | self.xid = None |
| 647 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 648 | |
| 649 | def pack(self): |
| 650 | packed = [] |
| 651 | packed.append(struct.pack("!B", self.version)) |
| 652 | packed.append(struct.pack("!B", self.type)) |
| 653 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 654 | packed.append(struct.pack("!L", self.xid)) |
| 655 | packed.append(struct.pack("!L", self.experimenter)) |
| 656 | packed.append(struct.pack("!L", self.subtype)) |
| 657 | length = sum([len(x) for x in packed]) |
| 658 | packed[2] = struct.pack("!H", length) |
| 659 | return ''.join(packed) |
| 660 | |
| 661 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 662 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 663 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 664 | _version = reader.read("!B")[0] |
| 665 | assert(_version == 1) |
| 666 | _type = reader.read("!B")[0] |
| 667 | assert(_type == 4) |
| 668 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 669 | orig_reader = reader |
| 670 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 671 | obj.xid = reader.read("!L")[0] |
| 672 | _experimenter = reader.read("!L")[0] |
| 673 | assert(_experimenter == 6035143) |
| 674 | _subtype = reader.read("!L")[0] |
| 675 | assert(_subtype == 21) |
| 676 | return obj |
| 677 | |
| 678 | def __eq__(self, other): |
| 679 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 680 | if self.xid != other.xid: return False |
| 681 | return True |
| 682 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 683 | def pretty_print(self, q): |
| 684 | q.text("bsn_bw_clear_data_request {") |
| 685 | with q.group(): |
| 686 | with q.indent(2): |
| 687 | q.breakable() |
| 688 | q.text("xid = "); |
| 689 | if self.xid != None: |
| 690 | q.text("%#x" % self.xid) |
| 691 | else: |
| 692 | q.text('None') |
| 693 | q.breakable() |
| 694 | q.text('}') |
| 695 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 696 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 697 | |
| 698 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 699 | version = 1 |
| 700 | type = 4 |
| 701 | experimenter = 6035143 |
| 702 | subtype = 20 |
| 703 | |
| 704 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 705 | if xid != None: |
| 706 | self.xid = xid |
| 707 | else: |
| 708 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 709 | if enabled != None: |
| 710 | self.enabled = enabled |
| 711 | else: |
| 712 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 713 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 714 | |
| 715 | def pack(self): |
| 716 | packed = [] |
| 717 | packed.append(struct.pack("!B", self.version)) |
| 718 | packed.append(struct.pack("!B", self.type)) |
| 719 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 720 | packed.append(struct.pack("!L", self.xid)) |
| 721 | packed.append(struct.pack("!L", self.experimenter)) |
| 722 | packed.append(struct.pack("!L", self.subtype)) |
| 723 | packed.append(struct.pack("!L", self.enabled)) |
| 724 | length = sum([len(x) for x in packed]) |
| 725 | packed[2] = struct.pack("!H", length) |
| 726 | return ''.join(packed) |
| 727 | |
| 728 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 729 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 730 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 731 | _version = reader.read("!B")[0] |
| 732 | assert(_version == 1) |
| 733 | _type = reader.read("!B")[0] |
| 734 | assert(_type == 4) |
| 735 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 736 | orig_reader = reader |
| 737 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 738 | obj.xid = reader.read("!L")[0] |
| 739 | _experimenter = reader.read("!L")[0] |
| 740 | assert(_experimenter == 6035143) |
| 741 | _subtype = reader.read("!L")[0] |
| 742 | assert(_subtype == 20) |
| 743 | obj.enabled = reader.read("!L")[0] |
| 744 | return obj |
| 745 | |
| 746 | def __eq__(self, other): |
| 747 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 748 | if self.xid != other.xid: return False |
| 749 | if self.enabled != other.enabled: return False |
| 750 | return True |
| 751 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 752 | def pretty_print(self, q): |
| 753 | q.text("bsn_bw_enable_get_reply {") |
| 754 | with q.group(): |
| 755 | with q.indent(2): |
| 756 | q.breakable() |
| 757 | q.text("xid = "); |
| 758 | if self.xid != None: |
| 759 | q.text("%#x" % self.xid) |
| 760 | else: |
| 761 | q.text('None') |
| 762 | q.text(","); q.breakable() |
| 763 | q.text("enabled = "); |
| 764 | q.text("%#x" % self.enabled) |
| 765 | q.breakable() |
| 766 | q.text('}') |
| 767 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 768 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 769 | |
| 770 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 771 | version = 1 |
| 772 | type = 4 |
| 773 | experimenter = 6035143 |
| 774 | subtype = 19 |
| 775 | |
| 776 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 777 | if xid != None: |
| 778 | self.xid = xid |
| 779 | else: |
| 780 | self.xid = None |
| 781 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 782 | |
| 783 | def pack(self): |
| 784 | packed = [] |
| 785 | packed.append(struct.pack("!B", self.version)) |
| 786 | packed.append(struct.pack("!B", self.type)) |
| 787 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 788 | packed.append(struct.pack("!L", self.xid)) |
| 789 | packed.append(struct.pack("!L", self.experimenter)) |
| 790 | packed.append(struct.pack("!L", self.subtype)) |
| 791 | length = sum([len(x) for x in packed]) |
| 792 | packed[2] = struct.pack("!H", length) |
| 793 | return ''.join(packed) |
| 794 | |
| 795 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 796 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 797 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 798 | _version = reader.read("!B")[0] |
| 799 | assert(_version == 1) |
| 800 | _type = reader.read("!B")[0] |
| 801 | assert(_type == 4) |
| 802 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 803 | orig_reader = reader |
| 804 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 805 | obj.xid = reader.read("!L")[0] |
| 806 | _experimenter = reader.read("!L")[0] |
| 807 | assert(_experimenter == 6035143) |
| 808 | _subtype = reader.read("!L")[0] |
| 809 | assert(_subtype == 19) |
| 810 | return obj |
| 811 | |
| 812 | def __eq__(self, other): |
| 813 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 814 | if self.xid != other.xid: return False |
| 815 | return True |
| 816 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 817 | def pretty_print(self, q): |
| 818 | q.text("bsn_bw_enable_get_request {") |
| 819 | with q.group(): |
| 820 | with q.indent(2): |
| 821 | q.breakable() |
| 822 | q.text("xid = "); |
| 823 | if self.xid != None: |
| 824 | q.text("%#x" % self.xid) |
| 825 | else: |
| 826 | q.text('None') |
| 827 | q.breakable() |
| 828 | q.text('}') |
| 829 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 830 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 831 | |
| 832 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 833 | version = 1 |
| 834 | type = 4 |
| 835 | experimenter = 6035143 |
| 836 | subtype = 23 |
| 837 | |
| 838 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 839 | if xid != None: |
| 840 | self.xid = xid |
| 841 | else: |
| 842 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 843 | if enable != None: |
| 844 | self.enable = enable |
| 845 | else: |
| 846 | self.enable = 0 |
| 847 | if status != None: |
| 848 | self.status = status |
| 849 | else: |
| 850 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 851 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 852 | |
| 853 | def pack(self): |
| 854 | packed = [] |
| 855 | packed.append(struct.pack("!B", self.version)) |
| 856 | packed.append(struct.pack("!B", self.type)) |
| 857 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 858 | packed.append(struct.pack("!L", self.xid)) |
| 859 | packed.append(struct.pack("!L", self.experimenter)) |
| 860 | packed.append(struct.pack("!L", self.subtype)) |
| 861 | packed.append(struct.pack("!L", self.enable)) |
| 862 | packed.append(struct.pack("!L", self.status)) |
| 863 | length = sum([len(x) for x in packed]) |
| 864 | packed[2] = struct.pack("!H", length) |
| 865 | return ''.join(packed) |
| 866 | |
| 867 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 868 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 869 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 870 | _version = reader.read("!B")[0] |
| 871 | assert(_version == 1) |
| 872 | _type = reader.read("!B")[0] |
| 873 | assert(_type == 4) |
| 874 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 875 | orig_reader = reader |
| 876 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 877 | obj.xid = reader.read("!L")[0] |
| 878 | _experimenter = reader.read("!L")[0] |
| 879 | assert(_experimenter == 6035143) |
| 880 | _subtype = reader.read("!L")[0] |
| 881 | assert(_subtype == 23) |
| 882 | obj.enable = reader.read("!L")[0] |
| 883 | obj.status = reader.read("!L")[0] |
| 884 | return obj |
| 885 | |
| 886 | def __eq__(self, other): |
| 887 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 888 | if self.xid != other.xid: return False |
| 889 | if self.enable != other.enable: return False |
| 890 | if self.status != other.status: return False |
| 891 | return True |
| 892 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 893 | def pretty_print(self, q): |
| 894 | q.text("bsn_bw_enable_set_reply {") |
| 895 | with q.group(): |
| 896 | with q.indent(2): |
| 897 | q.breakable() |
| 898 | q.text("xid = "); |
| 899 | if self.xid != None: |
| 900 | q.text("%#x" % self.xid) |
| 901 | else: |
| 902 | q.text('None') |
| 903 | q.text(","); q.breakable() |
| 904 | q.text("enable = "); |
| 905 | q.text("%#x" % self.enable) |
| 906 | q.text(","); q.breakable() |
| 907 | q.text("status = "); |
| 908 | q.text("%#x" % self.status) |
| 909 | q.breakable() |
| 910 | q.text('}') |
| 911 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 912 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 913 | |
| 914 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 915 | version = 1 |
| 916 | type = 4 |
| 917 | experimenter = 6035143 |
| 918 | subtype = 18 |
| 919 | |
| 920 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 921 | if xid != None: |
| 922 | self.xid = xid |
| 923 | else: |
| 924 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 925 | if enable != None: |
| 926 | self.enable = enable |
| 927 | else: |
| 928 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 929 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 930 | |
| 931 | def pack(self): |
| 932 | packed = [] |
| 933 | packed.append(struct.pack("!B", self.version)) |
| 934 | packed.append(struct.pack("!B", self.type)) |
| 935 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 936 | packed.append(struct.pack("!L", self.xid)) |
| 937 | packed.append(struct.pack("!L", self.experimenter)) |
| 938 | packed.append(struct.pack("!L", self.subtype)) |
| 939 | packed.append(struct.pack("!L", self.enable)) |
| 940 | length = sum([len(x) for x in packed]) |
| 941 | packed[2] = struct.pack("!H", length) |
| 942 | return ''.join(packed) |
| 943 | |
| 944 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 945 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 946 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 947 | _version = reader.read("!B")[0] |
| 948 | assert(_version == 1) |
| 949 | _type = reader.read("!B")[0] |
| 950 | assert(_type == 4) |
| 951 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 952 | orig_reader = reader |
| 953 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 954 | obj.xid = reader.read("!L")[0] |
| 955 | _experimenter = reader.read("!L")[0] |
| 956 | assert(_experimenter == 6035143) |
| 957 | _subtype = reader.read("!L")[0] |
| 958 | assert(_subtype == 18) |
| 959 | obj.enable = reader.read("!L")[0] |
| 960 | return obj |
| 961 | |
| 962 | def __eq__(self, other): |
| 963 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 964 | if self.xid != other.xid: return False |
| 965 | if self.enable != other.enable: return False |
| 966 | return True |
| 967 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 968 | def pretty_print(self, q): |
| 969 | q.text("bsn_bw_enable_set_request {") |
| 970 | with q.group(): |
| 971 | with q.indent(2): |
| 972 | q.breakable() |
| 973 | q.text("xid = "); |
| 974 | if self.xid != None: |
| 975 | q.text("%#x" % self.xid) |
| 976 | else: |
| 977 | q.text('None') |
| 978 | q.text(","); q.breakable() |
| 979 | q.text("enable = "); |
| 980 | q.text("%#x" % self.enable) |
| 981 | q.breakable() |
| 982 | q.text('}') |
| 983 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 984 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 985 | |
| 986 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 987 | version = 1 |
| 988 | type = 4 |
| 989 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 990 | subtype = 10 |
| 991 | |
| 992 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 993 | if xid != None: |
| 994 | self.xid = xid |
| 995 | else: |
| 996 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 997 | if interfaces != None: |
| 998 | self.interfaces = interfaces |
| 999 | else: |
| 1000 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1001 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1002 | |
| 1003 | def pack(self): |
| 1004 | packed = [] |
| 1005 | packed.append(struct.pack("!B", self.version)) |
| 1006 | packed.append(struct.pack("!B", self.type)) |
| 1007 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1008 | packed.append(struct.pack("!L", self.xid)) |
| 1009 | packed.append(struct.pack("!L", self.experimenter)) |
| 1010 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1011 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1012 | length = sum([len(x) for x in packed]) |
| 1013 | packed[2] = struct.pack("!H", length) |
| 1014 | return ''.join(packed) |
| 1015 | |
| 1016 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1017 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1018 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1019 | _version = reader.read("!B")[0] |
| 1020 | assert(_version == 1) |
| 1021 | _type = reader.read("!B")[0] |
| 1022 | assert(_type == 4) |
| 1023 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1024 | orig_reader = reader |
| 1025 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1026 | obj.xid = reader.read("!L")[0] |
| 1027 | _experimenter = reader.read("!L")[0] |
| 1028 | assert(_experimenter == 6035143) |
| 1029 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1030 | assert(_subtype == 10) |
| 1031 | obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1032 | return obj |
| 1033 | |
| 1034 | def __eq__(self, other): |
| 1035 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1036 | if self.xid != other.xid: return False |
| 1037 | if self.interfaces != other.interfaces: return False |
| 1038 | return True |
| 1039 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1040 | def pretty_print(self, q): |
| 1041 | q.text("bsn_get_interfaces_reply {") |
| 1042 | with q.group(): |
| 1043 | with q.indent(2): |
| 1044 | q.breakable() |
| 1045 | q.text("xid = "); |
| 1046 | if self.xid != None: |
| 1047 | q.text("%#x" % self.xid) |
| 1048 | else: |
| 1049 | q.text('None') |
| 1050 | q.text(","); q.breakable() |
| 1051 | q.text("interfaces = "); |
| 1052 | q.pp(self.interfaces) |
| 1053 | q.breakable() |
| 1054 | q.text('}') |
| 1055 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1056 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1057 | |
| 1058 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1059 | version = 1 |
| 1060 | type = 4 |
| 1061 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1062 | subtype = 9 |
| 1063 | |
| 1064 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1065 | if xid != None: |
| 1066 | self.xid = xid |
| 1067 | else: |
| 1068 | self.xid = None |
| 1069 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1070 | |
| 1071 | def pack(self): |
| 1072 | packed = [] |
| 1073 | packed.append(struct.pack("!B", self.version)) |
| 1074 | packed.append(struct.pack("!B", self.type)) |
| 1075 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1076 | packed.append(struct.pack("!L", self.xid)) |
| 1077 | packed.append(struct.pack("!L", self.experimenter)) |
| 1078 | packed.append(struct.pack("!L", self.subtype)) |
| 1079 | length = sum([len(x) for x in packed]) |
| 1080 | packed[2] = struct.pack("!H", length) |
| 1081 | return ''.join(packed) |
| 1082 | |
| 1083 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1084 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1085 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1086 | _version = reader.read("!B")[0] |
| 1087 | assert(_version == 1) |
| 1088 | _type = reader.read("!B")[0] |
| 1089 | assert(_type == 4) |
| 1090 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1091 | orig_reader = reader |
| 1092 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1093 | obj.xid = reader.read("!L")[0] |
| 1094 | _experimenter = reader.read("!L")[0] |
| 1095 | assert(_experimenter == 6035143) |
| 1096 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1097 | assert(_subtype == 9) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1098 | return obj |
| 1099 | |
| 1100 | def __eq__(self, other): |
| 1101 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1102 | if self.xid != other.xid: return False |
| 1103 | return True |
| 1104 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1105 | def pretty_print(self, q): |
| 1106 | q.text("bsn_get_interfaces_request {") |
| 1107 | with q.group(): |
| 1108 | with q.indent(2): |
| 1109 | q.breakable() |
| 1110 | q.text("xid = "); |
| 1111 | if self.xid != None: |
| 1112 | q.text("%#x" % self.xid) |
| 1113 | else: |
| 1114 | q.text('None') |
| 1115 | q.breakable() |
| 1116 | q.text('}') |
| 1117 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1118 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1119 | |
| 1120 | class bsn_get_ip_mask_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1121 | version = 1 |
| 1122 | type = 4 |
| 1123 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1124 | subtype = 2 |
| 1125 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1126 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1127 | if xid != None: |
| 1128 | self.xid = xid |
| 1129 | else: |
| 1130 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1131 | if index != None: |
| 1132 | self.index = index |
| 1133 | else: |
| 1134 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1135 | if mask != None: |
| 1136 | self.mask = mask |
| 1137 | else: |
| 1138 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1139 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1140 | |
| 1141 | def pack(self): |
| 1142 | packed = [] |
| 1143 | packed.append(struct.pack("!B", self.version)) |
| 1144 | packed.append(struct.pack("!B", self.type)) |
| 1145 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1146 | packed.append(struct.pack("!L", self.xid)) |
| 1147 | packed.append(struct.pack("!L", self.experimenter)) |
| 1148 | packed.append(struct.pack("!L", self.subtype)) |
| 1149 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1150 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1151 | packed.append(struct.pack("!L", self.mask)) |
| 1152 | length = sum([len(x) for x in packed]) |
| 1153 | packed[2] = struct.pack("!H", length) |
| 1154 | return ''.join(packed) |
| 1155 | |
| 1156 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1157 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1158 | obj = bsn_get_ip_mask_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1159 | _version = reader.read("!B")[0] |
| 1160 | assert(_version == 1) |
| 1161 | _type = reader.read("!B")[0] |
| 1162 | assert(_type == 4) |
| 1163 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1164 | orig_reader = reader |
| 1165 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1166 | obj.xid = reader.read("!L")[0] |
| 1167 | _experimenter = reader.read("!L")[0] |
| 1168 | assert(_experimenter == 6035143) |
| 1169 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1170 | assert(_subtype == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1171 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1172 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1173 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1174 | return obj |
| 1175 | |
| 1176 | def __eq__(self, other): |
| 1177 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1178 | if self.xid != other.xid: return False |
| 1179 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1180 | if self.mask != other.mask: return False |
| 1181 | return True |
| 1182 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1183 | def pretty_print(self, q): |
| 1184 | q.text("bsn_get_ip_mask_reply {") |
| 1185 | with q.group(): |
| 1186 | with q.indent(2): |
| 1187 | q.breakable() |
| 1188 | q.text("xid = "); |
| 1189 | if self.xid != None: |
| 1190 | q.text("%#x" % self.xid) |
| 1191 | else: |
| 1192 | q.text('None') |
| 1193 | q.text(","); q.breakable() |
| 1194 | q.text("index = "); |
| 1195 | q.text("%#x" % self.index) |
| 1196 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1197 | q.text("mask = "); |
| 1198 | q.text("%#x" % self.mask) |
| 1199 | q.breakable() |
| 1200 | q.text('}') |
| 1201 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1202 | bsn_header.subtypes[2] = bsn_get_ip_mask_reply |
| 1203 | |
| 1204 | class bsn_get_ip_mask_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1205 | version = 1 |
| 1206 | type = 4 |
| 1207 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1208 | subtype = 1 |
| 1209 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1210 | def __init__(self, xid=None, index=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1211 | if xid != None: |
| 1212 | self.xid = xid |
| 1213 | else: |
| 1214 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1215 | if index != None: |
| 1216 | self.index = index |
| 1217 | else: |
| 1218 | self.index = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1219 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1220 | |
| 1221 | def pack(self): |
| 1222 | packed = [] |
| 1223 | packed.append(struct.pack("!B", self.version)) |
| 1224 | packed.append(struct.pack("!B", self.type)) |
| 1225 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1226 | packed.append(struct.pack("!L", self.xid)) |
| 1227 | packed.append(struct.pack("!L", self.experimenter)) |
| 1228 | packed.append(struct.pack("!L", self.subtype)) |
| 1229 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1230 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1231 | length = sum([len(x) for x in packed]) |
| 1232 | packed[2] = struct.pack("!H", length) |
| 1233 | return ''.join(packed) |
| 1234 | |
| 1235 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1236 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1237 | obj = bsn_get_ip_mask_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1238 | _version = reader.read("!B")[0] |
| 1239 | assert(_version == 1) |
| 1240 | _type = reader.read("!B")[0] |
| 1241 | assert(_type == 4) |
| 1242 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1243 | orig_reader = reader |
| 1244 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1245 | obj.xid = reader.read("!L")[0] |
| 1246 | _experimenter = reader.read("!L")[0] |
| 1247 | assert(_experimenter == 6035143) |
| 1248 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1249 | assert(_subtype == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1250 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1251 | reader.skip(7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1252 | return obj |
| 1253 | |
| 1254 | def __eq__(self, other): |
| 1255 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1256 | if self.xid != other.xid: return False |
| 1257 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1258 | return True |
| 1259 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1260 | def pretty_print(self, q): |
| 1261 | q.text("bsn_get_ip_mask_request {") |
| 1262 | with q.group(): |
| 1263 | with q.indent(2): |
| 1264 | q.breakable() |
| 1265 | q.text("xid = "); |
| 1266 | if self.xid != None: |
| 1267 | q.text("%#x" % self.xid) |
| 1268 | else: |
| 1269 | q.text('None') |
| 1270 | q.text(","); q.breakable() |
| 1271 | q.text("index = "); |
| 1272 | q.text("%#x" % self.index) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1273 | q.breakable() |
| 1274 | q.text('}') |
| 1275 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1276 | bsn_header.subtypes[1] = bsn_get_ip_mask_request |
| 1277 | |
| 1278 | class bsn_get_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1279 | version = 1 |
| 1280 | type = 4 |
| 1281 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1282 | subtype = 14 |
| 1283 | |
| 1284 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1285 | if xid != None: |
| 1286 | self.xid = xid |
| 1287 | else: |
| 1288 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1289 | if l2_table_enable != None: |
| 1290 | self.l2_table_enable = l2_table_enable |
| 1291 | else: |
| 1292 | self.l2_table_enable = 0 |
| 1293 | if l2_table_priority != None: |
| 1294 | self.l2_table_priority = l2_table_priority |
| 1295 | else: |
| 1296 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1297 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1298 | |
| 1299 | def pack(self): |
| 1300 | packed = [] |
| 1301 | packed.append(struct.pack("!B", self.version)) |
| 1302 | packed.append(struct.pack("!B", self.type)) |
| 1303 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1304 | packed.append(struct.pack("!L", self.xid)) |
| 1305 | packed.append(struct.pack("!L", self.experimenter)) |
| 1306 | packed.append(struct.pack("!L", self.subtype)) |
| 1307 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 1308 | packed.append('\x00' * 1) |
| 1309 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 1310 | packed.append('\x00' * 4) |
| 1311 | length = sum([len(x) for x in packed]) |
| 1312 | packed[2] = struct.pack("!H", length) |
| 1313 | return ''.join(packed) |
| 1314 | |
| 1315 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1316 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1317 | obj = bsn_get_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1318 | _version = reader.read("!B")[0] |
| 1319 | assert(_version == 1) |
| 1320 | _type = reader.read("!B")[0] |
| 1321 | assert(_type == 4) |
| 1322 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1323 | orig_reader = reader |
| 1324 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1325 | obj.xid = reader.read("!L")[0] |
| 1326 | _experimenter = reader.read("!L")[0] |
| 1327 | assert(_experimenter == 6035143) |
| 1328 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1329 | assert(_subtype == 14) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1330 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1331 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1332 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1333 | reader.skip(4) |
| 1334 | return obj |
| 1335 | |
| 1336 | def __eq__(self, other): |
| 1337 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1338 | if self.xid != other.xid: return False |
| 1339 | if self.l2_table_enable != other.l2_table_enable: return False |
| 1340 | if self.l2_table_priority != other.l2_table_priority: return False |
| 1341 | return True |
| 1342 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1343 | def pretty_print(self, q): |
| 1344 | q.text("bsn_get_l2_table_reply {") |
| 1345 | with q.group(): |
| 1346 | with q.indent(2): |
| 1347 | q.breakable() |
| 1348 | q.text("xid = "); |
| 1349 | if self.xid != None: |
| 1350 | q.text("%#x" % self.xid) |
| 1351 | else: |
| 1352 | q.text('None') |
| 1353 | q.text(","); q.breakable() |
| 1354 | q.text("l2_table_enable = "); |
| 1355 | q.text("%#x" % self.l2_table_enable) |
| 1356 | q.text(","); q.breakable() |
| 1357 | q.text("l2_table_priority = "); |
| 1358 | q.text("%#x" % self.l2_table_priority) |
| 1359 | q.breakable() |
| 1360 | q.text('}') |
| 1361 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1362 | bsn_header.subtypes[14] = bsn_get_l2_table_reply |
| 1363 | |
| 1364 | class bsn_get_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1365 | version = 1 |
| 1366 | type = 4 |
| 1367 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1368 | subtype = 13 |
| 1369 | |
| 1370 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1371 | if xid != None: |
| 1372 | self.xid = xid |
| 1373 | else: |
| 1374 | self.xid = None |
| 1375 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1376 | |
| 1377 | def pack(self): |
| 1378 | packed = [] |
| 1379 | packed.append(struct.pack("!B", self.version)) |
| 1380 | packed.append(struct.pack("!B", self.type)) |
| 1381 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1382 | packed.append(struct.pack("!L", self.xid)) |
| 1383 | packed.append(struct.pack("!L", self.experimenter)) |
| 1384 | packed.append(struct.pack("!L", self.subtype)) |
| 1385 | length = sum([len(x) for x in packed]) |
| 1386 | packed[2] = struct.pack("!H", length) |
| 1387 | return ''.join(packed) |
| 1388 | |
| 1389 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1390 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1391 | obj = bsn_get_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1392 | _version = reader.read("!B")[0] |
| 1393 | assert(_version == 1) |
| 1394 | _type = reader.read("!B")[0] |
| 1395 | assert(_type == 4) |
| 1396 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1397 | orig_reader = reader |
| 1398 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1399 | obj.xid = reader.read("!L")[0] |
| 1400 | _experimenter = reader.read("!L")[0] |
| 1401 | assert(_experimenter == 6035143) |
| 1402 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1403 | assert(_subtype == 13) |
| 1404 | return obj |
| 1405 | |
| 1406 | def __eq__(self, other): |
| 1407 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1408 | if self.xid != other.xid: return False |
| 1409 | return True |
| 1410 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1411 | def pretty_print(self, q): |
| 1412 | q.text("bsn_get_l2_table_request {") |
| 1413 | with q.group(): |
| 1414 | with q.indent(2): |
| 1415 | q.breakable() |
| 1416 | q.text("xid = "); |
| 1417 | if self.xid != None: |
| 1418 | q.text("%#x" % self.xid) |
| 1419 | else: |
| 1420 | q.text('None') |
| 1421 | q.breakable() |
| 1422 | q.text('}') |
| 1423 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1424 | bsn_header.subtypes[13] = bsn_get_l2_table_request |
| 1425 | |
| 1426 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1427 | version = 1 |
| 1428 | type = 4 |
| 1429 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1430 | subtype = 5 |
| 1431 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1432 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1433 | if xid != None: |
| 1434 | self.xid = xid |
| 1435 | else: |
| 1436 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1437 | if report_mirror_ports != None: |
| 1438 | self.report_mirror_ports = report_mirror_ports |
| 1439 | else: |
| 1440 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1441 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1442 | |
| 1443 | def pack(self): |
| 1444 | packed = [] |
| 1445 | packed.append(struct.pack("!B", self.version)) |
| 1446 | packed.append(struct.pack("!B", self.type)) |
| 1447 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1448 | packed.append(struct.pack("!L", self.xid)) |
| 1449 | packed.append(struct.pack("!L", self.experimenter)) |
| 1450 | packed.append(struct.pack("!L", self.subtype)) |
| 1451 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1452 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1453 | length = sum([len(x) for x in packed]) |
| 1454 | packed[2] = struct.pack("!H", length) |
| 1455 | return ''.join(packed) |
| 1456 | |
| 1457 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1458 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1459 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1460 | _version = reader.read("!B")[0] |
| 1461 | assert(_version == 1) |
| 1462 | _type = reader.read("!B")[0] |
| 1463 | assert(_type == 4) |
| 1464 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1465 | orig_reader = reader |
| 1466 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1467 | obj.xid = reader.read("!L")[0] |
| 1468 | _experimenter = reader.read("!L")[0] |
| 1469 | assert(_experimenter == 6035143) |
| 1470 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1471 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1472 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1473 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1474 | return obj |
| 1475 | |
| 1476 | def __eq__(self, other): |
| 1477 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1478 | if self.xid != other.xid: return False |
| 1479 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1480 | return True |
| 1481 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1482 | def pretty_print(self, q): |
| 1483 | q.text("bsn_get_mirroring_reply {") |
| 1484 | with q.group(): |
| 1485 | with q.indent(2): |
| 1486 | q.breakable() |
| 1487 | q.text("xid = "); |
| 1488 | if self.xid != None: |
| 1489 | q.text("%#x" % self.xid) |
| 1490 | else: |
| 1491 | q.text('None') |
| 1492 | q.text(","); q.breakable() |
| 1493 | q.text("report_mirror_ports = "); |
| 1494 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1495 | q.breakable() |
| 1496 | q.text('}') |
| 1497 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1498 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1499 | |
| 1500 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1501 | version = 1 |
| 1502 | type = 4 |
| 1503 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1504 | subtype = 4 |
| 1505 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1506 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1507 | if xid != None: |
| 1508 | self.xid = xid |
| 1509 | else: |
| 1510 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1511 | if report_mirror_ports != None: |
| 1512 | self.report_mirror_ports = report_mirror_ports |
| 1513 | else: |
| 1514 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1515 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1516 | |
| 1517 | def pack(self): |
| 1518 | packed = [] |
| 1519 | packed.append(struct.pack("!B", self.version)) |
| 1520 | packed.append(struct.pack("!B", self.type)) |
| 1521 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1522 | packed.append(struct.pack("!L", self.xid)) |
| 1523 | packed.append(struct.pack("!L", self.experimenter)) |
| 1524 | packed.append(struct.pack("!L", self.subtype)) |
| 1525 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1526 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1527 | length = sum([len(x) for x in packed]) |
| 1528 | packed[2] = struct.pack("!H", length) |
| 1529 | return ''.join(packed) |
| 1530 | |
| 1531 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1532 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1533 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1534 | _version = reader.read("!B")[0] |
| 1535 | assert(_version == 1) |
| 1536 | _type = reader.read("!B")[0] |
| 1537 | assert(_type == 4) |
| 1538 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1539 | orig_reader = reader |
| 1540 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1541 | obj.xid = reader.read("!L")[0] |
| 1542 | _experimenter = reader.read("!L")[0] |
| 1543 | assert(_experimenter == 6035143) |
| 1544 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1545 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1546 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1547 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1548 | return obj |
| 1549 | |
| 1550 | def __eq__(self, other): |
| 1551 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1552 | if self.xid != other.xid: return False |
| 1553 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1554 | return True |
| 1555 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1556 | def pretty_print(self, q): |
| 1557 | q.text("bsn_get_mirroring_request {") |
| 1558 | with q.group(): |
| 1559 | with q.indent(2): |
| 1560 | q.breakable() |
| 1561 | q.text("xid = "); |
| 1562 | if self.xid != None: |
| 1563 | q.text("%#x" % self.xid) |
| 1564 | else: |
| 1565 | q.text('None') |
| 1566 | q.text(","); q.breakable() |
| 1567 | q.text("report_mirror_ports = "); |
| 1568 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1569 | q.breakable() |
| 1570 | q.text('}') |
| 1571 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1572 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 1573 | |
| 1574 | class bsn_hybrid_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1575 | version = 1 |
| 1576 | type = 4 |
| 1577 | experimenter = 6035143 |
| 1578 | subtype = 28 |
| 1579 | |
| 1580 | def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1581 | if xid != None: |
| 1582 | self.xid = xid |
| 1583 | else: |
| 1584 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1585 | if hybrid_enable != None: |
| 1586 | self.hybrid_enable = hybrid_enable |
| 1587 | else: |
| 1588 | self.hybrid_enable = 0 |
| 1589 | if hybrid_version != None: |
| 1590 | self.hybrid_version = hybrid_version |
| 1591 | else: |
| 1592 | self.hybrid_version = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1593 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1594 | |
| 1595 | def pack(self): |
| 1596 | packed = [] |
| 1597 | packed.append(struct.pack("!B", self.version)) |
| 1598 | packed.append(struct.pack("!B", self.type)) |
| 1599 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1600 | packed.append(struct.pack("!L", self.xid)) |
| 1601 | packed.append(struct.pack("!L", self.experimenter)) |
| 1602 | packed.append(struct.pack("!L", self.subtype)) |
| 1603 | packed.append(struct.pack("!B", self.hybrid_enable)) |
| 1604 | packed.append('\x00' * 1) |
| 1605 | packed.append(struct.pack("!H", self.hybrid_version)) |
| 1606 | packed.append('\x00' * 4) |
| 1607 | length = sum([len(x) for x in packed]) |
| 1608 | packed[2] = struct.pack("!H", length) |
| 1609 | return ''.join(packed) |
| 1610 | |
| 1611 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1612 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1613 | obj = bsn_hybrid_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1614 | _version = reader.read("!B")[0] |
| 1615 | assert(_version == 1) |
| 1616 | _type = reader.read("!B")[0] |
| 1617 | assert(_type == 4) |
| 1618 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1619 | orig_reader = reader |
| 1620 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1621 | obj.xid = reader.read("!L")[0] |
| 1622 | _experimenter = reader.read("!L")[0] |
| 1623 | assert(_experimenter == 6035143) |
| 1624 | _subtype = reader.read("!L")[0] |
| 1625 | assert(_subtype == 28) |
| 1626 | obj.hybrid_enable = reader.read("!B")[0] |
| 1627 | reader.skip(1) |
| 1628 | obj.hybrid_version = reader.read("!H")[0] |
| 1629 | reader.skip(4) |
| 1630 | return obj |
| 1631 | |
| 1632 | def __eq__(self, other): |
| 1633 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1634 | if self.xid != other.xid: return False |
| 1635 | if self.hybrid_enable != other.hybrid_enable: return False |
| 1636 | if self.hybrid_version != other.hybrid_version: return False |
| 1637 | return True |
| 1638 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1639 | def pretty_print(self, q): |
| 1640 | q.text("bsn_hybrid_get_reply {") |
| 1641 | with q.group(): |
| 1642 | with q.indent(2): |
| 1643 | q.breakable() |
| 1644 | q.text("xid = "); |
| 1645 | if self.xid != None: |
| 1646 | q.text("%#x" % self.xid) |
| 1647 | else: |
| 1648 | q.text('None') |
| 1649 | q.text(","); q.breakable() |
| 1650 | q.text("hybrid_enable = "); |
| 1651 | q.text("%#x" % self.hybrid_enable) |
| 1652 | q.text(","); q.breakable() |
| 1653 | q.text("hybrid_version = "); |
| 1654 | q.text("%#x" % self.hybrid_version) |
| 1655 | q.breakable() |
| 1656 | q.text('}') |
| 1657 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1658 | bsn_header.subtypes[28] = bsn_hybrid_get_reply |
| 1659 | |
| 1660 | class bsn_hybrid_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1661 | version = 1 |
| 1662 | type = 4 |
| 1663 | experimenter = 6035143 |
| 1664 | subtype = 27 |
| 1665 | |
| 1666 | def __init__(self, xid=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 |
| 1671 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1672 | |
| 1673 | def pack(self): |
| 1674 | packed = [] |
| 1675 | packed.append(struct.pack("!B", self.version)) |
| 1676 | packed.append(struct.pack("!B", self.type)) |
| 1677 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1678 | packed.append(struct.pack("!L", self.xid)) |
| 1679 | packed.append(struct.pack("!L", self.experimenter)) |
| 1680 | packed.append(struct.pack("!L", self.subtype)) |
| 1681 | length = sum([len(x) for x in packed]) |
| 1682 | packed[2] = struct.pack("!H", length) |
| 1683 | return ''.join(packed) |
| 1684 | |
| 1685 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1686 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1687 | obj = bsn_hybrid_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1688 | _version = reader.read("!B")[0] |
| 1689 | assert(_version == 1) |
| 1690 | _type = reader.read("!B")[0] |
| 1691 | assert(_type == 4) |
| 1692 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1693 | orig_reader = reader |
| 1694 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1695 | obj.xid = reader.read("!L")[0] |
| 1696 | _experimenter = reader.read("!L")[0] |
| 1697 | assert(_experimenter == 6035143) |
| 1698 | _subtype = reader.read("!L")[0] |
| 1699 | assert(_subtype == 27) |
| 1700 | return obj |
| 1701 | |
| 1702 | def __eq__(self, other): |
| 1703 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1704 | if self.xid != other.xid: return False |
| 1705 | return True |
| 1706 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1707 | def pretty_print(self, q): |
| 1708 | q.text("bsn_hybrid_get_request {") |
| 1709 | with q.group(): |
| 1710 | with q.indent(2): |
| 1711 | q.breakable() |
| 1712 | q.text("xid = "); |
| 1713 | if self.xid != None: |
| 1714 | q.text("%#x" % self.xid) |
| 1715 | else: |
| 1716 | q.text('None') |
| 1717 | q.breakable() |
| 1718 | q.text('}') |
| 1719 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1720 | bsn_header.subtypes[27] = bsn_hybrid_get_request |
| 1721 | |
| 1722 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1723 | version = 1 |
| 1724 | type = 4 |
| 1725 | experimenter = 6035143 |
| 1726 | subtype = 34 |
| 1727 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1728 | 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] | 1729 | if xid != None: |
| 1730 | self.xid = xid |
| 1731 | else: |
| 1732 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1733 | if status != None: |
| 1734 | self.status = status |
| 1735 | else: |
| 1736 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1737 | if port_no != None: |
| 1738 | self.port_no = port_no |
| 1739 | else: |
| 1740 | self.port_no = 0 |
| 1741 | if slot_num != None: |
| 1742 | self.slot_num = slot_num |
| 1743 | else: |
| 1744 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1745 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1746 | |
| 1747 | def pack(self): |
| 1748 | packed = [] |
| 1749 | packed.append(struct.pack("!B", self.version)) |
| 1750 | packed.append(struct.pack("!B", self.type)) |
| 1751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1752 | packed.append(struct.pack("!L", self.xid)) |
| 1753 | packed.append(struct.pack("!L", self.experimenter)) |
| 1754 | packed.append(struct.pack("!L", self.subtype)) |
| 1755 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1756 | packed.append(util.pack_port_no(self.port_no)) |
| 1757 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1758 | length = sum([len(x) for x in packed]) |
| 1759 | packed[2] = struct.pack("!H", length) |
| 1760 | return ''.join(packed) |
| 1761 | |
| 1762 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1763 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1764 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1765 | _version = reader.read("!B")[0] |
| 1766 | assert(_version == 1) |
| 1767 | _type = reader.read("!B")[0] |
| 1768 | assert(_type == 4) |
| 1769 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1770 | orig_reader = reader |
| 1771 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1772 | obj.xid = reader.read("!L")[0] |
| 1773 | _experimenter = reader.read("!L")[0] |
| 1774 | assert(_experimenter == 6035143) |
| 1775 | _subtype = reader.read("!L")[0] |
| 1776 | assert(_subtype == 34) |
| 1777 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1778 | obj.port_no = util.unpack_port_no(reader) |
| 1779 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1780 | return obj |
| 1781 | |
| 1782 | def __eq__(self, other): |
| 1783 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1784 | if self.xid != other.xid: return False |
| 1785 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1786 | if self.port_no != other.port_no: return False |
| 1787 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1788 | return True |
| 1789 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1790 | def pretty_print(self, q): |
| 1791 | q.text("bsn_pdu_rx_reply {") |
| 1792 | with q.group(): |
| 1793 | with q.indent(2): |
| 1794 | q.breakable() |
| 1795 | q.text("xid = "); |
| 1796 | if self.xid != None: |
| 1797 | q.text("%#x" % self.xid) |
| 1798 | else: |
| 1799 | q.text('None') |
| 1800 | q.text(","); q.breakable() |
| 1801 | q.text("status = "); |
| 1802 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1803 | q.text(","); q.breakable() |
| 1804 | q.text("port_no = "); |
| 1805 | q.text(util.pretty_port(self.port_no)) |
| 1806 | q.text(","); q.breakable() |
| 1807 | q.text("slot_num = "); |
| 1808 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1809 | q.breakable() |
| 1810 | q.text('}') |
| 1811 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1812 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 1813 | |
| 1814 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1815 | version = 1 |
| 1816 | type = 4 |
| 1817 | experimenter = 6035143 |
| 1818 | subtype = 33 |
| 1819 | |
| 1820 | 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] | 1821 | if xid != None: |
| 1822 | self.xid = xid |
| 1823 | else: |
| 1824 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1825 | if timeout_ms != None: |
| 1826 | self.timeout_ms = timeout_ms |
| 1827 | else: |
| 1828 | self.timeout_ms = 0 |
| 1829 | if port_no != None: |
| 1830 | self.port_no = port_no |
| 1831 | else: |
| 1832 | self.port_no = 0 |
| 1833 | if slot_num != None: |
| 1834 | self.slot_num = slot_num |
| 1835 | else: |
| 1836 | self.slot_num = 0 |
| 1837 | if data != None: |
| 1838 | self.data = data |
| 1839 | else: |
| 1840 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1841 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1842 | |
| 1843 | def pack(self): |
| 1844 | packed = [] |
| 1845 | packed.append(struct.pack("!B", self.version)) |
| 1846 | packed.append(struct.pack("!B", self.type)) |
| 1847 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1848 | packed.append(struct.pack("!L", self.xid)) |
| 1849 | packed.append(struct.pack("!L", self.experimenter)) |
| 1850 | packed.append(struct.pack("!L", self.subtype)) |
| 1851 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 1852 | packed.append(util.pack_port_no(self.port_no)) |
| 1853 | packed.append(struct.pack("!B", self.slot_num)) |
| 1854 | packed.append('\x00' * 3) |
| 1855 | packed.append(self.data) |
| 1856 | length = sum([len(x) for x in packed]) |
| 1857 | packed[2] = struct.pack("!H", length) |
| 1858 | return ''.join(packed) |
| 1859 | |
| 1860 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1861 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1862 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1863 | _version = reader.read("!B")[0] |
| 1864 | assert(_version == 1) |
| 1865 | _type = reader.read("!B")[0] |
| 1866 | assert(_type == 4) |
| 1867 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1868 | orig_reader = reader |
| 1869 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1870 | obj.xid = reader.read("!L")[0] |
| 1871 | _experimenter = reader.read("!L")[0] |
| 1872 | assert(_experimenter == 6035143) |
| 1873 | _subtype = reader.read("!L")[0] |
| 1874 | assert(_subtype == 33) |
| 1875 | obj.timeout_ms = reader.read("!L")[0] |
| 1876 | obj.port_no = util.unpack_port_no(reader) |
| 1877 | obj.slot_num = reader.read("!B")[0] |
| 1878 | reader.skip(3) |
| 1879 | obj.data = str(reader.read_all()) |
| 1880 | return obj |
| 1881 | |
| 1882 | def __eq__(self, other): |
| 1883 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1884 | if self.xid != other.xid: return False |
| 1885 | if self.timeout_ms != other.timeout_ms: return False |
| 1886 | if self.port_no != other.port_no: return False |
| 1887 | if self.slot_num != other.slot_num: return False |
| 1888 | if self.data != other.data: return False |
| 1889 | return True |
| 1890 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1891 | def pretty_print(self, q): |
| 1892 | q.text("bsn_pdu_rx_request {") |
| 1893 | with q.group(): |
| 1894 | with q.indent(2): |
| 1895 | q.breakable() |
| 1896 | q.text("xid = "); |
| 1897 | if self.xid != None: |
| 1898 | q.text("%#x" % self.xid) |
| 1899 | else: |
| 1900 | q.text('None') |
| 1901 | q.text(","); q.breakable() |
| 1902 | q.text("timeout_ms = "); |
| 1903 | q.text("%#x" % self.timeout_ms) |
| 1904 | q.text(","); q.breakable() |
| 1905 | q.text("port_no = "); |
| 1906 | q.text(util.pretty_port(self.port_no)) |
| 1907 | q.text(","); q.breakable() |
| 1908 | q.text("slot_num = "); |
| 1909 | q.text("%#x" % self.slot_num) |
| 1910 | q.text(","); q.breakable() |
| 1911 | q.text("data = "); |
| 1912 | q.pp(self.data) |
| 1913 | q.breakable() |
| 1914 | q.text('}') |
| 1915 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1916 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 1917 | |
| 1918 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1919 | version = 1 |
| 1920 | type = 4 |
| 1921 | experimenter = 6035143 |
| 1922 | subtype = 35 |
| 1923 | |
| 1924 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1925 | if xid != None: |
| 1926 | self.xid = xid |
| 1927 | else: |
| 1928 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1929 | if port_no != None: |
| 1930 | self.port_no = port_no |
| 1931 | else: |
| 1932 | self.port_no = 0 |
| 1933 | if slot_num != None: |
| 1934 | self.slot_num = slot_num |
| 1935 | else: |
| 1936 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1937 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1938 | |
| 1939 | def pack(self): |
| 1940 | packed = [] |
| 1941 | packed.append(struct.pack("!B", self.version)) |
| 1942 | packed.append(struct.pack("!B", self.type)) |
| 1943 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1944 | packed.append(struct.pack("!L", self.xid)) |
| 1945 | packed.append(struct.pack("!L", self.experimenter)) |
| 1946 | packed.append(struct.pack("!L", self.subtype)) |
| 1947 | packed.append(util.pack_port_no(self.port_no)) |
| 1948 | packed.append(struct.pack("!B", self.slot_num)) |
| 1949 | length = sum([len(x) for x in packed]) |
| 1950 | packed[2] = struct.pack("!H", length) |
| 1951 | return ''.join(packed) |
| 1952 | |
| 1953 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1954 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1955 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1956 | _version = reader.read("!B")[0] |
| 1957 | assert(_version == 1) |
| 1958 | _type = reader.read("!B")[0] |
| 1959 | assert(_type == 4) |
| 1960 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1961 | orig_reader = reader |
| 1962 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1963 | obj.xid = reader.read("!L")[0] |
| 1964 | _experimenter = reader.read("!L")[0] |
| 1965 | assert(_experimenter == 6035143) |
| 1966 | _subtype = reader.read("!L")[0] |
| 1967 | assert(_subtype == 35) |
| 1968 | obj.port_no = util.unpack_port_no(reader) |
| 1969 | obj.slot_num = reader.read("!B")[0] |
| 1970 | return obj |
| 1971 | |
| 1972 | def __eq__(self, other): |
| 1973 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1974 | if self.xid != other.xid: return False |
| 1975 | if self.port_no != other.port_no: return False |
| 1976 | if self.slot_num != other.slot_num: return False |
| 1977 | return True |
| 1978 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1979 | def pretty_print(self, q): |
| 1980 | q.text("bsn_pdu_rx_timeout {") |
| 1981 | with q.group(): |
| 1982 | with q.indent(2): |
| 1983 | q.breakable() |
| 1984 | q.text("xid = "); |
| 1985 | if self.xid != None: |
| 1986 | q.text("%#x" % self.xid) |
| 1987 | else: |
| 1988 | q.text('None') |
| 1989 | q.text(","); q.breakable() |
| 1990 | q.text("port_no = "); |
| 1991 | q.text(util.pretty_port(self.port_no)) |
| 1992 | q.text(","); q.breakable() |
| 1993 | q.text("slot_num = "); |
| 1994 | q.text("%#x" % self.slot_num) |
| 1995 | q.breakable() |
| 1996 | q.text('}') |
| 1997 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1998 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 1999 | |
| 2000 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2001 | version = 1 |
| 2002 | type = 4 |
| 2003 | experimenter = 6035143 |
| 2004 | subtype = 32 |
| 2005 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2006 | 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] | 2007 | if xid != None: |
| 2008 | self.xid = xid |
| 2009 | else: |
| 2010 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2011 | if status != None: |
| 2012 | self.status = status |
| 2013 | else: |
| 2014 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2015 | if port_no != None: |
| 2016 | self.port_no = port_no |
| 2017 | else: |
| 2018 | self.port_no = 0 |
| 2019 | if slot_num != None: |
| 2020 | self.slot_num = slot_num |
| 2021 | else: |
| 2022 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2023 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2024 | |
| 2025 | def pack(self): |
| 2026 | packed = [] |
| 2027 | packed.append(struct.pack("!B", self.version)) |
| 2028 | packed.append(struct.pack("!B", self.type)) |
| 2029 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2030 | packed.append(struct.pack("!L", self.xid)) |
| 2031 | packed.append(struct.pack("!L", self.experimenter)) |
| 2032 | packed.append(struct.pack("!L", self.subtype)) |
| 2033 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2034 | packed.append(util.pack_port_no(self.port_no)) |
| 2035 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2036 | length = sum([len(x) for x in packed]) |
| 2037 | packed[2] = struct.pack("!H", length) |
| 2038 | return ''.join(packed) |
| 2039 | |
| 2040 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2041 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2042 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2043 | _version = reader.read("!B")[0] |
| 2044 | assert(_version == 1) |
| 2045 | _type = reader.read("!B")[0] |
| 2046 | assert(_type == 4) |
| 2047 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2048 | orig_reader = reader |
| 2049 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2050 | obj.xid = reader.read("!L")[0] |
| 2051 | _experimenter = reader.read("!L")[0] |
| 2052 | assert(_experimenter == 6035143) |
| 2053 | _subtype = reader.read("!L")[0] |
| 2054 | assert(_subtype == 32) |
| 2055 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2056 | obj.port_no = util.unpack_port_no(reader) |
| 2057 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2058 | return obj |
| 2059 | |
| 2060 | def __eq__(self, other): |
| 2061 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2062 | if self.xid != other.xid: return False |
| 2063 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2064 | if self.port_no != other.port_no: return False |
| 2065 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2066 | return True |
| 2067 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2068 | def pretty_print(self, q): |
| 2069 | q.text("bsn_pdu_tx_reply {") |
| 2070 | with q.group(): |
| 2071 | with q.indent(2): |
| 2072 | q.breakable() |
| 2073 | q.text("xid = "); |
| 2074 | if self.xid != None: |
| 2075 | q.text("%#x" % self.xid) |
| 2076 | else: |
| 2077 | q.text('None') |
| 2078 | q.text(","); q.breakable() |
| 2079 | q.text("status = "); |
| 2080 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2081 | q.text(","); q.breakable() |
| 2082 | q.text("port_no = "); |
| 2083 | q.text(util.pretty_port(self.port_no)) |
| 2084 | q.text(","); q.breakable() |
| 2085 | q.text("slot_num = "); |
| 2086 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2087 | q.breakable() |
| 2088 | q.text('}') |
| 2089 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2090 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2091 | |
| 2092 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2093 | version = 1 |
| 2094 | type = 4 |
| 2095 | experimenter = 6035143 |
| 2096 | subtype = 31 |
| 2097 | |
| 2098 | 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] | 2099 | if xid != None: |
| 2100 | self.xid = xid |
| 2101 | else: |
| 2102 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2103 | if tx_interval_ms != None: |
| 2104 | self.tx_interval_ms = tx_interval_ms |
| 2105 | else: |
| 2106 | self.tx_interval_ms = 0 |
| 2107 | if port_no != None: |
| 2108 | self.port_no = port_no |
| 2109 | else: |
| 2110 | self.port_no = 0 |
| 2111 | if slot_num != None: |
| 2112 | self.slot_num = slot_num |
| 2113 | else: |
| 2114 | self.slot_num = 0 |
| 2115 | if data != None: |
| 2116 | self.data = data |
| 2117 | else: |
| 2118 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2119 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2120 | |
| 2121 | def pack(self): |
| 2122 | packed = [] |
| 2123 | packed.append(struct.pack("!B", self.version)) |
| 2124 | packed.append(struct.pack("!B", self.type)) |
| 2125 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2126 | packed.append(struct.pack("!L", self.xid)) |
| 2127 | packed.append(struct.pack("!L", self.experimenter)) |
| 2128 | packed.append(struct.pack("!L", self.subtype)) |
| 2129 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2130 | packed.append(util.pack_port_no(self.port_no)) |
| 2131 | packed.append(struct.pack("!B", self.slot_num)) |
| 2132 | packed.append('\x00' * 3) |
| 2133 | packed.append(self.data) |
| 2134 | length = sum([len(x) for x in packed]) |
| 2135 | packed[2] = struct.pack("!H", length) |
| 2136 | return ''.join(packed) |
| 2137 | |
| 2138 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2139 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2140 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2141 | _version = reader.read("!B")[0] |
| 2142 | assert(_version == 1) |
| 2143 | _type = reader.read("!B")[0] |
| 2144 | assert(_type == 4) |
| 2145 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2146 | orig_reader = reader |
| 2147 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2148 | obj.xid = reader.read("!L")[0] |
| 2149 | _experimenter = reader.read("!L")[0] |
| 2150 | assert(_experimenter == 6035143) |
| 2151 | _subtype = reader.read("!L")[0] |
| 2152 | assert(_subtype == 31) |
| 2153 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2154 | obj.port_no = util.unpack_port_no(reader) |
| 2155 | obj.slot_num = reader.read("!B")[0] |
| 2156 | reader.skip(3) |
| 2157 | obj.data = str(reader.read_all()) |
| 2158 | return obj |
| 2159 | |
| 2160 | def __eq__(self, other): |
| 2161 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2162 | if self.xid != other.xid: return False |
| 2163 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2164 | if self.port_no != other.port_no: return False |
| 2165 | if self.slot_num != other.slot_num: return False |
| 2166 | if self.data != other.data: return False |
| 2167 | return True |
| 2168 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2169 | def pretty_print(self, q): |
| 2170 | q.text("bsn_pdu_tx_request {") |
| 2171 | with q.group(): |
| 2172 | with q.indent(2): |
| 2173 | q.breakable() |
| 2174 | q.text("xid = "); |
| 2175 | if self.xid != None: |
| 2176 | q.text("%#x" % self.xid) |
| 2177 | else: |
| 2178 | q.text('None') |
| 2179 | q.text(","); q.breakable() |
| 2180 | q.text("tx_interval_ms = "); |
| 2181 | q.text("%#x" % self.tx_interval_ms) |
| 2182 | q.text(","); q.breakable() |
| 2183 | q.text("port_no = "); |
| 2184 | q.text(util.pretty_port(self.port_no)) |
| 2185 | q.text(","); q.breakable() |
| 2186 | q.text("slot_num = "); |
| 2187 | q.text("%#x" % self.slot_num) |
| 2188 | q.text(","); q.breakable() |
| 2189 | q.text("data = "); |
| 2190 | q.pp(self.data) |
| 2191 | q.breakable() |
| 2192 | q.text('}') |
| 2193 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2194 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2195 | |
| 2196 | class bsn_set_ip_mask(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2197 | version = 1 |
| 2198 | type = 4 |
| 2199 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2200 | subtype = 0 |
| 2201 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2202 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2203 | if xid != None: |
| 2204 | self.xid = xid |
| 2205 | else: |
| 2206 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2207 | if index != None: |
| 2208 | self.index = index |
| 2209 | else: |
| 2210 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2211 | if mask != None: |
| 2212 | self.mask = mask |
| 2213 | else: |
| 2214 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2215 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2216 | |
| 2217 | def pack(self): |
| 2218 | packed = [] |
| 2219 | packed.append(struct.pack("!B", self.version)) |
| 2220 | packed.append(struct.pack("!B", self.type)) |
| 2221 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2222 | packed.append(struct.pack("!L", self.xid)) |
| 2223 | packed.append(struct.pack("!L", self.experimenter)) |
| 2224 | packed.append(struct.pack("!L", self.subtype)) |
| 2225 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2226 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2227 | packed.append(struct.pack("!L", self.mask)) |
| 2228 | length = sum([len(x) for x in packed]) |
| 2229 | packed[2] = struct.pack("!H", length) |
| 2230 | return ''.join(packed) |
| 2231 | |
| 2232 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2233 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2234 | obj = bsn_set_ip_mask() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2235 | _version = reader.read("!B")[0] |
| 2236 | assert(_version == 1) |
| 2237 | _type = reader.read("!B")[0] |
| 2238 | assert(_type == 4) |
| 2239 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2240 | orig_reader = reader |
| 2241 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2242 | obj.xid = reader.read("!L")[0] |
| 2243 | _experimenter = reader.read("!L")[0] |
| 2244 | assert(_experimenter == 6035143) |
| 2245 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2246 | assert(_subtype == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2247 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2248 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2249 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2250 | return obj |
| 2251 | |
| 2252 | def __eq__(self, other): |
| 2253 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2254 | if self.xid != other.xid: return False |
| 2255 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2256 | if self.mask != other.mask: return False |
| 2257 | return True |
| 2258 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2259 | def pretty_print(self, q): |
| 2260 | q.text("bsn_set_ip_mask {") |
| 2261 | with q.group(): |
| 2262 | with q.indent(2): |
| 2263 | q.breakable() |
| 2264 | q.text("xid = "); |
| 2265 | if self.xid != None: |
| 2266 | q.text("%#x" % self.xid) |
| 2267 | else: |
| 2268 | q.text('None') |
| 2269 | q.text(","); q.breakable() |
| 2270 | q.text("index = "); |
| 2271 | q.text("%#x" % self.index) |
| 2272 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2273 | q.text("mask = "); |
| 2274 | q.text("%#x" % self.mask) |
| 2275 | q.breakable() |
| 2276 | q.text('}') |
| 2277 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2278 | bsn_header.subtypes[0] = bsn_set_ip_mask |
| 2279 | |
| 2280 | class bsn_set_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2281 | version = 1 |
| 2282 | type = 4 |
| 2283 | experimenter = 6035143 |
| 2284 | subtype = 24 |
| 2285 | |
| 2286 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2287 | if xid != None: |
| 2288 | self.xid = xid |
| 2289 | else: |
| 2290 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2291 | if l2_table_enable != None: |
| 2292 | self.l2_table_enable = l2_table_enable |
| 2293 | else: |
| 2294 | self.l2_table_enable = 0 |
| 2295 | if l2_table_priority != None: |
| 2296 | self.l2_table_priority = l2_table_priority |
| 2297 | else: |
| 2298 | self.l2_table_priority = 0 |
| 2299 | if status != None: |
| 2300 | self.status = status |
| 2301 | else: |
| 2302 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2303 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2304 | |
| 2305 | def pack(self): |
| 2306 | packed = [] |
| 2307 | packed.append(struct.pack("!B", self.version)) |
| 2308 | packed.append(struct.pack("!B", self.type)) |
| 2309 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2310 | packed.append(struct.pack("!L", self.xid)) |
| 2311 | packed.append(struct.pack("!L", self.experimenter)) |
| 2312 | packed.append(struct.pack("!L", self.subtype)) |
| 2313 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2314 | packed.append('\x00' * 1) |
| 2315 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2316 | packed.append(struct.pack("!L", self.status)) |
| 2317 | length = sum([len(x) for x in packed]) |
| 2318 | packed[2] = struct.pack("!H", length) |
| 2319 | return ''.join(packed) |
| 2320 | |
| 2321 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2322 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2323 | obj = bsn_set_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2324 | _version = reader.read("!B")[0] |
| 2325 | assert(_version == 1) |
| 2326 | _type = reader.read("!B")[0] |
| 2327 | assert(_type == 4) |
| 2328 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2329 | orig_reader = reader |
| 2330 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2331 | obj.xid = reader.read("!L")[0] |
| 2332 | _experimenter = reader.read("!L")[0] |
| 2333 | assert(_experimenter == 6035143) |
| 2334 | _subtype = reader.read("!L")[0] |
| 2335 | assert(_subtype == 24) |
| 2336 | obj.l2_table_enable = reader.read("!B")[0] |
| 2337 | reader.skip(1) |
| 2338 | obj.l2_table_priority = reader.read("!H")[0] |
| 2339 | obj.status = reader.read("!L")[0] |
| 2340 | return obj |
| 2341 | |
| 2342 | def __eq__(self, other): |
| 2343 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2344 | if self.xid != other.xid: return False |
| 2345 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2346 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2347 | if self.status != other.status: return False |
| 2348 | return True |
| 2349 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2350 | def pretty_print(self, q): |
| 2351 | q.text("bsn_set_l2_table_reply {") |
| 2352 | with q.group(): |
| 2353 | with q.indent(2): |
| 2354 | q.breakable() |
| 2355 | q.text("xid = "); |
| 2356 | if self.xid != None: |
| 2357 | q.text("%#x" % self.xid) |
| 2358 | else: |
| 2359 | q.text('None') |
| 2360 | q.text(","); q.breakable() |
| 2361 | q.text("l2_table_enable = "); |
| 2362 | q.text("%#x" % self.l2_table_enable) |
| 2363 | q.text(","); q.breakable() |
| 2364 | q.text("l2_table_priority = "); |
| 2365 | q.text("%#x" % self.l2_table_priority) |
| 2366 | q.text(","); q.breakable() |
| 2367 | q.text("status = "); |
| 2368 | q.text("%#x" % self.status) |
| 2369 | q.breakable() |
| 2370 | q.text('}') |
| 2371 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2372 | bsn_header.subtypes[24] = bsn_set_l2_table_reply |
| 2373 | |
| 2374 | class bsn_set_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2375 | version = 1 |
| 2376 | type = 4 |
| 2377 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2378 | subtype = 12 |
| 2379 | |
| 2380 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2381 | if xid != None: |
| 2382 | self.xid = xid |
| 2383 | else: |
| 2384 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2385 | if l2_table_enable != None: |
| 2386 | self.l2_table_enable = l2_table_enable |
| 2387 | else: |
| 2388 | self.l2_table_enable = 0 |
| 2389 | if l2_table_priority != None: |
| 2390 | self.l2_table_priority = l2_table_priority |
| 2391 | else: |
| 2392 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2393 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2394 | |
| 2395 | def pack(self): |
| 2396 | packed = [] |
| 2397 | packed.append(struct.pack("!B", self.version)) |
| 2398 | packed.append(struct.pack("!B", self.type)) |
| 2399 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2400 | packed.append(struct.pack("!L", self.xid)) |
| 2401 | packed.append(struct.pack("!L", self.experimenter)) |
| 2402 | packed.append(struct.pack("!L", self.subtype)) |
| 2403 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2404 | packed.append('\x00' * 1) |
| 2405 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2406 | packed.append('\x00' * 4) |
| 2407 | length = sum([len(x) for x in packed]) |
| 2408 | packed[2] = struct.pack("!H", length) |
| 2409 | return ''.join(packed) |
| 2410 | |
| 2411 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2412 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2413 | obj = bsn_set_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2414 | _version = reader.read("!B")[0] |
| 2415 | assert(_version == 1) |
| 2416 | _type = reader.read("!B")[0] |
| 2417 | assert(_type == 4) |
| 2418 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2419 | orig_reader = reader |
| 2420 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2421 | obj.xid = reader.read("!L")[0] |
| 2422 | _experimenter = reader.read("!L")[0] |
| 2423 | assert(_experimenter == 6035143) |
| 2424 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2425 | assert(_subtype == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2426 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2427 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2428 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2429 | reader.skip(4) |
| 2430 | return obj |
| 2431 | |
| 2432 | def __eq__(self, other): |
| 2433 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2434 | if self.xid != other.xid: return False |
| 2435 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2436 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2437 | return True |
| 2438 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2439 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2440 | q.text("bsn_set_l2_table_request {") |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2441 | with q.group(): |
| 2442 | with q.indent(2): |
| 2443 | q.breakable() |
| 2444 | q.text("xid = "); |
| 2445 | if self.xid != None: |
| 2446 | q.text("%#x" % self.xid) |
| 2447 | else: |
| 2448 | q.text('None') |
| 2449 | q.text(","); q.breakable() |
| 2450 | q.text("l2_table_enable = "); |
| 2451 | q.text("%#x" % self.l2_table_enable) |
| 2452 | q.text(","); q.breakable() |
| 2453 | q.text("l2_table_priority = "); |
| 2454 | q.text("%#x" % self.l2_table_priority) |
| 2455 | q.breakable() |
| 2456 | q.text('}') |
| 2457 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2458 | bsn_header.subtypes[12] = bsn_set_l2_table_request |
| 2459 | |
| 2460 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2461 | version = 1 |
| 2462 | type = 4 |
| 2463 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2464 | subtype = 3 |
| 2465 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2466 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2467 | if xid != None: |
| 2468 | self.xid = xid |
| 2469 | else: |
| 2470 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2471 | if report_mirror_ports != None: |
| 2472 | self.report_mirror_ports = report_mirror_ports |
| 2473 | else: |
| 2474 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2475 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2476 | |
| 2477 | def pack(self): |
| 2478 | packed = [] |
| 2479 | packed.append(struct.pack("!B", self.version)) |
| 2480 | packed.append(struct.pack("!B", self.type)) |
| 2481 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2482 | packed.append(struct.pack("!L", self.xid)) |
| 2483 | packed.append(struct.pack("!L", self.experimenter)) |
| 2484 | packed.append(struct.pack("!L", self.subtype)) |
| 2485 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2486 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2487 | length = sum([len(x) for x in packed]) |
| 2488 | packed[2] = struct.pack("!H", length) |
| 2489 | return ''.join(packed) |
| 2490 | |
| 2491 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2492 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2493 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2494 | _version = reader.read("!B")[0] |
| 2495 | assert(_version == 1) |
| 2496 | _type = reader.read("!B")[0] |
| 2497 | assert(_type == 4) |
| 2498 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2499 | orig_reader = reader |
| 2500 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2501 | obj.xid = reader.read("!L")[0] |
| 2502 | _experimenter = reader.read("!L")[0] |
| 2503 | assert(_experimenter == 6035143) |
| 2504 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2505 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2506 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2507 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2508 | return obj |
| 2509 | |
| 2510 | def __eq__(self, other): |
| 2511 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2512 | if self.xid != other.xid: return False |
| 2513 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2514 | return True |
| 2515 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2516 | def pretty_print(self, q): |
| 2517 | q.text("bsn_set_mirroring {") |
| 2518 | with q.group(): |
| 2519 | with q.indent(2): |
| 2520 | q.breakable() |
| 2521 | q.text("xid = "); |
| 2522 | if self.xid != None: |
| 2523 | q.text("%#x" % self.xid) |
| 2524 | else: |
| 2525 | q.text('None') |
| 2526 | q.text(","); q.breakable() |
| 2527 | q.text("report_mirror_ports = "); |
| 2528 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2529 | q.breakable() |
| 2530 | q.text('}') |
| 2531 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2532 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2533 | |
| 2534 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2535 | version = 1 |
| 2536 | type = 4 |
| 2537 | experimenter = 6035143 |
| 2538 | subtype = 25 |
| 2539 | |
| 2540 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2541 | if xid != None: |
| 2542 | self.xid = xid |
| 2543 | else: |
| 2544 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2545 | if status != None: |
| 2546 | self.status = status |
| 2547 | else: |
| 2548 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2549 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2550 | |
| 2551 | def pack(self): |
| 2552 | packed = [] |
| 2553 | packed.append(struct.pack("!B", self.version)) |
| 2554 | packed.append(struct.pack("!B", self.type)) |
| 2555 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2556 | packed.append(struct.pack("!L", self.xid)) |
| 2557 | packed.append(struct.pack("!L", self.experimenter)) |
| 2558 | packed.append(struct.pack("!L", self.subtype)) |
| 2559 | packed.append(struct.pack("!L", self.status)) |
| 2560 | length = sum([len(x) for x in packed]) |
| 2561 | packed[2] = struct.pack("!H", length) |
| 2562 | return ''.join(packed) |
| 2563 | |
| 2564 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2565 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2566 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2567 | _version = reader.read("!B")[0] |
| 2568 | assert(_version == 1) |
| 2569 | _type = reader.read("!B")[0] |
| 2570 | assert(_type == 4) |
| 2571 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2572 | orig_reader = reader |
| 2573 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2574 | obj.xid = reader.read("!L")[0] |
| 2575 | _experimenter = reader.read("!L")[0] |
| 2576 | assert(_experimenter == 6035143) |
| 2577 | _subtype = reader.read("!L")[0] |
| 2578 | assert(_subtype == 25) |
| 2579 | obj.status = reader.read("!L")[0] |
| 2580 | return obj |
| 2581 | |
| 2582 | def __eq__(self, other): |
| 2583 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2584 | if self.xid != other.xid: return False |
| 2585 | if self.status != other.status: return False |
| 2586 | return True |
| 2587 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2588 | def pretty_print(self, q): |
| 2589 | q.text("bsn_set_pktin_suppression_reply {") |
| 2590 | with q.group(): |
| 2591 | with q.indent(2): |
| 2592 | q.breakable() |
| 2593 | q.text("xid = "); |
| 2594 | if self.xid != None: |
| 2595 | q.text("%#x" % self.xid) |
| 2596 | else: |
| 2597 | q.text('None') |
| 2598 | q.text(","); q.breakable() |
| 2599 | q.text("status = "); |
| 2600 | q.text("%#x" % self.status) |
| 2601 | q.breakable() |
| 2602 | q.text('}') |
| 2603 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2604 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2605 | |
| 2606 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2607 | version = 1 |
| 2608 | type = 4 |
| 2609 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2610 | subtype = 11 |
| 2611 | |
| 2612 | 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] | 2613 | if xid != None: |
| 2614 | self.xid = xid |
| 2615 | else: |
| 2616 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2617 | if enabled != None: |
| 2618 | self.enabled = enabled |
| 2619 | else: |
| 2620 | self.enabled = 0 |
| 2621 | if idle_timeout != None: |
| 2622 | self.idle_timeout = idle_timeout |
| 2623 | else: |
| 2624 | self.idle_timeout = 0 |
| 2625 | if hard_timeout != None: |
| 2626 | self.hard_timeout = hard_timeout |
| 2627 | else: |
| 2628 | self.hard_timeout = 0 |
| 2629 | if priority != None: |
| 2630 | self.priority = priority |
| 2631 | else: |
| 2632 | self.priority = 0 |
| 2633 | if cookie != None: |
| 2634 | self.cookie = cookie |
| 2635 | else: |
| 2636 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2637 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2638 | |
| 2639 | def pack(self): |
| 2640 | packed = [] |
| 2641 | packed.append(struct.pack("!B", self.version)) |
| 2642 | packed.append(struct.pack("!B", self.type)) |
| 2643 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2644 | packed.append(struct.pack("!L", self.xid)) |
| 2645 | packed.append(struct.pack("!L", self.experimenter)) |
| 2646 | packed.append(struct.pack("!L", self.subtype)) |
| 2647 | packed.append(struct.pack("!B", self.enabled)) |
| 2648 | packed.append('\x00' * 1) |
| 2649 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2650 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2651 | packed.append(struct.pack("!H", self.priority)) |
| 2652 | packed.append(struct.pack("!Q", self.cookie)) |
| 2653 | length = sum([len(x) for x in packed]) |
| 2654 | packed[2] = struct.pack("!H", length) |
| 2655 | return ''.join(packed) |
| 2656 | |
| 2657 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2658 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2659 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2660 | _version = reader.read("!B")[0] |
| 2661 | assert(_version == 1) |
| 2662 | _type = reader.read("!B")[0] |
| 2663 | assert(_type == 4) |
| 2664 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2665 | orig_reader = reader |
| 2666 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2667 | obj.xid = reader.read("!L")[0] |
| 2668 | _experimenter = reader.read("!L")[0] |
| 2669 | assert(_experimenter == 6035143) |
| 2670 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2671 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2672 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2673 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2674 | obj.idle_timeout = reader.read("!H")[0] |
| 2675 | obj.hard_timeout = reader.read("!H")[0] |
| 2676 | obj.priority = reader.read("!H")[0] |
| 2677 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2678 | return obj |
| 2679 | |
| 2680 | def __eq__(self, other): |
| 2681 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2682 | if self.xid != other.xid: return False |
| 2683 | if self.enabled != other.enabled: return False |
| 2684 | if self.idle_timeout != other.idle_timeout: return False |
| 2685 | if self.hard_timeout != other.hard_timeout: return False |
| 2686 | if self.priority != other.priority: return False |
| 2687 | if self.cookie != other.cookie: return False |
| 2688 | return True |
| 2689 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2690 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2691 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2692 | with q.group(): |
| 2693 | with q.indent(2): |
| 2694 | q.breakable() |
| 2695 | q.text("xid = "); |
| 2696 | if self.xid != None: |
| 2697 | q.text("%#x" % self.xid) |
| 2698 | else: |
| 2699 | q.text('None') |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2700 | q.text(","); q.breakable() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2701 | q.text("enabled = "); |
| 2702 | q.text("%#x" % self.enabled) |
| 2703 | q.text(","); q.breakable() |
| 2704 | q.text("idle_timeout = "); |
| 2705 | q.text("%#x" % self.idle_timeout) |
| 2706 | q.text(","); q.breakable() |
| 2707 | q.text("hard_timeout = "); |
| 2708 | q.text("%#x" % self.hard_timeout) |
| 2709 | q.text(","); q.breakable() |
| 2710 | q.text("priority = "); |
| 2711 | q.text("%#x" % self.priority) |
| 2712 | q.text(","); q.breakable() |
| 2713 | q.text("cookie = "); |
| 2714 | q.text("%#x" % self.cookie) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2715 | q.breakable() |
| 2716 | q.text('}') |
| 2717 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2718 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 2719 | |
| 2720 | class bsn_shell_command(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2721 | version = 1 |
| 2722 | type = 4 |
| 2723 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2724 | subtype = 6 |
| 2725 | |
| 2726 | def __init__(self, xid=None, service=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2727 | if xid != None: |
| 2728 | self.xid = xid |
| 2729 | else: |
| 2730 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2731 | if service != None: |
| 2732 | self.service = service |
| 2733 | else: |
| 2734 | self.service = 0 |
| 2735 | if data != None: |
| 2736 | self.data = data |
| 2737 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2738 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2739 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2740 | |
| 2741 | def pack(self): |
| 2742 | packed = [] |
| 2743 | packed.append(struct.pack("!B", self.version)) |
| 2744 | packed.append(struct.pack("!B", self.type)) |
| 2745 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2746 | packed.append(struct.pack("!L", self.xid)) |
| 2747 | packed.append(struct.pack("!L", self.experimenter)) |
| 2748 | packed.append(struct.pack("!L", self.subtype)) |
| 2749 | packed.append(struct.pack("!L", self.service)) |
| 2750 | packed.append(self.data) |
| 2751 | length = sum([len(x) for x in packed]) |
| 2752 | packed[2] = struct.pack("!H", length) |
| 2753 | return ''.join(packed) |
| 2754 | |
| 2755 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2756 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2757 | obj = bsn_shell_command() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2758 | _version = reader.read("!B")[0] |
| 2759 | assert(_version == 1) |
| 2760 | _type = reader.read("!B")[0] |
| 2761 | assert(_type == 4) |
| 2762 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2763 | orig_reader = reader |
| 2764 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2765 | obj.xid = reader.read("!L")[0] |
| 2766 | _experimenter = reader.read("!L")[0] |
| 2767 | assert(_experimenter == 6035143) |
| 2768 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2769 | assert(_subtype == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2770 | obj.service = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2771 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2772 | return obj |
| 2773 | |
| 2774 | def __eq__(self, other): |
| 2775 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2776 | if self.xid != other.xid: return False |
| 2777 | if self.service != other.service: return False |
| 2778 | if self.data != other.data: return False |
| 2779 | return True |
| 2780 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2781 | def pretty_print(self, q): |
| 2782 | q.text("bsn_shell_command {") |
| 2783 | with q.group(): |
| 2784 | with q.indent(2): |
| 2785 | q.breakable() |
| 2786 | q.text("xid = "); |
| 2787 | if self.xid != None: |
| 2788 | q.text("%#x" % self.xid) |
| 2789 | else: |
| 2790 | q.text('None') |
| 2791 | q.text(","); q.breakable() |
| 2792 | q.text("service = "); |
| 2793 | q.text("%#x" % self.service) |
| 2794 | q.text(","); q.breakable() |
| 2795 | q.text("data = "); |
| 2796 | q.pp(self.data) |
| 2797 | q.breakable() |
| 2798 | q.text('}') |
| 2799 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2800 | bsn_header.subtypes[6] = bsn_shell_command |
| 2801 | |
| 2802 | class bsn_shell_output(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2803 | version = 1 |
| 2804 | type = 4 |
| 2805 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2806 | subtype = 7 |
| 2807 | |
| 2808 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2809 | if xid != None: |
| 2810 | self.xid = xid |
| 2811 | else: |
| 2812 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2813 | if data != None: |
| 2814 | self.data = data |
| 2815 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2816 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2817 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2818 | |
| 2819 | def pack(self): |
| 2820 | packed = [] |
| 2821 | packed.append(struct.pack("!B", self.version)) |
| 2822 | packed.append(struct.pack("!B", self.type)) |
| 2823 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2824 | packed.append(struct.pack("!L", self.xid)) |
| 2825 | packed.append(struct.pack("!L", self.experimenter)) |
| 2826 | packed.append(struct.pack("!L", self.subtype)) |
| 2827 | packed.append(self.data) |
| 2828 | length = sum([len(x) for x in packed]) |
| 2829 | packed[2] = struct.pack("!H", length) |
| 2830 | return ''.join(packed) |
| 2831 | |
| 2832 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2833 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2834 | obj = bsn_shell_output() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2835 | _version = reader.read("!B")[0] |
| 2836 | assert(_version == 1) |
| 2837 | _type = reader.read("!B")[0] |
| 2838 | assert(_type == 4) |
| 2839 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2840 | orig_reader = reader |
| 2841 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2842 | obj.xid = reader.read("!L")[0] |
| 2843 | _experimenter = reader.read("!L")[0] |
| 2844 | assert(_experimenter == 6035143) |
| 2845 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2846 | assert(_subtype == 7) |
| 2847 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2848 | return obj |
| 2849 | |
| 2850 | def __eq__(self, other): |
| 2851 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2852 | if self.xid != other.xid: return False |
| 2853 | if self.data != other.data: return False |
| 2854 | return True |
| 2855 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2856 | def pretty_print(self, q): |
| 2857 | q.text("bsn_shell_output {") |
| 2858 | with q.group(): |
| 2859 | with q.indent(2): |
| 2860 | q.breakable() |
| 2861 | q.text("xid = "); |
| 2862 | if self.xid != None: |
| 2863 | q.text("%#x" % self.xid) |
| 2864 | else: |
| 2865 | q.text('None') |
| 2866 | q.text(","); q.breakable() |
| 2867 | q.text("data = "); |
| 2868 | q.pp(self.data) |
| 2869 | q.breakable() |
| 2870 | q.text('}') |
| 2871 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2872 | bsn_header.subtypes[7] = bsn_shell_output |
| 2873 | |
| 2874 | class bsn_shell_status(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2875 | version = 1 |
| 2876 | type = 4 |
| 2877 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2878 | subtype = 8 |
| 2879 | |
| 2880 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2881 | if xid != None: |
| 2882 | self.xid = xid |
| 2883 | else: |
| 2884 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2885 | if status != None: |
| 2886 | self.status = status |
| 2887 | else: |
| 2888 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2889 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2890 | |
| 2891 | def pack(self): |
| 2892 | packed = [] |
| 2893 | packed.append(struct.pack("!B", self.version)) |
| 2894 | packed.append(struct.pack("!B", self.type)) |
| 2895 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2896 | packed.append(struct.pack("!L", self.xid)) |
| 2897 | packed.append(struct.pack("!L", self.experimenter)) |
| 2898 | packed.append(struct.pack("!L", self.subtype)) |
| 2899 | packed.append(struct.pack("!L", self.status)) |
| 2900 | length = sum([len(x) for x in packed]) |
| 2901 | packed[2] = struct.pack("!H", length) |
| 2902 | return ''.join(packed) |
| 2903 | |
| 2904 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2905 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2906 | obj = bsn_shell_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2907 | _version = reader.read("!B")[0] |
| 2908 | assert(_version == 1) |
| 2909 | _type = reader.read("!B")[0] |
| 2910 | assert(_type == 4) |
| 2911 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2912 | orig_reader = reader |
| 2913 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2914 | obj.xid = reader.read("!L")[0] |
| 2915 | _experimenter = reader.read("!L")[0] |
| 2916 | assert(_experimenter == 6035143) |
| 2917 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2918 | assert(_subtype == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2919 | obj.status = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2920 | return obj |
| 2921 | |
| 2922 | def __eq__(self, other): |
| 2923 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2924 | if self.xid != other.xid: return False |
| 2925 | if self.status != other.status: return False |
| 2926 | return True |
| 2927 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2928 | def pretty_print(self, q): |
| 2929 | q.text("bsn_shell_status {") |
| 2930 | with q.group(): |
| 2931 | with q.indent(2): |
| 2932 | q.breakable() |
| 2933 | q.text("xid = "); |
| 2934 | if self.xid != None: |
| 2935 | q.text("%#x" % self.xid) |
| 2936 | else: |
| 2937 | q.text('None') |
| 2938 | q.text(","); q.breakable() |
| 2939 | q.text("status = "); |
| 2940 | q.text("%#x" % self.status) |
| 2941 | q.breakable() |
| 2942 | q.text('}') |
| 2943 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2944 | bsn_header.subtypes[8] = bsn_shell_status |
| 2945 | |
| 2946 | class experimenter_stats_reply(stats_reply): |
| 2947 | subtypes = {} |
| 2948 | |
| 2949 | @staticmethod |
| 2950 | def unpack(reader): |
| 2951 | subtype, = reader.peek('!L', 12) |
| 2952 | try: |
| 2953 | subclass = experimenter_stats_reply.subtypes[subtype] |
| 2954 | except KeyError: |
| 2955 | raise loxi.ProtocolError("unknown experimenter_stats_reply stats_reply message subtype %#x" % subtype) |
| 2956 | return subclass.unpack(reader) |
| 2957 | |
| 2958 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2959 | |
| 2960 | class bsn_stats_reply(experimenter_stats_reply): |
| 2961 | subtypes = {} |
| 2962 | |
| 2963 | @staticmethod |
| 2964 | def unpack(reader): |
| 2965 | subtype, = reader.peek('!L', 20) |
| 2966 | try: |
| 2967 | subclass = bsn_stats_reply.subtypes[subtype] |
| 2968 | except KeyError: |
| 2969 | raise loxi.ProtocolError("unknown bsn_stats_reply experimenter_stats_reply stats_reply message subtype %#x" % subtype) |
| 2970 | return subclass.unpack(reader) |
| 2971 | |
| 2972 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2973 | |
| 2974 | class experimenter_stats_request(stats_request): |
| 2975 | subtypes = {} |
| 2976 | |
| 2977 | @staticmethod |
| 2978 | def unpack(reader): |
| 2979 | subtype, = reader.peek('!L', 12) |
| 2980 | try: |
| 2981 | subclass = experimenter_stats_request.subtypes[subtype] |
| 2982 | except KeyError: |
| 2983 | raise loxi.ProtocolError("unknown experimenter_stats_request stats_request message subtype %#x" % subtype) |
| 2984 | return subclass.unpack(reader) |
| 2985 | |
| 2986 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2987 | |
| 2988 | class bsn_stats_request(experimenter_stats_request): |
| 2989 | subtypes = {} |
| 2990 | |
| 2991 | @staticmethod |
| 2992 | def unpack(reader): |
| 2993 | subtype, = reader.peek('!L', 20) |
| 2994 | try: |
| 2995 | subclass = bsn_stats_request.subtypes[subtype] |
| 2996 | except KeyError: |
| 2997 | raise loxi.ProtocolError("unknown bsn_stats_request experimenter_stats_request stats_request message subtype %#x" % subtype) |
| 2998 | return subclass.unpack(reader) |
| 2999 | |
| 3000 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 3001 | |
| 3002 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3003 | version = 1 |
| 3004 | type = 4 |
| 3005 | experimenter = 6035143 |
| 3006 | subtype = 16 |
| 3007 | |
| 3008 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3009 | if xid != None: |
| 3010 | self.xid = xid |
| 3011 | else: |
| 3012 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3013 | if status != None: |
| 3014 | self.status = status |
| 3015 | else: |
| 3016 | self.status = 0 |
| 3017 | if vport_no != None: |
| 3018 | self.vport_no = vport_no |
| 3019 | else: |
| 3020 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3021 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3022 | |
| 3023 | def pack(self): |
| 3024 | packed = [] |
| 3025 | packed.append(struct.pack("!B", self.version)) |
| 3026 | packed.append(struct.pack("!B", self.type)) |
| 3027 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3028 | packed.append(struct.pack("!L", self.xid)) |
| 3029 | packed.append(struct.pack("!L", self.experimenter)) |
| 3030 | packed.append(struct.pack("!L", self.subtype)) |
| 3031 | packed.append(struct.pack("!L", self.status)) |
| 3032 | packed.append(struct.pack("!L", self.vport_no)) |
| 3033 | length = sum([len(x) for x in packed]) |
| 3034 | packed[2] = struct.pack("!H", length) |
| 3035 | return ''.join(packed) |
| 3036 | |
| 3037 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3038 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3039 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3040 | _version = reader.read("!B")[0] |
| 3041 | assert(_version == 1) |
| 3042 | _type = reader.read("!B")[0] |
| 3043 | assert(_type == 4) |
| 3044 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3045 | orig_reader = reader |
| 3046 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3047 | obj.xid = reader.read("!L")[0] |
| 3048 | _experimenter = reader.read("!L")[0] |
| 3049 | assert(_experimenter == 6035143) |
| 3050 | _subtype = reader.read("!L")[0] |
| 3051 | assert(_subtype == 16) |
| 3052 | obj.status = reader.read("!L")[0] |
| 3053 | obj.vport_no = reader.read("!L")[0] |
| 3054 | return obj |
| 3055 | |
| 3056 | def __eq__(self, other): |
| 3057 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3058 | if self.xid != other.xid: return False |
| 3059 | if self.status != other.status: return False |
| 3060 | if self.vport_no != other.vport_no: return False |
| 3061 | return True |
| 3062 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3063 | def pretty_print(self, q): |
| 3064 | q.text("bsn_virtual_port_create_reply {") |
| 3065 | with q.group(): |
| 3066 | with q.indent(2): |
| 3067 | q.breakable() |
| 3068 | q.text("xid = "); |
| 3069 | if self.xid != None: |
| 3070 | q.text("%#x" % self.xid) |
| 3071 | else: |
| 3072 | q.text('None') |
| 3073 | q.text(","); q.breakable() |
| 3074 | q.text("status = "); |
| 3075 | q.text("%#x" % self.status) |
| 3076 | q.text(","); q.breakable() |
| 3077 | q.text("vport_no = "); |
| 3078 | q.text("%#x" % self.vport_no) |
| 3079 | q.breakable() |
| 3080 | q.text('}') |
| 3081 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3082 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3083 | |
| 3084 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3085 | version = 1 |
| 3086 | type = 4 |
| 3087 | experimenter = 6035143 |
| 3088 | subtype = 15 |
| 3089 | |
| 3090 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3091 | if xid != None: |
| 3092 | self.xid = xid |
| 3093 | else: |
| 3094 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3095 | if vport != None: |
| 3096 | self.vport = vport |
| 3097 | else: |
| 3098 | self.vport = common.bsn_vport_q_in_q() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3099 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3100 | |
| 3101 | def pack(self): |
| 3102 | packed = [] |
| 3103 | packed.append(struct.pack("!B", self.version)) |
| 3104 | packed.append(struct.pack("!B", self.type)) |
| 3105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3106 | packed.append(struct.pack("!L", self.xid)) |
| 3107 | packed.append(struct.pack("!L", self.experimenter)) |
| 3108 | packed.append(struct.pack("!L", self.subtype)) |
| 3109 | packed.append(self.vport.pack()) |
| 3110 | length = sum([len(x) for x in packed]) |
| 3111 | packed[2] = struct.pack("!H", length) |
| 3112 | return ''.join(packed) |
| 3113 | |
| 3114 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3115 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3116 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3117 | _version = reader.read("!B")[0] |
| 3118 | assert(_version == 1) |
| 3119 | _type = reader.read("!B")[0] |
| 3120 | assert(_type == 4) |
| 3121 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3122 | orig_reader = reader |
| 3123 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3124 | obj.xid = reader.read("!L")[0] |
| 3125 | _experimenter = reader.read("!L")[0] |
| 3126 | assert(_experimenter == 6035143) |
| 3127 | _subtype = reader.read("!L")[0] |
| 3128 | assert(_subtype == 15) |
| 3129 | obj.vport = common.bsn_vport_q_in_q.unpack(reader) |
| 3130 | return obj |
| 3131 | |
| 3132 | def __eq__(self, other): |
| 3133 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3134 | if self.xid != other.xid: return False |
| 3135 | if self.vport != other.vport: return False |
| 3136 | return True |
| 3137 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3138 | def pretty_print(self, q): |
| 3139 | q.text("bsn_virtual_port_create_request {") |
| 3140 | with q.group(): |
| 3141 | with q.indent(2): |
| 3142 | q.breakable() |
| 3143 | q.text("xid = "); |
| 3144 | if self.xid != None: |
| 3145 | q.text("%#x" % self.xid) |
| 3146 | else: |
| 3147 | q.text('None') |
| 3148 | q.text(","); q.breakable() |
| 3149 | q.text("vport = "); |
| 3150 | q.pp(self.vport) |
| 3151 | q.breakable() |
| 3152 | q.text('}') |
| 3153 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3154 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3155 | |
| 3156 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3157 | version = 1 |
| 3158 | type = 4 |
| 3159 | experimenter = 6035143 |
| 3160 | subtype = 26 |
| 3161 | |
| 3162 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3163 | if xid != None: |
| 3164 | self.xid = xid |
| 3165 | else: |
| 3166 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3167 | if status != None: |
| 3168 | self.status = status |
| 3169 | else: |
| 3170 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3171 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3172 | |
| 3173 | def pack(self): |
| 3174 | packed = [] |
| 3175 | packed.append(struct.pack("!B", self.version)) |
| 3176 | packed.append(struct.pack("!B", self.type)) |
| 3177 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3178 | packed.append(struct.pack("!L", self.xid)) |
| 3179 | packed.append(struct.pack("!L", self.experimenter)) |
| 3180 | packed.append(struct.pack("!L", self.subtype)) |
| 3181 | packed.append(struct.pack("!L", self.status)) |
| 3182 | length = sum([len(x) for x in packed]) |
| 3183 | packed[2] = struct.pack("!H", length) |
| 3184 | return ''.join(packed) |
| 3185 | |
| 3186 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3187 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3188 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3189 | _version = reader.read("!B")[0] |
| 3190 | assert(_version == 1) |
| 3191 | _type = reader.read("!B")[0] |
| 3192 | assert(_type == 4) |
| 3193 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3194 | orig_reader = reader |
| 3195 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3196 | obj.xid = reader.read("!L")[0] |
| 3197 | _experimenter = reader.read("!L")[0] |
| 3198 | assert(_experimenter == 6035143) |
| 3199 | _subtype = reader.read("!L")[0] |
| 3200 | assert(_subtype == 26) |
| 3201 | obj.status = reader.read("!L")[0] |
| 3202 | return obj |
| 3203 | |
| 3204 | def __eq__(self, other): |
| 3205 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3206 | if self.xid != other.xid: return False |
| 3207 | if self.status != other.status: return False |
| 3208 | return True |
| 3209 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3210 | def pretty_print(self, q): |
| 3211 | q.text("bsn_virtual_port_remove_reply {") |
| 3212 | with q.group(): |
| 3213 | with q.indent(2): |
| 3214 | q.breakable() |
| 3215 | q.text("xid = "); |
| 3216 | if self.xid != None: |
| 3217 | q.text("%#x" % self.xid) |
| 3218 | else: |
| 3219 | q.text('None') |
| 3220 | q.text(","); q.breakable() |
| 3221 | q.text("status = "); |
| 3222 | q.text("%#x" % self.status) |
| 3223 | q.breakable() |
| 3224 | q.text('}') |
| 3225 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3226 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3227 | |
| 3228 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3229 | version = 1 |
| 3230 | type = 4 |
| 3231 | experimenter = 6035143 |
| 3232 | subtype = 17 |
| 3233 | |
| 3234 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3235 | if xid != None: |
| 3236 | self.xid = xid |
| 3237 | else: |
| 3238 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3239 | if vport_no != None: |
| 3240 | self.vport_no = vport_no |
| 3241 | else: |
| 3242 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3243 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3244 | |
| 3245 | def pack(self): |
| 3246 | packed = [] |
| 3247 | packed.append(struct.pack("!B", self.version)) |
| 3248 | packed.append(struct.pack("!B", self.type)) |
| 3249 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3250 | packed.append(struct.pack("!L", self.xid)) |
| 3251 | packed.append(struct.pack("!L", self.experimenter)) |
| 3252 | packed.append(struct.pack("!L", self.subtype)) |
| 3253 | packed.append(struct.pack("!L", self.vport_no)) |
| 3254 | length = sum([len(x) for x in packed]) |
| 3255 | packed[2] = struct.pack("!H", length) |
| 3256 | return ''.join(packed) |
| 3257 | |
| 3258 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3259 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3260 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3261 | _version = reader.read("!B")[0] |
| 3262 | assert(_version == 1) |
| 3263 | _type = reader.read("!B")[0] |
| 3264 | assert(_type == 4) |
| 3265 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3266 | orig_reader = reader |
| 3267 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3268 | obj.xid = reader.read("!L")[0] |
| 3269 | _experimenter = reader.read("!L")[0] |
| 3270 | assert(_experimenter == 6035143) |
| 3271 | _subtype = reader.read("!L")[0] |
| 3272 | assert(_subtype == 17) |
| 3273 | obj.vport_no = reader.read("!L")[0] |
| 3274 | return obj |
| 3275 | |
| 3276 | def __eq__(self, other): |
| 3277 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3278 | if self.xid != other.xid: return False |
| 3279 | if self.vport_no != other.vport_no: return False |
| 3280 | return True |
| 3281 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3282 | def pretty_print(self, q): |
| 3283 | q.text("bsn_virtual_port_remove_request {") |
| 3284 | with q.group(): |
| 3285 | with q.indent(2): |
| 3286 | q.breakable() |
| 3287 | q.text("xid = "); |
| 3288 | if self.xid != None: |
| 3289 | q.text("%#x" % self.xid) |
| 3290 | else: |
| 3291 | q.text('None') |
| 3292 | q.text(","); q.breakable() |
| 3293 | q.text("vport_no = "); |
| 3294 | q.text("%#x" % self.vport_no) |
| 3295 | q.breakable() |
| 3296 | q.text('}') |
| 3297 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3298 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3299 | |
| 3300 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3301 | version = 1 |
| 3302 | type = 17 |
| 3303 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3304 | |
| 3305 | 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] | 3306 | if xid != None: |
| 3307 | self.xid = xid |
| 3308 | else: |
| 3309 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3310 | if flags != None: |
| 3311 | self.flags = flags |
| 3312 | else: |
| 3313 | self.flags = 0 |
| 3314 | if mfr_desc != None: |
| 3315 | self.mfr_desc = mfr_desc |
| 3316 | else: |
| 3317 | self.mfr_desc = "" |
| 3318 | if hw_desc != None: |
| 3319 | self.hw_desc = hw_desc |
| 3320 | else: |
| 3321 | self.hw_desc = "" |
| 3322 | if sw_desc != None: |
| 3323 | self.sw_desc = sw_desc |
| 3324 | else: |
| 3325 | self.sw_desc = "" |
| 3326 | if serial_num != None: |
| 3327 | self.serial_num = serial_num |
| 3328 | else: |
| 3329 | self.serial_num = "" |
| 3330 | if dp_desc != None: |
| 3331 | self.dp_desc = dp_desc |
| 3332 | else: |
| 3333 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3334 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3335 | |
| 3336 | def pack(self): |
| 3337 | packed = [] |
| 3338 | packed.append(struct.pack("!B", self.version)) |
| 3339 | packed.append(struct.pack("!B", self.type)) |
| 3340 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3341 | packed.append(struct.pack("!L", self.xid)) |
| 3342 | packed.append(struct.pack("!H", self.stats_type)) |
| 3343 | packed.append(struct.pack("!H", self.flags)) |
| 3344 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 3345 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 3346 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 3347 | packed.append(struct.pack("!32s", self.serial_num)) |
| 3348 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 3349 | length = sum([len(x) for x in packed]) |
| 3350 | packed[2] = struct.pack("!H", length) |
| 3351 | return ''.join(packed) |
| 3352 | |
| 3353 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3354 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3355 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3356 | _version = reader.read("!B")[0] |
| 3357 | assert(_version == 1) |
| 3358 | _type = reader.read("!B")[0] |
| 3359 | assert(_type == 17) |
| 3360 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3361 | orig_reader = reader |
| 3362 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3363 | obj.xid = reader.read("!L")[0] |
| 3364 | _stats_type = reader.read("!H")[0] |
| 3365 | assert(_stats_type == 0) |
| 3366 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3367 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3368 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3369 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3370 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 3371 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3372 | return obj |
| 3373 | |
| 3374 | def __eq__(self, other): |
| 3375 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3376 | if self.xid != other.xid: return False |
| 3377 | if self.flags != other.flags: return False |
| 3378 | if self.mfr_desc != other.mfr_desc: return False |
| 3379 | if self.hw_desc != other.hw_desc: return False |
| 3380 | if self.sw_desc != other.sw_desc: return False |
| 3381 | if self.serial_num != other.serial_num: return False |
| 3382 | if self.dp_desc != other.dp_desc: return False |
| 3383 | return True |
| 3384 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3385 | def pretty_print(self, q): |
| 3386 | q.text("desc_stats_reply {") |
| 3387 | with q.group(): |
| 3388 | with q.indent(2): |
| 3389 | q.breakable() |
| 3390 | q.text("xid = "); |
| 3391 | if self.xid != None: |
| 3392 | q.text("%#x" % self.xid) |
| 3393 | else: |
| 3394 | q.text('None') |
| 3395 | q.text(","); q.breakable() |
| 3396 | q.text("flags = "); |
| 3397 | q.text("%#x" % self.flags) |
| 3398 | q.text(","); q.breakable() |
| 3399 | q.text("mfr_desc = "); |
| 3400 | q.pp(self.mfr_desc) |
| 3401 | q.text(","); q.breakable() |
| 3402 | q.text("hw_desc = "); |
| 3403 | q.pp(self.hw_desc) |
| 3404 | q.text(","); q.breakable() |
| 3405 | q.text("sw_desc = "); |
| 3406 | q.pp(self.sw_desc) |
| 3407 | q.text(","); q.breakable() |
| 3408 | q.text("serial_num = "); |
| 3409 | q.pp(self.serial_num) |
| 3410 | q.text(","); q.breakable() |
| 3411 | q.text("dp_desc = "); |
| 3412 | q.pp(self.dp_desc) |
| 3413 | q.breakable() |
| 3414 | q.text('}') |
| 3415 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3416 | stats_reply.subtypes[0] = desc_stats_reply |
| 3417 | |
| 3418 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3419 | version = 1 |
| 3420 | type = 16 |
| 3421 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3422 | |
| 3423 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3424 | if xid != None: |
| 3425 | self.xid = xid |
| 3426 | else: |
| 3427 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3428 | if flags != None: |
| 3429 | self.flags = flags |
| 3430 | else: |
| 3431 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3432 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3433 | |
| 3434 | def pack(self): |
| 3435 | packed = [] |
| 3436 | packed.append(struct.pack("!B", self.version)) |
| 3437 | packed.append(struct.pack("!B", self.type)) |
| 3438 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3439 | packed.append(struct.pack("!L", self.xid)) |
| 3440 | packed.append(struct.pack("!H", self.stats_type)) |
| 3441 | packed.append(struct.pack("!H", self.flags)) |
| 3442 | length = sum([len(x) for x in packed]) |
| 3443 | packed[2] = struct.pack("!H", length) |
| 3444 | return ''.join(packed) |
| 3445 | |
| 3446 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3447 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3448 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3449 | _version = reader.read("!B")[0] |
| 3450 | assert(_version == 1) |
| 3451 | _type = reader.read("!B")[0] |
| 3452 | assert(_type == 16) |
| 3453 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3454 | orig_reader = reader |
| 3455 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3456 | obj.xid = reader.read("!L")[0] |
| 3457 | _stats_type = reader.read("!H")[0] |
| 3458 | assert(_stats_type == 0) |
| 3459 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3460 | return obj |
| 3461 | |
| 3462 | def __eq__(self, other): |
| 3463 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3464 | if self.xid != other.xid: return False |
| 3465 | if self.flags != other.flags: return False |
| 3466 | return True |
| 3467 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3468 | def pretty_print(self, q): |
| 3469 | q.text("desc_stats_request {") |
| 3470 | with q.group(): |
| 3471 | with q.indent(2): |
| 3472 | q.breakable() |
| 3473 | q.text("xid = "); |
| 3474 | if self.xid != None: |
| 3475 | q.text("%#x" % self.xid) |
| 3476 | else: |
| 3477 | q.text('None') |
| 3478 | q.text(","); q.breakable() |
| 3479 | q.text("flags = "); |
| 3480 | q.text("%#x" % self.flags) |
| 3481 | q.breakable() |
| 3482 | q.text('}') |
| 3483 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3484 | stats_request.subtypes[0] = desc_stats_request |
| 3485 | |
| 3486 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3487 | version = 1 |
| 3488 | type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3489 | |
| 3490 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3491 | if xid != None: |
| 3492 | self.xid = xid |
| 3493 | else: |
| 3494 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3495 | if data != None: |
| 3496 | self.data = data |
| 3497 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3498 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3499 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3500 | |
| 3501 | def pack(self): |
| 3502 | packed = [] |
| 3503 | packed.append(struct.pack("!B", self.version)) |
| 3504 | packed.append(struct.pack("!B", self.type)) |
| 3505 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3506 | packed.append(struct.pack("!L", self.xid)) |
| 3507 | packed.append(self.data) |
| 3508 | length = sum([len(x) for x in packed]) |
| 3509 | packed[2] = struct.pack("!H", length) |
| 3510 | return ''.join(packed) |
| 3511 | |
| 3512 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3513 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3514 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3515 | _version = reader.read("!B")[0] |
| 3516 | assert(_version == 1) |
| 3517 | _type = reader.read("!B")[0] |
| 3518 | assert(_type == 3) |
| 3519 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3520 | orig_reader = reader |
| 3521 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3522 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3523 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3524 | return obj |
| 3525 | |
| 3526 | def __eq__(self, other): |
| 3527 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3528 | if self.xid != other.xid: return False |
| 3529 | if self.data != other.data: return False |
| 3530 | return True |
| 3531 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3532 | def pretty_print(self, q): |
| 3533 | q.text("echo_reply {") |
| 3534 | with q.group(): |
| 3535 | with q.indent(2): |
| 3536 | q.breakable() |
| 3537 | q.text("xid = "); |
| 3538 | if self.xid != None: |
| 3539 | q.text("%#x" % self.xid) |
| 3540 | else: |
| 3541 | q.text('None') |
| 3542 | q.text(","); q.breakable() |
| 3543 | q.text("data = "); |
| 3544 | q.pp(self.data) |
| 3545 | q.breakable() |
| 3546 | q.text('}') |
| 3547 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3548 | message.subtypes[3] = echo_reply |
| 3549 | |
| 3550 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3551 | version = 1 |
| 3552 | type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3553 | |
| 3554 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3555 | if xid != None: |
| 3556 | self.xid = xid |
| 3557 | else: |
| 3558 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3559 | if data != None: |
| 3560 | self.data = data |
| 3561 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3562 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3563 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3564 | |
| 3565 | def pack(self): |
| 3566 | packed = [] |
| 3567 | packed.append(struct.pack("!B", self.version)) |
| 3568 | packed.append(struct.pack("!B", self.type)) |
| 3569 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3570 | packed.append(struct.pack("!L", self.xid)) |
| 3571 | packed.append(self.data) |
| 3572 | length = sum([len(x) for x in packed]) |
| 3573 | packed[2] = struct.pack("!H", length) |
| 3574 | return ''.join(packed) |
| 3575 | |
| 3576 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3577 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3578 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3579 | _version = reader.read("!B")[0] |
| 3580 | assert(_version == 1) |
| 3581 | _type = reader.read("!B")[0] |
| 3582 | assert(_type == 2) |
| 3583 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3584 | orig_reader = reader |
| 3585 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3586 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3587 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3588 | return obj |
| 3589 | |
| 3590 | def __eq__(self, other): |
| 3591 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3592 | if self.xid != other.xid: return False |
| 3593 | if self.data != other.data: return False |
| 3594 | return True |
| 3595 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3596 | def pretty_print(self, q): |
| 3597 | q.text("echo_request {") |
| 3598 | with q.group(): |
| 3599 | with q.indent(2): |
| 3600 | q.breakable() |
| 3601 | q.text("xid = "); |
| 3602 | if self.xid != None: |
| 3603 | q.text("%#x" % self.xid) |
| 3604 | else: |
| 3605 | q.text('None') |
| 3606 | q.text(","); q.breakable() |
| 3607 | q.text("data = "); |
| 3608 | q.pp(self.data) |
| 3609 | q.breakable() |
| 3610 | q.text('}') |
| 3611 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3612 | message.subtypes[2] = echo_request |
| 3613 | |
| 3614 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3615 | version = 1 |
| 3616 | type = 6 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3617 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3618 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3619 | if xid != None: |
| 3620 | self.xid = xid |
| 3621 | else: |
| 3622 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3623 | if datapath_id != None: |
| 3624 | self.datapath_id = datapath_id |
| 3625 | else: |
| 3626 | self.datapath_id = 0 |
| 3627 | if n_buffers != None: |
| 3628 | self.n_buffers = n_buffers |
| 3629 | else: |
| 3630 | self.n_buffers = 0 |
| 3631 | if n_tables != None: |
| 3632 | self.n_tables = n_tables |
| 3633 | else: |
| 3634 | self.n_tables = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3635 | if capabilities != None: |
| 3636 | self.capabilities = capabilities |
| 3637 | else: |
| 3638 | self.capabilities = 0 |
| 3639 | if actions != None: |
| 3640 | self.actions = actions |
| 3641 | else: |
| 3642 | self.actions = 0 |
| 3643 | if ports != None: |
| 3644 | self.ports = ports |
| 3645 | else: |
| 3646 | self.ports = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3647 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3648 | |
| 3649 | def pack(self): |
| 3650 | packed = [] |
| 3651 | packed.append(struct.pack("!B", self.version)) |
| 3652 | packed.append(struct.pack("!B", self.type)) |
| 3653 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3654 | packed.append(struct.pack("!L", self.xid)) |
| 3655 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 3656 | packed.append(struct.pack("!L", self.n_buffers)) |
| 3657 | packed.append(struct.pack("!B", self.n_tables)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3658 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3659 | packed.append(struct.pack("!L", self.capabilities)) |
| 3660 | packed.append(struct.pack("!L", self.actions)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3661 | packed.append(loxi.generic_util.pack_list(self.ports)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3662 | length = sum([len(x) for x in packed]) |
| 3663 | packed[2] = struct.pack("!H", length) |
| 3664 | return ''.join(packed) |
| 3665 | |
| 3666 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3667 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3668 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3669 | _version = reader.read("!B")[0] |
| 3670 | assert(_version == 1) |
| 3671 | _type = reader.read("!B")[0] |
| 3672 | assert(_type == 6) |
| 3673 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3674 | orig_reader = reader |
| 3675 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3676 | obj.xid = reader.read("!L")[0] |
| 3677 | obj.datapath_id = reader.read("!Q")[0] |
| 3678 | obj.n_buffers = reader.read("!L")[0] |
| 3679 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3680 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3681 | obj.capabilities = reader.read("!L")[0] |
| 3682 | obj.actions = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3683 | obj.ports = loxi.generic_util.unpack_list(reader, common.port_desc.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3684 | return obj |
| 3685 | |
| 3686 | def __eq__(self, other): |
| 3687 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3688 | if self.xid != other.xid: return False |
| 3689 | if self.datapath_id != other.datapath_id: return False |
| 3690 | if self.n_buffers != other.n_buffers: return False |
| 3691 | if self.n_tables != other.n_tables: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3692 | if self.capabilities != other.capabilities: return False |
| 3693 | if self.actions != other.actions: return False |
| 3694 | if self.ports != other.ports: return False |
| 3695 | return True |
| 3696 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3697 | def pretty_print(self, q): |
| 3698 | q.text("features_reply {") |
| 3699 | with q.group(): |
| 3700 | with q.indent(2): |
| 3701 | q.breakable() |
| 3702 | q.text("xid = "); |
| 3703 | if self.xid != None: |
| 3704 | q.text("%#x" % self.xid) |
| 3705 | else: |
| 3706 | q.text('None') |
| 3707 | q.text(","); q.breakable() |
| 3708 | q.text("datapath_id = "); |
| 3709 | q.text("%#x" % self.datapath_id) |
| 3710 | q.text(","); q.breakable() |
| 3711 | q.text("n_buffers = "); |
| 3712 | q.text("%#x" % self.n_buffers) |
| 3713 | q.text(","); q.breakable() |
| 3714 | q.text("n_tables = "); |
| 3715 | q.text("%#x" % self.n_tables) |
| 3716 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3717 | q.text("capabilities = "); |
| 3718 | q.text("%#x" % self.capabilities) |
| 3719 | q.text(","); q.breakable() |
| 3720 | q.text("actions = "); |
| 3721 | q.text("%#x" % self.actions) |
| 3722 | q.text(","); q.breakable() |
| 3723 | q.text("ports = "); |
| 3724 | q.pp(self.ports) |
| 3725 | q.breakable() |
| 3726 | q.text('}') |
| 3727 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3728 | message.subtypes[6] = features_reply |
| 3729 | |
| 3730 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3731 | version = 1 |
| 3732 | type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3733 | |
| 3734 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3735 | if xid != None: |
| 3736 | self.xid = xid |
| 3737 | else: |
| 3738 | self.xid = None |
| 3739 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3740 | |
| 3741 | def pack(self): |
| 3742 | packed = [] |
| 3743 | packed.append(struct.pack("!B", self.version)) |
| 3744 | packed.append(struct.pack("!B", self.type)) |
| 3745 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3746 | packed.append(struct.pack("!L", self.xid)) |
| 3747 | length = sum([len(x) for x in packed]) |
| 3748 | packed[2] = struct.pack("!H", length) |
| 3749 | return ''.join(packed) |
| 3750 | |
| 3751 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3752 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3753 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3754 | _version = reader.read("!B")[0] |
| 3755 | assert(_version == 1) |
| 3756 | _type = reader.read("!B")[0] |
| 3757 | assert(_type == 5) |
| 3758 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3759 | orig_reader = reader |
| 3760 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3761 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3762 | return obj |
| 3763 | |
| 3764 | def __eq__(self, other): |
| 3765 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3766 | if self.xid != other.xid: return False |
| 3767 | return True |
| 3768 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3769 | def pretty_print(self, q): |
| 3770 | q.text("features_request {") |
| 3771 | with q.group(): |
| 3772 | with q.indent(2): |
| 3773 | q.breakable() |
| 3774 | q.text("xid = "); |
| 3775 | if self.xid != None: |
| 3776 | q.text("%#x" % self.xid) |
| 3777 | else: |
| 3778 | q.text('None') |
| 3779 | q.breakable() |
| 3780 | q.text('}') |
| 3781 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3782 | message.subtypes[5] = features_request |
| 3783 | |
| 3784 | class flow_mod(message): |
| 3785 | subtypes = {} |
| 3786 | |
| 3787 | @staticmethod |
| 3788 | def unpack(reader): |
| 3789 | subtype, = reader.peek('!H', 56) |
| 3790 | try: |
| 3791 | subclass = flow_mod.subtypes[subtype] |
| 3792 | except KeyError: |
| 3793 | raise loxi.ProtocolError("unknown flow_mod message subtype %#x" % subtype) |
| 3794 | return subclass.unpack(reader) |
| 3795 | |
| 3796 | message.subtypes[14] = flow_mod |
| 3797 | |
| 3798 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3799 | version = 1 |
| 3800 | type = 14 |
| 3801 | _command = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3802 | |
| 3803 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3804 | if xid != None: |
| 3805 | self.xid = xid |
| 3806 | else: |
| 3807 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3808 | if match != None: |
| 3809 | self.match = match |
| 3810 | else: |
| 3811 | self.match = common.match() |
| 3812 | if cookie != None: |
| 3813 | self.cookie = cookie |
| 3814 | else: |
| 3815 | self.cookie = 0 |
| 3816 | if idle_timeout != None: |
| 3817 | self.idle_timeout = idle_timeout |
| 3818 | else: |
| 3819 | self.idle_timeout = 0 |
| 3820 | if hard_timeout != None: |
| 3821 | self.hard_timeout = hard_timeout |
| 3822 | else: |
| 3823 | self.hard_timeout = 0 |
| 3824 | if priority != None: |
| 3825 | self.priority = priority |
| 3826 | else: |
| 3827 | self.priority = 0 |
| 3828 | if buffer_id != None: |
| 3829 | self.buffer_id = buffer_id |
| 3830 | else: |
| 3831 | self.buffer_id = 0 |
| 3832 | if out_port != None: |
| 3833 | self.out_port = out_port |
| 3834 | else: |
| 3835 | self.out_port = 0 |
| 3836 | if flags != None: |
| 3837 | self.flags = flags |
| 3838 | else: |
| 3839 | self.flags = 0 |
| 3840 | if actions != None: |
| 3841 | self.actions = actions |
| 3842 | else: |
| 3843 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3844 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3845 | |
| 3846 | def pack(self): |
| 3847 | packed = [] |
| 3848 | packed.append(struct.pack("!B", self.version)) |
| 3849 | packed.append(struct.pack("!B", self.type)) |
| 3850 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3851 | packed.append(struct.pack("!L", self.xid)) |
| 3852 | packed.append(self.match.pack()) |
| 3853 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3854 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3855 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3856 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3857 | packed.append(struct.pack("!H", self.priority)) |
| 3858 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3859 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3860 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3861 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3862 | length = sum([len(x) for x in packed]) |
| 3863 | packed[2] = struct.pack("!H", length) |
| 3864 | return ''.join(packed) |
| 3865 | |
| 3866 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3867 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3868 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3869 | _version = reader.read("!B")[0] |
| 3870 | assert(_version == 1) |
| 3871 | _type = reader.read("!B")[0] |
| 3872 | assert(_type == 14) |
| 3873 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3874 | orig_reader = reader |
| 3875 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3876 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3877 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3878 | obj.cookie = reader.read("!Q")[0] |
| 3879 | __command = util.unpack_fm_cmd(reader) |
| 3880 | assert(__command == 0) |
| 3881 | obj.idle_timeout = reader.read("!H")[0] |
| 3882 | obj.hard_timeout = reader.read("!H")[0] |
| 3883 | obj.priority = reader.read("!H")[0] |
| 3884 | obj.buffer_id = reader.read("!L")[0] |
| 3885 | obj.out_port = util.unpack_port_no(reader) |
| 3886 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3887 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3888 | return obj |
| 3889 | |
| 3890 | def __eq__(self, other): |
| 3891 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3892 | if self.xid != other.xid: return False |
| 3893 | if self.match != other.match: return False |
| 3894 | if self.cookie != other.cookie: return False |
| 3895 | if self.idle_timeout != other.idle_timeout: return False |
| 3896 | if self.hard_timeout != other.hard_timeout: return False |
| 3897 | if self.priority != other.priority: return False |
| 3898 | if self.buffer_id != other.buffer_id: return False |
| 3899 | if self.out_port != other.out_port: return False |
| 3900 | if self.flags != other.flags: return False |
| 3901 | if self.actions != other.actions: return False |
| 3902 | return True |
| 3903 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3904 | def pretty_print(self, q): |
| 3905 | q.text("flow_add {") |
| 3906 | with q.group(): |
| 3907 | with q.indent(2): |
| 3908 | q.breakable() |
| 3909 | q.text("xid = "); |
| 3910 | if self.xid != None: |
| 3911 | q.text("%#x" % self.xid) |
| 3912 | else: |
| 3913 | q.text('None') |
| 3914 | q.text(","); q.breakable() |
| 3915 | q.text("match = "); |
| 3916 | q.pp(self.match) |
| 3917 | q.text(","); q.breakable() |
| 3918 | q.text("cookie = "); |
| 3919 | q.text("%#x" % self.cookie) |
| 3920 | q.text(","); q.breakable() |
| 3921 | q.text("idle_timeout = "); |
| 3922 | q.text("%#x" % self.idle_timeout) |
| 3923 | q.text(","); q.breakable() |
| 3924 | q.text("hard_timeout = "); |
| 3925 | q.text("%#x" % self.hard_timeout) |
| 3926 | q.text(","); q.breakable() |
| 3927 | q.text("priority = "); |
| 3928 | q.text("%#x" % self.priority) |
| 3929 | q.text(","); q.breakable() |
| 3930 | q.text("buffer_id = "); |
| 3931 | q.text("%#x" % self.buffer_id) |
| 3932 | q.text(","); q.breakable() |
| 3933 | q.text("out_port = "); |
| 3934 | q.text(util.pretty_port(self.out_port)) |
| 3935 | q.text(","); q.breakable() |
| 3936 | q.text("flags = "); |
| 3937 | q.text("%#x" % self.flags) |
| 3938 | q.text(","); q.breakable() |
| 3939 | q.text("actions = "); |
| 3940 | q.pp(self.actions) |
| 3941 | q.breakable() |
| 3942 | q.text('}') |
| 3943 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3944 | flow_mod.subtypes[0] = flow_add |
| 3945 | |
| 3946 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3947 | version = 1 |
| 3948 | type = 14 |
| 3949 | _command = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3950 | |
| 3951 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3952 | if xid != None: |
| 3953 | self.xid = xid |
| 3954 | else: |
| 3955 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3956 | if match != None: |
| 3957 | self.match = match |
| 3958 | else: |
| 3959 | self.match = common.match() |
| 3960 | if cookie != None: |
| 3961 | self.cookie = cookie |
| 3962 | else: |
| 3963 | self.cookie = 0 |
| 3964 | if idle_timeout != None: |
| 3965 | self.idle_timeout = idle_timeout |
| 3966 | else: |
| 3967 | self.idle_timeout = 0 |
| 3968 | if hard_timeout != None: |
| 3969 | self.hard_timeout = hard_timeout |
| 3970 | else: |
| 3971 | self.hard_timeout = 0 |
| 3972 | if priority != None: |
| 3973 | self.priority = priority |
| 3974 | else: |
| 3975 | self.priority = 0 |
| 3976 | if buffer_id != None: |
| 3977 | self.buffer_id = buffer_id |
| 3978 | else: |
| 3979 | self.buffer_id = 0 |
| 3980 | if out_port != None: |
| 3981 | self.out_port = out_port |
| 3982 | else: |
| 3983 | self.out_port = 0 |
| 3984 | if flags != None: |
| 3985 | self.flags = flags |
| 3986 | else: |
| 3987 | self.flags = 0 |
| 3988 | if actions != None: |
| 3989 | self.actions = actions |
| 3990 | else: |
| 3991 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3992 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3993 | |
| 3994 | def pack(self): |
| 3995 | packed = [] |
| 3996 | packed.append(struct.pack("!B", self.version)) |
| 3997 | packed.append(struct.pack("!B", self.type)) |
| 3998 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3999 | packed.append(struct.pack("!L", self.xid)) |
| 4000 | packed.append(self.match.pack()) |
| 4001 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4002 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4003 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4004 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4005 | packed.append(struct.pack("!H", self.priority)) |
| 4006 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4007 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4008 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4009 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4010 | length = sum([len(x) for x in packed]) |
| 4011 | packed[2] = struct.pack("!H", length) |
| 4012 | return ''.join(packed) |
| 4013 | |
| 4014 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4015 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4016 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4017 | _version = reader.read("!B")[0] |
| 4018 | assert(_version == 1) |
| 4019 | _type = reader.read("!B")[0] |
| 4020 | assert(_type == 14) |
| 4021 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4022 | orig_reader = reader |
| 4023 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4024 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4025 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4026 | obj.cookie = reader.read("!Q")[0] |
| 4027 | __command = util.unpack_fm_cmd(reader) |
| 4028 | assert(__command == 3) |
| 4029 | obj.idle_timeout = reader.read("!H")[0] |
| 4030 | obj.hard_timeout = reader.read("!H")[0] |
| 4031 | obj.priority = reader.read("!H")[0] |
| 4032 | obj.buffer_id = reader.read("!L")[0] |
| 4033 | obj.out_port = util.unpack_port_no(reader) |
| 4034 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4035 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4036 | return obj |
| 4037 | |
| 4038 | def __eq__(self, other): |
| 4039 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4040 | if self.xid != other.xid: return False |
| 4041 | if self.match != other.match: return False |
| 4042 | if self.cookie != other.cookie: return False |
| 4043 | if self.idle_timeout != other.idle_timeout: return False |
| 4044 | if self.hard_timeout != other.hard_timeout: return False |
| 4045 | if self.priority != other.priority: return False |
| 4046 | if self.buffer_id != other.buffer_id: return False |
| 4047 | if self.out_port != other.out_port: return False |
| 4048 | if self.flags != other.flags: return False |
| 4049 | if self.actions != other.actions: return False |
| 4050 | return True |
| 4051 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4052 | def pretty_print(self, q): |
| 4053 | q.text("flow_delete {") |
| 4054 | with q.group(): |
| 4055 | with q.indent(2): |
| 4056 | q.breakable() |
| 4057 | q.text("xid = "); |
| 4058 | if self.xid != None: |
| 4059 | q.text("%#x" % self.xid) |
| 4060 | else: |
| 4061 | q.text('None') |
| 4062 | q.text(","); q.breakable() |
| 4063 | q.text("match = "); |
| 4064 | q.pp(self.match) |
| 4065 | q.text(","); q.breakable() |
| 4066 | q.text("cookie = "); |
| 4067 | q.text("%#x" % self.cookie) |
| 4068 | q.text(","); q.breakable() |
| 4069 | q.text("idle_timeout = "); |
| 4070 | q.text("%#x" % self.idle_timeout) |
| 4071 | q.text(","); q.breakable() |
| 4072 | q.text("hard_timeout = "); |
| 4073 | q.text("%#x" % self.hard_timeout) |
| 4074 | q.text(","); q.breakable() |
| 4075 | q.text("priority = "); |
| 4076 | q.text("%#x" % self.priority) |
| 4077 | q.text(","); q.breakable() |
| 4078 | q.text("buffer_id = "); |
| 4079 | q.text("%#x" % self.buffer_id) |
| 4080 | q.text(","); q.breakable() |
| 4081 | q.text("out_port = "); |
| 4082 | q.text(util.pretty_port(self.out_port)) |
| 4083 | q.text(","); q.breakable() |
| 4084 | q.text("flags = "); |
| 4085 | q.text("%#x" % self.flags) |
| 4086 | q.text(","); q.breakable() |
| 4087 | q.text("actions = "); |
| 4088 | q.pp(self.actions) |
| 4089 | q.breakable() |
| 4090 | q.text('}') |
| 4091 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4092 | flow_mod.subtypes[3] = flow_delete |
| 4093 | |
| 4094 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4095 | version = 1 |
| 4096 | type = 14 |
| 4097 | _command = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4098 | |
| 4099 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4100 | if xid != None: |
| 4101 | self.xid = xid |
| 4102 | else: |
| 4103 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4104 | if match != None: |
| 4105 | self.match = match |
| 4106 | else: |
| 4107 | self.match = common.match() |
| 4108 | if cookie != None: |
| 4109 | self.cookie = cookie |
| 4110 | else: |
| 4111 | self.cookie = 0 |
| 4112 | if idle_timeout != None: |
| 4113 | self.idle_timeout = idle_timeout |
| 4114 | else: |
| 4115 | self.idle_timeout = 0 |
| 4116 | if hard_timeout != None: |
| 4117 | self.hard_timeout = hard_timeout |
| 4118 | else: |
| 4119 | self.hard_timeout = 0 |
| 4120 | if priority != None: |
| 4121 | self.priority = priority |
| 4122 | else: |
| 4123 | self.priority = 0 |
| 4124 | if buffer_id != None: |
| 4125 | self.buffer_id = buffer_id |
| 4126 | else: |
| 4127 | self.buffer_id = 0 |
| 4128 | if out_port != None: |
| 4129 | self.out_port = out_port |
| 4130 | else: |
| 4131 | self.out_port = 0 |
| 4132 | if flags != None: |
| 4133 | self.flags = flags |
| 4134 | else: |
| 4135 | self.flags = 0 |
| 4136 | if actions != None: |
| 4137 | self.actions = actions |
| 4138 | else: |
| 4139 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4140 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4141 | |
| 4142 | def pack(self): |
| 4143 | packed = [] |
| 4144 | packed.append(struct.pack("!B", self.version)) |
| 4145 | packed.append(struct.pack("!B", self.type)) |
| 4146 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4147 | packed.append(struct.pack("!L", self.xid)) |
| 4148 | packed.append(self.match.pack()) |
| 4149 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4150 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4151 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4152 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4153 | packed.append(struct.pack("!H", self.priority)) |
| 4154 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4155 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4156 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4157 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4158 | length = sum([len(x) for x in packed]) |
| 4159 | packed[2] = struct.pack("!H", length) |
| 4160 | return ''.join(packed) |
| 4161 | |
| 4162 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4163 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4164 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4165 | _version = reader.read("!B")[0] |
| 4166 | assert(_version == 1) |
| 4167 | _type = reader.read("!B")[0] |
| 4168 | assert(_type == 14) |
| 4169 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4170 | orig_reader = reader |
| 4171 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4172 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4173 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4174 | obj.cookie = reader.read("!Q")[0] |
| 4175 | __command = util.unpack_fm_cmd(reader) |
| 4176 | assert(__command == 4) |
| 4177 | obj.idle_timeout = reader.read("!H")[0] |
| 4178 | obj.hard_timeout = reader.read("!H")[0] |
| 4179 | obj.priority = reader.read("!H")[0] |
| 4180 | obj.buffer_id = reader.read("!L")[0] |
| 4181 | obj.out_port = util.unpack_port_no(reader) |
| 4182 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4183 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4184 | return obj |
| 4185 | |
| 4186 | def __eq__(self, other): |
| 4187 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4188 | if self.xid != other.xid: return False |
| 4189 | if self.match != other.match: return False |
| 4190 | if self.cookie != other.cookie: return False |
| 4191 | if self.idle_timeout != other.idle_timeout: return False |
| 4192 | if self.hard_timeout != other.hard_timeout: return False |
| 4193 | if self.priority != other.priority: return False |
| 4194 | if self.buffer_id != other.buffer_id: return False |
| 4195 | if self.out_port != other.out_port: return False |
| 4196 | if self.flags != other.flags: return False |
| 4197 | if self.actions != other.actions: return False |
| 4198 | return True |
| 4199 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4200 | def pretty_print(self, q): |
| 4201 | q.text("flow_delete_strict {") |
| 4202 | with q.group(): |
| 4203 | with q.indent(2): |
| 4204 | q.breakable() |
| 4205 | q.text("xid = "); |
| 4206 | if self.xid != None: |
| 4207 | q.text("%#x" % self.xid) |
| 4208 | else: |
| 4209 | q.text('None') |
| 4210 | q.text(","); q.breakable() |
| 4211 | q.text("match = "); |
| 4212 | q.pp(self.match) |
| 4213 | q.text(","); q.breakable() |
| 4214 | q.text("cookie = "); |
| 4215 | q.text("%#x" % self.cookie) |
| 4216 | q.text(","); q.breakable() |
| 4217 | q.text("idle_timeout = "); |
| 4218 | q.text("%#x" % self.idle_timeout) |
| 4219 | q.text(","); q.breakable() |
| 4220 | q.text("hard_timeout = "); |
| 4221 | q.text("%#x" % self.hard_timeout) |
| 4222 | q.text(","); q.breakable() |
| 4223 | q.text("priority = "); |
| 4224 | q.text("%#x" % self.priority) |
| 4225 | q.text(","); q.breakable() |
| 4226 | q.text("buffer_id = "); |
| 4227 | q.text("%#x" % self.buffer_id) |
| 4228 | q.text(","); q.breakable() |
| 4229 | q.text("out_port = "); |
| 4230 | q.text(util.pretty_port(self.out_port)) |
| 4231 | q.text(","); q.breakable() |
| 4232 | q.text("flags = "); |
| 4233 | q.text("%#x" % self.flags) |
| 4234 | q.text(","); q.breakable() |
| 4235 | q.text("actions = "); |
| 4236 | q.pp(self.actions) |
| 4237 | q.breakable() |
| 4238 | q.text('}') |
| 4239 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4240 | flow_mod.subtypes[4] = flow_delete_strict |
| 4241 | |
| 4242 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4243 | version = 1 |
| 4244 | type = 1 |
| 4245 | err_type = 3 |
| 4246 | |
| 4247 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4248 | if xid != None: |
| 4249 | self.xid = xid |
| 4250 | else: |
| 4251 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4252 | if code != None: |
| 4253 | self.code = code |
| 4254 | else: |
| 4255 | self.code = 0 |
| 4256 | if data != None: |
| 4257 | self.data = data |
| 4258 | else: |
| 4259 | self.data = '' |
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("!H", self.err_type)) |
| 4269 | packed.append(struct.pack("!H", self.code)) |
| 4270 | packed.append(self.data) |
| 4271 | length = sum([len(x) for x in packed]) |
| 4272 | packed[2] = struct.pack("!H", length) |
| 4273 | return ''.join(packed) |
| 4274 | |
| 4275 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4276 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4277 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4278 | _version = reader.read("!B")[0] |
| 4279 | assert(_version == 1) |
| 4280 | _type = reader.read("!B")[0] |
| 4281 | assert(_type == 1) |
| 4282 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4283 | orig_reader = reader |
| 4284 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4285 | obj.xid = reader.read("!L")[0] |
| 4286 | _err_type = reader.read("!H")[0] |
| 4287 | assert(_err_type == 3) |
| 4288 | obj.code = reader.read("!H")[0] |
| 4289 | obj.data = str(reader.read_all()) |
| 4290 | return obj |
| 4291 | |
| 4292 | def __eq__(self, other): |
| 4293 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4294 | if self.xid != other.xid: return False |
| 4295 | if self.code != other.code: return False |
| 4296 | if self.data != other.data: return False |
| 4297 | return True |
| 4298 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4299 | def pretty_print(self, q): |
| 4300 | q.text("flow_mod_failed_error_msg {") |
| 4301 | with q.group(): |
| 4302 | with q.indent(2): |
| 4303 | q.breakable() |
| 4304 | q.text("xid = "); |
| 4305 | if self.xid != None: |
| 4306 | q.text("%#x" % self.xid) |
| 4307 | else: |
| 4308 | q.text('None') |
| 4309 | q.text(","); q.breakable() |
| 4310 | q.text("code = "); |
| 4311 | q.text("%#x" % self.code) |
| 4312 | q.text(","); q.breakable() |
| 4313 | q.text("data = "); |
| 4314 | q.pp(self.data) |
| 4315 | q.breakable() |
| 4316 | q.text('}') |
| 4317 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4318 | error_msg.subtypes[3] = flow_mod_failed_error_msg |
| 4319 | |
| 4320 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4321 | version = 1 |
| 4322 | type = 14 |
| 4323 | _command = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4324 | |
| 4325 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4326 | if xid != None: |
| 4327 | self.xid = xid |
| 4328 | else: |
| 4329 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4330 | if match != None: |
| 4331 | self.match = match |
| 4332 | else: |
| 4333 | self.match = common.match() |
| 4334 | if cookie != None: |
| 4335 | self.cookie = cookie |
| 4336 | else: |
| 4337 | self.cookie = 0 |
| 4338 | if idle_timeout != None: |
| 4339 | self.idle_timeout = idle_timeout |
| 4340 | else: |
| 4341 | self.idle_timeout = 0 |
| 4342 | if hard_timeout != None: |
| 4343 | self.hard_timeout = hard_timeout |
| 4344 | else: |
| 4345 | self.hard_timeout = 0 |
| 4346 | if priority != None: |
| 4347 | self.priority = priority |
| 4348 | else: |
| 4349 | self.priority = 0 |
| 4350 | if buffer_id != None: |
| 4351 | self.buffer_id = buffer_id |
| 4352 | else: |
| 4353 | self.buffer_id = 0 |
| 4354 | if out_port != None: |
| 4355 | self.out_port = out_port |
| 4356 | else: |
| 4357 | self.out_port = 0 |
| 4358 | if flags != None: |
| 4359 | self.flags = flags |
| 4360 | else: |
| 4361 | self.flags = 0 |
| 4362 | if actions != None: |
| 4363 | self.actions = actions |
| 4364 | else: |
| 4365 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4366 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4367 | |
| 4368 | def pack(self): |
| 4369 | packed = [] |
| 4370 | packed.append(struct.pack("!B", self.version)) |
| 4371 | packed.append(struct.pack("!B", self.type)) |
| 4372 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4373 | packed.append(struct.pack("!L", self.xid)) |
| 4374 | packed.append(self.match.pack()) |
| 4375 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4376 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4377 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4378 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4379 | packed.append(struct.pack("!H", self.priority)) |
| 4380 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4381 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4382 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4383 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4384 | length = sum([len(x) for x in packed]) |
| 4385 | packed[2] = struct.pack("!H", length) |
| 4386 | return ''.join(packed) |
| 4387 | |
| 4388 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4389 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4390 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4391 | _version = reader.read("!B")[0] |
| 4392 | assert(_version == 1) |
| 4393 | _type = reader.read("!B")[0] |
| 4394 | assert(_type == 14) |
| 4395 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4396 | orig_reader = reader |
| 4397 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4398 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4399 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4400 | obj.cookie = reader.read("!Q")[0] |
| 4401 | __command = util.unpack_fm_cmd(reader) |
| 4402 | assert(__command == 1) |
| 4403 | obj.idle_timeout = reader.read("!H")[0] |
| 4404 | obj.hard_timeout = reader.read("!H")[0] |
| 4405 | obj.priority = reader.read("!H")[0] |
| 4406 | obj.buffer_id = reader.read("!L")[0] |
| 4407 | obj.out_port = util.unpack_port_no(reader) |
| 4408 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4409 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4410 | return obj |
| 4411 | |
| 4412 | def __eq__(self, other): |
| 4413 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4414 | if self.xid != other.xid: return False |
| 4415 | if self.match != other.match: return False |
| 4416 | if self.cookie != other.cookie: return False |
| 4417 | if self.idle_timeout != other.idle_timeout: return False |
| 4418 | if self.hard_timeout != other.hard_timeout: return False |
| 4419 | if self.priority != other.priority: return False |
| 4420 | if self.buffer_id != other.buffer_id: return False |
| 4421 | if self.out_port != other.out_port: return False |
| 4422 | if self.flags != other.flags: return False |
| 4423 | if self.actions != other.actions: return False |
| 4424 | return True |
| 4425 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4426 | def pretty_print(self, q): |
| 4427 | q.text("flow_modify {") |
| 4428 | with q.group(): |
| 4429 | with q.indent(2): |
| 4430 | q.breakable() |
| 4431 | q.text("xid = "); |
| 4432 | if self.xid != None: |
| 4433 | q.text("%#x" % self.xid) |
| 4434 | else: |
| 4435 | q.text('None') |
| 4436 | q.text(","); q.breakable() |
| 4437 | q.text("match = "); |
| 4438 | q.pp(self.match) |
| 4439 | q.text(","); q.breakable() |
| 4440 | q.text("cookie = "); |
| 4441 | q.text("%#x" % self.cookie) |
| 4442 | q.text(","); q.breakable() |
| 4443 | q.text("idle_timeout = "); |
| 4444 | q.text("%#x" % self.idle_timeout) |
| 4445 | q.text(","); q.breakable() |
| 4446 | q.text("hard_timeout = "); |
| 4447 | q.text("%#x" % self.hard_timeout) |
| 4448 | q.text(","); q.breakable() |
| 4449 | q.text("priority = "); |
| 4450 | q.text("%#x" % self.priority) |
| 4451 | q.text(","); q.breakable() |
| 4452 | q.text("buffer_id = "); |
| 4453 | q.text("%#x" % self.buffer_id) |
| 4454 | q.text(","); q.breakable() |
| 4455 | q.text("out_port = "); |
| 4456 | q.text(util.pretty_port(self.out_port)) |
| 4457 | q.text(","); q.breakable() |
| 4458 | q.text("flags = "); |
| 4459 | q.text("%#x" % self.flags) |
| 4460 | q.text(","); q.breakable() |
| 4461 | q.text("actions = "); |
| 4462 | q.pp(self.actions) |
| 4463 | q.breakable() |
| 4464 | q.text('}') |
| 4465 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4466 | flow_mod.subtypes[1] = flow_modify |
| 4467 | |
| 4468 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4469 | version = 1 |
| 4470 | type = 14 |
| 4471 | _command = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4472 | |
| 4473 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4474 | if xid != None: |
| 4475 | self.xid = xid |
| 4476 | else: |
| 4477 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4478 | if match != None: |
| 4479 | self.match = match |
| 4480 | else: |
| 4481 | self.match = common.match() |
| 4482 | if cookie != None: |
| 4483 | self.cookie = cookie |
| 4484 | else: |
| 4485 | self.cookie = 0 |
| 4486 | if idle_timeout != None: |
| 4487 | self.idle_timeout = idle_timeout |
| 4488 | else: |
| 4489 | self.idle_timeout = 0 |
| 4490 | if hard_timeout != None: |
| 4491 | self.hard_timeout = hard_timeout |
| 4492 | else: |
| 4493 | self.hard_timeout = 0 |
| 4494 | if priority != None: |
| 4495 | self.priority = priority |
| 4496 | else: |
| 4497 | self.priority = 0 |
| 4498 | if buffer_id != None: |
| 4499 | self.buffer_id = buffer_id |
| 4500 | else: |
| 4501 | self.buffer_id = 0 |
| 4502 | if out_port != None: |
| 4503 | self.out_port = out_port |
| 4504 | else: |
| 4505 | self.out_port = 0 |
| 4506 | if flags != None: |
| 4507 | self.flags = flags |
| 4508 | else: |
| 4509 | self.flags = 0 |
| 4510 | if actions != None: |
| 4511 | self.actions = actions |
| 4512 | else: |
| 4513 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4514 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4515 | |
| 4516 | def pack(self): |
| 4517 | packed = [] |
| 4518 | packed.append(struct.pack("!B", self.version)) |
| 4519 | packed.append(struct.pack("!B", self.type)) |
| 4520 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4521 | packed.append(struct.pack("!L", self.xid)) |
| 4522 | packed.append(self.match.pack()) |
| 4523 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4524 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4525 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4526 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4527 | packed.append(struct.pack("!H", self.priority)) |
| 4528 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4529 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4530 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4531 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4532 | length = sum([len(x) for x in packed]) |
| 4533 | packed[2] = struct.pack("!H", length) |
| 4534 | return ''.join(packed) |
| 4535 | |
| 4536 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4537 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4538 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4539 | _version = reader.read("!B")[0] |
| 4540 | assert(_version == 1) |
| 4541 | _type = reader.read("!B")[0] |
| 4542 | assert(_type == 14) |
| 4543 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4544 | orig_reader = reader |
| 4545 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4546 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4547 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4548 | obj.cookie = reader.read("!Q")[0] |
| 4549 | __command = util.unpack_fm_cmd(reader) |
| 4550 | assert(__command == 2) |
| 4551 | obj.idle_timeout = reader.read("!H")[0] |
| 4552 | obj.hard_timeout = reader.read("!H")[0] |
| 4553 | obj.priority = reader.read("!H")[0] |
| 4554 | obj.buffer_id = reader.read("!L")[0] |
| 4555 | obj.out_port = util.unpack_port_no(reader) |
| 4556 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4557 | obj.actions = loxi.generic_util.unpack_list(reader, action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4558 | return obj |
| 4559 | |
| 4560 | def __eq__(self, other): |
| 4561 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4562 | if self.xid != other.xid: return False |
| 4563 | if self.match != other.match: return False |
| 4564 | if self.cookie != other.cookie: return False |
| 4565 | if self.idle_timeout != other.idle_timeout: return False |
| 4566 | if self.hard_timeout != other.hard_timeout: return False |
| 4567 | if self.priority != other.priority: return False |
| 4568 | if self.buffer_id != other.buffer_id: return False |
| 4569 | if self.out_port != other.out_port: return False |
| 4570 | if self.flags != other.flags: return False |
| 4571 | if self.actions != other.actions: return False |
| 4572 | return True |
| 4573 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4574 | def pretty_print(self, q): |
| 4575 | q.text("flow_modify_strict {") |
| 4576 | with q.group(): |
| 4577 | with q.indent(2): |
| 4578 | q.breakable() |
| 4579 | q.text("xid = "); |
| 4580 | if self.xid != None: |
| 4581 | q.text("%#x" % self.xid) |
| 4582 | else: |
| 4583 | q.text('None') |
| 4584 | q.text(","); q.breakable() |
| 4585 | q.text("match = "); |
| 4586 | q.pp(self.match) |
| 4587 | q.text(","); q.breakable() |
| 4588 | q.text("cookie = "); |
| 4589 | q.text("%#x" % self.cookie) |
| 4590 | q.text(","); q.breakable() |
| 4591 | q.text("idle_timeout = "); |
| 4592 | q.text("%#x" % self.idle_timeout) |
| 4593 | q.text(","); q.breakable() |
| 4594 | q.text("hard_timeout = "); |
| 4595 | q.text("%#x" % self.hard_timeout) |
| 4596 | q.text(","); q.breakable() |
| 4597 | q.text("priority = "); |
| 4598 | q.text("%#x" % self.priority) |
| 4599 | q.text(","); q.breakable() |
| 4600 | q.text("buffer_id = "); |
| 4601 | q.text("%#x" % self.buffer_id) |
| 4602 | q.text(","); q.breakable() |
| 4603 | q.text("out_port = "); |
| 4604 | q.text(util.pretty_port(self.out_port)) |
| 4605 | q.text(","); q.breakable() |
| 4606 | q.text("flags = "); |
| 4607 | q.text("%#x" % self.flags) |
| 4608 | q.text(","); q.breakable() |
| 4609 | q.text("actions = "); |
| 4610 | q.pp(self.actions) |
| 4611 | q.breakable() |
| 4612 | q.text('}') |
| 4613 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4614 | flow_mod.subtypes[2] = flow_modify_strict |
| 4615 | |
| 4616 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4617 | version = 1 |
| 4618 | type = 11 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4619 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4620 | def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4621 | if xid != None: |
| 4622 | self.xid = xid |
| 4623 | else: |
| 4624 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4625 | if match != None: |
| 4626 | self.match = match |
| 4627 | else: |
| 4628 | self.match = common.match() |
| 4629 | if cookie != None: |
| 4630 | self.cookie = cookie |
| 4631 | else: |
| 4632 | self.cookie = 0 |
| 4633 | if priority != None: |
| 4634 | self.priority = priority |
| 4635 | else: |
| 4636 | self.priority = 0 |
| 4637 | if reason != None: |
| 4638 | self.reason = reason |
| 4639 | else: |
| 4640 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4641 | if duration_sec != None: |
| 4642 | self.duration_sec = duration_sec |
| 4643 | else: |
| 4644 | self.duration_sec = 0 |
| 4645 | if duration_nsec != None: |
| 4646 | self.duration_nsec = duration_nsec |
| 4647 | else: |
| 4648 | self.duration_nsec = 0 |
| 4649 | if idle_timeout != None: |
| 4650 | self.idle_timeout = idle_timeout |
| 4651 | else: |
| 4652 | self.idle_timeout = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4653 | if packet_count != None: |
| 4654 | self.packet_count = packet_count |
| 4655 | else: |
| 4656 | self.packet_count = 0 |
| 4657 | if byte_count != None: |
| 4658 | self.byte_count = byte_count |
| 4659 | else: |
| 4660 | self.byte_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4661 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4662 | |
| 4663 | def pack(self): |
| 4664 | packed = [] |
| 4665 | packed.append(struct.pack("!B", self.version)) |
| 4666 | packed.append(struct.pack("!B", self.type)) |
| 4667 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4668 | packed.append(struct.pack("!L", self.xid)) |
| 4669 | packed.append(self.match.pack()) |
| 4670 | packed.append(struct.pack("!Q", self.cookie)) |
| 4671 | packed.append(struct.pack("!H", self.priority)) |
| 4672 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4673 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4674 | packed.append(struct.pack("!L", self.duration_sec)) |
| 4675 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 4676 | packed.append(struct.pack("!H", self.idle_timeout)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4677 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4678 | packed.append(struct.pack("!Q", self.packet_count)) |
| 4679 | packed.append(struct.pack("!Q", self.byte_count)) |
| 4680 | length = sum([len(x) for x in packed]) |
| 4681 | packed[2] = struct.pack("!H", length) |
| 4682 | return ''.join(packed) |
| 4683 | |
| 4684 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4685 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4686 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4687 | _version = reader.read("!B")[0] |
| 4688 | assert(_version == 1) |
| 4689 | _type = reader.read("!B")[0] |
| 4690 | assert(_type == 11) |
| 4691 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4692 | orig_reader = reader |
| 4693 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4694 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4695 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4696 | obj.cookie = reader.read("!Q")[0] |
| 4697 | obj.priority = reader.read("!H")[0] |
| 4698 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4699 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4700 | obj.duration_sec = reader.read("!L")[0] |
| 4701 | obj.duration_nsec = reader.read("!L")[0] |
| 4702 | obj.idle_timeout = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4703 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4704 | obj.packet_count = reader.read("!Q")[0] |
| 4705 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4706 | return obj |
| 4707 | |
| 4708 | def __eq__(self, other): |
| 4709 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4710 | if self.xid != other.xid: return False |
| 4711 | if self.match != other.match: return False |
| 4712 | if self.cookie != other.cookie: return False |
| 4713 | if self.priority != other.priority: return False |
| 4714 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4715 | if self.duration_sec != other.duration_sec: return False |
| 4716 | if self.duration_nsec != other.duration_nsec: return False |
| 4717 | if self.idle_timeout != other.idle_timeout: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4718 | if self.packet_count != other.packet_count: return False |
| 4719 | if self.byte_count != other.byte_count: return False |
| 4720 | return True |
| 4721 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4722 | def pretty_print(self, q): |
| 4723 | q.text("flow_removed {") |
| 4724 | with q.group(): |
| 4725 | with q.indent(2): |
| 4726 | q.breakable() |
| 4727 | q.text("xid = "); |
| 4728 | if self.xid != None: |
| 4729 | q.text("%#x" % self.xid) |
| 4730 | else: |
| 4731 | q.text('None') |
| 4732 | q.text(","); q.breakable() |
| 4733 | q.text("match = "); |
| 4734 | q.pp(self.match) |
| 4735 | q.text(","); q.breakable() |
| 4736 | q.text("cookie = "); |
| 4737 | q.text("%#x" % self.cookie) |
| 4738 | q.text(","); q.breakable() |
| 4739 | q.text("priority = "); |
| 4740 | q.text("%#x" % self.priority) |
| 4741 | q.text(","); q.breakable() |
| 4742 | q.text("reason = "); |
| 4743 | q.text("%#x" % self.reason) |
| 4744 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4745 | q.text("duration_sec = "); |
| 4746 | q.text("%#x" % self.duration_sec) |
| 4747 | q.text(","); q.breakable() |
| 4748 | q.text("duration_nsec = "); |
| 4749 | q.text("%#x" % self.duration_nsec) |
| 4750 | q.text(","); q.breakable() |
| 4751 | q.text("idle_timeout = "); |
| 4752 | q.text("%#x" % self.idle_timeout) |
| 4753 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4754 | q.text("packet_count = "); |
| 4755 | q.text("%#x" % self.packet_count) |
| 4756 | q.text(","); q.breakable() |
| 4757 | q.text("byte_count = "); |
| 4758 | q.text("%#x" % self.byte_count) |
| 4759 | q.breakable() |
| 4760 | q.text('}') |
| 4761 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4762 | message.subtypes[11] = flow_removed |
| 4763 | |
| 4764 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4765 | version = 1 |
| 4766 | type = 17 |
| 4767 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4768 | |
| 4769 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4770 | if xid != None: |
| 4771 | self.xid = xid |
| 4772 | else: |
| 4773 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4774 | if flags != None: |
| 4775 | self.flags = flags |
| 4776 | else: |
| 4777 | self.flags = 0 |
| 4778 | if entries != None: |
| 4779 | self.entries = entries |
| 4780 | else: |
| 4781 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4782 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4783 | |
| 4784 | def pack(self): |
| 4785 | packed = [] |
| 4786 | packed.append(struct.pack("!B", self.version)) |
| 4787 | packed.append(struct.pack("!B", self.type)) |
| 4788 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4789 | packed.append(struct.pack("!L", self.xid)) |
| 4790 | packed.append(struct.pack("!H", self.stats_type)) |
| 4791 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4792 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4793 | length = sum([len(x) for x in packed]) |
| 4794 | packed[2] = struct.pack("!H", length) |
| 4795 | return ''.join(packed) |
| 4796 | |
| 4797 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4798 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4799 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4800 | _version = reader.read("!B")[0] |
| 4801 | assert(_version == 1) |
| 4802 | _type = reader.read("!B")[0] |
| 4803 | assert(_type == 17) |
| 4804 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4805 | orig_reader = reader |
| 4806 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4807 | obj.xid = reader.read("!L")[0] |
| 4808 | _stats_type = reader.read("!H")[0] |
| 4809 | assert(_stats_type == 1) |
| 4810 | obj.flags = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4811 | obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4812 | return obj |
| 4813 | |
| 4814 | def __eq__(self, other): |
| 4815 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4816 | if self.xid != other.xid: return False |
| 4817 | if self.flags != other.flags: return False |
| 4818 | if self.entries != other.entries: return False |
| 4819 | return True |
| 4820 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4821 | def pretty_print(self, q): |
| 4822 | q.text("flow_stats_reply {") |
| 4823 | with q.group(): |
| 4824 | with q.indent(2): |
| 4825 | q.breakable() |
| 4826 | q.text("xid = "); |
| 4827 | if self.xid != None: |
| 4828 | q.text("%#x" % self.xid) |
| 4829 | else: |
| 4830 | q.text('None') |
| 4831 | q.text(","); q.breakable() |
| 4832 | q.text("flags = "); |
| 4833 | q.text("%#x" % self.flags) |
| 4834 | q.text(","); q.breakable() |
| 4835 | q.text("entries = "); |
| 4836 | q.pp(self.entries) |
| 4837 | q.breakable() |
| 4838 | q.text('}') |
| 4839 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4840 | stats_reply.subtypes[1] = flow_stats_reply |
| 4841 | |
| 4842 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4843 | version = 1 |
| 4844 | type = 16 |
| 4845 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4846 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4847 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4848 | if xid != None: |
| 4849 | self.xid = xid |
| 4850 | else: |
| 4851 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4852 | if flags != None: |
| 4853 | self.flags = flags |
| 4854 | else: |
| 4855 | self.flags = 0 |
| 4856 | if match != None: |
| 4857 | self.match = match |
| 4858 | else: |
| 4859 | self.match = common.match() |
| 4860 | if table_id != None: |
| 4861 | self.table_id = table_id |
| 4862 | else: |
| 4863 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4864 | if out_port != None: |
| 4865 | self.out_port = out_port |
| 4866 | else: |
| 4867 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4868 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4869 | |
| 4870 | def pack(self): |
| 4871 | packed = [] |
| 4872 | packed.append(struct.pack("!B", self.version)) |
| 4873 | packed.append(struct.pack("!B", self.type)) |
| 4874 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4875 | packed.append(struct.pack("!L", self.xid)) |
| 4876 | packed.append(struct.pack("!H", self.stats_type)) |
| 4877 | packed.append(struct.pack("!H", self.flags)) |
| 4878 | packed.append(self.match.pack()) |
| 4879 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4880 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4881 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4882 | length = sum([len(x) for x in packed]) |
| 4883 | packed[2] = struct.pack("!H", length) |
| 4884 | return ''.join(packed) |
| 4885 | |
| 4886 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4887 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4888 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4889 | _version = reader.read("!B")[0] |
| 4890 | assert(_version == 1) |
| 4891 | _type = reader.read("!B")[0] |
| 4892 | assert(_type == 16) |
| 4893 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4894 | orig_reader = reader |
| 4895 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4896 | obj.xid = reader.read("!L")[0] |
| 4897 | _stats_type = reader.read("!H")[0] |
| 4898 | assert(_stats_type == 1) |
| 4899 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4900 | obj.match = common.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4901 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4902 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4903 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4904 | return obj |
| 4905 | |
| 4906 | def __eq__(self, other): |
| 4907 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4908 | if self.xid != other.xid: return False |
| 4909 | if self.flags != other.flags: return False |
| 4910 | if self.match != other.match: return False |
| 4911 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4912 | if self.out_port != other.out_port: return False |
| 4913 | return True |
| 4914 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4915 | def pretty_print(self, q): |
| 4916 | q.text("flow_stats_request {") |
| 4917 | with q.group(): |
| 4918 | with q.indent(2): |
| 4919 | q.breakable() |
| 4920 | q.text("xid = "); |
| 4921 | if self.xid != None: |
| 4922 | q.text("%#x" % self.xid) |
| 4923 | else: |
| 4924 | q.text('None') |
| 4925 | q.text(","); q.breakable() |
| 4926 | q.text("flags = "); |
| 4927 | q.text("%#x" % self.flags) |
| 4928 | q.text(","); q.breakable() |
| 4929 | q.text("match = "); |
| 4930 | q.pp(self.match) |
| 4931 | q.text(","); q.breakable() |
| 4932 | q.text("table_id = "); |
| 4933 | q.text("%#x" % self.table_id) |
| 4934 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4935 | q.text("out_port = "); |
| 4936 | q.text(util.pretty_port(self.out_port)) |
| 4937 | q.breakable() |
| 4938 | q.text('}') |
| 4939 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4940 | stats_request.subtypes[1] = flow_stats_request |
| 4941 | |
| 4942 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4943 | version = 1 |
| 4944 | type = 8 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4945 | |
| 4946 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4947 | if xid != None: |
| 4948 | self.xid = xid |
| 4949 | else: |
| 4950 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4951 | if flags != None: |
| 4952 | self.flags = flags |
| 4953 | else: |
| 4954 | self.flags = 0 |
| 4955 | if miss_send_len != None: |
| 4956 | self.miss_send_len = miss_send_len |
| 4957 | else: |
| 4958 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4959 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4960 | |
| 4961 | def pack(self): |
| 4962 | packed = [] |
| 4963 | packed.append(struct.pack("!B", self.version)) |
| 4964 | packed.append(struct.pack("!B", self.type)) |
| 4965 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4966 | packed.append(struct.pack("!L", self.xid)) |
| 4967 | packed.append(struct.pack("!H", self.flags)) |
| 4968 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 4969 | length = sum([len(x) for x in packed]) |
| 4970 | packed[2] = struct.pack("!H", length) |
| 4971 | return ''.join(packed) |
| 4972 | |
| 4973 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4974 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4975 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4976 | _version = reader.read("!B")[0] |
| 4977 | assert(_version == 1) |
| 4978 | _type = reader.read("!B")[0] |
| 4979 | assert(_type == 8) |
| 4980 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4981 | orig_reader = reader |
| 4982 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4983 | obj.xid = reader.read("!L")[0] |
| 4984 | obj.flags = reader.read("!H")[0] |
| 4985 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4986 | return obj |
| 4987 | |
| 4988 | def __eq__(self, other): |
| 4989 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4990 | if self.xid != other.xid: return False |
| 4991 | if self.flags != other.flags: return False |
| 4992 | if self.miss_send_len != other.miss_send_len: return False |
| 4993 | return True |
| 4994 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4995 | def pretty_print(self, q): |
| 4996 | q.text("get_config_reply {") |
| 4997 | with q.group(): |
| 4998 | with q.indent(2): |
| 4999 | q.breakable() |
| 5000 | q.text("xid = "); |
| 5001 | if self.xid != None: |
| 5002 | q.text("%#x" % self.xid) |
| 5003 | else: |
| 5004 | q.text('None') |
| 5005 | q.text(","); q.breakable() |
| 5006 | q.text("flags = "); |
| 5007 | q.text("%#x" % self.flags) |
| 5008 | q.text(","); q.breakable() |
| 5009 | q.text("miss_send_len = "); |
| 5010 | q.text("%#x" % self.miss_send_len) |
| 5011 | q.breakable() |
| 5012 | q.text('}') |
| 5013 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5014 | message.subtypes[8] = get_config_reply |
| 5015 | |
| 5016 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5017 | version = 1 |
| 5018 | type = 7 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5019 | |
| 5020 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5021 | if xid != None: |
| 5022 | self.xid = xid |
| 5023 | else: |
| 5024 | self.xid = None |
| 5025 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5026 | |
| 5027 | def pack(self): |
| 5028 | packed = [] |
| 5029 | packed.append(struct.pack("!B", self.version)) |
| 5030 | packed.append(struct.pack("!B", self.type)) |
| 5031 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5032 | packed.append(struct.pack("!L", self.xid)) |
| 5033 | length = sum([len(x) for x in packed]) |
| 5034 | packed[2] = struct.pack("!H", length) |
| 5035 | return ''.join(packed) |
| 5036 | |
| 5037 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5038 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5039 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5040 | _version = reader.read("!B")[0] |
| 5041 | assert(_version == 1) |
| 5042 | _type = reader.read("!B")[0] |
| 5043 | assert(_type == 7) |
| 5044 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5045 | orig_reader = reader |
| 5046 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5047 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5048 | return obj |
| 5049 | |
| 5050 | def __eq__(self, other): |
| 5051 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5052 | if self.xid != other.xid: return False |
| 5053 | return True |
| 5054 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5055 | def pretty_print(self, q): |
| 5056 | q.text("get_config_request {") |
| 5057 | with q.group(): |
| 5058 | with q.indent(2): |
| 5059 | q.breakable() |
| 5060 | q.text("xid = "); |
| 5061 | if self.xid != None: |
| 5062 | q.text("%#x" % self.xid) |
| 5063 | else: |
| 5064 | q.text('None') |
| 5065 | q.breakable() |
| 5066 | q.text('}') |
| 5067 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5068 | message.subtypes[7] = get_config_request |
| 5069 | |
| 5070 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5071 | version = 1 |
| 5072 | type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5073 | |
| 5074 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5075 | if xid != None: |
| 5076 | self.xid = xid |
| 5077 | else: |
| 5078 | self.xid = None |
| 5079 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5080 | |
| 5081 | def pack(self): |
| 5082 | packed = [] |
| 5083 | packed.append(struct.pack("!B", self.version)) |
| 5084 | packed.append(struct.pack("!B", self.type)) |
| 5085 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5086 | packed.append(struct.pack("!L", self.xid)) |
| 5087 | length = sum([len(x) for x in packed]) |
| 5088 | packed[2] = struct.pack("!H", length) |
| 5089 | return ''.join(packed) |
| 5090 | |
| 5091 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5092 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5093 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5094 | _version = reader.read("!B")[0] |
| 5095 | assert(_version == 1) |
| 5096 | _type = reader.read("!B")[0] |
| 5097 | assert(_type == 0) |
| 5098 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5099 | orig_reader = reader |
| 5100 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5101 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5102 | return obj |
| 5103 | |
| 5104 | def __eq__(self, other): |
| 5105 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5106 | if self.xid != other.xid: return False |
| 5107 | return True |
| 5108 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5109 | def pretty_print(self, q): |
| 5110 | q.text("hello {") |
| 5111 | with q.group(): |
| 5112 | with q.indent(2): |
| 5113 | q.breakable() |
| 5114 | q.text("xid = "); |
| 5115 | if self.xid != None: |
| 5116 | q.text("%#x" % self.xid) |
| 5117 | else: |
| 5118 | q.text('None') |
| 5119 | q.breakable() |
| 5120 | q.text('}') |
| 5121 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5122 | message.subtypes[0] = hello |
| 5123 | |
| 5124 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5125 | version = 1 |
| 5126 | type = 1 |
| 5127 | err_type = 0 |
| 5128 | |
| 5129 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5130 | if xid != None: |
| 5131 | self.xid = xid |
| 5132 | else: |
| 5133 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5134 | if code != None: |
| 5135 | self.code = code |
| 5136 | else: |
| 5137 | self.code = 0 |
| 5138 | if data != None: |
| 5139 | self.data = data |
| 5140 | else: |
| 5141 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5142 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5143 | |
| 5144 | def pack(self): |
| 5145 | packed = [] |
| 5146 | packed.append(struct.pack("!B", self.version)) |
| 5147 | packed.append(struct.pack("!B", self.type)) |
| 5148 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5149 | packed.append(struct.pack("!L", self.xid)) |
| 5150 | packed.append(struct.pack("!H", self.err_type)) |
| 5151 | packed.append(struct.pack("!H", self.code)) |
| 5152 | packed.append(self.data) |
| 5153 | length = sum([len(x) for x in packed]) |
| 5154 | packed[2] = struct.pack("!H", length) |
| 5155 | return ''.join(packed) |
| 5156 | |
| 5157 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5158 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5159 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5160 | _version = reader.read("!B")[0] |
| 5161 | assert(_version == 1) |
| 5162 | _type = reader.read("!B")[0] |
| 5163 | assert(_type == 1) |
| 5164 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5165 | orig_reader = reader |
| 5166 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5167 | obj.xid = reader.read("!L")[0] |
| 5168 | _err_type = reader.read("!H")[0] |
| 5169 | assert(_err_type == 0) |
| 5170 | obj.code = reader.read("!H")[0] |
| 5171 | obj.data = str(reader.read_all()) |
| 5172 | return obj |
| 5173 | |
| 5174 | def __eq__(self, other): |
| 5175 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5176 | if self.xid != other.xid: return False |
| 5177 | if self.code != other.code: return False |
| 5178 | if self.data != other.data: return False |
| 5179 | return True |
| 5180 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5181 | def pretty_print(self, q): |
| 5182 | q.text("hello_failed_error_msg {") |
| 5183 | with q.group(): |
| 5184 | with q.indent(2): |
| 5185 | q.breakable() |
| 5186 | q.text("xid = "); |
| 5187 | if self.xid != None: |
| 5188 | q.text("%#x" % self.xid) |
| 5189 | else: |
| 5190 | q.text('None') |
| 5191 | q.text(","); q.breakable() |
| 5192 | q.text("code = "); |
| 5193 | q.text("%#x" % self.code) |
| 5194 | q.text(","); q.breakable() |
| 5195 | q.text("data = "); |
| 5196 | q.pp(self.data) |
| 5197 | q.breakable() |
| 5198 | q.text('}') |
| 5199 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5200 | error_msg.subtypes[0] = hello_failed_error_msg |
| 5201 | |
| 5202 | class nicira_header(experimenter): |
| 5203 | subtypes = {} |
| 5204 | |
| 5205 | @staticmethod |
| 5206 | def unpack(reader): |
| 5207 | subtype, = reader.peek('!L', 12) |
| 5208 | try: |
| 5209 | subclass = nicira_header.subtypes[subtype] |
| 5210 | except KeyError: |
| 5211 | raise loxi.ProtocolError("unknown nicira_header experimenter message subtype %#x" % subtype) |
| 5212 | return subclass.unpack(reader) |
| 5213 | |
| 5214 | experimenter.subtypes[8992] = nicira_header |
| 5215 | |
| 5216 | class nicira_controller_role_reply(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5217 | version = 1 |
| 5218 | type = 4 |
| 5219 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5220 | subtype = 11 |
| 5221 | |
| 5222 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5223 | if xid != None: |
| 5224 | self.xid = xid |
| 5225 | else: |
| 5226 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5227 | if role != None: |
| 5228 | self.role = role |
| 5229 | else: |
| 5230 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5231 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5232 | |
| 5233 | def pack(self): |
| 5234 | packed = [] |
| 5235 | packed.append(struct.pack("!B", self.version)) |
| 5236 | packed.append(struct.pack("!B", self.type)) |
| 5237 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5238 | packed.append(struct.pack("!L", self.xid)) |
| 5239 | packed.append(struct.pack("!L", self.experimenter)) |
| 5240 | packed.append(struct.pack("!L", self.subtype)) |
| 5241 | packed.append(struct.pack("!L", self.role)) |
| 5242 | length = sum([len(x) for x in packed]) |
| 5243 | packed[2] = struct.pack("!H", length) |
| 5244 | return ''.join(packed) |
| 5245 | |
| 5246 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5247 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5248 | obj = nicira_controller_role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5249 | _version = reader.read("!B")[0] |
| 5250 | assert(_version == 1) |
| 5251 | _type = reader.read("!B")[0] |
| 5252 | assert(_type == 4) |
| 5253 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5254 | orig_reader = reader |
| 5255 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5256 | obj.xid = reader.read("!L")[0] |
| 5257 | _experimenter = reader.read("!L")[0] |
| 5258 | assert(_experimenter == 8992) |
| 5259 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5260 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5261 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5262 | return obj |
| 5263 | |
| 5264 | def __eq__(self, other): |
| 5265 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5266 | if self.xid != other.xid: return False |
| 5267 | if self.role != other.role: return False |
| 5268 | return True |
| 5269 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5270 | def pretty_print(self, q): |
| 5271 | q.text("nicira_controller_role_reply {") |
| 5272 | with q.group(): |
| 5273 | with q.indent(2): |
| 5274 | q.breakable() |
| 5275 | q.text("xid = "); |
| 5276 | if self.xid != None: |
| 5277 | q.text("%#x" % self.xid) |
| 5278 | else: |
| 5279 | q.text('None') |
| 5280 | q.text(","); q.breakable() |
| 5281 | q.text("role = "); |
| 5282 | q.text("%#x" % self.role) |
| 5283 | q.breakable() |
| 5284 | q.text('}') |
| 5285 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5286 | nicira_header.subtypes[11] = nicira_controller_role_reply |
| 5287 | |
| 5288 | class nicira_controller_role_request(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5289 | version = 1 |
| 5290 | type = 4 |
| 5291 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5292 | subtype = 10 |
| 5293 | |
| 5294 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5295 | if xid != None: |
| 5296 | self.xid = xid |
| 5297 | else: |
| 5298 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5299 | if role != None: |
| 5300 | self.role = role |
| 5301 | else: |
| 5302 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5303 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5304 | |
| 5305 | def pack(self): |
| 5306 | packed = [] |
| 5307 | packed.append(struct.pack("!B", self.version)) |
| 5308 | packed.append(struct.pack("!B", self.type)) |
| 5309 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5310 | packed.append(struct.pack("!L", self.xid)) |
| 5311 | packed.append(struct.pack("!L", self.experimenter)) |
| 5312 | packed.append(struct.pack("!L", self.subtype)) |
| 5313 | packed.append(struct.pack("!L", self.role)) |
| 5314 | length = sum([len(x) for x in packed]) |
| 5315 | packed[2] = struct.pack("!H", length) |
| 5316 | return ''.join(packed) |
| 5317 | |
| 5318 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5319 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5320 | obj = nicira_controller_role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5321 | _version = reader.read("!B")[0] |
| 5322 | assert(_version == 1) |
| 5323 | _type = reader.read("!B")[0] |
| 5324 | assert(_type == 4) |
| 5325 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5326 | orig_reader = reader |
| 5327 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5328 | obj.xid = reader.read("!L")[0] |
| 5329 | _experimenter = reader.read("!L")[0] |
| 5330 | assert(_experimenter == 8992) |
| 5331 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5332 | assert(_subtype == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5333 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5334 | return obj |
| 5335 | |
| 5336 | def __eq__(self, other): |
| 5337 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5338 | if self.xid != other.xid: return False |
| 5339 | if self.role != other.role: return False |
| 5340 | return True |
| 5341 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5342 | def pretty_print(self, q): |
| 5343 | q.text("nicira_controller_role_request {") |
| 5344 | with q.group(): |
| 5345 | with q.indent(2): |
| 5346 | q.breakable() |
| 5347 | q.text("xid = "); |
| 5348 | if self.xid != None: |
| 5349 | q.text("%#x" % self.xid) |
| 5350 | else: |
| 5351 | q.text('None') |
| 5352 | q.text(","); q.breakable() |
| 5353 | q.text("role = "); |
| 5354 | q.text("%#x" % self.role) |
| 5355 | q.breakable() |
| 5356 | q.text('}') |
| 5357 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5358 | nicira_header.subtypes[10] = nicira_controller_role_request |
| 5359 | |
| 5360 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5361 | version = 1 |
| 5362 | type = 10 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5363 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5364 | def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5365 | if xid != None: |
| 5366 | self.xid = xid |
| 5367 | else: |
| 5368 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5369 | if buffer_id != None: |
| 5370 | self.buffer_id = buffer_id |
| 5371 | else: |
| 5372 | self.buffer_id = 0 |
| 5373 | if total_len != None: |
| 5374 | self.total_len = total_len |
| 5375 | else: |
| 5376 | self.total_len = 0 |
| 5377 | if in_port != None: |
| 5378 | self.in_port = in_port |
| 5379 | else: |
| 5380 | self.in_port = 0 |
| 5381 | if reason != None: |
| 5382 | self.reason = reason |
| 5383 | else: |
| 5384 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5385 | if data != None: |
| 5386 | self.data = data |
| 5387 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5388 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5389 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5390 | |
| 5391 | def pack(self): |
| 5392 | packed = [] |
| 5393 | packed.append(struct.pack("!B", self.version)) |
| 5394 | packed.append(struct.pack("!B", self.type)) |
| 5395 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5396 | packed.append(struct.pack("!L", self.xid)) |
| 5397 | packed.append(struct.pack("!L", self.buffer_id)) |
| 5398 | packed.append(struct.pack("!H", self.total_len)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5399 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5400 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5401 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5402 | packed.append(self.data) |
| 5403 | length = sum([len(x) for x in packed]) |
| 5404 | packed[2] = struct.pack("!H", length) |
| 5405 | return ''.join(packed) |
| 5406 | |
| 5407 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5408 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5409 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5410 | _version = reader.read("!B")[0] |
| 5411 | assert(_version == 1) |
| 5412 | _type = reader.read("!B")[0] |
| 5413 | assert(_type == 10) |
| 5414 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5415 | orig_reader = reader |
| 5416 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5417 | obj.xid = reader.read("!L")[0] |
| 5418 | obj.buffer_id = reader.read("!L")[0] |
| 5419 | obj.total_len = reader.read("!H")[0] |
| 5420 | obj.in_port = util.unpack_port_no(reader) |
| 5421 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5422 | reader.skip(1) |
| 5423 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5424 | return obj |
| 5425 | |
| 5426 | def __eq__(self, other): |
| 5427 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5428 | if self.xid != other.xid: return False |
| 5429 | if self.buffer_id != other.buffer_id: return False |
| 5430 | if self.total_len != other.total_len: return False |
| 5431 | if self.in_port != other.in_port: return False |
| 5432 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5433 | if self.data != other.data: return False |
| 5434 | return True |
| 5435 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5436 | def pretty_print(self, q): |
| 5437 | q.text("packet_in {") |
| 5438 | with q.group(): |
| 5439 | with q.indent(2): |
| 5440 | q.breakable() |
| 5441 | q.text("xid = "); |
| 5442 | if self.xid != None: |
| 5443 | q.text("%#x" % self.xid) |
| 5444 | else: |
| 5445 | q.text('None') |
| 5446 | q.text(","); q.breakable() |
| 5447 | q.text("buffer_id = "); |
| 5448 | q.text("%#x" % self.buffer_id) |
| 5449 | q.text(","); q.breakable() |
| 5450 | q.text("total_len = "); |
| 5451 | q.text("%#x" % self.total_len) |
| 5452 | q.text(","); q.breakable() |
| 5453 | q.text("in_port = "); |
| 5454 | q.text(util.pretty_port(self.in_port)) |
| 5455 | q.text(","); q.breakable() |
| 5456 | q.text("reason = "); |
| 5457 | q.text("%#x" % self.reason) |
| 5458 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5459 | q.text("data = "); |
| 5460 | q.pp(self.data) |
| 5461 | q.breakable() |
| 5462 | q.text('}') |
| 5463 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5464 | message.subtypes[10] = packet_in |
| 5465 | |
| 5466 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5467 | version = 1 |
| 5468 | type = 13 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5469 | |
| 5470 | 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] | 5471 | if xid != None: |
| 5472 | self.xid = xid |
| 5473 | else: |
| 5474 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5475 | if buffer_id != None: |
| 5476 | self.buffer_id = buffer_id |
| 5477 | else: |
Rich Lane | ff637c9 | 2013-04-04 13:57:09 -0700 | [diff] [blame] | 5478 | self.buffer_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5479 | if in_port != None: |
| 5480 | self.in_port = in_port |
| 5481 | else: |
| 5482 | self.in_port = 0 |
| 5483 | if actions != None: |
| 5484 | self.actions = actions |
| 5485 | else: |
| 5486 | self.actions = [] |
| 5487 | if data != None: |
| 5488 | self.data = data |
| 5489 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5490 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5491 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5492 | |
| 5493 | def pack(self): |
| 5494 | packed = [] |
| 5495 | packed.append(struct.pack("!B", self.version)) |
| 5496 | packed.append(struct.pack("!B", self.type)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5498 | packed.append(struct.pack("!L", self.xid)) |
| 5499 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5500 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5501 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5502 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5503 | packed[6] = struct.pack("!H", len(packed[-1])) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5504 | packed.append(self.data) |
| 5505 | length = sum([len(x) for x in packed]) |
| 5506 | packed[2] = struct.pack("!H", length) |
| 5507 | return ''.join(packed) |
| 5508 | |
| 5509 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5510 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5511 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5512 | _version = reader.read("!B")[0] |
| 5513 | assert(_version == 1) |
| 5514 | _type = reader.read("!B")[0] |
| 5515 | assert(_type == 13) |
| 5516 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5517 | orig_reader = reader |
| 5518 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5519 | obj.xid = reader.read("!L")[0] |
| 5520 | obj.buffer_id = reader.read("!L")[0] |
| 5521 | obj.in_port = util.unpack_port_no(reader) |
| 5522 | _actions_len = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5523 | 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] | 5524 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5525 | return obj |
| 5526 | |
| 5527 | def __eq__(self, other): |
| 5528 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5529 | if self.xid != other.xid: return False |
| 5530 | if self.buffer_id != other.buffer_id: return False |
| 5531 | if self.in_port != other.in_port: return False |
| 5532 | if self.actions != other.actions: return False |
| 5533 | if self.data != other.data: return False |
| 5534 | return True |
| 5535 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5536 | def pretty_print(self, q): |
| 5537 | q.text("packet_out {") |
| 5538 | with q.group(): |
| 5539 | with q.indent(2): |
| 5540 | q.breakable() |
| 5541 | q.text("xid = "); |
| 5542 | if self.xid != None: |
| 5543 | q.text("%#x" % self.xid) |
| 5544 | else: |
| 5545 | q.text('None') |
| 5546 | q.text(","); q.breakable() |
| 5547 | q.text("buffer_id = "); |
| 5548 | q.text("%#x" % self.buffer_id) |
| 5549 | q.text(","); q.breakable() |
| 5550 | q.text("in_port = "); |
| 5551 | q.text(util.pretty_port(self.in_port)) |
| 5552 | q.text(","); q.breakable() |
| 5553 | q.text("actions = "); |
| 5554 | q.pp(self.actions) |
| 5555 | q.text(","); q.breakable() |
| 5556 | q.text("data = "); |
| 5557 | q.pp(self.data) |
| 5558 | q.breakable() |
| 5559 | q.text('}') |
| 5560 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5561 | message.subtypes[13] = packet_out |
| 5562 | |
| 5563 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5564 | version = 1 |
| 5565 | type = 15 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5566 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5567 | 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] | 5568 | if xid != None: |
| 5569 | self.xid = xid |
| 5570 | else: |
| 5571 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5572 | if port_no != None: |
| 5573 | self.port_no = port_no |
| 5574 | else: |
| 5575 | self.port_no = 0 |
| 5576 | if hw_addr != None: |
| 5577 | self.hw_addr = hw_addr |
| 5578 | else: |
| 5579 | self.hw_addr = [0,0,0,0,0,0] |
| 5580 | if config != None: |
| 5581 | self.config = config |
| 5582 | else: |
| 5583 | self.config = 0 |
| 5584 | if mask != None: |
| 5585 | self.mask = mask |
| 5586 | else: |
| 5587 | self.mask = 0 |
| 5588 | if advertise != None: |
| 5589 | self.advertise = advertise |
| 5590 | else: |
| 5591 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5592 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5593 | |
| 5594 | def pack(self): |
| 5595 | packed = [] |
| 5596 | packed.append(struct.pack("!B", self.version)) |
| 5597 | packed.append(struct.pack("!B", self.type)) |
| 5598 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5599 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5600 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5601 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 5602 | packed.append(struct.pack("!L", self.config)) |
| 5603 | packed.append(struct.pack("!L", self.mask)) |
| 5604 | packed.append(struct.pack("!L", self.advertise)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5605 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5606 | length = sum([len(x) for x in packed]) |
| 5607 | packed[2] = struct.pack("!H", length) |
| 5608 | return ''.join(packed) |
| 5609 | |
| 5610 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5611 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5612 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5613 | _version = reader.read("!B")[0] |
| 5614 | assert(_version == 1) |
| 5615 | _type = reader.read("!B")[0] |
| 5616 | assert(_type == 15) |
| 5617 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5618 | orig_reader = reader |
| 5619 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5620 | obj.xid = reader.read("!L")[0] |
| 5621 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5622 | obj.hw_addr = list(reader.read('!6B')) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5623 | obj.config = reader.read("!L")[0] |
| 5624 | obj.mask = reader.read("!L")[0] |
| 5625 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5626 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5627 | return obj |
| 5628 | |
| 5629 | def __eq__(self, other): |
| 5630 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5631 | if self.xid != other.xid: return False |
| 5632 | if self.port_no != other.port_no: return False |
| 5633 | if self.hw_addr != other.hw_addr: return False |
| 5634 | if self.config != other.config: return False |
| 5635 | if self.mask != other.mask: return False |
| 5636 | if self.advertise != other.advertise: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5637 | return True |
| 5638 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5639 | def pretty_print(self, q): |
| 5640 | q.text("port_mod {") |
| 5641 | with q.group(): |
| 5642 | with q.indent(2): |
| 5643 | q.breakable() |
| 5644 | q.text("xid = "); |
| 5645 | if self.xid != None: |
| 5646 | q.text("%#x" % self.xid) |
| 5647 | else: |
| 5648 | q.text('None') |
| 5649 | q.text(","); q.breakable() |
| 5650 | q.text("port_no = "); |
| 5651 | q.text(util.pretty_port(self.port_no)) |
| 5652 | q.text(","); q.breakable() |
| 5653 | q.text("hw_addr = "); |
| 5654 | q.text(util.pretty_mac(self.hw_addr)) |
| 5655 | q.text(","); q.breakable() |
| 5656 | q.text("config = "); |
| 5657 | q.text("%#x" % self.config) |
| 5658 | q.text(","); q.breakable() |
| 5659 | q.text("mask = "); |
| 5660 | q.text("%#x" % self.mask) |
| 5661 | q.text(","); q.breakable() |
| 5662 | q.text("advertise = "); |
| 5663 | q.text("%#x" % self.advertise) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5664 | q.breakable() |
| 5665 | q.text('}') |
| 5666 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5667 | message.subtypes[15] = port_mod |
| 5668 | |
| 5669 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5670 | version = 1 |
| 5671 | type = 1 |
| 5672 | err_type = 4 |
| 5673 | |
| 5674 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5675 | if xid != None: |
| 5676 | self.xid = xid |
| 5677 | else: |
| 5678 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5679 | if code != None: |
| 5680 | self.code = code |
| 5681 | else: |
| 5682 | self.code = 0 |
| 5683 | if data != None: |
| 5684 | self.data = data |
| 5685 | else: |
| 5686 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5687 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5688 | |
| 5689 | def pack(self): |
| 5690 | packed = [] |
| 5691 | packed.append(struct.pack("!B", self.version)) |
| 5692 | packed.append(struct.pack("!B", self.type)) |
| 5693 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5694 | packed.append(struct.pack("!L", self.xid)) |
| 5695 | packed.append(struct.pack("!H", self.err_type)) |
| 5696 | packed.append(struct.pack("!H", self.code)) |
| 5697 | packed.append(self.data) |
| 5698 | length = sum([len(x) for x in packed]) |
| 5699 | packed[2] = struct.pack("!H", length) |
| 5700 | return ''.join(packed) |
| 5701 | |
| 5702 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5703 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5704 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5705 | _version = reader.read("!B")[0] |
| 5706 | assert(_version == 1) |
| 5707 | _type = reader.read("!B")[0] |
| 5708 | assert(_type == 1) |
| 5709 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5710 | orig_reader = reader |
| 5711 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5712 | obj.xid = reader.read("!L")[0] |
| 5713 | _err_type = reader.read("!H")[0] |
| 5714 | assert(_err_type == 4) |
| 5715 | obj.code = reader.read("!H")[0] |
| 5716 | obj.data = str(reader.read_all()) |
| 5717 | return obj |
| 5718 | |
| 5719 | def __eq__(self, other): |
| 5720 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5721 | if self.xid != other.xid: return False |
| 5722 | if self.code != other.code: return False |
| 5723 | if self.data != other.data: return False |
| 5724 | return True |
| 5725 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5726 | def pretty_print(self, q): |
| 5727 | q.text("port_mod_failed_error_msg {") |
| 5728 | with q.group(): |
| 5729 | with q.indent(2): |
| 5730 | q.breakable() |
| 5731 | q.text("xid = "); |
| 5732 | if self.xid != None: |
| 5733 | q.text("%#x" % self.xid) |
| 5734 | else: |
| 5735 | q.text('None') |
| 5736 | q.text(","); q.breakable() |
| 5737 | q.text("code = "); |
| 5738 | q.text("%#x" % self.code) |
| 5739 | q.text(","); q.breakable() |
| 5740 | q.text("data = "); |
| 5741 | q.pp(self.data) |
| 5742 | q.breakable() |
| 5743 | q.text('}') |
| 5744 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5745 | error_msg.subtypes[4] = port_mod_failed_error_msg |
| 5746 | |
| 5747 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5748 | version = 1 |
| 5749 | type = 17 |
| 5750 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5751 | |
| 5752 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5753 | if xid != None: |
| 5754 | self.xid = xid |
| 5755 | else: |
| 5756 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5757 | if flags != None: |
| 5758 | self.flags = flags |
| 5759 | else: |
| 5760 | self.flags = 0 |
| 5761 | if entries != None: |
| 5762 | self.entries = entries |
| 5763 | else: |
| 5764 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5765 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5766 | |
| 5767 | def pack(self): |
| 5768 | packed = [] |
| 5769 | packed.append(struct.pack("!B", self.version)) |
| 5770 | packed.append(struct.pack("!B", self.type)) |
| 5771 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5772 | packed.append(struct.pack("!L", self.xid)) |
| 5773 | packed.append(struct.pack("!H", self.stats_type)) |
| 5774 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5775 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5776 | length = sum([len(x) for x in packed]) |
| 5777 | packed[2] = struct.pack("!H", length) |
| 5778 | return ''.join(packed) |
| 5779 | |
| 5780 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5781 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5782 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5783 | _version = reader.read("!B")[0] |
| 5784 | assert(_version == 1) |
| 5785 | _type = reader.read("!B")[0] |
| 5786 | assert(_type == 17) |
| 5787 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5788 | orig_reader = reader |
| 5789 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5790 | obj.xid = reader.read("!L")[0] |
| 5791 | _stats_type = reader.read("!H")[0] |
| 5792 | assert(_stats_type == 4) |
| 5793 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5794 | obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5795 | return obj |
| 5796 | |
| 5797 | def __eq__(self, other): |
| 5798 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5799 | if self.xid != other.xid: return False |
| 5800 | if self.flags != other.flags: return False |
| 5801 | if self.entries != other.entries: return False |
| 5802 | return True |
| 5803 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5804 | def pretty_print(self, q): |
| 5805 | q.text("port_stats_reply {") |
| 5806 | with q.group(): |
| 5807 | with q.indent(2): |
| 5808 | q.breakable() |
| 5809 | q.text("xid = "); |
| 5810 | if self.xid != None: |
| 5811 | q.text("%#x" % self.xid) |
| 5812 | else: |
| 5813 | q.text('None') |
| 5814 | q.text(","); q.breakable() |
| 5815 | q.text("flags = "); |
| 5816 | q.text("%#x" % self.flags) |
| 5817 | q.text(","); q.breakable() |
| 5818 | q.text("entries = "); |
| 5819 | q.pp(self.entries) |
| 5820 | q.breakable() |
| 5821 | q.text('}') |
| 5822 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5823 | stats_reply.subtypes[4] = port_stats_reply |
| 5824 | |
| 5825 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5826 | version = 1 |
| 5827 | type = 16 |
| 5828 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5829 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5830 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5831 | if xid != None: |
| 5832 | self.xid = xid |
| 5833 | else: |
| 5834 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5835 | if flags != None: |
| 5836 | self.flags = flags |
| 5837 | else: |
| 5838 | self.flags = 0 |
| 5839 | if port_no != None: |
| 5840 | self.port_no = port_no |
| 5841 | else: |
| 5842 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5843 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5844 | |
| 5845 | def pack(self): |
| 5846 | packed = [] |
| 5847 | packed.append(struct.pack("!B", self.version)) |
| 5848 | packed.append(struct.pack("!B", self.type)) |
| 5849 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5850 | packed.append(struct.pack("!L", self.xid)) |
| 5851 | packed.append(struct.pack("!H", self.stats_type)) |
| 5852 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5853 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5854 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5855 | length = sum([len(x) for x in packed]) |
| 5856 | packed[2] = struct.pack("!H", length) |
| 5857 | return ''.join(packed) |
| 5858 | |
| 5859 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5860 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5861 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5862 | _version = reader.read("!B")[0] |
| 5863 | assert(_version == 1) |
| 5864 | _type = reader.read("!B")[0] |
| 5865 | assert(_type == 16) |
| 5866 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5867 | orig_reader = reader |
| 5868 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5869 | obj.xid = reader.read("!L")[0] |
| 5870 | _stats_type = reader.read("!H")[0] |
| 5871 | assert(_stats_type == 4) |
| 5872 | obj.flags = reader.read("!H")[0] |
| 5873 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5874 | reader.skip(6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5875 | return obj |
| 5876 | |
| 5877 | def __eq__(self, other): |
| 5878 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5879 | if self.xid != other.xid: return False |
| 5880 | if self.flags != other.flags: return False |
| 5881 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5882 | return True |
| 5883 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5884 | def pretty_print(self, q): |
| 5885 | q.text("port_stats_request {") |
| 5886 | with q.group(): |
| 5887 | with q.indent(2): |
| 5888 | q.breakable() |
| 5889 | q.text("xid = "); |
| 5890 | if self.xid != None: |
| 5891 | q.text("%#x" % self.xid) |
| 5892 | else: |
| 5893 | q.text('None') |
| 5894 | q.text(","); q.breakable() |
| 5895 | q.text("flags = "); |
| 5896 | q.text("%#x" % self.flags) |
| 5897 | q.text(","); q.breakable() |
| 5898 | q.text("port_no = "); |
| 5899 | q.text(util.pretty_port(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5900 | q.breakable() |
| 5901 | q.text('}') |
| 5902 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5903 | stats_request.subtypes[4] = port_stats_request |
| 5904 | |
| 5905 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5906 | version = 1 |
| 5907 | type = 12 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5908 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5909 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5910 | if xid != None: |
| 5911 | self.xid = xid |
| 5912 | else: |
| 5913 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5914 | if reason != None: |
| 5915 | self.reason = reason |
| 5916 | else: |
| 5917 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5918 | if desc != None: |
| 5919 | self.desc = desc |
| 5920 | else: |
| 5921 | self.desc = common.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5922 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5923 | |
| 5924 | def pack(self): |
| 5925 | packed = [] |
| 5926 | packed.append(struct.pack("!B", self.version)) |
| 5927 | packed.append(struct.pack("!B", self.type)) |
| 5928 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5929 | packed.append(struct.pack("!L", self.xid)) |
| 5930 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5931 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5932 | packed.append(self.desc.pack()) |
| 5933 | length = sum([len(x) for x in packed]) |
| 5934 | packed[2] = struct.pack("!H", length) |
| 5935 | return ''.join(packed) |
| 5936 | |
| 5937 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5938 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5939 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5940 | _version = reader.read("!B")[0] |
| 5941 | assert(_version == 1) |
| 5942 | _type = reader.read("!B")[0] |
| 5943 | assert(_type == 12) |
| 5944 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5945 | orig_reader = reader |
| 5946 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5947 | obj.xid = reader.read("!L")[0] |
| 5948 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5949 | reader.skip(7) |
| 5950 | obj.desc = common.port_desc.unpack(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5951 | return obj |
| 5952 | |
| 5953 | def __eq__(self, other): |
| 5954 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5955 | if self.xid != other.xid: return False |
| 5956 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5957 | if self.desc != other.desc: return False |
| 5958 | return True |
| 5959 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5960 | def pretty_print(self, q): |
| 5961 | q.text("port_status {") |
| 5962 | with q.group(): |
| 5963 | with q.indent(2): |
| 5964 | q.breakable() |
| 5965 | q.text("xid = "); |
| 5966 | if self.xid != None: |
| 5967 | q.text("%#x" % self.xid) |
| 5968 | else: |
| 5969 | q.text('None') |
| 5970 | q.text(","); q.breakable() |
| 5971 | q.text("reason = "); |
| 5972 | q.text("%#x" % self.reason) |
| 5973 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5974 | q.text("desc = "); |
| 5975 | q.pp(self.desc) |
| 5976 | q.breakable() |
| 5977 | q.text('}') |
| 5978 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5979 | message.subtypes[12] = port_status |
| 5980 | |
| 5981 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5982 | version = 1 |
| 5983 | type = 21 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5984 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5985 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5986 | if xid != None: |
| 5987 | self.xid = xid |
| 5988 | else: |
| 5989 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5990 | if port != None: |
| 5991 | self.port = port |
| 5992 | else: |
| 5993 | self.port = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5994 | if queues != None: |
| 5995 | self.queues = queues |
| 5996 | else: |
| 5997 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5998 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -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)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6006 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6007 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6008 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 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): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6015 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6016 | _version = reader.read("!B")[0] |
| 6017 | assert(_version == 1) |
| 6018 | _type = reader.read("!B")[0] |
| 6019 | assert(_type == 21) |
| 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 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6025 | reader.skip(6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6026 | obj.queues = loxi.generic_util.unpack_list(reader, common.packet_queue.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6027 | return obj |
| 6028 | |
| 6029 | def __eq__(self, other): |
| 6030 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6031 | if self.xid != other.xid: return False |
| 6032 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6033 | if self.queues != other.queues: return False |
| 6034 | return True |
| 6035 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6036 | def pretty_print(self, q): |
| 6037 | q.text("queue_get_config_reply {") |
| 6038 | with q.group(): |
| 6039 | with q.indent(2): |
| 6040 | q.breakable() |
| 6041 | q.text("xid = "); |
| 6042 | if self.xid != None: |
| 6043 | q.text("%#x" % self.xid) |
| 6044 | else: |
| 6045 | q.text('None') |
| 6046 | q.text(","); q.breakable() |
| 6047 | q.text("port = "); |
| 6048 | q.text(util.pretty_port(self.port)) |
| 6049 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6050 | q.text("queues = "); |
| 6051 | q.pp(self.queues) |
| 6052 | q.breakable() |
| 6053 | q.text('}') |
| 6054 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6055 | message.subtypes[21] = queue_get_config_reply |
| 6056 | |
| 6057 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6058 | version = 1 |
| 6059 | type = 20 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6060 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6061 | def __init__(self, xid=None, port=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 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6066 | if port != None: |
| 6067 | self.port = port |
| 6068 | else: |
| 6069 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6070 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -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)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6078 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6079 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6080 | length = sum([len(x) for x in packed]) |
| 6081 | packed[2] = struct.pack("!H", length) |
| 6082 | return ''.join(packed) |
| 6083 | |
| 6084 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6085 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6086 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6087 | _version = reader.read("!B")[0] |
| 6088 | assert(_version == 1) |
| 6089 | _type = reader.read("!B")[0] |
| 6090 | assert(_type == 20) |
| 6091 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6092 | orig_reader = reader |
| 6093 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6094 | obj.xid = reader.read("!L")[0] |
| 6095 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6096 | reader.skip(2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6097 | return obj |
| 6098 | |
| 6099 | def __eq__(self, other): |
| 6100 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6101 | if self.xid != other.xid: return False |
| 6102 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6103 | return True |
| 6104 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6105 | def pretty_print(self, q): |
| 6106 | q.text("queue_get_config_request {") |
| 6107 | with q.group(): |
| 6108 | with q.indent(2): |
| 6109 | q.breakable() |
| 6110 | q.text("xid = "); |
| 6111 | if self.xid != None: |
| 6112 | q.text("%#x" % self.xid) |
| 6113 | else: |
| 6114 | q.text('None') |
| 6115 | q.text(","); q.breakable() |
| 6116 | q.text("port = "); |
| 6117 | q.text(util.pretty_port(self.port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6118 | q.breakable() |
| 6119 | q.text('}') |
| 6120 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6121 | message.subtypes[20] = queue_get_config_request |
| 6122 | |
| 6123 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6124 | version = 1 |
| 6125 | type = 1 |
| 6126 | err_type = 5 |
| 6127 | |
| 6128 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6129 | if xid != None: |
| 6130 | self.xid = xid |
| 6131 | else: |
| 6132 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6133 | if code != None: |
| 6134 | self.code = code |
| 6135 | else: |
| 6136 | self.code = 0 |
| 6137 | if data != None: |
| 6138 | self.data = data |
| 6139 | else: |
| 6140 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6141 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6142 | |
| 6143 | def pack(self): |
| 6144 | packed = [] |
| 6145 | packed.append(struct.pack("!B", self.version)) |
| 6146 | packed.append(struct.pack("!B", self.type)) |
| 6147 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6148 | packed.append(struct.pack("!L", self.xid)) |
| 6149 | packed.append(struct.pack("!H", self.err_type)) |
| 6150 | packed.append(struct.pack("!H", self.code)) |
| 6151 | packed.append(self.data) |
| 6152 | length = sum([len(x) for x in packed]) |
| 6153 | packed[2] = struct.pack("!H", length) |
| 6154 | return ''.join(packed) |
| 6155 | |
| 6156 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6157 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6158 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6159 | _version = reader.read("!B")[0] |
| 6160 | assert(_version == 1) |
| 6161 | _type = reader.read("!B")[0] |
| 6162 | assert(_type == 1) |
| 6163 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6164 | orig_reader = reader |
| 6165 | reader = orig_reader.slice(_length - (2 + 2)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6166 | obj.xid = reader.read("!L")[0] |
| 6167 | _err_type = reader.read("!H")[0] |
| 6168 | assert(_err_type == 5) |
| 6169 | obj.code = reader.read("!H")[0] |
| 6170 | obj.data = str(reader.read_all()) |
| 6171 | return obj |
| 6172 | |
| 6173 | def __eq__(self, other): |
| 6174 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6175 | if self.xid != other.xid: return False |
| 6176 | if self.code != other.code: return False |
| 6177 | if self.data != other.data: return False |
| 6178 | return True |
| 6179 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6180 | def pretty_print(self, q): |
| 6181 | q.text("queue_op_failed_error_msg {") |
| 6182 | with q.group(): |
| 6183 | with q.indent(2): |
| 6184 | q.breakable() |
| 6185 | q.text("xid = "); |
| 6186 | if self.xid != None: |
| 6187 | q.text("%#x" % self.xid) |
| 6188 | else: |
| 6189 | q.text('None') |
| 6190 | q.text(","); q.breakable() |
| 6191 | q.text("code = "); |
| 6192 | q.text("%#x" % self.code) |
| 6193 | q.text(","); q.breakable() |
| 6194 | q.text("data = "); |
| 6195 | q.pp(self.data) |
| 6196 | q.breakable() |
| 6197 | q.text('}') |
| 6198 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6199 | error_msg.subtypes[5] = queue_op_failed_error_msg |
| 6200 | |
| 6201 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6202 | version = 1 |
| 6203 | type = 17 |
| 6204 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6205 | |
| 6206 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6207 | if xid != None: |
| 6208 | self.xid = xid |
| 6209 | else: |
| 6210 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 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 = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6219 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 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)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6229 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6230 | length = sum([len(x) for x in packed]) |
| 6231 | packed[2] = struct.pack("!H", length) |
| 6232 | return ''.join(packed) |
| 6233 | |
| 6234 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6235 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6236 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6237 | _version = reader.read("!B")[0] |
| 6238 | assert(_version == 1) |
| 6239 | _type = reader.read("!B")[0] |
| 6240 | assert(_type == 17) |
| 6241 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6242 | orig_reader = reader |
| 6243 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6244 | obj.xid = reader.read("!L")[0] |
| 6245 | _stats_type = reader.read("!H")[0] |
| 6246 | assert(_stats_type == 5) |
| 6247 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6248 | obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6249 | return obj |
| 6250 | |
| 6251 | def __eq__(self, other): |
| 6252 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6253 | if self.xid != other.xid: return False |
| 6254 | if self.flags != other.flags: return False |
| 6255 | if self.entries != other.entries: return False |
| 6256 | return True |
| 6257 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6258 | def pretty_print(self, q): |
| 6259 | q.text("queue_stats_reply {") |
| 6260 | with q.group(): |
| 6261 | with q.indent(2): |
| 6262 | q.breakable() |
| 6263 | q.text("xid = "); |
| 6264 | if self.xid != None: |
| 6265 | q.text("%#x" % self.xid) |
| 6266 | else: |
| 6267 | q.text('None') |
| 6268 | q.text(","); q.breakable() |
| 6269 | q.text("flags = "); |
| 6270 | q.text("%#x" % self.flags) |
| 6271 | q.text(","); q.breakable() |
| 6272 | q.text("entries = "); |
| 6273 | q.pp(self.entries) |
| 6274 | q.breakable() |
| 6275 | q.text('}') |
| 6276 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6277 | stats_reply.subtypes[5] = queue_stats_reply |
| 6278 | |
| 6279 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6280 | version = 1 |
| 6281 | type = 16 |
| 6282 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6283 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6284 | 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] | 6285 | if xid != None: |
| 6286 | self.xid = xid |
| 6287 | else: |
| 6288 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6289 | if flags != None: |
| 6290 | self.flags = flags |
| 6291 | else: |
| 6292 | self.flags = 0 |
| 6293 | if port_no != None: |
| 6294 | self.port_no = port_no |
| 6295 | else: |
| 6296 | self.port_no = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6297 | if queue_id != None: |
| 6298 | self.queue_id = queue_id |
| 6299 | else: |
| 6300 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6301 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6302 | |
| 6303 | def pack(self): |
| 6304 | packed = [] |
| 6305 | packed.append(struct.pack("!B", self.version)) |
| 6306 | packed.append(struct.pack("!B", self.type)) |
| 6307 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6308 | packed.append(struct.pack("!L", self.xid)) |
| 6309 | packed.append(struct.pack("!H", self.stats_type)) |
| 6310 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6311 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6312 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6313 | packed.append(struct.pack("!L", self.queue_id)) |
| 6314 | length = sum([len(x) for x in packed]) |
| 6315 | packed[2] = struct.pack("!H", length) |
| 6316 | return ''.join(packed) |
| 6317 | |
| 6318 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6319 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6320 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6321 | _version = reader.read("!B")[0] |
| 6322 | assert(_version == 1) |
| 6323 | _type = reader.read("!B")[0] |
| 6324 | assert(_type == 16) |
| 6325 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6326 | orig_reader = reader |
| 6327 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6328 | obj.xid = reader.read("!L")[0] |
| 6329 | _stats_type = reader.read("!H")[0] |
| 6330 | assert(_stats_type == 5) |
| 6331 | obj.flags = reader.read("!H")[0] |
| 6332 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6333 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6334 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6335 | return obj |
| 6336 | |
| 6337 | def __eq__(self, other): |
| 6338 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6339 | if self.xid != other.xid: return False |
| 6340 | if self.flags != other.flags: return False |
| 6341 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6342 | if self.queue_id != other.queue_id: return False |
| 6343 | return True |
| 6344 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6345 | def pretty_print(self, q): |
| 6346 | q.text("queue_stats_request {") |
| 6347 | with q.group(): |
| 6348 | with q.indent(2): |
| 6349 | q.breakable() |
| 6350 | q.text("xid = "); |
| 6351 | if self.xid != None: |
| 6352 | q.text("%#x" % self.xid) |
| 6353 | else: |
| 6354 | q.text('None') |
| 6355 | q.text(","); q.breakable() |
| 6356 | q.text("flags = "); |
| 6357 | q.text("%#x" % self.flags) |
| 6358 | q.text(","); q.breakable() |
| 6359 | q.text("port_no = "); |
| 6360 | q.text(util.pretty_port(self.port_no)) |
| 6361 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6362 | q.text("queue_id = "); |
| 6363 | q.text("%#x" % self.queue_id) |
| 6364 | q.breakable() |
| 6365 | q.text('}') |
| 6366 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6367 | stats_request.subtypes[5] = queue_stats_request |
| 6368 | |
| 6369 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6370 | version = 1 |
| 6371 | type = 9 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6372 | |
| 6373 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6374 | if xid != None: |
| 6375 | self.xid = xid |
| 6376 | else: |
| 6377 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6378 | if flags != None: |
| 6379 | self.flags = flags |
| 6380 | else: |
| 6381 | self.flags = 0 |
| 6382 | if miss_send_len != None: |
| 6383 | self.miss_send_len = miss_send_len |
| 6384 | else: |
| 6385 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6386 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6387 | |
| 6388 | def pack(self): |
| 6389 | packed = [] |
| 6390 | packed.append(struct.pack("!B", self.version)) |
| 6391 | packed.append(struct.pack("!B", self.type)) |
| 6392 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6393 | packed.append(struct.pack("!L", self.xid)) |
| 6394 | packed.append(struct.pack("!H", self.flags)) |
| 6395 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 6396 | length = sum([len(x) for x in packed]) |
| 6397 | packed[2] = struct.pack("!H", length) |
| 6398 | return ''.join(packed) |
| 6399 | |
| 6400 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6401 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6402 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6403 | _version = reader.read("!B")[0] |
| 6404 | assert(_version == 1) |
| 6405 | _type = reader.read("!B")[0] |
| 6406 | assert(_type == 9) |
| 6407 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6408 | orig_reader = reader |
| 6409 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6410 | obj.xid = reader.read("!L")[0] |
| 6411 | obj.flags = reader.read("!H")[0] |
| 6412 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6413 | return obj |
| 6414 | |
| 6415 | def __eq__(self, other): |
| 6416 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6417 | if self.xid != other.xid: return False |
| 6418 | if self.flags != other.flags: return False |
| 6419 | if self.miss_send_len != other.miss_send_len: return False |
| 6420 | return True |
| 6421 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6422 | def pretty_print(self, q): |
| 6423 | q.text("set_config {") |
| 6424 | with q.group(): |
| 6425 | with q.indent(2): |
| 6426 | q.breakable() |
| 6427 | q.text("xid = "); |
| 6428 | if self.xid != None: |
| 6429 | q.text("%#x" % self.xid) |
| 6430 | else: |
| 6431 | q.text('None') |
| 6432 | q.text(","); q.breakable() |
| 6433 | q.text("flags = "); |
| 6434 | q.text("%#x" % self.flags) |
| 6435 | q.text(","); q.breakable() |
| 6436 | q.text("miss_send_len = "); |
| 6437 | q.text("%#x" % self.miss_send_len) |
| 6438 | q.breakable() |
| 6439 | q.text('}') |
| 6440 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6441 | message.subtypes[9] = set_config |
| 6442 | |
| 6443 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6444 | version = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6445 | type = 22 |
| 6446 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6447 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6448 | if xid != None: |
| 6449 | self.xid = xid |
| 6450 | else: |
| 6451 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6452 | if table_id != None: |
| 6453 | self.table_id = table_id |
| 6454 | else: |
| 6455 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6456 | if config != None: |
| 6457 | self.config = config |
| 6458 | else: |
| 6459 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6460 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6461 | |
| 6462 | def pack(self): |
| 6463 | packed = [] |
| 6464 | packed.append(struct.pack("!B", self.version)) |
| 6465 | packed.append(struct.pack("!B", self.type)) |
| 6466 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6467 | packed.append(struct.pack("!L", self.xid)) |
| 6468 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6469 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6470 | packed.append(struct.pack("!L", self.config)) |
| 6471 | length = sum([len(x) for x in packed]) |
| 6472 | packed[2] = struct.pack("!H", length) |
| 6473 | return ''.join(packed) |
| 6474 | |
| 6475 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6476 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6477 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6478 | _version = reader.read("!B")[0] |
| 6479 | assert(_version == 1) |
| 6480 | _type = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6481 | assert(_type == 22) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6482 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6483 | orig_reader = reader |
| 6484 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6485 | obj.xid = reader.read("!L")[0] |
| 6486 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6487 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6488 | obj.config = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6489 | return obj |
| 6490 | |
| 6491 | def __eq__(self, other): |
| 6492 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6493 | if self.xid != other.xid: return False |
| 6494 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6495 | if self.config != other.config: return False |
| 6496 | return True |
| 6497 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6498 | def pretty_print(self, q): |
| 6499 | q.text("table_mod {") |
| 6500 | with q.group(): |
| 6501 | with q.indent(2): |
| 6502 | q.breakable() |
| 6503 | q.text("xid = "); |
| 6504 | if self.xid != None: |
| 6505 | q.text("%#x" % self.xid) |
| 6506 | else: |
| 6507 | q.text('None') |
| 6508 | q.text(","); q.breakable() |
| 6509 | q.text("table_id = "); |
| 6510 | q.text("%#x" % self.table_id) |
| 6511 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6512 | q.text("config = "); |
| 6513 | q.text("%#x" % self.config) |
| 6514 | q.breakable() |
| 6515 | q.text('}') |
| 6516 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6517 | message.subtypes[22] = table_mod |
| 6518 | |
| 6519 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6520 | version = 1 |
| 6521 | type = 17 |
| 6522 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6523 | |
| 6524 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6525 | if xid != None: |
| 6526 | self.xid = xid |
| 6527 | else: |
| 6528 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6529 | if flags != None: |
| 6530 | self.flags = flags |
| 6531 | else: |
| 6532 | self.flags = 0 |
| 6533 | if entries != None: |
| 6534 | self.entries = entries |
| 6535 | else: |
| 6536 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6537 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6538 | |
| 6539 | def pack(self): |
| 6540 | packed = [] |
| 6541 | packed.append(struct.pack("!B", self.version)) |
| 6542 | packed.append(struct.pack("!B", self.type)) |
| 6543 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6544 | packed.append(struct.pack("!L", self.xid)) |
| 6545 | packed.append(struct.pack("!H", self.stats_type)) |
| 6546 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6547 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6548 | length = sum([len(x) for x in packed]) |
| 6549 | packed[2] = struct.pack("!H", length) |
| 6550 | return ''.join(packed) |
| 6551 | |
| 6552 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6553 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6554 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6555 | _version = reader.read("!B")[0] |
| 6556 | assert(_version == 1) |
| 6557 | _type = reader.read("!B")[0] |
| 6558 | assert(_type == 17) |
| 6559 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6560 | orig_reader = reader |
| 6561 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6562 | obj.xid = reader.read("!L")[0] |
| 6563 | _stats_type = reader.read("!H")[0] |
| 6564 | assert(_stats_type == 3) |
| 6565 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6566 | obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6567 | return obj |
| 6568 | |
| 6569 | def __eq__(self, other): |
| 6570 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6571 | if self.xid != other.xid: return False |
| 6572 | if self.flags != other.flags: return False |
| 6573 | if self.entries != other.entries: return False |
| 6574 | return True |
| 6575 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6576 | def pretty_print(self, q): |
| 6577 | q.text("table_stats_reply {") |
| 6578 | with q.group(): |
| 6579 | with q.indent(2): |
| 6580 | q.breakable() |
| 6581 | q.text("xid = "); |
| 6582 | if self.xid != None: |
| 6583 | q.text("%#x" % self.xid) |
| 6584 | else: |
| 6585 | q.text('None') |
| 6586 | q.text(","); q.breakable() |
| 6587 | q.text("flags = "); |
| 6588 | q.text("%#x" % self.flags) |
| 6589 | q.text(","); q.breakable() |
| 6590 | q.text("entries = "); |
| 6591 | q.pp(self.entries) |
| 6592 | q.breakable() |
| 6593 | q.text('}') |
| 6594 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6595 | stats_reply.subtypes[3] = table_stats_reply |
| 6596 | |
| 6597 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6598 | version = 1 |
| 6599 | type = 16 |
| 6600 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6601 | |
| 6602 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6603 | if xid != None: |
| 6604 | self.xid = xid |
| 6605 | else: |
| 6606 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6607 | if flags != None: |
| 6608 | self.flags = flags |
| 6609 | else: |
| 6610 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6611 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6612 | |
| 6613 | def pack(self): |
| 6614 | packed = [] |
| 6615 | packed.append(struct.pack("!B", self.version)) |
| 6616 | packed.append(struct.pack("!B", self.type)) |
| 6617 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6618 | packed.append(struct.pack("!L", self.xid)) |
| 6619 | packed.append(struct.pack("!H", self.stats_type)) |
| 6620 | packed.append(struct.pack("!H", self.flags)) |
| 6621 | length = sum([len(x) for x in packed]) |
| 6622 | packed[2] = struct.pack("!H", length) |
| 6623 | return ''.join(packed) |
| 6624 | |
| 6625 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6626 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6627 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6628 | _version = reader.read("!B")[0] |
| 6629 | assert(_version == 1) |
| 6630 | _type = reader.read("!B")[0] |
| 6631 | assert(_type == 16) |
| 6632 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6633 | orig_reader = reader |
| 6634 | reader = orig_reader.slice(_length - (2 + 2)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6635 | obj.xid = reader.read("!L")[0] |
| 6636 | _stats_type = reader.read("!H")[0] |
| 6637 | assert(_stats_type == 3) |
| 6638 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6639 | return obj |
| 6640 | |
| 6641 | def __eq__(self, other): |
| 6642 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6643 | if self.xid != other.xid: return False |
| 6644 | if self.flags != other.flags: return False |
| 6645 | return True |
| 6646 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6647 | def pretty_print(self, q): |
| 6648 | q.text("table_stats_request {") |
| 6649 | with q.group(): |
| 6650 | with q.indent(2): |
| 6651 | q.breakable() |
| 6652 | q.text("xid = "); |
| 6653 | if self.xid != None: |
| 6654 | q.text("%#x" % self.xid) |
| 6655 | else: |
| 6656 | q.text('None') |
| 6657 | q.text(","); q.breakable() |
| 6658 | q.text("flags = "); |
| 6659 | q.text("%#x" % self.flags) |
| 6660 | q.breakable() |
| 6661 | q.text('}') |
| 6662 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6663 | stats_request.subtypes[3] = table_stats_request |
| 6664 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6665 | |
| 6666 | def parse_header(buf): |
| 6667 | if len(buf) < 8: |
| 6668 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 6669 | return struct.unpack_from("!BBHL", buf) |
| 6670 | |
| 6671 | def parse_message(buf): |
| 6672 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | fe600f5 | 2013-07-09 13:22:32 -0700 | [diff] [blame] | 6673 | if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO: |
| 6674 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6675 | if len(buf) != msg_len: |
| 6676 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6677 | return message.unpack(loxi.generic_util.OFReader(buf)) |