Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6 | # Automatically generated by LOXI from template module.py |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11 | import util |
| 12 | import loxi.generic_util |
| 13 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14 | import sys |
| 15 | ofp = sys.modules['loxi.of12'] |
| 16 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 17 | class message(loxi.OFObject): |
| 18 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 19 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 20 | version = 3 |
| 21 | |
| 22 | def __init__(self, type=None, xid=None): |
| 23 | if type != None: |
| 24 | self.type = type |
| 25 | else: |
| 26 | self.type = 0 |
| 27 | if xid != None: |
| 28 | self.xid = xid |
| 29 | else: |
| 30 | self.xid = None |
| 31 | return |
| 32 | |
| 33 | def pack(self): |
| 34 | packed = [] |
| 35 | packed.append(struct.pack("!B", self.version)) |
| 36 | packed.append(struct.pack("!B", self.type)) |
| 37 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 38 | packed.append(struct.pack("!L", self.xid)) |
| 39 | length = sum([len(x) for x in packed]) |
| 40 | packed[2] = struct.pack("!H", length) |
| 41 | return ''.join(packed) |
| 42 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 43 | @staticmethod |
| 44 | def unpack(reader): |
| 45 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 46 | subclass = message.subtypes.get(subtype) |
| 47 | if subclass: |
| 48 | return subclass.unpack(reader) |
| 49 | |
| 50 | obj = message() |
| 51 | _version = reader.read("!B")[0] |
| 52 | assert(_version == 3) |
| 53 | obj.type = reader.read("!B")[0] |
| 54 | _length = reader.read("!H")[0] |
| 55 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 56 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 57 | obj.xid = reader.read("!L")[0] |
| 58 | return obj |
| 59 | |
| 60 | def __eq__(self, other): |
| 61 | if type(self) != type(other): return False |
| 62 | if self.type != other.type: return False |
| 63 | if self.xid != other.xid: return False |
| 64 | return True |
| 65 | |
| 66 | def pretty_print(self, q): |
| 67 | q.text("message {") |
| 68 | with q.group(): |
| 69 | with q.indent(2): |
| 70 | q.breakable() |
| 71 | q.text("xid = "); |
| 72 | if self.xid != None: |
| 73 | q.text("%#x" % self.xid) |
| 74 | else: |
| 75 | q.text('None') |
| 76 | q.breakable() |
| 77 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 78 | |
| 79 | |
| 80 | class stats_reply(message): |
| 81 | subtypes = {} |
| 82 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 83 | version = 3 |
| 84 | type = 19 |
| 85 | |
| 86 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 87 | if xid != None: |
| 88 | self.xid = xid |
| 89 | else: |
| 90 | self.xid = None |
| 91 | if stats_type != None: |
| 92 | self.stats_type = stats_type |
| 93 | else: |
| 94 | self.stats_type = 0 |
| 95 | if flags != None: |
| 96 | self.flags = flags |
| 97 | else: |
| 98 | self.flags = 0 |
| 99 | return |
| 100 | |
| 101 | def pack(self): |
| 102 | packed = [] |
| 103 | packed.append(struct.pack("!B", self.version)) |
| 104 | packed.append(struct.pack("!B", self.type)) |
| 105 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 106 | packed.append(struct.pack("!L", self.xid)) |
| 107 | packed.append(struct.pack("!H", self.stats_type)) |
| 108 | packed.append(struct.pack("!H", self.flags)) |
| 109 | packed.append('\x00' * 4) |
| 110 | length = sum([len(x) for x in packed]) |
| 111 | packed[2] = struct.pack("!H", length) |
| 112 | return ''.join(packed) |
| 113 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 114 | @staticmethod |
| 115 | def unpack(reader): |
| 116 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 117 | subclass = stats_reply.subtypes.get(subtype) |
| 118 | if subclass: |
| 119 | return subclass.unpack(reader) |
| 120 | |
| 121 | obj = stats_reply() |
| 122 | _version = reader.read("!B")[0] |
| 123 | assert(_version == 3) |
| 124 | _type = reader.read("!B")[0] |
| 125 | assert(_type == 19) |
| 126 | _length = reader.read("!H")[0] |
| 127 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 128 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 129 | obj.xid = reader.read("!L")[0] |
| 130 | obj.stats_type = reader.read("!H")[0] |
| 131 | obj.flags = reader.read("!H")[0] |
| 132 | reader.skip(4) |
| 133 | return obj |
| 134 | |
| 135 | def __eq__(self, other): |
| 136 | if type(self) != type(other): return False |
| 137 | if self.xid != other.xid: return False |
| 138 | if self.stats_type != other.stats_type: return False |
| 139 | if self.flags != other.flags: return False |
| 140 | return True |
| 141 | |
| 142 | def pretty_print(self, q): |
| 143 | q.text("stats_reply {") |
| 144 | with q.group(): |
| 145 | with q.indent(2): |
| 146 | q.breakable() |
| 147 | q.text("xid = "); |
| 148 | if self.xid != None: |
| 149 | q.text("%#x" % self.xid) |
| 150 | else: |
| 151 | q.text('None') |
| 152 | q.text(","); q.breakable() |
| 153 | q.text("flags = "); |
| 154 | q.text("%#x" % self.flags) |
| 155 | q.breakable() |
| 156 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 157 | |
| 158 | message.subtypes[19] = stats_reply |
| 159 | |
| 160 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 161 | version = 3 |
| 162 | type = 19 |
| 163 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 164 | |
| 165 | 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] | 166 | if xid != None: |
| 167 | self.xid = xid |
| 168 | else: |
| 169 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 170 | if flags != None: |
| 171 | self.flags = flags |
| 172 | else: |
| 173 | self.flags = 0 |
| 174 | if packet_count != None: |
| 175 | self.packet_count = packet_count |
| 176 | else: |
| 177 | self.packet_count = 0 |
| 178 | if byte_count != None: |
| 179 | self.byte_count = byte_count |
| 180 | else: |
| 181 | self.byte_count = 0 |
| 182 | if flow_count != None: |
| 183 | self.flow_count = flow_count |
| 184 | else: |
| 185 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 186 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 187 | |
| 188 | def pack(self): |
| 189 | packed = [] |
| 190 | packed.append(struct.pack("!B", self.version)) |
| 191 | packed.append(struct.pack("!B", self.type)) |
| 192 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 193 | packed.append(struct.pack("!L", self.xid)) |
| 194 | packed.append(struct.pack("!H", self.stats_type)) |
| 195 | packed.append(struct.pack("!H", self.flags)) |
| 196 | packed.append('\x00' * 4) |
| 197 | packed.append(struct.pack("!Q", self.packet_count)) |
| 198 | packed.append(struct.pack("!Q", self.byte_count)) |
| 199 | packed.append(struct.pack("!L", self.flow_count)) |
| 200 | packed.append('\x00' * 4) |
| 201 | length = sum([len(x) for x in packed]) |
| 202 | packed[2] = struct.pack("!H", length) |
| 203 | return ''.join(packed) |
| 204 | |
| 205 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 206 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 207 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 208 | _version = reader.read("!B")[0] |
| 209 | assert(_version == 3) |
| 210 | _type = reader.read("!B")[0] |
| 211 | assert(_type == 19) |
| 212 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 213 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 214 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 215 | obj.xid = reader.read("!L")[0] |
| 216 | _stats_type = reader.read("!H")[0] |
| 217 | assert(_stats_type == 2) |
| 218 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 219 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 220 | obj.packet_count = reader.read("!Q")[0] |
| 221 | obj.byte_count = reader.read("!Q")[0] |
| 222 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 223 | reader.skip(4) |
| 224 | return obj |
| 225 | |
| 226 | def __eq__(self, other): |
| 227 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 228 | if self.xid != other.xid: return False |
| 229 | if self.flags != other.flags: return False |
| 230 | if self.packet_count != other.packet_count: return False |
| 231 | if self.byte_count != other.byte_count: return False |
| 232 | if self.flow_count != other.flow_count: return False |
| 233 | return True |
| 234 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 235 | def pretty_print(self, q): |
| 236 | q.text("aggregate_stats_reply {") |
| 237 | with q.group(): |
| 238 | with q.indent(2): |
| 239 | q.breakable() |
| 240 | q.text("xid = "); |
| 241 | if self.xid != None: |
| 242 | q.text("%#x" % self.xid) |
| 243 | else: |
| 244 | q.text('None') |
| 245 | q.text(","); q.breakable() |
| 246 | q.text("flags = "); |
| 247 | q.text("%#x" % self.flags) |
| 248 | q.text(","); q.breakable() |
| 249 | q.text("packet_count = "); |
| 250 | q.text("%#x" % self.packet_count) |
| 251 | q.text(","); q.breakable() |
| 252 | q.text("byte_count = "); |
| 253 | q.text("%#x" % self.byte_count) |
| 254 | q.text(","); q.breakable() |
| 255 | q.text("flow_count = "); |
| 256 | q.text("%#x" % self.flow_count) |
| 257 | q.breakable() |
| 258 | q.text('}') |
| 259 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 260 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 261 | |
| 262 | class stats_request(message): |
| 263 | subtypes = {} |
| 264 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 265 | version = 3 |
| 266 | type = 18 |
| 267 | |
| 268 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 269 | if xid != None: |
| 270 | self.xid = xid |
| 271 | else: |
| 272 | self.xid = None |
| 273 | if stats_type != None: |
| 274 | self.stats_type = stats_type |
| 275 | else: |
| 276 | self.stats_type = 0 |
| 277 | if flags != None: |
| 278 | self.flags = flags |
| 279 | else: |
| 280 | self.flags = 0 |
| 281 | return |
| 282 | |
| 283 | def pack(self): |
| 284 | packed = [] |
| 285 | packed.append(struct.pack("!B", self.version)) |
| 286 | packed.append(struct.pack("!B", self.type)) |
| 287 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 288 | packed.append(struct.pack("!L", self.xid)) |
| 289 | packed.append(struct.pack("!H", self.stats_type)) |
| 290 | packed.append(struct.pack("!H", self.flags)) |
| 291 | packed.append('\x00' * 4) |
| 292 | length = sum([len(x) for x in packed]) |
| 293 | packed[2] = struct.pack("!H", length) |
| 294 | return ''.join(packed) |
| 295 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 296 | @staticmethod |
| 297 | def unpack(reader): |
| 298 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 299 | subclass = stats_request.subtypes.get(subtype) |
| 300 | if subclass: |
| 301 | return subclass.unpack(reader) |
| 302 | |
| 303 | obj = stats_request() |
| 304 | _version = reader.read("!B")[0] |
| 305 | assert(_version == 3) |
| 306 | _type = reader.read("!B")[0] |
| 307 | assert(_type == 18) |
| 308 | _length = reader.read("!H")[0] |
| 309 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 310 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 311 | obj.xid = reader.read("!L")[0] |
| 312 | obj.stats_type = reader.read("!H")[0] |
| 313 | obj.flags = reader.read("!H")[0] |
| 314 | reader.skip(4) |
| 315 | return obj |
| 316 | |
| 317 | def __eq__(self, other): |
| 318 | if type(self) != type(other): return False |
| 319 | if self.xid != other.xid: return False |
| 320 | if self.stats_type != other.stats_type: return False |
| 321 | if self.flags != other.flags: return False |
| 322 | return True |
| 323 | |
| 324 | def pretty_print(self, q): |
| 325 | q.text("stats_request {") |
| 326 | with q.group(): |
| 327 | with q.indent(2): |
| 328 | q.breakable() |
| 329 | q.text("xid = "); |
| 330 | if self.xid != None: |
| 331 | q.text("%#x" % self.xid) |
| 332 | else: |
| 333 | q.text('None') |
| 334 | q.text(","); q.breakable() |
| 335 | q.text("flags = "); |
| 336 | q.text("%#x" % self.flags) |
| 337 | q.breakable() |
| 338 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 339 | |
| 340 | message.subtypes[18] = stats_request |
| 341 | |
| 342 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 343 | version = 3 |
| 344 | type = 18 |
| 345 | stats_type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 346 | |
| 347 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 348 | if xid != None: |
| 349 | self.xid = xid |
| 350 | else: |
| 351 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 352 | if flags != None: |
| 353 | self.flags = flags |
| 354 | else: |
| 355 | self.flags = 0 |
| 356 | if table_id != None: |
| 357 | self.table_id = table_id |
| 358 | else: |
| 359 | self.table_id = 0 |
| 360 | if out_port != None: |
| 361 | self.out_port = out_port |
| 362 | else: |
| 363 | self.out_port = 0 |
| 364 | if out_group != None: |
| 365 | self.out_group = out_group |
| 366 | else: |
| 367 | self.out_group = 0 |
| 368 | if cookie != None: |
| 369 | self.cookie = cookie |
| 370 | else: |
| 371 | self.cookie = 0 |
| 372 | if cookie_mask != None: |
| 373 | self.cookie_mask = cookie_mask |
| 374 | else: |
| 375 | self.cookie_mask = 0 |
| 376 | if match != None: |
| 377 | self.match = match |
| 378 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 379 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 380 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 381 | |
| 382 | def pack(self): |
| 383 | packed = [] |
| 384 | packed.append(struct.pack("!B", self.version)) |
| 385 | packed.append(struct.pack("!B", self.type)) |
| 386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 387 | packed.append(struct.pack("!L", self.xid)) |
| 388 | packed.append(struct.pack("!H", self.stats_type)) |
| 389 | packed.append(struct.pack("!H", self.flags)) |
| 390 | packed.append('\x00' * 4) |
| 391 | packed.append(struct.pack("!B", self.table_id)) |
| 392 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 393 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 394 | packed.append(struct.pack("!L", self.out_group)) |
| 395 | packed.append('\x00' * 4) |
| 396 | packed.append(struct.pack("!Q", self.cookie)) |
| 397 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 398 | packed.append(self.match.pack()) |
| 399 | length = sum([len(x) for x in packed]) |
| 400 | packed[2] = struct.pack("!H", length) |
| 401 | return ''.join(packed) |
| 402 | |
| 403 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 404 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 405 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 406 | _version = reader.read("!B")[0] |
| 407 | assert(_version == 3) |
| 408 | _type = reader.read("!B")[0] |
| 409 | assert(_type == 18) |
| 410 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 411 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 412 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 413 | obj.xid = reader.read("!L")[0] |
| 414 | _stats_type = reader.read("!H")[0] |
| 415 | assert(_stats_type == 2) |
| 416 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 417 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 418 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 419 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 420 | obj.out_port = util.unpack_port_no(reader) |
| 421 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 422 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 423 | obj.cookie = reader.read("!Q")[0] |
| 424 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 425 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 426 | return obj |
| 427 | |
| 428 | def __eq__(self, other): |
| 429 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 430 | if self.xid != other.xid: return False |
| 431 | if self.flags != other.flags: return False |
| 432 | if self.table_id != other.table_id: return False |
| 433 | if self.out_port != other.out_port: return False |
| 434 | if self.out_group != other.out_group: return False |
| 435 | if self.cookie != other.cookie: return False |
| 436 | if self.cookie_mask != other.cookie_mask: return False |
| 437 | if self.match != other.match: return False |
| 438 | return True |
| 439 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 440 | def pretty_print(self, q): |
| 441 | q.text("aggregate_stats_request {") |
| 442 | with q.group(): |
| 443 | with q.indent(2): |
| 444 | q.breakable() |
| 445 | q.text("xid = "); |
| 446 | if self.xid != None: |
| 447 | q.text("%#x" % self.xid) |
| 448 | else: |
| 449 | q.text('None') |
| 450 | q.text(","); q.breakable() |
| 451 | q.text("flags = "); |
| 452 | q.text("%#x" % self.flags) |
| 453 | q.text(","); q.breakable() |
| 454 | q.text("table_id = "); |
| 455 | q.text("%#x" % self.table_id) |
| 456 | q.text(","); q.breakable() |
| 457 | q.text("out_port = "); |
| 458 | q.text(util.pretty_port(self.out_port)) |
| 459 | q.text(","); q.breakable() |
| 460 | q.text("out_group = "); |
| 461 | q.text("%#x" % self.out_group) |
| 462 | q.text(","); q.breakable() |
| 463 | q.text("cookie = "); |
| 464 | q.text("%#x" % self.cookie) |
| 465 | q.text(","); q.breakable() |
| 466 | q.text("cookie_mask = "); |
| 467 | q.text("%#x" % self.cookie_mask) |
| 468 | q.text(","); q.breakable() |
| 469 | q.text("match = "); |
| 470 | q.pp(self.match) |
| 471 | q.breakable() |
| 472 | q.text('}') |
| 473 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 474 | stats_request.subtypes[2] = aggregate_stats_request |
| 475 | |
| 476 | class error_msg(message): |
| 477 | subtypes = {} |
| 478 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 479 | version = 3 |
| 480 | type = 1 |
| 481 | |
| 482 | def __init__(self, xid=None, err_type=None): |
| 483 | if xid != None: |
| 484 | self.xid = xid |
| 485 | else: |
| 486 | self.xid = None |
| 487 | if err_type != None: |
| 488 | self.err_type = err_type |
| 489 | else: |
| 490 | self.err_type = 0 |
| 491 | return |
| 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 | packed.append(struct.pack("!H", self.err_type)) |
| 500 | length = sum([len(x) for x in packed]) |
| 501 | packed[2] = struct.pack("!H", length) |
| 502 | return ''.join(packed) |
| 503 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 504 | @staticmethod |
| 505 | def unpack(reader): |
| 506 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 507 | subclass = error_msg.subtypes.get(subtype) |
| 508 | if subclass: |
| 509 | return subclass.unpack(reader) |
| 510 | |
| 511 | obj = error_msg() |
| 512 | _version = reader.read("!B")[0] |
| 513 | assert(_version == 3) |
| 514 | _type = reader.read("!B")[0] |
| 515 | assert(_type == 1) |
| 516 | _length = reader.read("!H")[0] |
| 517 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 518 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 519 | obj.xid = reader.read("!L")[0] |
| 520 | obj.err_type = reader.read("!H")[0] |
| 521 | return obj |
| 522 | |
| 523 | def __eq__(self, other): |
| 524 | if type(self) != type(other): return False |
| 525 | if self.xid != other.xid: return False |
| 526 | if self.err_type != other.err_type: return False |
| 527 | return True |
| 528 | |
| 529 | def pretty_print(self, q): |
| 530 | q.text("error_msg {") |
| 531 | with q.group(): |
| 532 | with q.indent(2): |
| 533 | q.breakable() |
| 534 | q.text("xid = "); |
| 535 | if self.xid != None: |
| 536 | q.text("%#x" % self.xid) |
| 537 | else: |
| 538 | q.text('None') |
| 539 | q.breakable() |
| 540 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 541 | |
| 542 | message.subtypes[1] = error_msg |
| 543 | |
| 544 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 545 | version = 3 |
| 546 | type = 1 |
| 547 | err_type = 2 |
| 548 | |
| 549 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 550 | if xid != None: |
| 551 | self.xid = xid |
| 552 | else: |
| 553 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 554 | if code != None: |
| 555 | self.code = code |
| 556 | else: |
| 557 | self.code = 0 |
| 558 | if data != None: |
| 559 | self.data = data |
| 560 | else: |
| 561 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 562 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 563 | |
| 564 | def pack(self): |
| 565 | packed = [] |
| 566 | packed.append(struct.pack("!B", self.version)) |
| 567 | packed.append(struct.pack("!B", self.type)) |
| 568 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 569 | packed.append(struct.pack("!L", self.xid)) |
| 570 | packed.append(struct.pack("!H", self.err_type)) |
| 571 | packed.append(struct.pack("!H", self.code)) |
| 572 | packed.append(self.data) |
| 573 | length = sum([len(x) for x in packed]) |
| 574 | packed[2] = struct.pack("!H", length) |
| 575 | return ''.join(packed) |
| 576 | |
| 577 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 578 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 579 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 580 | _version = reader.read("!B")[0] |
| 581 | assert(_version == 3) |
| 582 | _type = reader.read("!B")[0] |
| 583 | assert(_type == 1) |
| 584 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 585 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 586 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 587 | obj.xid = reader.read("!L")[0] |
| 588 | _err_type = reader.read("!H")[0] |
| 589 | assert(_err_type == 2) |
| 590 | obj.code = reader.read("!H")[0] |
| 591 | obj.data = str(reader.read_all()) |
| 592 | return obj |
| 593 | |
| 594 | def __eq__(self, other): |
| 595 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 596 | if self.xid != other.xid: return False |
| 597 | if self.code != other.code: return False |
| 598 | if self.data != other.data: return False |
| 599 | return True |
| 600 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 601 | def pretty_print(self, q): |
| 602 | q.text("bad_action_error_msg {") |
| 603 | with q.group(): |
| 604 | with q.indent(2): |
| 605 | q.breakable() |
| 606 | q.text("xid = "); |
| 607 | if self.xid != None: |
| 608 | q.text("%#x" % self.xid) |
| 609 | else: |
| 610 | q.text('None') |
| 611 | q.text(","); q.breakable() |
| 612 | q.text("code = "); |
| 613 | q.text("%#x" % self.code) |
| 614 | q.text(","); q.breakable() |
| 615 | q.text("data = "); |
| 616 | q.pp(self.data) |
| 617 | q.breakable() |
| 618 | q.text('}') |
| 619 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 620 | error_msg.subtypes[2] = bad_action_error_msg |
| 621 | |
| 622 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 623 | version = 3 |
| 624 | type = 1 |
| 625 | err_type = 3 |
| 626 | |
| 627 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 628 | if xid != None: |
| 629 | self.xid = xid |
| 630 | else: |
| 631 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 632 | if code != None: |
| 633 | self.code = code |
| 634 | else: |
| 635 | self.code = 0 |
| 636 | if data != None: |
| 637 | self.data = data |
| 638 | else: |
| 639 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 640 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 641 | |
| 642 | def pack(self): |
| 643 | packed = [] |
| 644 | packed.append(struct.pack("!B", self.version)) |
| 645 | packed.append(struct.pack("!B", self.type)) |
| 646 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 647 | packed.append(struct.pack("!L", self.xid)) |
| 648 | packed.append(struct.pack("!H", self.err_type)) |
| 649 | packed.append(struct.pack("!H", self.code)) |
| 650 | packed.append(self.data) |
| 651 | length = sum([len(x) for x in packed]) |
| 652 | packed[2] = struct.pack("!H", length) |
| 653 | return ''.join(packed) |
| 654 | |
| 655 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 656 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 657 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 658 | _version = reader.read("!B")[0] |
| 659 | assert(_version == 3) |
| 660 | _type = reader.read("!B")[0] |
| 661 | assert(_type == 1) |
| 662 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 663 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 664 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 665 | obj.xid = reader.read("!L")[0] |
| 666 | _err_type = reader.read("!H")[0] |
| 667 | assert(_err_type == 3) |
| 668 | obj.code = reader.read("!H")[0] |
| 669 | obj.data = str(reader.read_all()) |
| 670 | return obj |
| 671 | |
| 672 | def __eq__(self, other): |
| 673 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 674 | if self.xid != other.xid: return False |
| 675 | if self.code != other.code: return False |
| 676 | if self.data != other.data: return False |
| 677 | return True |
| 678 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 679 | def pretty_print(self, q): |
| 680 | q.text("bad_instruction_error_msg {") |
| 681 | with q.group(): |
| 682 | with q.indent(2): |
| 683 | q.breakable() |
| 684 | q.text("xid = "); |
| 685 | if self.xid != None: |
| 686 | q.text("%#x" % self.xid) |
| 687 | else: |
| 688 | q.text('None') |
| 689 | q.text(","); q.breakable() |
| 690 | q.text("code = "); |
| 691 | q.text("%#x" % self.code) |
| 692 | q.text(","); q.breakable() |
| 693 | q.text("data = "); |
| 694 | q.pp(self.data) |
| 695 | q.breakable() |
| 696 | q.text('}') |
| 697 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 698 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 699 | |
| 700 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 701 | version = 3 |
| 702 | type = 1 |
| 703 | err_type = 4 |
| 704 | |
| 705 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 706 | if xid != None: |
| 707 | self.xid = xid |
| 708 | else: |
| 709 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 710 | if code != None: |
| 711 | self.code = code |
| 712 | else: |
| 713 | self.code = 0 |
| 714 | if data != None: |
| 715 | self.data = data |
| 716 | else: |
| 717 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 718 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 719 | |
| 720 | def pack(self): |
| 721 | packed = [] |
| 722 | packed.append(struct.pack("!B", self.version)) |
| 723 | packed.append(struct.pack("!B", self.type)) |
| 724 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 725 | packed.append(struct.pack("!L", self.xid)) |
| 726 | packed.append(struct.pack("!H", self.err_type)) |
| 727 | packed.append(struct.pack("!H", self.code)) |
| 728 | packed.append(self.data) |
| 729 | length = sum([len(x) for x in packed]) |
| 730 | packed[2] = struct.pack("!H", length) |
| 731 | return ''.join(packed) |
| 732 | |
| 733 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 734 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 735 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 736 | _version = reader.read("!B")[0] |
| 737 | assert(_version == 3) |
| 738 | _type = reader.read("!B")[0] |
| 739 | assert(_type == 1) |
| 740 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 741 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 742 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 743 | obj.xid = reader.read("!L")[0] |
| 744 | _err_type = reader.read("!H")[0] |
| 745 | assert(_err_type == 4) |
| 746 | obj.code = reader.read("!H")[0] |
| 747 | obj.data = str(reader.read_all()) |
| 748 | return obj |
| 749 | |
| 750 | def __eq__(self, other): |
| 751 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 752 | if self.xid != other.xid: return False |
| 753 | if self.code != other.code: return False |
| 754 | if self.data != other.data: return False |
| 755 | return True |
| 756 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 757 | def pretty_print(self, q): |
| 758 | q.text("bad_match_error_msg {") |
| 759 | with q.group(): |
| 760 | with q.indent(2): |
| 761 | q.breakable() |
| 762 | q.text("xid = "); |
| 763 | if self.xid != None: |
| 764 | q.text("%#x" % self.xid) |
| 765 | else: |
| 766 | q.text('None') |
| 767 | q.text(","); q.breakable() |
| 768 | q.text("code = "); |
| 769 | q.text("%#x" % self.code) |
| 770 | q.text(","); q.breakable() |
| 771 | q.text("data = "); |
| 772 | q.pp(self.data) |
| 773 | q.breakable() |
| 774 | q.text('}') |
| 775 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 776 | error_msg.subtypes[4] = bad_match_error_msg |
| 777 | |
| 778 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 779 | version = 3 |
| 780 | type = 1 |
| 781 | err_type = 1 |
| 782 | |
| 783 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 784 | if xid != None: |
| 785 | self.xid = xid |
| 786 | else: |
| 787 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 788 | if code != None: |
| 789 | self.code = code |
| 790 | else: |
| 791 | self.code = 0 |
| 792 | if data != None: |
| 793 | self.data = data |
| 794 | else: |
| 795 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 796 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 797 | |
| 798 | def pack(self): |
| 799 | packed = [] |
| 800 | packed.append(struct.pack("!B", self.version)) |
| 801 | packed.append(struct.pack("!B", self.type)) |
| 802 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 803 | packed.append(struct.pack("!L", self.xid)) |
| 804 | packed.append(struct.pack("!H", self.err_type)) |
| 805 | packed.append(struct.pack("!H", self.code)) |
| 806 | packed.append(self.data) |
| 807 | length = sum([len(x) for x in packed]) |
| 808 | packed[2] = struct.pack("!H", length) |
| 809 | return ''.join(packed) |
| 810 | |
| 811 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 812 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 813 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 814 | _version = reader.read("!B")[0] |
| 815 | assert(_version == 3) |
| 816 | _type = reader.read("!B")[0] |
| 817 | assert(_type == 1) |
| 818 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 819 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 820 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 821 | obj.xid = reader.read("!L")[0] |
| 822 | _err_type = reader.read("!H")[0] |
| 823 | assert(_err_type == 1) |
| 824 | obj.code = reader.read("!H")[0] |
| 825 | obj.data = str(reader.read_all()) |
| 826 | return obj |
| 827 | |
| 828 | def __eq__(self, other): |
| 829 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 830 | if self.xid != other.xid: return False |
| 831 | if self.code != other.code: return False |
| 832 | if self.data != other.data: return False |
| 833 | return True |
| 834 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 835 | def pretty_print(self, q): |
| 836 | q.text("bad_request_error_msg {") |
| 837 | with q.group(): |
| 838 | with q.indent(2): |
| 839 | q.breakable() |
| 840 | q.text("xid = "); |
| 841 | if self.xid != None: |
| 842 | q.text("%#x" % self.xid) |
| 843 | else: |
| 844 | q.text('None') |
| 845 | q.text(","); q.breakable() |
| 846 | q.text("code = "); |
| 847 | q.text("%#x" % self.code) |
| 848 | q.text(","); q.breakable() |
| 849 | q.text("data = "); |
| 850 | q.pp(self.data) |
| 851 | q.breakable() |
| 852 | q.text('}') |
| 853 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 854 | error_msg.subtypes[1] = bad_request_error_msg |
| 855 | |
| 856 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 857 | version = 3 |
| 858 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 859 | |
| 860 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 861 | if xid != None: |
| 862 | self.xid = xid |
| 863 | else: |
| 864 | self.xid = None |
| 865 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 866 | |
| 867 | def pack(self): |
| 868 | packed = [] |
| 869 | packed.append(struct.pack("!B", self.version)) |
| 870 | packed.append(struct.pack("!B", self.type)) |
| 871 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 872 | packed.append(struct.pack("!L", self.xid)) |
| 873 | length = sum([len(x) for x in packed]) |
| 874 | packed[2] = struct.pack("!H", length) |
| 875 | return ''.join(packed) |
| 876 | |
| 877 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 878 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 879 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 880 | _version = reader.read("!B")[0] |
| 881 | assert(_version == 3) |
| 882 | _type = reader.read("!B")[0] |
| 883 | assert(_type == 21) |
| 884 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 885 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 886 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 887 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 888 | return obj |
| 889 | |
| 890 | def __eq__(self, other): |
| 891 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 892 | if self.xid != other.xid: return False |
| 893 | return True |
| 894 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 895 | def pretty_print(self, q): |
| 896 | q.text("barrier_reply {") |
| 897 | with q.group(): |
| 898 | with q.indent(2): |
| 899 | q.breakable() |
| 900 | q.text("xid = "); |
| 901 | if self.xid != None: |
| 902 | q.text("%#x" % self.xid) |
| 903 | else: |
| 904 | q.text('None') |
| 905 | q.breakable() |
| 906 | q.text('}') |
| 907 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 908 | message.subtypes[21] = barrier_reply |
| 909 | |
| 910 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 911 | version = 3 |
| 912 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 913 | |
| 914 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 915 | if xid != None: |
| 916 | self.xid = xid |
| 917 | else: |
| 918 | self.xid = None |
| 919 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 920 | |
| 921 | def pack(self): |
| 922 | packed = [] |
| 923 | packed.append(struct.pack("!B", self.version)) |
| 924 | packed.append(struct.pack("!B", self.type)) |
| 925 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 926 | packed.append(struct.pack("!L", self.xid)) |
| 927 | length = sum([len(x) for x in packed]) |
| 928 | packed[2] = struct.pack("!H", length) |
| 929 | return ''.join(packed) |
| 930 | |
| 931 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 932 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 933 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 934 | _version = reader.read("!B")[0] |
| 935 | assert(_version == 3) |
| 936 | _type = reader.read("!B")[0] |
| 937 | assert(_type == 20) |
| 938 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 939 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 940 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 941 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 942 | return obj |
| 943 | |
| 944 | def __eq__(self, other): |
| 945 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 946 | if self.xid != other.xid: return False |
| 947 | return True |
| 948 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 949 | def pretty_print(self, q): |
| 950 | q.text("barrier_request {") |
| 951 | with q.group(): |
| 952 | with q.indent(2): |
| 953 | q.breakable() |
| 954 | q.text("xid = "); |
| 955 | if self.xid != None: |
| 956 | q.text("%#x" % self.xid) |
| 957 | else: |
| 958 | q.text('None') |
| 959 | q.breakable() |
| 960 | q.text('}') |
| 961 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 962 | message.subtypes[20] = barrier_request |
| 963 | |
| 964 | class experimenter(message): |
| 965 | subtypes = {} |
| 966 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 967 | version = 3 |
| 968 | type = 4 |
| 969 | |
| 970 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 971 | if xid != None: |
| 972 | self.xid = xid |
| 973 | else: |
| 974 | self.xid = None |
| 975 | if experimenter != None: |
| 976 | self.experimenter = experimenter |
| 977 | else: |
| 978 | self.experimenter = 0 |
| 979 | if subtype != None: |
| 980 | self.subtype = subtype |
| 981 | else: |
| 982 | self.subtype = 0 |
| 983 | if data != None: |
| 984 | self.data = data |
| 985 | else: |
| 986 | self.data = '' |
| 987 | return |
| 988 | |
| 989 | def pack(self): |
| 990 | packed = [] |
| 991 | packed.append(struct.pack("!B", self.version)) |
| 992 | packed.append(struct.pack("!B", self.type)) |
| 993 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 994 | packed.append(struct.pack("!L", self.xid)) |
| 995 | packed.append(struct.pack("!L", self.experimenter)) |
| 996 | packed.append(struct.pack("!L", self.subtype)) |
| 997 | packed.append(self.data) |
| 998 | length = sum([len(x) for x in packed]) |
| 999 | packed[2] = struct.pack("!H", length) |
| 1000 | return ''.join(packed) |
| 1001 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1002 | @staticmethod |
| 1003 | def unpack(reader): |
| 1004 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1005 | subclass = experimenter.subtypes.get(subtype) |
| 1006 | if subclass: |
| 1007 | return subclass.unpack(reader) |
| 1008 | |
| 1009 | obj = experimenter() |
| 1010 | _version = reader.read("!B")[0] |
| 1011 | assert(_version == 3) |
| 1012 | _type = reader.read("!B")[0] |
| 1013 | assert(_type == 4) |
| 1014 | _length = reader.read("!H")[0] |
| 1015 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1016 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1017 | obj.xid = reader.read("!L")[0] |
| 1018 | obj.experimenter = reader.read("!L")[0] |
| 1019 | obj.subtype = reader.read("!L")[0] |
| 1020 | obj.data = str(reader.read_all()) |
| 1021 | return obj |
| 1022 | |
| 1023 | def __eq__(self, other): |
| 1024 | if type(self) != type(other): return False |
| 1025 | if self.xid != other.xid: return False |
| 1026 | if self.experimenter != other.experimenter: return False |
| 1027 | if self.subtype != other.subtype: return False |
| 1028 | if self.data != other.data: return False |
| 1029 | return True |
| 1030 | |
| 1031 | def pretty_print(self, q): |
| 1032 | q.text("experimenter {") |
| 1033 | with q.group(): |
| 1034 | with q.indent(2): |
| 1035 | q.breakable() |
| 1036 | q.text("xid = "); |
| 1037 | if self.xid != None: |
| 1038 | q.text("%#x" % self.xid) |
| 1039 | else: |
| 1040 | q.text('None') |
| 1041 | q.text(","); q.breakable() |
| 1042 | q.text("subtype = "); |
| 1043 | q.text("%#x" % self.subtype) |
| 1044 | q.text(","); q.breakable() |
| 1045 | q.text("data = "); |
| 1046 | q.pp(self.data) |
| 1047 | q.breakable() |
| 1048 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1049 | |
| 1050 | message.subtypes[4] = experimenter |
| 1051 | |
| 1052 | class bsn_header(experimenter): |
| 1053 | subtypes = {} |
| 1054 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1055 | version = 3 |
| 1056 | type = 4 |
| 1057 | experimenter = 6035143 |
| 1058 | |
| 1059 | def __init__(self, xid=None, subtype=None): |
| 1060 | if xid != None: |
| 1061 | self.xid = xid |
| 1062 | else: |
| 1063 | self.xid = None |
| 1064 | if subtype != None: |
| 1065 | self.subtype = subtype |
| 1066 | else: |
| 1067 | self.subtype = 0 |
| 1068 | return |
| 1069 | |
| 1070 | def pack(self): |
| 1071 | packed = [] |
| 1072 | packed.append(struct.pack("!B", self.version)) |
| 1073 | packed.append(struct.pack("!B", self.type)) |
| 1074 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1075 | packed.append(struct.pack("!L", self.xid)) |
| 1076 | packed.append(struct.pack("!L", self.experimenter)) |
| 1077 | packed.append(struct.pack("!L", self.subtype)) |
| 1078 | length = sum([len(x) for x in packed]) |
| 1079 | packed[2] = struct.pack("!H", length) |
| 1080 | return ''.join(packed) |
| 1081 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1082 | @staticmethod |
| 1083 | def unpack(reader): |
| 1084 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1085 | subclass = bsn_header.subtypes.get(subtype) |
| 1086 | if subclass: |
| 1087 | return subclass.unpack(reader) |
| 1088 | |
| 1089 | obj = bsn_header() |
| 1090 | _version = reader.read("!B")[0] |
| 1091 | assert(_version == 3) |
| 1092 | _type = reader.read("!B")[0] |
| 1093 | assert(_type == 4) |
| 1094 | _length = reader.read("!H")[0] |
| 1095 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1096 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1097 | obj.xid = reader.read("!L")[0] |
| 1098 | _experimenter = reader.read("!L")[0] |
| 1099 | assert(_experimenter == 6035143) |
| 1100 | obj.subtype = reader.read("!L")[0] |
| 1101 | return obj |
| 1102 | |
| 1103 | def __eq__(self, other): |
| 1104 | if type(self) != type(other): return False |
| 1105 | if self.xid != other.xid: return False |
| 1106 | if self.subtype != other.subtype: return False |
| 1107 | return True |
| 1108 | |
| 1109 | def pretty_print(self, q): |
| 1110 | q.text("bsn_header {") |
| 1111 | with q.group(): |
| 1112 | with q.indent(2): |
| 1113 | q.breakable() |
| 1114 | q.text("xid = "); |
| 1115 | if self.xid != None: |
| 1116 | q.text("%#x" % self.xid) |
| 1117 | else: |
| 1118 | q.text('None') |
| 1119 | q.breakable() |
| 1120 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1121 | |
| 1122 | experimenter.subtypes[6035143] = bsn_header |
| 1123 | |
| 1124 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1125 | version = 3 |
| 1126 | type = 4 |
| 1127 | experimenter = 6035143 |
| 1128 | subtype = 22 |
| 1129 | |
| 1130 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1131 | if xid != None: |
| 1132 | self.xid = xid |
| 1133 | else: |
| 1134 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1135 | if status != None: |
| 1136 | self.status = status |
| 1137 | else: |
| 1138 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1139 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -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("!L", self.status)) |
| 1150 | length = sum([len(x) for x in packed]) |
| 1151 | packed[2] = struct.pack("!H", length) |
| 1152 | return ''.join(packed) |
| 1153 | |
| 1154 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1155 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1156 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1157 | _version = reader.read("!B")[0] |
| 1158 | assert(_version == 3) |
| 1159 | _type = reader.read("!B")[0] |
| 1160 | assert(_type == 4) |
| 1161 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1162 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1163 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1164 | obj.xid = reader.read("!L")[0] |
| 1165 | _experimenter = reader.read("!L")[0] |
| 1166 | assert(_experimenter == 6035143) |
| 1167 | _subtype = reader.read("!L")[0] |
| 1168 | assert(_subtype == 22) |
| 1169 | obj.status = reader.read("!L")[0] |
| 1170 | return obj |
| 1171 | |
| 1172 | def __eq__(self, other): |
| 1173 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1174 | if self.xid != other.xid: return False |
| 1175 | if self.status != other.status: return False |
| 1176 | return True |
| 1177 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1178 | def pretty_print(self, q): |
| 1179 | q.text("bsn_bw_clear_data_reply {") |
| 1180 | with q.group(): |
| 1181 | with q.indent(2): |
| 1182 | q.breakable() |
| 1183 | q.text("xid = "); |
| 1184 | if self.xid != None: |
| 1185 | q.text("%#x" % self.xid) |
| 1186 | else: |
| 1187 | q.text('None') |
| 1188 | q.text(","); q.breakable() |
| 1189 | q.text("status = "); |
| 1190 | q.text("%#x" % self.status) |
| 1191 | q.breakable() |
| 1192 | q.text('}') |
| 1193 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1194 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1195 | |
| 1196 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1197 | version = 3 |
| 1198 | type = 4 |
| 1199 | experimenter = 6035143 |
| 1200 | subtype = 21 |
| 1201 | |
| 1202 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1203 | if xid != None: |
| 1204 | self.xid = xid |
| 1205 | else: |
| 1206 | self.xid = None |
| 1207 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1208 | |
| 1209 | def pack(self): |
| 1210 | packed = [] |
| 1211 | packed.append(struct.pack("!B", self.version)) |
| 1212 | packed.append(struct.pack("!B", self.type)) |
| 1213 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1214 | packed.append(struct.pack("!L", self.xid)) |
| 1215 | packed.append(struct.pack("!L", self.experimenter)) |
| 1216 | packed.append(struct.pack("!L", self.subtype)) |
| 1217 | length = sum([len(x) for x in packed]) |
| 1218 | packed[2] = struct.pack("!H", length) |
| 1219 | return ''.join(packed) |
| 1220 | |
| 1221 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1222 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1223 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1224 | _version = reader.read("!B")[0] |
| 1225 | assert(_version == 3) |
| 1226 | _type = reader.read("!B")[0] |
| 1227 | assert(_type == 4) |
| 1228 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1229 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1230 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1231 | obj.xid = reader.read("!L")[0] |
| 1232 | _experimenter = reader.read("!L")[0] |
| 1233 | assert(_experimenter == 6035143) |
| 1234 | _subtype = reader.read("!L")[0] |
| 1235 | assert(_subtype == 21) |
| 1236 | return obj |
| 1237 | |
| 1238 | def __eq__(self, other): |
| 1239 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1240 | if self.xid != other.xid: return False |
| 1241 | return True |
| 1242 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1243 | def pretty_print(self, q): |
| 1244 | q.text("bsn_bw_clear_data_request {") |
| 1245 | with q.group(): |
| 1246 | with q.indent(2): |
| 1247 | q.breakable() |
| 1248 | q.text("xid = "); |
| 1249 | if self.xid != None: |
| 1250 | q.text("%#x" % self.xid) |
| 1251 | else: |
| 1252 | q.text('None') |
| 1253 | q.breakable() |
| 1254 | q.text('}') |
| 1255 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1256 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1257 | |
| 1258 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1259 | version = 3 |
| 1260 | type = 4 |
| 1261 | experimenter = 6035143 |
| 1262 | subtype = 20 |
| 1263 | |
| 1264 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1265 | if xid != None: |
| 1266 | self.xid = xid |
| 1267 | else: |
| 1268 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1269 | if enabled != None: |
| 1270 | self.enabled = enabled |
| 1271 | else: |
| 1272 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1273 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1274 | |
| 1275 | def pack(self): |
| 1276 | packed = [] |
| 1277 | packed.append(struct.pack("!B", self.version)) |
| 1278 | packed.append(struct.pack("!B", self.type)) |
| 1279 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1280 | packed.append(struct.pack("!L", self.xid)) |
| 1281 | packed.append(struct.pack("!L", self.experimenter)) |
| 1282 | packed.append(struct.pack("!L", self.subtype)) |
| 1283 | packed.append(struct.pack("!L", self.enabled)) |
| 1284 | length = sum([len(x) for x in packed]) |
| 1285 | packed[2] = struct.pack("!H", length) |
| 1286 | return ''.join(packed) |
| 1287 | |
| 1288 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1289 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1290 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1291 | _version = reader.read("!B")[0] |
| 1292 | assert(_version == 3) |
| 1293 | _type = reader.read("!B")[0] |
| 1294 | assert(_type == 4) |
| 1295 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1296 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1297 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1298 | obj.xid = reader.read("!L")[0] |
| 1299 | _experimenter = reader.read("!L")[0] |
| 1300 | assert(_experimenter == 6035143) |
| 1301 | _subtype = reader.read("!L")[0] |
| 1302 | assert(_subtype == 20) |
| 1303 | obj.enabled = reader.read("!L")[0] |
| 1304 | return obj |
| 1305 | |
| 1306 | def __eq__(self, other): |
| 1307 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1308 | if self.xid != other.xid: return False |
| 1309 | if self.enabled != other.enabled: return False |
| 1310 | return True |
| 1311 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1312 | def pretty_print(self, q): |
| 1313 | q.text("bsn_bw_enable_get_reply {") |
| 1314 | with q.group(): |
| 1315 | with q.indent(2): |
| 1316 | q.breakable() |
| 1317 | q.text("xid = "); |
| 1318 | if self.xid != None: |
| 1319 | q.text("%#x" % self.xid) |
| 1320 | else: |
| 1321 | q.text('None') |
| 1322 | q.text(","); q.breakable() |
| 1323 | q.text("enabled = "); |
| 1324 | q.text("%#x" % self.enabled) |
| 1325 | q.breakable() |
| 1326 | q.text('}') |
| 1327 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1328 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1329 | |
| 1330 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1331 | version = 3 |
| 1332 | type = 4 |
| 1333 | experimenter = 6035143 |
| 1334 | subtype = 19 |
| 1335 | |
| 1336 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1337 | if xid != None: |
| 1338 | self.xid = xid |
| 1339 | else: |
| 1340 | self.xid = None |
| 1341 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1342 | |
| 1343 | def pack(self): |
| 1344 | packed = [] |
| 1345 | packed.append(struct.pack("!B", self.version)) |
| 1346 | packed.append(struct.pack("!B", self.type)) |
| 1347 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1348 | packed.append(struct.pack("!L", self.xid)) |
| 1349 | packed.append(struct.pack("!L", self.experimenter)) |
| 1350 | packed.append(struct.pack("!L", self.subtype)) |
| 1351 | length = sum([len(x) for x in packed]) |
| 1352 | packed[2] = struct.pack("!H", length) |
| 1353 | return ''.join(packed) |
| 1354 | |
| 1355 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1356 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1357 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1358 | _version = reader.read("!B")[0] |
| 1359 | assert(_version == 3) |
| 1360 | _type = reader.read("!B")[0] |
| 1361 | assert(_type == 4) |
| 1362 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1363 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1364 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1365 | obj.xid = reader.read("!L")[0] |
| 1366 | _experimenter = reader.read("!L")[0] |
| 1367 | assert(_experimenter == 6035143) |
| 1368 | _subtype = reader.read("!L")[0] |
| 1369 | assert(_subtype == 19) |
| 1370 | return obj |
| 1371 | |
| 1372 | def __eq__(self, other): |
| 1373 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1374 | if self.xid != other.xid: return False |
| 1375 | return True |
| 1376 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1377 | def pretty_print(self, q): |
| 1378 | q.text("bsn_bw_enable_get_request {") |
| 1379 | with q.group(): |
| 1380 | with q.indent(2): |
| 1381 | q.breakable() |
| 1382 | q.text("xid = "); |
| 1383 | if self.xid != None: |
| 1384 | q.text("%#x" % self.xid) |
| 1385 | else: |
| 1386 | q.text('None') |
| 1387 | q.breakable() |
| 1388 | q.text('}') |
| 1389 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1390 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1391 | |
| 1392 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1393 | version = 3 |
| 1394 | type = 4 |
| 1395 | experimenter = 6035143 |
| 1396 | subtype = 23 |
| 1397 | |
| 1398 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1399 | if xid != None: |
| 1400 | self.xid = xid |
| 1401 | else: |
| 1402 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1403 | if enable != None: |
| 1404 | self.enable = enable |
| 1405 | else: |
| 1406 | self.enable = 0 |
| 1407 | if status != None: |
| 1408 | self.status = status |
| 1409 | else: |
| 1410 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1411 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1412 | |
| 1413 | def pack(self): |
| 1414 | packed = [] |
| 1415 | packed.append(struct.pack("!B", self.version)) |
| 1416 | packed.append(struct.pack("!B", self.type)) |
| 1417 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1418 | packed.append(struct.pack("!L", self.xid)) |
| 1419 | packed.append(struct.pack("!L", self.experimenter)) |
| 1420 | packed.append(struct.pack("!L", self.subtype)) |
| 1421 | packed.append(struct.pack("!L", self.enable)) |
| 1422 | packed.append(struct.pack("!L", self.status)) |
| 1423 | length = sum([len(x) for x in packed]) |
| 1424 | packed[2] = struct.pack("!H", length) |
| 1425 | return ''.join(packed) |
| 1426 | |
| 1427 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1428 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1429 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1430 | _version = reader.read("!B")[0] |
| 1431 | assert(_version == 3) |
| 1432 | _type = reader.read("!B")[0] |
| 1433 | assert(_type == 4) |
| 1434 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1435 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1436 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1437 | obj.xid = reader.read("!L")[0] |
| 1438 | _experimenter = reader.read("!L")[0] |
| 1439 | assert(_experimenter == 6035143) |
| 1440 | _subtype = reader.read("!L")[0] |
| 1441 | assert(_subtype == 23) |
| 1442 | obj.enable = reader.read("!L")[0] |
| 1443 | obj.status = reader.read("!L")[0] |
| 1444 | return obj |
| 1445 | |
| 1446 | def __eq__(self, other): |
| 1447 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1448 | if self.xid != other.xid: return False |
| 1449 | if self.enable != other.enable: return False |
| 1450 | if self.status != other.status: return False |
| 1451 | return True |
| 1452 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1453 | def pretty_print(self, q): |
| 1454 | q.text("bsn_bw_enable_set_reply {") |
| 1455 | with q.group(): |
| 1456 | with q.indent(2): |
| 1457 | q.breakable() |
| 1458 | q.text("xid = "); |
| 1459 | if self.xid != None: |
| 1460 | q.text("%#x" % self.xid) |
| 1461 | else: |
| 1462 | q.text('None') |
| 1463 | q.text(","); q.breakable() |
| 1464 | q.text("enable = "); |
| 1465 | q.text("%#x" % self.enable) |
| 1466 | q.text(","); q.breakable() |
| 1467 | q.text("status = "); |
| 1468 | q.text("%#x" % self.status) |
| 1469 | q.breakable() |
| 1470 | q.text('}') |
| 1471 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1472 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1473 | |
| 1474 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1475 | version = 3 |
| 1476 | type = 4 |
| 1477 | experimenter = 6035143 |
| 1478 | subtype = 18 |
| 1479 | |
| 1480 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1481 | if xid != None: |
| 1482 | self.xid = xid |
| 1483 | else: |
| 1484 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1485 | if enable != None: |
| 1486 | self.enable = enable |
| 1487 | else: |
| 1488 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1489 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1490 | |
| 1491 | def pack(self): |
| 1492 | packed = [] |
| 1493 | packed.append(struct.pack("!B", self.version)) |
| 1494 | packed.append(struct.pack("!B", self.type)) |
| 1495 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1496 | packed.append(struct.pack("!L", self.xid)) |
| 1497 | packed.append(struct.pack("!L", self.experimenter)) |
| 1498 | packed.append(struct.pack("!L", self.subtype)) |
| 1499 | packed.append(struct.pack("!L", self.enable)) |
| 1500 | length = sum([len(x) for x in packed]) |
| 1501 | packed[2] = struct.pack("!H", length) |
| 1502 | return ''.join(packed) |
| 1503 | |
| 1504 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1505 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1506 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1507 | _version = reader.read("!B")[0] |
| 1508 | assert(_version == 3) |
| 1509 | _type = reader.read("!B")[0] |
| 1510 | assert(_type == 4) |
| 1511 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1512 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1513 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1514 | obj.xid = reader.read("!L")[0] |
| 1515 | _experimenter = reader.read("!L")[0] |
| 1516 | assert(_experimenter == 6035143) |
| 1517 | _subtype = reader.read("!L")[0] |
| 1518 | assert(_subtype == 18) |
| 1519 | obj.enable = reader.read("!L")[0] |
| 1520 | return obj |
| 1521 | |
| 1522 | def __eq__(self, other): |
| 1523 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1524 | if self.xid != other.xid: return False |
| 1525 | if self.enable != other.enable: return False |
| 1526 | return True |
| 1527 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1528 | def pretty_print(self, q): |
| 1529 | q.text("bsn_bw_enable_set_request {") |
| 1530 | with q.group(): |
| 1531 | with q.indent(2): |
| 1532 | q.breakable() |
| 1533 | q.text("xid = "); |
| 1534 | if self.xid != None: |
| 1535 | q.text("%#x" % self.xid) |
| 1536 | else: |
| 1537 | q.text('None') |
| 1538 | q.text(","); q.breakable() |
| 1539 | q.text("enable = "); |
| 1540 | q.text("%#x" % self.enable) |
| 1541 | q.breakable() |
| 1542 | q.text('}') |
| 1543 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1544 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1545 | |
| 1546 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1547 | version = 3 |
| 1548 | type = 4 |
| 1549 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1550 | subtype = 10 |
| 1551 | |
| 1552 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1553 | if xid != None: |
| 1554 | self.xid = xid |
| 1555 | else: |
| 1556 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1557 | if interfaces != None: |
| 1558 | self.interfaces = interfaces |
| 1559 | else: |
| 1560 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1561 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1562 | |
| 1563 | def pack(self): |
| 1564 | packed = [] |
| 1565 | packed.append(struct.pack("!B", self.version)) |
| 1566 | packed.append(struct.pack("!B", self.type)) |
| 1567 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1568 | packed.append(struct.pack("!L", self.xid)) |
| 1569 | packed.append(struct.pack("!L", self.experimenter)) |
| 1570 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1571 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1572 | length = sum([len(x) for x in packed]) |
| 1573 | packed[2] = struct.pack("!H", length) |
| 1574 | return ''.join(packed) |
| 1575 | |
| 1576 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1577 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1578 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1579 | _version = reader.read("!B")[0] |
| 1580 | assert(_version == 3) |
| 1581 | _type = reader.read("!B")[0] |
| 1582 | assert(_type == 4) |
| 1583 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1584 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1585 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1586 | obj.xid = reader.read("!L")[0] |
| 1587 | _experimenter = reader.read("!L")[0] |
| 1588 | assert(_experimenter == 6035143) |
| 1589 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1590 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 1591 | obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1592 | return obj |
| 1593 | |
| 1594 | def __eq__(self, other): |
| 1595 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1596 | if self.xid != other.xid: return False |
| 1597 | if self.interfaces != other.interfaces: return False |
| 1598 | return True |
| 1599 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1600 | def pretty_print(self, q): |
| 1601 | q.text("bsn_get_interfaces_reply {") |
| 1602 | with q.group(): |
| 1603 | with q.indent(2): |
| 1604 | q.breakable() |
| 1605 | q.text("xid = "); |
| 1606 | if self.xid != None: |
| 1607 | q.text("%#x" % self.xid) |
| 1608 | else: |
| 1609 | q.text('None') |
| 1610 | q.text(","); q.breakable() |
| 1611 | q.text("interfaces = "); |
| 1612 | q.pp(self.interfaces) |
| 1613 | q.breakable() |
| 1614 | q.text('}') |
| 1615 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1616 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1617 | |
| 1618 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1619 | version = 3 |
| 1620 | type = 4 |
| 1621 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1622 | subtype = 9 |
| 1623 | |
| 1624 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1625 | if xid != None: |
| 1626 | self.xid = xid |
| 1627 | else: |
| 1628 | self.xid = None |
| 1629 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1630 | |
| 1631 | def pack(self): |
| 1632 | packed = [] |
| 1633 | packed.append(struct.pack("!B", self.version)) |
| 1634 | packed.append(struct.pack("!B", self.type)) |
| 1635 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1636 | packed.append(struct.pack("!L", self.xid)) |
| 1637 | packed.append(struct.pack("!L", self.experimenter)) |
| 1638 | packed.append(struct.pack("!L", self.subtype)) |
| 1639 | length = sum([len(x) for x in packed]) |
| 1640 | packed[2] = struct.pack("!H", length) |
| 1641 | return ''.join(packed) |
| 1642 | |
| 1643 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1644 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1645 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1646 | _version = reader.read("!B")[0] |
| 1647 | assert(_version == 3) |
| 1648 | _type = reader.read("!B")[0] |
| 1649 | assert(_type == 4) |
| 1650 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1651 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1652 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1653 | obj.xid = reader.read("!L")[0] |
| 1654 | _experimenter = reader.read("!L")[0] |
| 1655 | assert(_experimenter == 6035143) |
| 1656 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1657 | assert(_subtype == 9) |
| 1658 | return obj |
| 1659 | |
| 1660 | def __eq__(self, other): |
| 1661 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1662 | if self.xid != other.xid: return False |
| 1663 | return True |
| 1664 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1665 | def pretty_print(self, q): |
| 1666 | q.text("bsn_get_interfaces_request {") |
| 1667 | with q.group(): |
| 1668 | with q.indent(2): |
| 1669 | q.breakable() |
| 1670 | q.text("xid = "); |
| 1671 | if self.xid != None: |
| 1672 | q.text("%#x" % self.xid) |
| 1673 | else: |
| 1674 | q.text('None') |
| 1675 | q.breakable() |
| 1676 | q.text('}') |
| 1677 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1678 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1679 | |
| 1680 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1681 | version = 3 |
| 1682 | type = 4 |
| 1683 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1684 | subtype = 5 |
| 1685 | |
| 1686 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1687 | if xid != None: |
| 1688 | self.xid = xid |
| 1689 | else: |
| 1690 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1691 | if report_mirror_ports != None: |
| 1692 | self.report_mirror_ports = report_mirror_ports |
| 1693 | else: |
| 1694 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1695 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1696 | |
| 1697 | def pack(self): |
| 1698 | packed = [] |
| 1699 | packed.append(struct.pack("!B", self.version)) |
| 1700 | packed.append(struct.pack("!B", self.type)) |
| 1701 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1702 | packed.append(struct.pack("!L", self.xid)) |
| 1703 | packed.append(struct.pack("!L", self.experimenter)) |
| 1704 | packed.append(struct.pack("!L", self.subtype)) |
| 1705 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1706 | packed.append('\x00' * 3) |
| 1707 | length = sum([len(x) for x in packed]) |
| 1708 | packed[2] = struct.pack("!H", length) |
| 1709 | return ''.join(packed) |
| 1710 | |
| 1711 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1712 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1713 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1714 | _version = reader.read("!B")[0] |
| 1715 | assert(_version == 3) |
| 1716 | _type = reader.read("!B")[0] |
| 1717 | assert(_type == 4) |
| 1718 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1719 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1720 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1721 | obj.xid = reader.read("!L")[0] |
| 1722 | _experimenter = reader.read("!L")[0] |
| 1723 | assert(_experimenter == 6035143) |
| 1724 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1725 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1726 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1727 | reader.skip(3) |
| 1728 | return obj |
| 1729 | |
| 1730 | def __eq__(self, other): |
| 1731 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1732 | if self.xid != other.xid: return False |
| 1733 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1734 | return True |
| 1735 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1736 | def pretty_print(self, q): |
| 1737 | q.text("bsn_get_mirroring_reply {") |
| 1738 | with q.group(): |
| 1739 | with q.indent(2): |
| 1740 | q.breakable() |
| 1741 | q.text("xid = "); |
| 1742 | if self.xid != None: |
| 1743 | q.text("%#x" % self.xid) |
| 1744 | else: |
| 1745 | q.text('None') |
| 1746 | q.text(","); q.breakable() |
| 1747 | q.text("report_mirror_ports = "); |
| 1748 | q.text("%#x" % self.report_mirror_ports) |
| 1749 | q.breakable() |
| 1750 | q.text('}') |
| 1751 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1752 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1753 | |
| 1754 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1755 | version = 3 |
| 1756 | type = 4 |
| 1757 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1758 | subtype = 4 |
| 1759 | |
| 1760 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1761 | if xid != None: |
| 1762 | self.xid = xid |
| 1763 | else: |
| 1764 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1765 | if report_mirror_ports != None: |
| 1766 | self.report_mirror_ports = report_mirror_ports |
| 1767 | else: |
| 1768 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1769 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1770 | |
| 1771 | def pack(self): |
| 1772 | packed = [] |
| 1773 | packed.append(struct.pack("!B", self.version)) |
| 1774 | packed.append(struct.pack("!B", self.type)) |
| 1775 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1776 | packed.append(struct.pack("!L", self.xid)) |
| 1777 | packed.append(struct.pack("!L", self.experimenter)) |
| 1778 | packed.append(struct.pack("!L", self.subtype)) |
| 1779 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 1780 | packed.append('\x00' * 3) |
| 1781 | length = sum([len(x) for x in packed]) |
| 1782 | packed[2] = struct.pack("!H", length) |
| 1783 | return ''.join(packed) |
| 1784 | |
| 1785 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1786 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1787 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1788 | _version = reader.read("!B")[0] |
| 1789 | assert(_version == 3) |
| 1790 | _type = reader.read("!B")[0] |
| 1791 | assert(_type == 4) |
| 1792 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1793 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1794 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1795 | obj.xid = reader.read("!L")[0] |
| 1796 | _experimenter = reader.read("!L")[0] |
| 1797 | assert(_experimenter == 6035143) |
| 1798 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1799 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1800 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1801 | reader.skip(3) |
| 1802 | return obj |
| 1803 | |
| 1804 | def __eq__(self, other): |
| 1805 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1806 | if self.xid != other.xid: return False |
| 1807 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 1808 | return True |
| 1809 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1810 | def pretty_print(self, q): |
| 1811 | q.text("bsn_get_mirroring_request {") |
| 1812 | with q.group(): |
| 1813 | with q.indent(2): |
| 1814 | q.breakable() |
| 1815 | q.text("xid = "); |
| 1816 | if self.xid != None: |
| 1817 | q.text("%#x" % self.xid) |
| 1818 | else: |
| 1819 | q.text('None') |
| 1820 | q.text(","); q.breakable() |
| 1821 | q.text("report_mirror_ports = "); |
| 1822 | q.text("%#x" % self.report_mirror_ports) |
| 1823 | q.breakable() |
| 1824 | q.text('}') |
| 1825 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1826 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 1827 | |
| 1828 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1829 | version = 3 |
| 1830 | type = 4 |
| 1831 | experimenter = 6035143 |
| 1832 | subtype = 34 |
| 1833 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1834 | 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] | 1835 | if xid != None: |
| 1836 | self.xid = xid |
| 1837 | else: |
| 1838 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1839 | if status != None: |
| 1840 | self.status = status |
| 1841 | else: |
| 1842 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1843 | if port_no != None: |
| 1844 | self.port_no = port_no |
| 1845 | else: |
| 1846 | self.port_no = 0 |
| 1847 | if slot_num != None: |
| 1848 | self.slot_num = slot_num |
| 1849 | else: |
| 1850 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1851 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1852 | |
| 1853 | def pack(self): |
| 1854 | packed = [] |
| 1855 | packed.append(struct.pack("!B", self.version)) |
| 1856 | packed.append(struct.pack("!B", self.type)) |
| 1857 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1858 | packed.append(struct.pack("!L", self.xid)) |
| 1859 | packed.append(struct.pack("!L", self.experimenter)) |
| 1860 | packed.append(struct.pack("!L", self.subtype)) |
| 1861 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1862 | packed.append(util.pack_port_no(self.port_no)) |
| 1863 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1864 | length = sum([len(x) for x in packed]) |
| 1865 | packed[2] = struct.pack("!H", length) |
| 1866 | return ''.join(packed) |
| 1867 | |
| 1868 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1869 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1870 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1871 | _version = reader.read("!B")[0] |
| 1872 | assert(_version == 3) |
| 1873 | _type = reader.read("!B")[0] |
| 1874 | assert(_type == 4) |
| 1875 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1876 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1877 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1878 | obj.xid = reader.read("!L")[0] |
| 1879 | _experimenter = reader.read("!L")[0] |
| 1880 | assert(_experimenter == 6035143) |
| 1881 | _subtype = reader.read("!L")[0] |
| 1882 | assert(_subtype == 34) |
| 1883 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1884 | obj.port_no = util.unpack_port_no(reader) |
| 1885 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1886 | return obj |
| 1887 | |
| 1888 | def __eq__(self, other): |
| 1889 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1890 | if self.xid != other.xid: return False |
| 1891 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1892 | if self.port_no != other.port_no: return False |
| 1893 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1894 | return True |
| 1895 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1896 | def pretty_print(self, q): |
| 1897 | q.text("bsn_pdu_rx_reply {") |
| 1898 | with q.group(): |
| 1899 | with q.indent(2): |
| 1900 | q.breakable() |
| 1901 | q.text("xid = "); |
| 1902 | if self.xid != None: |
| 1903 | q.text("%#x" % self.xid) |
| 1904 | else: |
| 1905 | q.text('None') |
| 1906 | q.text(","); q.breakable() |
| 1907 | q.text("status = "); |
| 1908 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 1909 | q.text(","); q.breakable() |
| 1910 | q.text("port_no = "); |
| 1911 | q.text(util.pretty_port(self.port_no)) |
| 1912 | q.text(","); q.breakable() |
| 1913 | q.text("slot_num = "); |
| 1914 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1915 | q.breakable() |
| 1916 | q.text('}') |
| 1917 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1918 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 1919 | |
| 1920 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1921 | version = 3 |
| 1922 | type = 4 |
| 1923 | experimenter = 6035143 |
| 1924 | subtype = 33 |
| 1925 | |
| 1926 | 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] | 1927 | if xid != None: |
| 1928 | self.xid = xid |
| 1929 | else: |
| 1930 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1931 | if timeout_ms != None: |
| 1932 | self.timeout_ms = timeout_ms |
| 1933 | else: |
| 1934 | self.timeout_ms = 0 |
| 1935 | if port_no != None: |
| 1936 | self.port_no = port_no |
| 1937 | else: |
| 1938 | self.port_no = 0 |
| 1939 | if slot_num != None: |
| 1940 | self.slot_num = slot_num |
| 1941 | else: |
| 1942 | self.slot_num = 0 |
| 1943 | if data != None: |
| 1944 | self.data = data |
| 1945 | else: |
| 1946 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1947 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1948 | |
| 1949 | def pack(self): |
| 1950 | packed = [] |
| 1951 | packed.append(struct.pack("!B", self.version)) |
| 1952 | packed.append(struct.pack("!B", self.type)) |
| 1953 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1954 | packed.append(struct.pack("!L", self.xid)) |
| 1955 | packed.append(struct.pack("!L", self.experimenter)) |
| 1956 | packed.append(struct.pack("!L", self.subtype)) |
| 1957 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 1958 | packed.append(util.pack_port_no(self.port_no)) |
| 1959 | packed.append(struct.pack("!B", self.slot_num)) |
| 1960 | packed.append('\x00' * 3) |
| 1961 | packed.append(self.data) |
| 1962 | length = sum([len(x) for x in packed]) |
| 1963 | packed[2] = struct.pack("!H", length) |
| 1964 | return ''.join(packed) |
| 1965 | |
| 1966 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1967 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1968 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1969 | _version = reader.read("!B")[0] |
| 1970 | assert(_version == 3) |
| 1971 | _type = reader.read("!B")[0] |
| 1972 | assert(_type == 4) |
| 1973 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1974 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1975 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1976 | obj.xid = reader.read("!L")[0] |
| 1977 | _experimenter = reader.read("!L")[0] |
| 1978 | assert(_experimenter == 6035143) |
| 1979 | _subtype = reader.read("!L")[0] |
| 1980 | assert(_subtype == 33) |
| 1981 | obj.timeout_ms = reader.read("!L")[0] |
| 1982 | obj.port_no = util.unpack_port_no(reader) |
| 1983 | obj.slot_num = reader.read("!B")[0] |
| 1984 | reader.skip(3) |
| 1985 | obj.data = str(reader.read_all()) |
| 1986 | return obj |
| 1987 | |
| 1988 | def __eq__(self, other): |
| 1989 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1990 | if self.xid != other.xid: return False |
| 1991 | if self.timeout_ms != other.timeout_ms: return False |
| 1992 | if self.port_no != other.port_no: return False |
| 1993 | if self.slot_num != other.slot_num: return False |
| 1994 | if self.data != other.data: return False |
| 1995 | return True |
| 1996 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1997 | def pretty_print(self, q): |
| 1998 | q.text("bsn_pdu_rx_request {") |
| 1999 | with q.group(): |
| 2000 | with q.indent(2): |
| 2001 | q.breakable() |
| 2002 | q.text("xid = "); |
| 2003 | if self.xid != None: |
| 2004 | q.text("%#x" % self.xid) |
| 2005 | else: |
| 2006 | q.text('None') |
| 2007 | q.text(","); q.breakable() |
| 2008 | q.text("timeout_ms = "); |
| 2009 | q.text("%#x" % self.timeout_ms) |
| 2010 | q.text(","); q.breakable() |
| 2011 | q.text("port_no = "); |
| 2012 | q.text(util.pretty_port(self.port_no)) |
| 2013 | q.text(","); q.breakable() |
| 2014 | q.text("slot_num = "); |
| 2015 | q.text("%#x" % self.slot_num) |
| 2016 | q.text(","); q.breakable() |
| 2017 | q.text("data = "); |
| 2018 | q.pp(self.data) |
| 2019 | q.breakable() |
| 2020 | q.text('}') |
| 2021 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2022 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 2023 | |
| 2024 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2025 | version = 3 |
| 2026 | type = 4 |
| 2027 | experimenter = 6035143 |
| 2028 | subtype = 35 |
| 2029 | |
| 2030 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2031 | if xid != None: |
| 2032 | self.xid = xid |
| 2033 | else: |
| 2034 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2035 | if port_no != None: |
| 2036 | self.port_no = port_no |
| 2037 | else: |
| 2038 | self.port_no = 0 |
| 2039 | if slot_num != None: |
| 2040 | self.slot_num = slot_num |
| 2041 | else: |
| 2042 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2043 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2044 | |
| 2045 | def pack(self): |
| 2046 | packed = [] |
| 2047 | packed.append(struct.pack("!B", self.version)) |
| 2048 | packed.append(struct.pack("!B", self.type)) |
| 2049 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2050 | packed.append(struct.pack("!L", self.xid)) |
| 2051 | packed.append(struct.pack("!L", self.experimenter)) |
| 2052 | packed.append(struct.pack("!L", self.subtype)) |
| 2053 | packed.append(util.pack_port_no(self.port_no)) |
| 2054 | packed.append(struct.pack("!B", self.slot_num)) |
| 2055 | length = sum([len(x) for x in packed]) |
| 2056 | packed[2] = struct.pack("!H", length) |
| 2057 | return ''.join(packed) |
| 2058 | |
| 2059 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2060 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2061 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2062 | _version = reader.read("!B")[0] |
| 2063 | assert(_version == 3) |
| 2064 | _type = reader.read("!B")[0] |
| 2065 | assert(_type == 4) |
| 2066 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2067 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2068 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2069 | obj.xid = reader.read("!L")[0] |
| 2070 | _experimenter = reader.read("!L")[0] |
| 2071 | assert(_experimenter == 6035143) |
| 2072 | _subtype = reader.read("!L")[0] |
| 2073 | assert(_subtype == 35) |
| 2074 | obj.port_no = util.unpack_port_no(reader) |
| 2075 | obj.slot_num = reader.read("!B")[0] |
| 2076 | return obj |
| 2077 | |
| 2078 | def __eq__(self, other): |
| 2079 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2080 | if self.xid != other.xid: return False |
| 2081 | if self.port_no != other.port_no: return False |
| 2082 | if self.slot_num != other.slot_num: return False |
| 2083 | return True |
| 2084 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2085 | def pretty_print(self, q): |
| 2086 | q.text("bsn_pdu_rx_timeout {") |
| 2087 | with q.group(): |
| 2088 | with q.indent(2): |
| 2089 | q.breakable() |
| 2090 | q.text("xid = "); |
| 2091 | if self.xid != None: |
| 2092 | q.text("%#x" % self.xid) |
| 2093 | else: |
| 2094 | q.text('None') |
| 2095 | q.text(","); q.breakable() |
| 2096 | q.text("port_no = "); |
| 2097 | q.text(util.pretty_port(self.port_no)) |
| 2098 | q.text(","); q.breakable() |
| 2099 | q.text("slot_num = "); |
| 2100 | q.text("%#x" % self.slot_num) |
| 2101 | q.breakable() |
| 2102 | q.text('}') |
| 2103 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2104 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 2105 | |
| 2106 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2107 | version = 3 |
| 2108 | type = 4 |
| 2109 | experimenter = 6035143 |
| 2110 | subtype = 32 |
| 2111 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2112 | 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] | 2113 | if xid != None: |
| 2114 | self.xid = xid |
| 2115 | else: |
| 2116 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2117 | if status != None: |
| 2118 | self.status = status |
| 2119 | else: |
| 2120 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2121 | if port_no != None: |
| 2122 | self.port_no = port_no |
| 2123 | else: |
| 2124 | self.port_no = 0 |
| 2125 | if slot_num != None: |
| 2126 | self.slot_num = slot_num |
| 2127 | else: |
| 2128 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2129 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2130 | |
| 2131 | def pack(self): |
| 2132 | packed = [] |
| 2133 | packed.append(struct.pack("!B", self.version)) |
| 2134 | packed.append(struct.pack("!B", self.type)) |
| 2135 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2136 | packed.append(struct.pack("!L", self.xid)) |
| 2137 | packed.append(struct.pack("!L", self.experimenter)) |
| 2138 | packed.append(struct.pack("!L", self.subtype)) |
| 2139 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2140 | packed.append(util.pack_port_no(self.port_no)) |
| 2141 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2142 | length = sum([len(x) for x in packed]) |
| 2143 | packed[2] = struct.pack("!H", length) |
| 2144 | return ''.join(packed) |
| 2145 | |
| 2146 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2147 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2148 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2149 | _version = reader.read("!B")[0] |
| 2150 | assert(_version == 3) |
| 2151 | _type = reader.read("!B")[0] |
| 2152 | assert(_type == 4) |
| 2153 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2154 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2155 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2156 | obj.xid = reader.read("!L")[0] |
| 2157 | _experimenter = reader.read("!L")[0] |
| 2158 | assert(_experimenter == 6035143) |
| 2159 | _subtype = reader.read("!L")[0] |
| 2160 | assert(_subtype == 32) |
| 2161 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2162 | obj.port_no = util.unpack_port_no(reader) |
| 2163 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2164 | return obj |
| 2165 | |
| 2166 | def __eq__(self, other): |
| 2167 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2168 | if self.xid != other.xid: return False |
| 2169 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2170 | if self.port_no != other.port_no: return False |
| 2171 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2172 | return True |
| 2173 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2174 | def pretty_print(self, q): |
| 2175 | q.text("bsn_pdu_tx_reply {") |
| 2176 | with q.group(): |
| 2177 | with q.indent(2): |
| 2178 | q.breakable() |
| 2179 | q.text("xid = "); |
| 2180 | if self.xid != None: |
| 2181 | q.text("%#x" % self.xid) |
| 2182 | else: |
| 2183 | q.text('None') |
| 2184 | q.text(","); q.breakable() |
| 2185 | q.text("status = "); |
| 2186 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2187 | q.text(","); q.breakable() |
| 2188 | q.text("port_no = "); |
| 2189 | q.text(util.pretty_port(self.port_no)) |
| 2190 | q.text(","); q.breakable() |
| 2191 | q.text("slot_num = "); |
| 2192 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2193 | q.breakable() |
| 2194 | q.text('}') |
| 2195 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2196 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2197 | |
| 2198 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2199 | version = 3 |
| 2200 | type = 4 |
| 2201 | experimenter = 6035143 |
| 2202 | subtype = 31 |
| 2203 | |
| 2204 | 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] | 2205 | if xid != None: |
| 2206 | self.xid = xid |
| 2207 | else: |
| 2208 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2209 | if tx_interval_ms != None: |
| 2210 | self.tx_interval_ms = tx_interval_ms |
| 2211 | else: |
| 2212 | self.tx_interval_ms = 0 |
| 2213 | if port_no != None: |
| 2214 | self.port_no = port_no |
| 2215 | else: |
| 2216 | self.port_no = 0 |
| 2217 | if slot_num != None: |
| 2218 | self.slot_num = slot_num |
| 2219 | else: |
| 2220 | self.slot_num = 0 |
| 2221 | if data != None: |
| 2222 | self.data = data |
| 2223 | else: |
| 2224 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2225 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2226 | |
| 2227 | def pack(self): |
| 2228 | packed = [] |
| 2229 | packed.append(struct.pack("!B", self.version)) |
| 2230 | packed.append(struct.pack("!B", self.type)) |
| 2231 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2232 | packed.append(struct.pack("!L", self.xid)) |
| 2233 | packed.append(struct.pack("!L", self.experimenter)) |
| 2234 | packed.append(struct.pack("!L", self.subtype)) |
| 2235 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2236 | packed.append(util.pack_port_no(self.port_no)) |
| 2237 | packed.append(struct.pack("!B", self.slot_num)) |
| 2238 | packed.append('\x00' * 3) |
| 2239 | packed.append(self.data) |
| 2240 | length = sum([len(x) for x in packed]) |
| 2241 | packed[2] = struct.pack("!H", length) |
| 2242 | return ''.join(packed) |
| 2243 | |
| 2244 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2245 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2246 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2247 | _version = reader.read("!B")[0] |
| 2248 | assert(_version == 3) |
| 2249 | _type = reader.read("!B")[0] |
| 2250 | assert(_type == 4) |
| 2251 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2252 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2253 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2254 | obj.xid = reader.read("!L")[0] |
| 2255 | _experimenter = reader.read("!L")[0] |
| 2256 | assert(_experimenter == 6035143) |
| 2257 | _subtype = reader.read("!L")[0] |
| 2258 | assert(_subtype == 31) |
| 2259 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2260 | obj.port_no = util.unpack_port_no(reader) |
| 2261 | obj.slot_num = reader.read("!B")[0] |
| 2262 | reader.skip(3) |
| 2263 | obj.data = str(reader.read_all()) |
| 2264 | return obj |
| 2265 | |
| 2266 | def __eq__(self, other): |
| 2267 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2268 | if self.xid != other.xid: return False |
| 2269 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2270 | if self.port_no != other.port_no: return False |
| 2271 | if self.slot_num != other.slot_num: return False |
| 2272 | if self.data != other.data: return False |
| 2273 | return True |
| 2274 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2275 | def pretty_print(self, q): |
| 2276 | q.text("bsn_pdu_tx_request {") |
| 2277 | with q.group(): |
| 2278 | with q.indent(2): |
| 2279 | q.breakable() |
| 2280 | q.text("xid = "); |
| 2281 | if self.xid != None: |
| 2282 | q.text("%#x" % self.xid) |
| 2283 | else: |
| 2284 | q.text('None') |
| 2285 | q.text(","); q.breakable() |
| 2286 | q.text("tx_interval_ms = "); |
| 2287 | q.text("%#x" % self.tx_interval_ms) |
| 2288 | q.text(","); q.breakable() |
| 2289 | q.text("port_no = "); |
| 2290 | q.text(util.pretty_port(self.port_no)) |
| 2291 | q.text(","); q.breakable() |
| 2292 | q.text("slot_num = "); |
| 2293 | q.text("%#x" % self.slot_num) |
| 2294 | q.text(","); q.breakable() |
| 2295 | q.text("data = "); |
| 2296 | q.pp(self.data) |
| 2297 | q.breakable() |
| 2298 | q.text('}') |
| 2299 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2300 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2301 | |
| 2302 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2303 | version = 3 |
| 2304 | type = 4 |
| 2305 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2306 | subtype = 3 |
| 2307 | |
| 2308 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2309 | if xid != None: |
| 2310 | self.xid = xid |
| 2311 | else: |
| 2312 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2313 | if report_mirror_ports != None: |
| 2314 | self.report_mirror_ports = report_mirror_ports |
| 2315 | else: |
| 2316 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2317 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2318 | |
| 2319 | def pack(self): |
| 2320 | packed = [] |
| 2321 | packed.append(struct.pack("!B", self.version)) |
| 2322 | packed.append(struct.pack("!B", self.type)) |
| 2323 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2324 | packed.append(struct.pack("!L", self.xid)) |
| 2325 | packed.append(struct.pack("!L", self.experimenter)) |
| 2326 | packed.append(struct.pack("!L", self.subtype)) |
| 2327 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 2328 | packed.append('\x00' * 3) |
| 2329 | length = sum([len(x) for x in packed]) |
| 2330 | packed[2] = struct.pack("!H", length) |
| 2331 | return ''.join(packed) |
| 2332 | |
| 2333 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2334 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2335 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2336 | _version = reader.read("!B")[0] |
| 2337 | assert(_version == 3) |
| 2338 | _type = reader.read("!B")[0] |
| 2339 | assert(_type == 4) |
| 2340 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2341 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2342 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2343 | obj.xid = reader.read("!L")[0] |
| 2344 | _experimenter = reader.read("!L")[0] |
| 2345 | assert(_experimenter == 6035143) |
| 2346 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2347 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2348 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2349 | reader.skip(3) |
| 2350 | return obj |
| 2351 | |
| 2352 | def __eq__(self, other): |
| 2353 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2354 | if self.xid != other.xid: return False |
| 2355 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 2356 | return True |
| 2357 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2358 | def pretty_print(self, q): |
| 2359 | q.text("bsn_set_mirroring {") |
| 2360 | with q.group(): |
| 2361 | with q.indent(2): |
| 2362 | q.breakable() |
| 2363 | q.text("xid = "); |
| 2364 | if self.xid != None: |
| 2365 | q.text("%#x" % self.xid) |
| 2366 | else: |
| 2367 | q.text('None') |
| 2368 | q.text(","); q.breakable() |
| 2369 | q.text("report_mirror_ports = "); |
| 2370 | q.text("%#x" % self.report_mirror_ports) |
| 2371 | q.breakable() |
| 2372 | q.text('}') |
| 2373 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2374 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2375 | |
| 2376 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2377 | version = 3 |
| 2378 | type = 4 |
| 2379 | experimenter = 6035143 |
| 2380 | subtype = 25 |
| 2381 | |
| 2382 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2383 | if xid != None: |
| 2384 | self.xid = xid |
| 2385 | else: |
| 2386 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2387 | if status != None: |
| 2388 | self.status = status |
| 2389 | else: |
| 2390 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2391 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2392 | |
| 2393 | def pack(self): |
| 2394 | packed = [] |
| 2395 | packed.append(struct.pack("!B", self.version)) |
| 2396 | packed.append(struct.pack("!B", self.type)) |
| 2397 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2398 | packed.append(struct.pack("!L", self.xid)) |
| 2399 | packed.append(struct.pack("!L", self.experimenter)) |
| 2400 | packed.append(struct.pack("!L", self.subtype)) |
| 2401 | packed.append(struct.pack("!L", self.status)) |
| 2402 | length = sum([len(x) for x in packed]) |
| 2403 | packed[2] = struct.pack("!H", length) |
| 2404 | return ''.join(packed) |
| 2405 | |
| 2406 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2407 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2408 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2409 | _version = reader.read("!B")[0] |
| 2410 | assert(_version == 3) |
| 2411 | _type = reader.read("!B")[0] |
| 2412 | assert(_type == 4) |
| 2413 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2414 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2415 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2416 | obj.xid = reader.read("!L")[0] |
| 2417 | _experimenter = reader.read("!L")[0] |
| 2418 | assert(_experimenter == 6035143) |
| 2419 | _subtype = reader.read("!L")[0] |
| 2420 | assert(_subtype == 25) |
| 2421 | obj.status = reader.read("!L")[0] |
| 2422 | return obj |
| 2423 | |
| 2424 | def __eq__(self, other): |
| 2425 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2426 | if self.xid != other.xid: return False |
| 2427 | if self.status != other.status: return False |
| 2428 | return True |
| 2429 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2430 | def pretty_print(self, q): |
| 2431 | q.text("bsn_set_pktin_suppression_reply {") |
| 2432 | with q.group(): |
| 2433 | with q.indent(2): |
| 2434 | q.breakable() |
| 2435 | q.text("xid = "); |
| 2436 | if self.xid != None: |
| 2437 | q.text("%#x" % self.xid) |
| 2438 | else: |
| 2439 | q.text('None') |
| 2440 | q.text(","); q.breakable() |
| 2441 | q.text("status = "); |
| 2442 | q.text("%#x" % self.status) |
| 2443 | q.breakable() |
| 2444 | q.text('}') |
| 2445 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2446 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2447 | |
| 2448 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2449 | version = 3 |
| 2450 | type = 4 |
| 2451 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2452 | subtype = 11 |
| 2453 | |
| 2454 | 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] | 2455 | if xid != None: |
| 2456 | self.xid = xid |
| 2457 | else: |
| 2458 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2459 | if enabled != None: |
| 2460 | self.enabled = enabled |
| 2461 | else: |
| 2462 | self.enabled = 0 |
| 2463 | if idle_timeout != None: |
| 2464 | self.idle_timeout = idle_timeout |
| 2465 | else: |
| 2466 | self.idle_timeout = 0 |
| 2467 | if hard_timeout != None: |
| 2468 | self.hard_timeout = hard_timeout |
| 2469 | else: |
| 2470 | self.hard_timeout = 0 |
| 2471 | if priority != None: |
| 2472 | self.priority = priority |
| 2473 | else: |
| 2474 | self.priority = 0 |
| 2475 | if cookie != None: |
| 2476 | self.cookie = cookie |
| 2477 | else: |
| 2478 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2479 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2480 | |
| 2481 | def pack(self): |
| 2482 | packed = [] |
| 2483 | packed.append(struct.pack("!B", self.version)) |
| 2484 | packed.append(struct.pack("!B", self.type)) |
| 2485 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2486 | packed.append(struct.pack("!L", self.xid)) |
| 2487 | packed.append(struct.pack("!L", self.experimenter)) |
| 2488 | packed.append(struct.pack("!L", self.subtype)) |
| 2489 | packed.append(struct.pack("!B", self.enabled)) |
| 2490 | packed.append('\x00' * 1) |
| 2491 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 2492 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 2493 | packed.append(struct.pack("!H", self.priority)) |
| 2494 | packed.append(struct.pack("!Q", self.cookie)) |
| 2495 | length = sum([len(x) for x in packed]) |
| 2496 | packed[2] = struct.pack("!H", length) |
| 2497 | return ''.join(packed) |
| 2498 | |
| 2499 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2500 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2501 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2502 | _version = reader.read("!B")[0] |
| 2503 | assert(_version == 3) |
| 2504 | _type = reader.read("!B")[0] |
| 2505 | assert(_type == 4) |
| 2506 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2507 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2508 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2509 | obj.xid = reader.read("!L")[0] |
| 2510 | _experimenter = reader.read("!L")[0] |
| 2511 | assert(_experimenter == 6035143) |
| 2512 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2513 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2514 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2515 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2516 | obj.idle_timeout = reader.read("!H")[0] |
| 2517 | obj.hard_timeout = reader.read("!H")[0] |
| 2518 | obj.priority = reader.read("!H")[0] |
| 2519 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2520 | return obj |
| 2521 | |
| 2522 | def __eq__(self, other): |
| 2523 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2524 | if self.xid != other.xid: return False |
| 2525 | if self.enabled != other.enabled: return False |
| 2526 | if self.idle_timeout != other.idle_timeout: return False |
| 2527 | if self.hard_timeout != other.hard_timeout: return False |
| 2528 | if self.priority != other.priority: return False |
| 2529 | if self.cookie != other.cookie: return False |
| 2530 | return True |
| 2531 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2532 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2533 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2534 | with q.group(): |
| 2535 | with q.indent(2): |
| 2536 | q.breakable() |
| 2537 | q.text("xid = "); |
| 2538 | if self.xid != None: |
| 2539 | q.text("%#x" % self.xid) |
| 2540 | else: |
| 2541 | q.text('None') |
| 2542 | q.text(","); q.breakable() |
| 2543 | q.text("enabled = "); |
| 2544 | q.text("%#x" % self.enabled) |
| 2545 | q.text(","); q.breakable() |
| 2546 | q.text("idle_timeout = "); |
| 2547 | q.text("%#x" % self.idle_timeout) |
| 2548 | q.text(","); q.breakable() |
| 2549 | q.text("hard_timeout = "); |
| 2550 | q.text("%#x" % self.hard_timeout) |
| 2551 | q.text(","); q.breakable() |
| 2552 | q.text("priority = "); |
| 2553 | q.text("%#x" % self.priority) |
| 2554 | q.text(","); q.breakable() |
| 2555 | q.text("cookie = "); |
| 2556 | q.text("%#x" % self.cookie) |
| 2557 | q.breakable() |
| 2558 | q.text('}') |
| 2559 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2560 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 2561 | |
| 2562 | class experimenter_stats_reply(stats_reply): |
| 2563 | subtypes = {} |
| 2564 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2565 | version = 3 |
| 2566 | type = 19 |
| 2567 | stats_type = 65535 |
| 2568 | |
| 2569 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None): |
| 2570 | if xid != None: |
| 2571 | self.xid = xid |
| 2572 | else: |
| 2573 | self.xid = None |
| 2574 | if flags != None: |
| 2575 | self.flags = flags |
| 2576 | else: |
| 2577 | self.flags = 0 |
| 2578 | if experimenter != None: |
| 2579 | self.experimenter = experimenter |
| 2580 | else: |
| 2581 | self.experimenter = 0 |
| 2582 | if subtype != None: |
| 2583 | self.subtype = subtype |
| 2584 | else: |
| 2585 | self.subtype = 0 |
| 2586 | if data != None: |
| 2587 | self.data = data |
| 2588 | else: |
| 2589 | self.data = '' |
| 2590 | return |
| 2591 | |
| 2592 | def pack(self): |
| 2593 | packed = [] |
| 2594 | packed.append(struct.pack("!B", self.version)) |
| 2595 | packed.append(struct.pack("!B", self.type)) |
| 2596 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2597 | packed.append(struct.pack("!L", self.xid)) |
| 2598 | packed.append(struct.pack("!H", self.stats_type)) |
| 2599 | packed.append(struct.pack("!H", self.flags)) |
| 2600 | packed.append('\x00' * 4) |
| 2601 | packed.append(struct.pack("!L", self.experimenter)) |
| 2602 | packed.append(struct.pack("!L", self.subtype)) |
| 2603 | packed.append(self.data) |
| 2604 | length = sum([len(x) for x in packed]) |
| 2605 | packed[2] = struct.pack("!H", length) |
| 2606 | return ''.join(packed) |
| 2607 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2608 | @staticmethod |
| 2609 | def unpack(reader): |
| 2610 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2611 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2612 | if subclass: |
| 2613 | return subclass.unpack(reader) |
| 2614 | |
| 2615 | obj = experimenter_stats_reply() |
| 2616 | _version = reader.read("!B")[0] |
| 2617 | assert(_version == 3) |
| 2618 | _type = reader.read("!B")[0] |
| 2619 | assert(_type == 19) |
| 2620 | _length = reader.read("!H")[0] |
| 2621 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2622 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2623 | obj.xid = reader.read("!L")[0] |
| 2624 | _stats_type = reader.read("!H")[0] |
| 2625 | assert(_stats_type == 65535) |
| 2626 | obj.flags = reader.read("!H")[0] |
| 2627 | reader.skip(4) |
| 2628 | obj.experimenter = reader.read("!L")[0] |
| 2629 | obj.subtype = reader.read("!L")[0] |
| 2630 | obj.data = str(reader.read_all()) |
| 2631 | return obj |
| 2632 | |
| 2633 | def __eq__(self, other): |
| 2634 | if type(self) != type(other): return False |
| 2635 | if self.xid != other.xid: return False |
| 2636 | if self.flags != other.flags: return False |
| 2637 | if self.experimenter != other.experimenter: return False |
| 2638 | if self.subtype != other.subtype: return False |
| 2639 | if self.data != other.data: return False |
| 2640 | return True |
| 2641 | |
| 2642 | def pretty_print(self, q): |
| 2643 | q.text("experimenter_stats_reply {") |
| 2644 | with q.group(): |
| 2645 | with q.indent(2): |
| 2646 | q.breakable() |
| 2647 | q.text("xid = "); |
| 2648 | if self.xid != None: |
| 2649 | q.text("%#x" % self.xid) |
| 2650 | else: |
| 2651 | q.text('None') |
| 2652 | q.text(","); q.breakable() |
| 2653 | q.text("flags = "); |
| 2654 | q.text("%#x" % self.flags) |
| 2655 | q.text(","); q.breakable() |
| 2656 | q.text("subtype = "); |
| 2657 | q.text("%#x" % self.subtype) |
| 2658 | q.text(","); q.breakable() |
| 2659 | q.text("data = "); |
| 2660 | q.pp(self.data) |
| 2661 | q.breakable() |
| 2662 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2663 | |
| 2664 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2665 | |
| 2666 | class bsn_stats_reply(experimenter_stats_reply): |
| 2667 | subtypes = {} |
| 2668 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2669 | version = 3 |
| 2670 | type = 19 |
| 2671 | stats_type = 65535 |
| 2672 | experimenter = 6035143 |
| 2673 | |
| 2674 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2675 | if xid != None: |
| 2676 | self.xid = xid |
| 2677 | else: |
| 2678 | self.xid = None |
| 2679 | if flags != None: |
| 2680 | self.flags = flags |
| 2681 | else: |
| 2682 | self.flags = 0 |
| 2683 | if subtype != None: |
| 2684 | self.subtype = subtype |
| 2685 | else: |
| 2686 | self.subtype = 0 |
| 2687 | return |
| 2688 | |
| 2689 | def pack(self): |
| 2690 | packed = [] |
| 2691 | packed.append(struct.pack("!B", self.version)) |
| 2692 | packed.append(struct.pack("!B", self.type)) |
| 2693 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2694 | packed.append(struct.pack("!L", self.xid)) |
| 2695 | packed.append(struct.pack("!H", self.stats_type)) |
| 2696 | packed.append(struct.pack("!H", self.flags)) |
| 2697 | packed.append('\x00' * 4) |
| 2698 | packed.append(struct.pack("!L", self.experimenter)) |
| 2699 | packed.append(struct.pack("!L", self.subtype)) |
| 2700 | length = sum([len(x) for x in packed]) |
| 2701 | packed[2] = struct.pack("!H", length) |
| 2702 | return ''.join(packed) |
| 2703 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2704 | @staticmethod |
| 2705 | def unpack(reader): |
| 2706 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2707 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2708 | if subclass: |
| 2709 | return subclass.unpack(reader) |
| 2710 | |
| 2711 | obj = bsn_stats_reply() |
| 2712 | _version = reader.read("!B")[0] |
| 2713 | assert(_version == 3) |
| 2714 | _type = reader.read("!B")[0] |
| 2715 | assert(_type == 19) |
| 2716 | _length = reader.read("!H")[0] |
| 2717 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2718 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2719 | obj.xid = reader.read("!L")[0] |
| 2720 | _stats_type = reader.read("!H")[0] |
| 2721 | assert(_stats_type == 65535) |
| 2722 | obj.flags = reader.read("!H")[0] |
| 2723 | reader.skip(4) |
| 2724 | _experimenter = reader.read("!L")[0] |
| 2725 | assert(_experimenter == 6035143) |
| 2726 | obj.subtype = reader.read("!L")[0] |
| 2727 | return obj |
| 2728 | |
| 2729 | def __eq__(self, other): |
| 2730 | if type(self) != type(other): return False |
| 2731 | if self.xid != other.xid: return False |
| 2732 | if self.flags != other.flags: return False |
| 2733 | if self.subtype != other.subtype: return False |
| 2734 | return True |
| 2735 | |
| 2736 | def pretty_print(self, q): |
| 2737 | q.text("bsn_stats_reply {") |
| 2738 | with q.group(): |
| 2739 | with q.indent(2): |
| 2740 | q.breakable() |
| 2741 | q.text("xid = "); |
| 2742 | if self.xid != None: |
| 2743 | q.text("%#x" % self.xid) |
| 2744 | else: |
| 2745 | q.text('None') |
| 2746 | q.text(","); q.breakable() |
| 2747 | q.text("flags = "); |
| 2748 | q.text("%#x" % self.flags) |
| 2749 | q.breakable() |
| 2750 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2751 | |
| 2752 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2753 | |
| 2754 | class experimenter_stats_request(stats_request): |
| 2755 | subtypes = {} |
| 2756 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2757 | version = 3 |
| 2758 | type = 18 |
| 2759 | stats_type = 65535 |
| 2760 | |
| 2761 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None, data=None): |
| 2762 | if xid != None: |
| 2763 | self.xid = xid |
| 2764 | else: |
| 2765 | self.xid = None |
| 2766 | if flags != None: |
| 2767 | self.flags = flags |
| 2768 | else: |
| 2769 | self.flags = 0 |
| 2770 | if experimenter != None: |
| 2771 | self.experimenter = experimenter |
| 2772 | else: |
| 2773 | self.experimenter = 0 |
| 2774 | if subtype != None: |
| 2775 | self.subtype = subtype |
| 2776 | else: |
| 2777 | self.subtype = 0 |
| 2778 | if data != None: |
| 2779 | self.data = data |
| 2780 | else: |
| 2781 | self.data = '' |
| 2782 | return |
| 2783 | |
| 2784 | def pack(self): |
| 2785 | packed = [] |
| 2786 | packed.append(struct.pack("!B", self.version)) |
| 2787 | packed.append(struct.pack("!B", self.type)) |
| 2788 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2789 | packed.append(struct.pack("!L", self.xid)) |
| 2790 | packed.append(struct.pack("!H", self.stats_type)) |
| 2791 | packed.append(struct.pack("!H", self.flags)) |
| 2792 | packed.append('\x00' * 4) |
| 2793 | packed.append(struct.pack("!L", self.experimenter)) |
| 2794 | packed.append(struct.pack("!L", self.subtype)) |
| 2795 | packed.append(self.data) |
| 2796 | length = sum([len(x) for x in packed]) |
| 2797 | packed[2] = struct.pack("!H", length) |
| 2798 | return ''.join(packed) |
| 2799 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2800 | @staticmethod |
| 2801 | def unpack(reader): |
| 2802 | subtype, = reader.peek('!L', 16) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2803 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2804 | if subclass: |
| 2805 | return subclass.unpack(reader) |
| 2806 | |
| 2807 | obj = experimenter_stats_request() |
| 2808 | _version = reader.read("!B")[0] |
| 2809 | assert(_version == 3) |
| 2810 | _type = reader.read("!B")[0] |
| 2811 | assert(_type == 18) |
| 2812 | _length = reader.read("!H")[0] |
| 2813 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2814 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2815 | obj.xid = reader.read("!L")[0] |
| 2816 | _stats_type = reader.read("!H")[0] |
| 2817 | assert(_stats_type == 65535) |
| 2818 | obj.flags = reader.read("!H")[0] |
| 2819 | reader.skip(4) |
| 2820 | obj.experimenter = reader.read("!L")[0] |
| 2821 | obj.subtype = reader.read("!L")[0] |
| 2822 | obj.data = str(reader.read_all()) |
| 2823 | return obj |
| 2824 | |
| 2825 | def __eq__(self, other): |
| 2826 | if type(self) != type(other): return False |
| 2827 | if self.xid != other.xid: return False |
| 2828 | if self.flags != other.flags: return False |
| 2829 | if self.experimenter != other.experimenter: return False |
| 2830 | if self.subtype != other.subtype: return False |
| 2831 | if self.data != other.data: return False |
| 2832 | return True |
| 2833 | |
| 2834 | def pretty_print(self, q): |
| 2835 | q.text("experimenter_stats_request {") |
| 2836 | with q.group(): |
| 2837 | with q.indent(2): |
| 2838 | q.breakable() |
| 2839 | q.text("xid = "); |
| 2840 | if self.xid != None: |
| 2841 | q.text("%#x" % self.xid) |
| 2842 | else: |
| 2843 | q.text('None') |
| 2844 | q.text(","); q.breakable() |
| 2845 | q.text("flags = "); |
| 2846 | q.text("%#x" % self.flags) |
| 2847 | q.text(","); q.breakable() |
| 2848 | q.text("subtype = "); |
| 2849 | q.text("%#x" % self.subtype) |
| 2850 | q.text(","); q.breakable() |
| 2851 | q.text("data = "); |
| 2852 | q.pp(self.data) |
| 2853 | q.breakable() |
| 2854 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2855 | |
| 2856 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2857 | |
| 2858 | class bsn_stats_request(experimenter_stats_request): |
| 2859 | subtypes = {} |
| 2860 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2861 | version = 3 |
| 2862 | type = 18 |
| 2863 | stats_type = 65535 |
| 2864 | experimenter = 6035143 |
| 2865 | |
| 2866 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2867 | if xid != None: |
| 2868 | self.xid = xid |
| 2869 | else: |
| 2870 | self.xid = None |
| 2871 | if flags != None: |
| 2872 | self.flags = flags |
| 2873 | else: |
| 2874 | self.flags = 0 |
| 2875 | if subtype != None: |
| 2876 | self.subtype = subtype |
| 2877 | else: |
| 2878 | self.subtype = 0 |
| 2879 | return |
| 2880 | |
| 2881 | def pack(self): |
| 2882 | packed = [] |
| 2883 | packed.append(struct.pack("!B", self.version)) |
| 2884 | packed.append(struct.pack("!B", self.type)) |
| 2885 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2886 | packed.append(struct.pack("!L", self.xid)) |
| 2887 | packed.append(struct.pack("!H", self.stats_type)) |
| 2888 | packed.append(struct.pack("!H", self.flags)) |
| 2889 | packed.append('\x00' * 4) |
| 2890 | packed.append(struct.pack("!L", self.experimenter)) |
| 2891 | packed.append(struct.pack("!L", self.subtype)) |
| 2892 | length = sum([len(x) for x in packed]) |
| 2893 | packed[2] = struct.pack("!H", length) |
| 2894 | return ''.join(packed) |
| 2895 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2896 | @staticmethod |
| 2897 | def unpack(reader): |
| 2898 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2899 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2900 | if subclass: |
| 2901 | return subclass.unpack(reader) |
| 2902 | |
| 2903 | obj = bsn_stats_request() |
| 2904 | _version = reader.read("!B")[0] |
| 2905 | assert(_version == 3) |
| 2906 | _type = reader.read("!B")[0] |
| 2907 | assert(_type == 18) |
| 2908 | _length = reader.read("!H")[0] |
| 2909 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2910 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 2911 | obj.xid = reader.read("!L")[0] |
| 2912 | _stats_type = reader.read("!H")[0] |
| 2913 | assert(_stats_type == 65535) |
| 2914 | obj.flags = reader.read("!H")[0] |
| 2915 | reader.skip(4) |
| 2916 | _experimenter = reader.read("!L")[0] |
| 2917 | assert(_experimenter == 6035143) |
| 2918 | obj.subtype = reader.read("!L")[0] |
| 2919 | return obj |
| 2920 | |
| 2921 | def __eq__(self, other): |
| 2922 | if type(self) != type(other): return False |
| 2923 | if self.xid != other.xid: return False |
| 2924 | if self.flags != other.flags: return False |
| 2925 | if self.subtype != other.subtype: return False |
| 2926 | return True |
| 2927 | |
| 2928 | def pretty_print(self, q): |
| 2929 | q.text("bsn_stats_request {") |
| 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("flags = "); |
| 2940 | q.text("%#x" % self.flags) |
| 2941 | q.breakable() |
| 2942 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2943 | |
| 2944 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2945 | |
| 2946 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2947 | version = 3 |
| 2948 | type = 4 |
| 2949 | experimenter = 6035143 |
| 2950 | subtype = 16 |
| 2951 | |
| 2952 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2953 | if xid != None: |
| 2954 | self.xid = xid |
| 2955 | else: |
| 2956 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2957 | if status != None: |
| 2958 | self.status = status |
| 2959 | else: |
| 2960 | self.status = 0 |
| 2961 | if vport_no != None: |
| 2962 | self.vport_no = vport_no |
| 2963 | else: |
| 2964 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2965 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2966 | |
| 2967 | def pack(self): |
| 2968 | packed = [] |
| 2969 | packed.append(struct.pack("!B", self.version)) |
| 2970 | packed.append(struct.pack("!B", self.type)) |
| 2971 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2972 | packed.append(struct.pack("!L", self.xid)) |
| 2973 | packed.append(struct.pack("!L", self.experimenter)) |
| 2974 | packed.append(struct.pack("!L", self.subtype)) |
| 2975 | packed.append(struct.pack("!L", self.status)) |
| 2976 | packed.append(struct.pack("!L", self.vport_no)) |
| 2977 | length = sum([len(x) for x in packed]) |
| 2978 | packed[2] = struct.pack("!H", length) |
| 2979 | return ''.join(packed) |
| 2980 | |
| 2981 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2982 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2983 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2984 | _version = reader.read("!B")[0] |
| 2985 | assert(_version == 3) |
| 2986 | _type = reader.read("!B")[0] |
| 2987 | assert(_type == 4) |
| 2988 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2989 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2990 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2991 | obj.xid = reader.read("!L")[0] |
| 2992 | _experimenter = reader.read("!L")[0] |
| 2993 | assert(_experimenter == 6035143) |
| 2994 | _subtype = reader.read("!L")[0] |
| 2995 | assert(_subtype == 16) |
| 2996 | obj.status = reader.read("!L")[0] |
| 2997 | obj.vport_no = reader.read("!L")[0] |
| 2998 | return obj |
| 2999 | |
| 3000 | def __eq__(self, other): |
| 3001 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3002 | if self.xid != other.xid: return False |
| 3003 | if self.status != other.status: return False |
| 3004 | if self.vport_no != other.vport_no: return False |
| 3005 | return True |
| 3006 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3007 | def pretty_print(self, q): |
| 3008 | q.text("bsn_virtual_port_create_reply {") |
| 3009 | with q.group(): |
| 3010 | with q.indent(2): |
| 3011 | q.breakable() |
| 3012 | q.text("xid = "); |
| 3013 | if self.xid != None: |
| 3014 | q.text("%#x" % self.xid) |
| 3015 | else: |
| 3016 | q.text('None') |
| 3017 | q.text(","); q.breakable() |
| 3018 | q.text("status = "); |
| 3019 | q.text("%#x" % self.status) |
| 3020 | q.text(","); q.breakable() |
| 3021 | q.text("vport_no = "); |
| 3022 | q.text("%#x" % self.vport_no) |
| 3023 | q.breakable() |
| 3024 | q.text('}') |
| 3025 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3026 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3027 | |
| 3028 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3029 | version = 3 |
| 3030 | type = 4 |
| 3031 | experimenter = 6035143 |
| 3032 | subtype = 15 |
| 3033 | |
| 3034 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3035 | if xid != None: |
| 3036 | self.xid = xid |
| 3037 | else: |
| 3038 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3039 | if vport != None: |
| 3040 | self.vport = vport |
| 3041 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3042 | self.vport = ofp.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3043 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3044 | |
| 3045 | def pack(self): |
| 3046 | packed = [] |
| 3047 | packed.append(struct.pack("!B", self.version)) |
| 3048 | packed.append(struct.pack("!B", self.type)) |
| 3049 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3050 | packed.append(struct.pack("!L", self.xid)) |
| 3051 | packed.append(struct.pack("!L", self.experimenter)) |
| 3052 | packed.append(struct.pack("!L", self.subtype)) |
| 3053 | packed.append(self.vport.pack()) |
| 3054 | length = sum([len(x) for x in packed]) |
| 3055 | packed[2] = struct.pack("!H", length) |
| 3056 | return ''.join(packed) |
| 3057 | |
| 3058 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3059 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3060 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3061 | _version = reader.read("!B")[0] |
| 3062 | assert(_version == 3) |
| 3063 | _type = reader.read("!B")[0] |
| 3064 | assert(_type == 4) |
| 3065 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3066 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3067 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3068 | obj.xid = reader.read("!L")[0] |
| 3069 | _experimenter = reader.read("!L")[0] |
| 3070 | assert(_experimenter == 6035143) |
| 3071 | _subtype = reader.read("!L")[0] |
| 3072 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3073 | obj.vport = ofp.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3074 | return obj |
| 3075 | |
| 3076 | def __eq__(self, other): |
| 3077 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3078 | if self.xid != other.xid: return False |
| 3079 | if self.vport != other.vport: return False |
| 3080 | return True |
| 3081 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3082 | def pretty_print(self, q): |
| 3083 | q.text("bsn_virtual_port_create_request {") |
| 3084 | with q.group(): |
| 3085 | with q.indent(2): |
| 3086 | q.breakable() |
| 3087 | q.text("xid = "); |
| 3088 | if self.xid != None: |
| 3089 | q.text("%#x" % self.xid) |
| 3090 | else: |
| 3091 | q.text('None') |
| 3092 | q.text(","); q.breakable() |
| 3093 | q.text("vport = "); |
| 3094 | q.pp(self.vport) |
| 3095 | q.breakable() |
| 3096 | q.text('}') |
| 3097 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3098 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3099 | |
| 3100 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3101 | version = 3 |
| 3102 | type = 4 |
| 3103 | experimenter = 6035143 |
| 3104 | subtype = 26 |
| 3105 | |
| 3106 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3107 | if xid != None: |
| 3108 | self.xid = xid |
| 3109 | else: |
| 3110 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3111 | if status != None: |
| 3112 | self.status = status |
| 3113 | else: |
| 3114 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3115 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3116 | |
| 3117 | def pack(self): |
| 3118 | packed = [] |
| 3119 | packed.append(struct.pack("!B", self.version)) |
| 3120 | packed.append(struct.pack("!B", self.type)) |
| 3121 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3122 | packed.append(struct.pack("!L", self.xid)) |
| 3123 | packed.append(struct.pack("!L", self.experimenter)) |
| 3124 | packed.append(struct.pack("!L", self.subtype)) |
| 3125 | packed.append(struct.pack("!L", self.status)) |
| 3126 | length = sum([len(x) for x in packed]) |
| 3127 | packed[2] = struct.pack("!H", length) |
| 3128 | return ''.join(packed) |
| 3129 | |
| 3130 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3131 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3132 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3133 | _version = reader.read("!B")[0] |
| 3134 | assert(_version == 3) |
| 3135 | _type = reader.read("!B")[0] |
| 3136 | assert(_type == 4) |
| 3137 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3138 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3139 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3140 | obj.xid = reader.read("!L")[0] |
| 3141 | _experimenter = reader.read("!L")[0] |
| 3142 | assert(_experimenter == 6035143) |
| 3143 | _subtype = reader.read("!L")[0] |
| 3144 | assert(_subtype == 26) |
| 3145 | obj.status = reader.read("!L")[0] |
| 3146 | return obj |
| 3147 | |
| 3148 | def __eq__(self, other): |
| 3149 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3150 | if self.xid != other.xid: return False |
| 3151 | if self.status != other.status: return False |
| 3152 | return True |
| 3153 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3154 | def pretty_print(self, q): |
| 3155 | q.text("bsn_virtual_port_remove_reply {") |
| 3156 | with q.group(): |
| 3157 | with q.indent(2): |
| 3158 | q.breakable() |
| 3159 | q.text("xid = "); |
| 3160 | if self.xid != None: |
| 3161 | q.text("%#x" % self.xid) |
| 3162 | else: |
| 3163 | q.text('None') |
| 3164 | q.text(","); q.breakable() |
| 3165 | q.text("status = "); |
| 3166 | q.text("%#x" % self.status) |
| 3167 | q.breakable() |
| 3168 | q.text('}') |
| 3169 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3170 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3171 | |
| 3172 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3173 | version = 3 |
| 3174 | type = 4 |
| 3175 | experimenter = 6035143 |
| 3176 | subtype = 17 |
| 3177 | |
| 3178 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3179 | if xid != None: |
| 3180 | self.xid = xid |
| 3181 | else: |
| 3182 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3183 | if vport_no != None: |
| 3184 | self.vport_no = vport_no |
| 3185 | else: |
| 3186 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3187 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3188 | |
| 3189 | def pack(self): |
| 3190 | packed = [] |
| 3191 | packed.append(struct.pack("!B", self.version)) |
| 3192 | packed.append(struct.pack("!B", self.type)) |
| 3193 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3194 | packed.append(struct.pack("!L", self.xid)) |
| 3195 | packed.append(struct.pack("!L", self.experimenter)) |
| 3196 | packed.append(struct.pack("!L", self.subtype)) |
| 3197 | packed.append(struct.pack("!L", self.vport_no)) |
| 3198 | length = sum([len(x) for x in packed]) |
| 3199 | packed[2] = struct.pack("!H", length) |
| 3200 | return ''.join(packed) |
| 3201 | |
| 3202 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3203 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3204 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3205 | _version = reader.read("!B")[0] |
| 3206 | assert(_version == 3) |
| 3207 | _type = reader.read("!B")[0] |
| 3208 | assert(_type == 4) |
| 3209 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3210 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3211 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3212 | obj.xid = reader.read("!L")[0] |
| 3213 | _experimenter = reader.read("!L")[0] |
| 3214 | assert(_experimenter == 6035143) |
| 3215 | _subtype = reader.read("!L")[0] |
| 3216 | assert(_subtype == 17) |
| 3217 | obj.vport_no = reader.read("!L")[0] |
| 3218 | return obj |
| 3219 | |
| 3220 | def __eq__(self, other): |
| 3221 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3222 | if self.xid != other.xid: return False |
| 3223 | if self.vport_no != other.vport_no: return False |
| 3224 | return True |
| 3225 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3226 | def pretty_print(self, q): |
| 3227 | q.text("bsn_virtual_port_remove_request {") |
| 3228 | with q.group(): |
| 3229 | with q.indent(2): |
| 3230 | q.breakable() |
| 3231 | q.text("xid = "); |
| 3232 | if self.xid != None: |
| 3233 | q.text("%#x" % self.xid) |
| 3234 | else: |
| 3235 | q.text('None') |
| 3236 | q.text(","); q.breakable() |
| 3237 | q.text("vport_no = "); |
| 3238 | q.text("%#x" % self.vport_no) |
| 3239 | q.breakable() |
| 3240 | q.text('}') |
| 3241 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3242 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3243 | |
| 3244 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3245 | version = 3 |
| 3246 | type = 19 |
| 3247 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3248 | |
| 3249 | 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] | 3250 | if xid != None: |
| 3251 | self.xid = xid |
| 3252 | else: |
| 3253 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3254 | if flags != None: |
| 3255 | self.flags = flags |
| 3256 | else: |
| 3257 | self.flags = 0 |
| 3258 | if mfr_desc != None: |
| 3259 | self.mfr_desc = mfr_desc |
| 3260 | else: |
| 3261 | self.mfr_desc = "" |
| 3262 | if hw_desc != None: |
| 3263 | self.hw_desc = hw_desc |
| 3264 | else: |
| 3265 | self.hw_desc = "" |
| 3266 | if sw_desc != None: |
| 3267 | self.sw_desc = sw_desc |
| 3268 | else: |
| 3269 | self.sw_desc = "" |
| 3270 | if serial_num != None: |
| 3271 | self.serial_num = serial_num |
| 3272 | else: |
| 3273 | self.serial_num = "" |
| 3274 | if dp_desc != None: |
| 3275 | self.dp_desc = dp_desc |
| 3276 | else: |
| 3277 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3278 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3279 | |
| 3280 | def pack(self): |
| 3281 | packed = [] |
| 3282 | packed.append(struct.pack("!B", self.version)) |
| 3283 | packed.append(struct.pack("!B", self.type)) |
| 3284 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3285 | packed.append(struct.pack("!L", self.xid)) |
| 3286 | packed.append(struct.pack("!H", self.stats_type)) |
| 3287 | packed.append(struct.pack("!H", self.flags)) |
| 3288 | packed.append('\x00' * 4) |
| 3289 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 3290 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 3291 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 3292 | packed.append(struct.pack("!32s", self.serial_num)) |
| 3293 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 3294 | length = sum([len(x) for x in packed]) |
| 3295 | packed[2] = struct.pack("!H", length) |
| 3296 | return ''.join(packed) |
| 3297 | |
| 3298 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3299 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3300 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3301 | _version = reader.read("!B")[0] |
| 3302 | assert(_version == 3) |
| 3303 | _type = reader.read("!B")[0] |
| 3304 | assert(_type == 19) |
| 3305 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3306 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3307 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3308 | obj.xid = reader.read("!L")[0] |
| 3309 | _stats_type = reader.read("!H")[0] |
| 3310 | assert(_stats_type == 0) |
| 3311 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3312 | reader.skip(4) |
| 3313 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3314 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3315 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3316 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 3317 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 3318 | return obj |
| 3319 | |
| 3320 | def __eq__(self, other): |
| 3321 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3322 | if self.xid != other.xid: return False |
| 3323 | if self.flags != other.flags: return False |
| 3324 | if self.mfr_desc != other.mfr_desc: return False |
| 3325 | if self.hw_desc != other.hw_desc: return False |
| 3326 | if self.sw_desc != other.sw_desc: return False |
| 3327 | if self.serial_num != other.serial_num: return False |
| 3328 | if self.dp_desc != other.dp_desc: return False |
| 3329 | return True |
| 3330 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3331 | def pretty_print(self, q): |
| 3332 | q.text("desc_stats_reply {") |
| 3333 | with q.group(): |
| 3334 | with q.indent(2): |
| 3335 | q.breakable() |
| 3336 | q.text("xid = "); |
| 3337 | if self.xid != None: |
| 3338 | q.text("%#x" % self.xid) |
| 3339 | else: |
| 3340 | q.text('None') |
| 3341 | q.text(","); q.breakable() |
| 3342 | q.text("flags = "); |
| 3343 | q.text("%#x" % self.flags) |
| 3344 | q.text(","); q.breakable() |
| 3345 | q.text("mfr_desc = "); |
| 3346 | q.pp(self.mfr_desc) |
| 3347 | q.text(","); q.breakable() |
| 3348 | q.text("hw_desc = "); |
| 3349 | q.pp(self.hw_desc) |
| 3350 | q.text(","); q.breakable() |
| 3351 | q.text("sw_desc = "); |
| 3352 | q.pp(self.sw_desc) |
| 3353 | q.text(","); q.breakable() |
| 3354 | q.text("serial_num = "); |
| 3355 | q.pp(self.serial_num) |
| 3356 | q.text(","); q.breakable() |
| 3357 | q.text("dp_desc = "); |
| 3358 | q.pp(self.dp_desc) |
| 3359 | q.breakable() |
| 3360 | q.text('}') |
| 3361 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3362 | stats_reply.subtypes[0] = desc_stats_reply |
| 3363 | |
| 3364 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3365 | version = 3 |
| 3366 | type = 18 |
| 3367 | stats_type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3368 | |
| 3369 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3370 | if xid != None: |
| 3371 | self.xid = xid |
| 3372 | else: |
| 3373 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3374 | if flags != None: |
| 3375 | self.flags = flags |
| 3376 | else: |
| 3377 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3378 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3379 | |
| 3380 | def pack(self): |
| 3381 | packed = [] |
| 3382 | packed.append(struct.pack("!B", self.version)) |
| 3383 | packed.append(struct.pack("!B", self.type)) |
| 3384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3385 | packed.append(struct.pack("!L", self.xid)) |
| 3386 | packed.append(struct.pack("!H", self.stats_type)) |
| 3387 | packed.append(struct.pack("!H", self.flags)) |
| 3388 | packed.append('\x00' * 4) |
| 3389 | length = sum([len(x) for x in packed]) |
| 3390 | packed[2] = struct.pack("!H", length) |
| 3391 | return ''.join(packed) |
| 3392 | |
| 3393 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3394 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3395 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3396 | _version = reader.read("!B")[0] |
| 3397 | assert(_version == 3) |
| 3398 | _type = reader.read("!B")[0] |
| 3399 | assert(_type == 18) |
| 3400 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3401 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3402 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3403 | obj.xid = reader.read("!L")[0] |
| 3404 | _stats_type = reader.read("!H")[0] |
| 3405 | assert(_stats_type == 0) |
| 3406 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3407 | reader.skip(4) |
| 3408 | return obj |
| 3409 | |
| 3410 | def __eq__(self, other): |
| 3411 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3412 | if self.xid != other.xid: return False |
| 3413 | if self.flags != other.flags: return False |
| 3414 | return True |
| 3415 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3416 | def pretty_print(self, q): |
| 3417 | q.text("desc_stats_request {") |
| 3418 | with q.group(): |
| 3419 | with q.indent(2): |
| 3420 | q.breakable() |
| 3421 | q.text("xid = "); |
| 3422 | if self.xid != None: |
| 3423 | q.text("%#x" % self.xid) |
| 3424 | else: |
| 3425 | q.text('None') |
| 3426 | q.text(","); q.breakable() |
| 3427 | q.text("flags = "); |
| 3428 | q.text("%#x" % self.flags) |
| 3429 | q.breakable() |
| 3430 | q.text('}') |
| 3431 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3432 | stats_request.subtypes[0] = desc_stats_request |
| 3433 | |
| 3434 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3435 | version = 3 |
| 3436 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3437 | |
| 3438 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3439 | if xid != None: |
| 3440 | self.xid = xid |
| 3441 | else: |
| 3442 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3443 | if data != None: |
| 3444 | self.data = data |
| 3445 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3446 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3447 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3448 | |
| 3449 | def pack(self): |
| 3450 | packed = [] |
| 3451 | packed.append(struct.pack("!B", self.version)) |
| 3452 | packed.append(struct.pack("!B", self.type)) |
| 3453 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3454 | packed.append(struct.pack("!L", self.xid)) |
| 3455 | packed.append(self.data) |
| 3456 | length = sum([len(x) for x in packed]) |
| 3457 | packed[2] = struct.pack("!H", length) |
| 3458 | return ''.join(packed) |
| 3459 | |
| 3460 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3461 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3462 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3463 | _version = reader.read("!B")[0] |
| 3464 | assert(_version == 3) |
| 3465 | _type = reader.read("!B")[0] |
| 3466 | assert(_type == 3) |
| 3467 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3468 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3469 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3470 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3471 | obj.data = str(reader.read_all()) |
| 3472 | return obj |
| 3473 | |
| 3474 | def __eq__(self, other): |
| 3475 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3476 | if self.xid != other.xid: return False |
| 3477 | if self.data != other.data: return False |
| 3478 | return True |
| 3479 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3480 | def pretty_print(self, q): |
| 3481 | q.text("echo_reply {") |
| 3482 | with q.group(): |
| 3483 | with q.indent(2): |
| 3484 | q.breakable() |
| 3485 | q.text("xid = "); |
| 3486 | if self.xid != None: |
| 3487 | q.text("%#x" % self.xid) |
| 3488 | else: |
| 3489 | q.text('None') |
| 3490 | q.text(","); q.breakable() |
| 3491 | q.text("data = "); |
| 3492 | q.pp(self.data) |
| 3493 | q.breakable() |
| 3494 | q.text('}') |
| 3495 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3496 | message.subtypes[3] = echo_reply |
| 3497 | |
| 3498 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3499 | version = 3 |
| 3500 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3501 | |
| 3502 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3503 | if xid != None: |
| 3504 | self.xid = xid |
| 3505 | else: |
| 3506 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3507 | if data != None: |
| 3508 | self.data = data |
| 3509 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3510 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3511 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3512 | |
| 3513 | def pack(self): |
| 3514 | packed = [] |
| 3515 | packed.append(struct.pack("!B", self.version)) |
| 3516 | packed.append(struct.pack("!B", self.type)) |
| 3517 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3518 | packed.append(struct.pack("!L", self.xid)) |
| 3519 | packed.append(self.data) |
| 3520 | length = sum([len(x) for x in packed]) |
| 3521 | packed[2] = struct.pack("!H", length) |
| 3522 | return ''.join(packed) |
| 3523 | |
| 3524 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3525 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3526 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3527 | _version = reader.read("!B")[0] |
| 3528 | assert(_version == 3) |
| 3529 | _type = reader.read("!B")[0] |
| 3530 | assert(_type == 2) |
| 3531 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3532 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3533 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3534 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3535 | obj.data = str(reader.read_all()) |
| 3536 | return obj |
| 3537 | |
| 3538 | def __eq__(self, other): |
| 3539 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3540 | if self.xid != other.xid: return False |
| 3541 | if self.data != other.data: return False |
| 3542 | return True |
| 3543 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3544 | def pretty_print(self, q): |
| 3545 | q.text("echo_request {") |
| 3546 | with q.group(): |
| 3547 | with q.indent(2): |
| 3548 | q.breakable() |
| 3549 | q.text("xid = "); |
| 3550 | if self.xid != None: |
| 3551 | q.text("%#x" % self.xid) |
| 3552 | else: |
| 3553 | q.text('None') |
| 3554 | q.text(","); q.breakable() |
| 3555 | q.text("data = "); |
| 3556 | q.pp(self.data) |
| 3557 | q.breakable() |
| 3558 | q.text('}') |
| 3559 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3560 | message.subtypes[2] = echo_request |
| 3561 | |
| 3562 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3563 | version = 3 |
| 3564 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3565 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3566 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3567 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3568 | if xid != None: |
| 3569 | self.xid = xid |
| 3570 | else: |
| 3571 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3572 | if subtype != None: |
| 3573 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3574 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3575 | self.subtype = 0 |
| 3576 | if experimenter != None: |
| 3577 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3578 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3579 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3580 | if data != None: |
| 3581 | self.data = data |
| 3582 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3583 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3584 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3585 | |
| 3586 | def pack(self): |
| 3587 | packed = [] |
| 3588 | packed.append(struct.pack("!B", self.version)) |
| 3589 | packed.append(struct.pack("!B", self.type)) |
| 3590 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3591 | packed.append(struct.pack("!L", self.xid)) |
| 3592 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3593 | packed.append(struct.pack("!H", self.subtype)) |
| 3594 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3595 | packed.append(self.data) |
| 3596 | length = sum([len(x) for x in packed]) |
| 3597 | packed[2] = struct.pack("!H", length) |
| 3598 | return ''.join(packed) |
| 3599 | |
| 3600 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3601 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3602 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3603 | _version = reader.read("!B")[0] |
| 3604 | assert(_version == 3) |
| 3605 | _type = reader.read("!B")[0] |
| 3606 | assert(_type == 1) |
| 3607 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3608 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3609 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3610 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3611 | _err_type = reader.read("!H")[0] |
| 3612 | assert(_err_type == 65535) |
| 3613 | obj.subtype = reader.read("!H")[0] |
| 3614 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3615 | obj.data = str(reader.read_all()) |
| 3616 | return obj |
| 3617 | |
| 3618 | def __eq__(self, other): |
| 3619 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3620 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3621 | if self.subtype != other.subtype: return False |
| 3622 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3623 | if self.data != other.data: return False |
| 3624 | return True |
| 3625 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3626 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3627 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3628 | with q.group(): |
| 3629 | with q.indent(2): |
| 3630 | q.breakable() |
| 3631 | q.text("xid = "); |
| 3632 | if self.xid != None: |
| 3633 | q.text("%#x" % self.xid) |
| 3634 | else: |
| 3635 | q.text('None') |
| 3636 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3637 | q.text("subtype = "); |
| 3638 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3639 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3640 | q.text("experimenter = "); |
| 3641 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3642 | q.text(","); q.breakable() |
| 3643 | q.text("data = "); |
| 3644 | q.pp(self.data) |
| 3645 | q.breakable() |
| 3646 | q.text('}') |
| 3647 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3648 | error_msg.subtypes[65535] = experimenter_error_msg |
| 3649 | |
| 3650 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3651 | version = 3 |
| 3652 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3653 | |
| 3654 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, reserved=None, ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3655 | if xid != None: |
| 3656 | self.xid = xid |
| 3657 | else: |
| 3658 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3659 | if datapath_id != None: |
| 3660 | self.datapath_id = datapath_id |
| 3661 | else: |
| 3662 | self.datapath_id = 0 |
| 3663 | if n_buffers != None: |
| 3664 | self.n_buffers = n_buffers |
| 3665 | else: |
| 3666 | self.n_buffers = 0 |
| 3667 | if n_tables != None: |
| 3668 | self.n_tables = n_tables |
| 3669 | else: |
| 3670 | self.n_tables = 0 |
| 3671 | if capabilities != None: |
| 3672 | self.capabilities = capabilities |
| 3673 | else: |
| 3674 | self.capabilities = 0 |
| 3675 | if reserved != None: |
| 3676 | self.reserved = reserved |
| 3677 | else: |
| 3678 | self.reserved = 0 |
| 3679 | if ports != None: |
| 3680 | self.ports = ports |
| 3681 | else: |
| 3682 | self.ports = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3683 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3684 | |
| 3685 | def pack(self): |
| 3686 | packed = [] |
| 3687 | packed.append(struct.pack("!B", self.version)) |
| 3688 | packed.append(struct.pack("!B", self.type)) |
| 3689 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3690 | packed.append(struct.pack("!L", self.xid)) |
| 3691 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 3692 | packed.append(struct.pack("!L", self.n_buffers)) |
| 3693 | packed.append(struct.pack("!B", self.n_tables)) |
| 3694 | packed.append('\x00' * 3) |
| 3695 | packed.append(struct.pack("!L", self.capabilities)) |
| 3696 | packed.append(struct.pack("!L", self.reserved)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3697 | packed.append(loxi.generic_util.pack_list(self.ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3698 | length = sum([len(x) for x in packed]) |
| 3699 | packed[2] = struct.pack("!H", length) |
| 3700 | return ''.join(packed) |
| 3701 | |
| 3702 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3703 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3704 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3705 | _version = reader.read("!B")[0] |
| 3706 | assert(_version == 3) |
| 3707 | _type = reader.read("!B")[0] |
| 3708 | assert(_type == 6) |
| 3709 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3710 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3711 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3712 | obj.xid = reader.read("!L")[0] |
| 3713 | obj.datapath_id = reader.read("!Q")[0] |
| 3714 | obj.n_buffers = reader.read("!L")[0] |
| 3715 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3716 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3717 | obj.capabilities = reader.read("!L")[0] |
| 3718 | obj.reserved = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3719 | obj.ports = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3720 | return obj |
| 3721 | |
| 3722 | def __eq__(self, other): |
| 3723 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3724 | if self.xid != other.xid: return False |
| 3725 | if self.datapath_id != other.datapath_id: return False |
| 3726 | if self.n_buffers != other.n_buffers: return False |
| 3727 | if self.n_tables != other.n_tables: return False |
| 3728 | if self.capabilities != other.capabilities: return False |
| 3729 | if self.reserved != other.reserved: return False |
| 3730 | if self.ports != other.ports: return False |
| 3731 | return True |
| 3732 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3733 | def pretty_print(self, q): |
| 3734 | q.text("features_reply {") |
| 3735 | with q.group(): |
| 3736 | with q.indent(2): |
| 3737 | q.breakable() |
| 3738 | q.text("xid = "); |
| 3739 | if self.xid != None: |
| 3740 | q.text("%#x" % self.xid) |
| 3741 | else: |
| 3742 | q.text('None') |
| 3743 | q.text(","); q.breakable() |
| 3744 | q.text("datapath_id = "); |
| 3745 | q.text("%#x" % self.datapath_id) |
| 3746 | q.text(","); q.breakable() |
| 3747 | q.text("n_buffers = "); |
| 3748 | q.text("%#x" % self.n_buffers) |
| 3749 | q.text(","); q.breakable() |
| 3750 | q.text("n_tables = "); |
| 3751 | q.text("%#x" % self.n_tables) |
| 3752 | q.text(","); q.breakable() |
| 3753 | q.text("capabilities = "); |
| 3754 | q.text("%#x" % self.capabilities) |
| 3755 | q.text(","); q.breakable() |
| 3756 | q.text("reserved = "); |
| 3757 | q.text("%#x" % self.reserved) |
| 3758 | q.text(","); q.breakable() |
| 3759 | q.text("ports = "); |
| 3760 | q.pp(self.ports) |
| 3761 | q.breakable() |
| 3762 | q.text('}') |
| 3763 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3764 | message.subtypes[6] = features_reply |
| 3765 | |
| 3766 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3767 | version = 3 |
| 3768 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3769 | |
| 3770 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3771 | if xid != None: |
| 3772 | self.xid = xid |
| 3773 | else: |
| 3774 | self.xid = None |
| 3775 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3776 | |
| 3777 | def pack(self): |
| 3778 | packed = [] |
| 3779 | packed.append(struct.pack("!B", self.version)) |
| 3780 | packed.append(struct.pack("!B", self.type)) |
| 3781 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3782 | packed.append(struct.pack("!L", self.xid)) |
| 3783 | length = sum([len(x) for x in packed]) |
| 3784 | packed[2] = struct.pack("!H", length) |
| 3785 | return ''.join(packed) |
| 3786 | |
| 3787 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3788 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3789 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3790 | _version = reader.read("!B")[0] |
| 3791 | assert(_version == 3) |
| 3792 | _type = reader.read("!B")[0] |
| 3793 | assert(_type == 5) |
| 3794 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3795 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3796 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3797 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3798 | return obj |
| 3799 | |
| 3800 | def __eq__(self, other): |
| 3801 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3802 | if self.xid != other.xid: return False |
| 3803 | return True |
| 3804 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3805 | def pretty_print(self, q): |
| 3806 | q.text("features_request {") |
| 3807 | with q.group(): |
| 3808 | with q.indent(2): |
| 3809 | q.breakable() |
| 3810 | q.text("xid = "); |
| 3811 | if self.xid != None: |
| 3812 | q.text("%#x" % self.xid) |
| 3813 | else: |
| 3814 | q.text('None') |
| 3815 | q.breakable() |
| 3816 | q.text('}') |
| 3817 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3818 | message.subtypes[5] = features_request |
| 3819 | |
| 3820 | class flow_mod(message): |
| 3821 | subtypes = {} |
| 3822 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3823 | version = 3 |
| 3824 | type = 14 |
| 3825 | |
| 3826 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
| 3827 | if xid != None: |
| 3828 | self.xid = xid |
| 3829 | else: |
| 3830 | self.xid = None |
| 3831 | if cookie != None: |
| 3832 | self.cookie = cookie |
| 3833 | else: |
| 3834 | self.cookie = 0 |
| 3835 | if cookie_mask != None: |
| 3836 | self.cookie_mask = cookie_mask |
| 3837 | else: |
| 3838 | self.cookie_mask = 0 |
| 3839 | if table_id != None: |
| 3840 | self.table_id = table_id |
| 3841 | else: |
| 3842 | self.table_id = 0 |
| 3843 | if _command != None: |
| 3844 | self._command = _command |
| 3845 | else: |
| 3846 | self._command = 0 |
| 3847 | if idle_timeout != None: |
| 3848 | self.idle_timeout = idle_timeout |
| 3849 | else: |
| 3850 | self.idle_timeout = 0 |
| 3851 | if hard_timeout != None: |
| 3852 | self.hard_timeout = hard_timeout |
| 3853 | else: |
| 3854 | self.hard_timeout = 0 |
| 3855 | if priority != None: |
| 3856 | self.priority = priority |
| 3857 | else: |
| 3858 | self.priority = 0 |
| 3859 | if buffer_id != None: |
| 3860 | self.buffer_id = buffer_id |
| 3861 | else: |
| 3862 | self.buffer_id = 0 |
| 3863 | if out_port != None: |
| 3864 | self.out_port = out_port |
| 3865 | else: |
| 3866 | self.out_port = 0 |
| 3867 | if out_group != None: |
| 3868 | self.out_group = out_group |
| 3869 | else: |
| 3870 | self.out_group = 0 |
| 3871 | if flags != None: |
| 3872 | self.flags = flags |
| 3873 | else: |
| 3874 | self.flags = 0 |
| 3875 | if match != None: |
| 3876 | self.match = match |
| 3877 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3878 | self.match = ofp.match() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3879 | if instructions != None: |
| 3880 | self.instructions = instructions |
| 3881 | else: |
| 3882 | self.instructions = [] |
| 3883 | return |
| 3884 | |
| 3885 | def pack(self): |
| 3886 | packed = [] |
| 3887 | packed.append(struct.pack("!B", self.version)) |
| 3888 | packed.append(struct.pack("!B", self.type)) |
| 3889 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3890 | packed.append(struct.pack("!L", self.xid)) |
| 3891 | packed.append(struct.pack("!Q", self.cookie)) |
| 3892 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 3893 | packed.append(struct.pack("!B", self.table_id)) |
| 3894 | packed.append(util.pack_fm_cmd(self._command)) |
| 3895 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3896 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3897 | packed.append(struct.pack("!H", self.priority)) |
| 3898 | packed.append(struct.pack("!L", self.buffer_id)) |
| 3899 | packed.append(util.pack_port_no(self.out_port)) |
| 3900 | packed.append(struct.pack("!L", self.out_group)) |
| 3901 | packed.append(struct.pack("!H", self.flags)) |
| 3902 | packed.append('\x00' * 2) |
| 3903 | packed.append(self.match.pack()) |
| 3904 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 3905 | length = sum([len(x) for x in packed]) |
| 3906 | packed[2] = struct.pack("!H", length) |
| 3907 | return ''.join(packed) |
| 3908 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3909 | @staticmethod |
| 3910 | def unpack(reader): |
| 3911 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3912 | subclass = flow_mod.subtypes.get(subtype) |
| 3913 | if subclass: |
| 3914 | return subclass.unpack(reader) |
| 3915 | |
| 3916 | obj = flow_mod() |
| 3917 | _version = reader.read("!B")[0] |
| 3918 | assert(_version == 3) |
| 3919 | _type = reader.read("!B")[0] |
| 3920 | assert(_type == 14) |
| 3921 | _length = reader.read("!H")[0] |
| 3922 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3923 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3924 | obj.xid = reader.read("!L")[0] |
| 3925 | obj.cookie = reader.read("!Q")[0] |
| 3926 | obj.cookie_mask = reader.read("!Q")[0] |
| 3927 | obj.table_id = reader.read("!B")[0] |
| 3928 | obj._command = util.unpack_fm_cmd(reader) |
| 3929 | obj.idle_timeout = reader.read("!H")[0] |
| 3930 | obj.hard_timeout = reader.read("!H")[0] |
| 3931 | obj.priority = reader.read("!H")[0] |
| 3932 | obj.buffer_id = reader.read("!L")[0] |
| 3933 | obj.out_port = util.unpack_port_no(reader) |
| 3934 | obj.out_group = reader.read("!L")[0] |
| 3935 | obj.flags = reader.read("!H")[0] |
| 3936 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3937 | obj.match = ofp.match.unpack(reader) |
| 3938 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3939 | return obj |
| 3940 | |
| 3941 | def __eq__(self, other): |
| 3942 | if type(self) != type(other): return False |
| 3943 | if self.xid != other.xid: return False |
| 3944 | if self.cookie != other.cookie: return False |
| 3945 | if self.cookie_mask != other.cookie_mask: return False |
| 3946 | if self.table_id != other.table_id: return False |
| 3947 | if self._command != other._command: return False |
| 3948 | if self.idle_timeout != other.idle_timeout: return False |
| 3949 | if self.hard_timeout != other.hard_timeout: return False |
| 3950 | if self.priority != other.priority: return False |
| 3951 | if self.buffer_id != other.buffer_id: return False |
| 3952 | if self.out_port != other.out_port: return False |
| 3953 | if self.out_group != other.out_group: return False |
| 3954 | if self.flags != other.flags: return False |
| 3955 | if self.match != other.match: return False |
| 3956 | if self.instructions != other.instructions: return False |
| 3957 | return True |
| 3958 | |
| 3959 | def pretty_print(self, q): |
| 3960 | q.text("flow_mod {") |
| 3961 | with q.group(): |
| 3962 | with q.indent(2): |
| 3963 | q.breakable() |
| 3964 | q.text("xid = "); |
| 3965 | if self.xid != None: |
| 3966 | q.text("%#x" % self.xid) |
| 3967 | else: |
| 3968 | q.text('None') |
| 3969 | q.text(","); q.breakable() |
| 3970 | q.text("cookie = "); |
| 3971 | q.text("%#x" % self.cookie) |
| 3972 | q.text(","); q.breakable() |
| 3973 | q.text("cookie_mask = "); |
| 3974 | q.text("%#x" % self.cookie_mask) |
| 3975 | q.text(","); q.breakable() |
| 3976 | q.text("table_id = "); |
| 3977 | q.text("%#x" % self.table_id) |
| 3978 | q.text(","); q.breakable() |
| 3979 | q.text("idle_timeout = "); |
| 3980 | q.text("%#x" % self.idle_timeout) |
| 3981 | q.text(","); q.breakable() |
| 3982 | q.text("hard_timeout = "); |
| 3983 | q.text("%#x" % self.hard_timeout) |
| 3984 | q.text(","); q.breakable() |
| 3985 | q.text("priority = "); |
| 3986 | q.text("%#x" % self.priority) |
| 3987 | q.text(","); q.breakable() |
| 3988 | q.text("buffer_id = "); |
| 3989 | q.text("%#x" % self.buffer_id) |
| 3990 | q.text(","); q.breakable() |
| 3991 | q.text("out_port = "); |
| 3992 | q.text(util.pretty_port(self.out_port)) |
| 3993 | q.text(","); q.breakable() |
| 3994 | q.text("out_group = "); |
| 3995 | q.text("%#x" % self.out_group) |
| 3996 | q.text(","); q.breakable() |
| 3997 | q.text("flags = "); |
| 3998 | q.text("%#x" % self.flags) |
| 3999 | q.text(","); q.breakable() |
| 4000 | q.text("match = "); |
| 4001 | q.pp(self.match) |
| 4002 | q.text(","); q.breakable() |
| 4003 | q.text("instructions = "); |
| 4004 | q.pp(self.instructions) |
| 4005 | q.breakable() |
| 4006 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4007 | |
| 4008 | message.subtypes[14] = flow_mod |
| 4009 | |
| 4010 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4011 | version = 3 |
| 4012 | type = 14 |
| 4013 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4014 | |
| 4015 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4016 | if xid != None: |
| 4017 | self.xid = xid |
| 4018 | else: |
| 4019 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4020 | if cookie != None: |
| 4021 | self.cookie = cookie |
| 4022 | else: |
| 4023 | self.cookie = 0 |
| 4024 | if cookie_mask != None: |
| 4025 | self.cookie_mask = cookie_mask |
| 4026 | else: |
| 4027 | self.cookie_mask = 0 |
| 4028 | if table_id != None: |
| 4029 | self.table_id = table_id |
| 4030 | else: |
| 4031 | self.table_id = 0 |
| 4032 | if idle_timeout != None: |
| 4033 | self.idle_timeout = idle_timeout |
| 4034 | else: |
| 4035 | self.idle_timeout = 0 |
| 4036 | if hard_timeout != None: |
| 4037 | self.hard_timeout = hard_timeout |
| 4038 | else: |
| 4039 | self.hard_timeout = 0 |
| 4040 | if priority != None: |
| 4041 | self.priority = priority |
| 4042 | else: |
| 4043 | self.priority = 0 |
| 4044 | if buffer_id != None: |
| 4045 | self.buffer_id = buffer_id |
| 4046 | else: |
| 4047 | self.buffer_id = 0 |
| 4048 | if out_port != None: |
| 4049 | self.out_port = out_port |
| 4050 | else: |
| 4051 | self.out_port = 0 |
| 4052 | if out_group != None: |
| 4053 | self.out_group = out_group |
| 4054 | else: |
| 4055 | self.out_group = 0 |
| 4056 | if flags != None: |
| 4057 | self.flags = flags |
| 4058 | else: |
| 4059 | self.flags = 0 |
| 4060 | if match != None: |
| 4061 | self.match = match |
| 4062 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4063 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4064 | if instructions != None: |
| 4065 | self.instructions = instructions |
| 4066 | else: |
| 4067 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4068 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4069 | |
| 4070 | def pack(self): |
| 4071 | packed = [] |
| 4072 | packed.append(struct.pack("!B", self.version)) |
| 4073 | packed.append(struct.pack("!B", self.type)) |
| 4074 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4075 | packed.append(struct.pack("!L", self.xid)) |
| 4076 | packed.append(struct.pack("!Q", self.cookie)) |
| 4077 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4078 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4079 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4080 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4081 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4082 | packed.append(struct.pack("!H", self.priority)) |
| 4083 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4084 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4085 | packed.append(struct.pack("!L", self.out_group)) |
| 4086 | packed.append(struct.pack("!H", self.flags)) |
| 4087 | packed.append('\x00' * 2) |
| 4088 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4089 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4090 | length = sum([len(x) for x in packed]) |
| 4091 | packed[2] = struct.pack("!H", length) |
| 4092 | return ''.join(packed) |
| 4093 | |
| 4094 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4095 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4096 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4097 | _version = reader.read("!B")[0] |
| 4098 | assert(_version == 3) |
| 4099 | _type = reader.read("!B")[0] |
| 4100 | assert(_type == 14) |
| 4101 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4102 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4103 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4104 | obj.xid = reader.read("!L")[0] |
| 4105 | obj.cookie = reader.read("!Q")[0] |
| 4106 | obj.cookie_mask = reader.read("!Q")[0] |
| 4107 | obj.table_id = reader.read("!B")[0] |
| 4108 | __command = util.unpack_fm_cmd(reader) |
| 4109 | assert(__command == 0) |
| 4110 | obj.idle_timeout = reader.read("!H")[0] |
| 4111 | obj.hard_timeout = reader.read("!H")[0] |
| 4112 | obj.priority = reader.read("!H")[0] |
| 4113 | obj.buffer_id = reader.read("!L")[0] |
| 4114 | obj.out_port = util.unpack_port_no(reader) |
| 4115 | obj.out_group = reader.read("!L")[0] |
| 4116 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4117 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4118 | obj.match = ofp.match.unpack(reader) |
| 4119 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4120 | return obj |
| 4121 | |
| 4122 | def __eq__(self, other): |
| 4123 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4124 | if self.xid != other.xid: return False |
| 4125 | if self.cookie != other.cookie: return False |
| 4126 | if self.cookie_mask != other.cookie_mask: return False |
| 4127 | if self.table_id != other.table_id: return False |
| 4128 | if self.idle_timeout != other.idle_timeout: return False |
| 4129 | if self.hard_timeout != other.hard_timeout: return False |
| 4130 | if self.priority != other.priority: return False |
| 4131 | if self.buffer_id != other.buffer_id: return False |
| 4132 | if self.out_port != other.out_port: return False |
| 4133 | if self.out_group != other.out_group: return False |
| 4134 | if self.flags != other.flags: return False |
| 4135 | if self.match != other.match: return False |
| 4136 | if self.instructions != other.instructions: return False |
| 4137 | return True |
| 4138 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4139 | def pretty_print(self, q): |
| 4140 | q.text("flow_add {") |
| 4141 | with q.group(): |
| 4142 | with q.indent(2): |
| 4143 | q.breakable() |
| 4144 | q.text("xid = "); |
| 4145 | if self.xid != None: |
| 4146 | q.text("%#x" % self.xid) |
| 4147 | else: |
| 4148 | q.text('None') |
| 4149 | q.text(","); q.breakable() |
| 4150 | q.text("cookie = "); |
| 4151 | q.text("%#x" % self.cookie) |
| 4152 | q.text(","); q.breakable() |
| 4153 | q.text("cookie_mask = "); |
| 4154 | q.text("%#x" % self.cookie_mask) |
| 4155 | q.text(","); q.breakable() |
| 4156 | q.text("table_id = "); |
| 4157 | q.text("%#x" % self.table_id) |
| 4158 | q.text(","); q.breakable() |
| 4159 | q.text("idle_timeout = "); |
| 4160 | q.text("%#x" % self.idle_timeout) |
| 4161 | q.text(","); q.breakable() |
| 4162 | q.text("hard_timeout = "); |
| 4163 | q.text("%#x" % self.hard_timeout) |
| 4164 | q.text(","); q.breakable() |
| 4165 | q.text("priority = "); |
| 4166 | q.text("%#x" % self.priority) |
| 4167 | q.text(","); q.breakable() |
| 4168 | q.text("buffer_id = "); |
| 4169 | q.text("%#x" % self.buffer_id) |
| 4170 | q.text(","); q.breakable() |
| 4171 | q.text("out_port = "); |
| 4172 | q.text(util.pretty_port(self.out_port)) |
| 4173 | q.text(","); q.breakable() |
| 4174 | q.text("out_group = "); |
| 4175 | q.text("%#x" % self.out_group) |
| 4176 | q.text(","); q.breakable() |
| 4177 | q.text("flags = "); |
| 4178 | q.text("%#x" % self.flags) |
| 4179 | q.text(","); q.breakable() |
| 4180 | q.text("match = "); |
| 4181 | q.pp(self.match) |
| 4182 | q.text(","); q.breakable() |
| 4183 | q.text("instructions = "); |
| 4184 | q.pp(self.instructions) |
| 4185 | q.breakable() |
| 4186 | q.text('}') |
| 4187 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4188 | flow_mod.subtypes[0] = flow_add |
| 4189 | |
| 4190 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4191 | version = 3 |
| 4192 | type = 14 |
| 4193 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4194 | |
| 4195 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4196 | if xid != None: |
| 4197 | self.xid = xid |
| 4198 | else: |
| 4199 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4200 | if cookie != None: |
| 4201 | self.cookie = cookie |
| 4202 | else: |
| 4203 | self.cookie = 0 |
| 4204 | if cookie_mask != None: |
| 4205 | self.cookie_mask = cookie_mask |
| 4206 | else: |
| 4207 | self.cookie_mask = 0 |
| 4208 | if table_id != None: |
| 4209 | self.table_id = table_id |
| 4210 | else: |
| 4211 | self.table_id = 0 |
| 4212 | if idle_timeout != None: |
| 4213 | self.idle_timeout = idle_timeout |
| 4214 | else: |
| 4215 | self.idle_timeout = 0 |
| 4216 | if hard_timeout != None: |
| 4217 | self.hard_timeout = hard_timeout |
| 4218 | else: |
| 4219 | self.hard_timeout = 0 |
| 4220 | if priority != None: |
| 4221 | self.priority = priority |
| 4222 | else: |
| 4223 | self.priority = 0 |
| 4224 | if buffer_id != None: |
| 4225 | self.buffer_id = buffer_id |
| 4226 | else: |
| 4227 | self.buffer_id = 0 |
| 4228 | if out_port != None: |
| 4229 | self.out_port = out_port |
| 4230 | else: |
| 4231 | self.out_port = 0 |
| 4232 | if out_group != None: |
| 4233 | self.out_group = out_group |
| 4234 | else: |
| 4235 | self.out_group = 0 |
| 4236 | if flags != None: |
| 4237 | self.flags = flags |
| 4238 | else: |
| 4239 | self.flags = 0 |
| 4240 | if match != None: |
| 4241 | self.match = match |
| 4242 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4243 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4244 | if instructions != None: |
| 4245 | self.instructions = instructions |
| 4246 | else: |
| 4247 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4248 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4249 | |
| 4250 | def pack(self): |
| 4251 | packed = [] |
| 4252 | packed.append(struct.pack("!B", self.version)) |
| 4253 | packed.append(struct.pack("!B", self.type)) |
| 4254 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4255 | packed.append(struct.pack("!L", self.xid)) |
| 4256 | packed.append(struct.pack("!Q", self.cookie)) |
| 4257 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4258 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4259 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4260 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4261 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4262 | packed.append(struct.pack("!H", self.priority)) |
| 4263 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4264 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4265 | packed.append(struct.pack("!L", self.out_group)) |
| 4266 | packed.append(struct.pack("!H", self.flags)) |
| 4267 | packed.append('\x00' * 2) |
| 4268 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4269 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4270 | length = sum([len(x) for x in packed]) |
| 4271 | packed[2] = struct.pack("!H", length) |
| 4272 | return ''.join(packed) |
| 4273 | |
| 4274 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4275 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4276 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4277 | _version = reader.read("!B")[0] |
| 4278 | assert(_version == 3) |
| 4279 | _type = reader.read("!B")[0] |
| 4280 | assert(_type == 14) |
| 4281 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4282 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4283 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4284 | obj.xid = reader.read("!L")[0] |
| 4285 | obj.cookie = reader.read("!Q")[0] |
| 4286 | obj.cookie_mask = reader.read("!Q")[0] |
| 4287 | obj.table_id = reader.read("!B")[0] |
| 4288 | __command = util.unpack_fm_cmd(reader) |
| 4289 | assert(__command == 3) |
| 4290 | obj.idle_timeout = reader.read("!H")[0] |
| 4291 | obj.hard_timeout = reader.read("!H")[0] |
| 4292 | obj.priority = reader.read("!H")[0] |
| 4293 | obj.buffer_id = reader.read("!L")[0] |
| 4294 | obj.out_port = util.unpack_port_no(reader) |
| 4295 | obj.out_group = reader.read("!L")[0] |
| 4296 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4297 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4298 | obj.match = ofp.match.unpack(reader) |
| 4299 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4300 | return obj |
| 4301 | |
| 4302 | def __eq__(self, other): |
| 4303 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4304 | if self.xid != other.xid: return False |
| 4305 | if self.cookie != other.cookie: return False |
| 4306 | if self.cookie_mask != other.cookie_mask: return False |
| 4307 | if self.table_id != other.table_id: return False |
| 4308 | if self.idle_timeout != other.idle_timeout: return False |
| 4309 | if self.hard_timeout != other.hard_timeout: return False |
| 4310 | if self.priority != other.priority: return False |
| 4311 | if self.buffer_id != other.buffer_id: return False |
| 4312 | if self.out_port != other.out_port: return False |
| 4313 | if self.out_group != other.out_group: return False |
| 4314 | if self.flags != other.flags: return False |
| 4315 | if self.match != other.match: return False |
| 4316 | if self.instructions != other.instructions: return False |
| 4317 | return True |
| 4318 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4319 | def pretty_print(self, q): |
| 4320 | q.text("flow_delete {") |
| 4321 | with q.group(): |
| 4322 | with q.indent(2): |
| 4323 | q.breakable() |
| 4324 | q.text("xid = "); |
| 4325 | if self.xid != None: |
| 4326 | q.text("%#x" % self.xid) |
| 4327 | else: |
| 4328 | q.text('None') |
| 4329 | q.text(","); q.breakable() |
| 4330 | q.text("cookie = "); |
| 4331 | q.text("%#x" % self.cookie) |
| 4332 | q.text(","); q.breakable() |
| 4333 | q.text("cookie_mask = "); |
| 4334 | q.text("%#x" % self.cookie_mask) |
| 4335 | q.text(","); q.breakable() |
| 4336 | q.text("table_id = "); |
| 4337 | q.text("%#x" % self.table_id) |
| 4338 | q.text(","); q.breakable() |
| 4339 | q.text("idle_timeout = "); |
| 4340 | q.text("%#x" % self.idle_timeout) |
| 4341 | q.text(","); q.breakable() |
| 4342 | q.text("hard_timeout = "); |
| 4343 | q.text("%#x" % self.hard_timeout) |
| 4344 | q.text(","); q.breakable() |
| 4345 | q.text("priority = "); |
| 4346 | q.text("%#x" % self.priority) |
| 4347 | q.text(","); q.breakable() |
| 4348 | q.text("buffer_id = "); |
| 4349 | q.text("%#x" % self.buffer_id) |
| 4350 | q.text(","); q.breakable() |
| 4351 | q.text("out_port = "); |
| 4352 | q.text(util.pretty_port(self.out_port)) |
| 4353 | q.text(","); q.breakable() |
| 4354 | q.text("out_group = "); |
| 4355 | q.text("%#x" % self.out_group) |
| 4356 | q.text(","); q.breakable() |
| 4357 | q.text("flags = "); |
| 4358 | q.text("%#x" % self.flags) |
| 4359 | q.text(","); q.breakable() |
| 4360 | q.text("match = "); |
| 4361 | q.pp(self.match) |
| 4362 | q.text(","); q.breakable() |
| 4363 | q.text("instructions = "); |
| 4364 | q.pp(self.instructions) |
| 4365 | q.breakable() |
| 4366 | q.text('}') |
| 4367 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4368 | flow_mod.subtypes[3] = flow_delete |
| 4369 | |
| 4370 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4371 | version = 3 |
| 4372 | type = 14 |
| 4373 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4374 | |
| 4375 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4376 | if xid != None: |
| 4377 | self.xid = xid |
| 4378 | else: |
| 4379 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4380 | if cookie != None: |
| 4381 | self.cookie = cookie |
| 4382 | else: |
| 4383 | self.cookie = 0 |
| 4384 | if cookie_mask != None: |
| 4385 | self.cookie_mask = cookie_mask |
| 4386 | else: |
| 4387 | self.cookie_mask = 0 |
| 4388 | if table_id != None: |
| 4389 | self.table_id = table_id |
| 4390 | else: |
| 4391 | self.table_id = 0 |
| 4392 | if idle_timeout != None: |
| 4393 | self.idle_timeout = idle_timeout |
| 4394 | else: |
| 4395 | self.idle_timeout = 0 |
| 4396 | if hard_timeout != None: |
| 4397 | self.hard_timeout = hard_timeout |
| 4398 | else: |
| 4399 | self.hard_timeout = 0 |
| 4400 | if priority != None: |
| 4401 | self.priority = priority |
| 4402 | else: |
| 4403 | self.priority = 0 |
| 4404 | if buffer_id != None: |
| 4405 | self.buffer_id = buffer_id |
| 4406 | else: |
| 4407 | self.buffer_id = 0 |
| 4408 | if out_port != None: |
| 4409 | self.out_port = out_port |
| 4410 | else: |
| 4411 | self.out_port = 0 |
| 4412 | if out_group != None: |
| 4413 | self.out_group = out_group |
| 4414 | else: |
| 4415 | self.out_group = 0 |
| 4416 | if flags != None: |
| 4417 | self.flags = flags |
| 4418 | else: |
| 4419 | self.flags = 0 |
| 4420 | if match != None: |
| 4421 | self.match = match |
| 4422 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4423 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4424 | if instructions != None: |
| 4425 | self.instructions = instructions |
| 4426 | else: |
| 4427 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4428 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4429 | |
| 4430 | def pack(self): |
| 4431 | packed = [] |
| 4432 | packed.append(struct.pack("!B", self.version)) |
| 4433 | packed.append(struct.pack("!B", self.type)) |
| 4434 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4435 | packed.append(struct.pack("!L", self.xid)) |
| 4436 | packed.append(struct.pack("!Q", self.cookie)) |
| 4437 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4438 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4439 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4440 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4441 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4442 | packed.append(struct.pack("!H", self.priority)) |
| 4443 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4444 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4445 | packed.append(struct.pack("!L", self.out_group)) |
| 4446 | packed.append(struct.pack("!H", self.flags)) |
| 4447 | packed.append('\x00' * 2) |
| 4448 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4449 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4450 | length = sum([len(x) for x in packed]) |
| 4451 | packed[2] = struct.pack("!H", length) |
| 4452 | return ''.join(packed) |
| 4453 | |
| 4454 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4455 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4456 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4457 | _version = reader.read("!B")[0] |
| 4458 | assert(_version == 3) |
| 4459 | _type = reader.read("!B")[0] |
| 4460 | assert(_type == 14) |
| 4461 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4462 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4463 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4464 | obj.xid = reader.read("!L")[0] |
| 4465 | obj.cookie = reader.read("!Q")[0] |
| 4466 | obj.cookie_mask = reader.read("!Q")[0] |
| 4467 | obj.table_id = reader.read("!B")[0] |
| 4468 | __command = util.unpack_fm_cmd(reader) |
| 4469 | assert(__command == 4) |
| 4470 | obj.idle_timeout = reader.read("!H")[0] |
| 4471 | obj.hard_timeout = reader.read("!H")[0] |
| 4472 | obj.priority = reader.read("!H")[0] |
| 4473 | obj.buffer_id = reader.read("!L")[0] |
| 4474 | obj.out_port = util.unpack_port_no(reader) |
| 4475 | obj.out_group = reader.read("!L")[0] |
| 4476 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4477 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4478 | obj.match = ofp.match.unpack(reader) |
| 4479 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4480 | return obj |
| 4481 | |
| 4482 | def __eq__(self, other): |
| 4483 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4484 | if self.xid != other.xid: return False |
| 4485 | if self.cookie != other.cookie: return False |
| 4486 | if self.cookie_mask != other.cookie_mask: return False |
| 4487 | if self.table_id != other.table_id: return False |
| 4488 | if self.idle_timeout != other.idle_timeout: return False |
| 4489 | if self.hard_timeout != other.hard_timeout: return False |
| 4490 | if self.priority != other.priority: return False |
| 4491 | if self.buffer_id != other.buffer_id: return False |
| 4492 | if self.out_port != other.out_port: return False |
| 4493 | if self.out_group != other.out_group: return False |
| 4494 | if self.flags != other.flags: return False |
| 4495 | if self.match != other.match: return False |
| 4496 | if self.instructions != other.instructions: return False |
| 4497 | return True |
| 4498 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4499 | def pretty_print(self, q): |
| 4500 | q.text("flow_delete_strict {") |
| 4501 | with q.group(): |
| 4502 | with q.indent(2): |
| 4503 | q.breakable() |
| 4504 | q.text("xid = "); |
| 4505 | if self.xid != None: |
| 4506 | q.text("%#x" % self.xid) |
| 4507 | else: |
| 4508 | q.text('None') |
| 4509 | q.text(","); q.breakable() |
| 4510 | q.text("cookie = "); |
| 4511 | q.text("%#x" % self.cookie) |
| 4512 | q.text(","); q.breakable() |
| 4513 | q.text("cookie_mask = "); |
| 4514 | q.text("%#x" % self.cookie_mask) |
| 4515 | q.text(","); q.breakable() |
| 4516 | q.text("table_id = "); |
| 4517 | q.text("%#x" % self.table_id) |
| 4518 | q.text(","); q.breakable() |
| 4519 | q.text("idle_timeout = "); |
| 4520 | q.text("%#x" % self.idle_timeout) |
| 4521 | q.text(","); q.breakable() |
| 4522 | q.text("hard_timeout = "); |
| 4523 | q.text("%#x" % self.hard_timeout) |
| 4524 | q.text(","); q.breakable() |
| 4525 | q.text("priority = "); |
| 4526 | q.text("%#x" % self.priority) |
| 4527 | q.text(","); q.breakable() |
| 4528 | q.text("buffer_id = "); |
| 4529 | q.text("%#x" % self.buffer_id) |
| 4530 | q.text(","); q.breakable() |
| 4531 | q.text("out_port = "); |
| 4532 | q.text(util.pretty_port(self.out_port)) |
| 4533 | q.text(","); q.breakable() |
| 4534 | q.text("out_group = "); |
| 4535 | q.text("%#x" % self.out_group) |
| 4536 | q.text(","); q.breakable() |
| 4537 | q.text("flags = "); |
| 4538 | q.text("%#x" % self.flags) |
| 4539 | q.text(","); q.breakable() |
| 4540 | q.text("match = "); |
| 4541 | q.pp(self.match) |
| 4542 | q.text(","); q.breakable() |
| 4543 | q.text("instructions = "); |
| 4544 | q.pp(self.instructions) |
| 4545 | q.breakable() |
| 4546 | q.text('}') |
| 4547 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4548 | flow_mod.subtypes[4] = flow_delete_strict |
| 4549 | |
| 4550 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4551 | version = 3 |
| 4552 | type = 1 |
| 4553 | err_type = 5 |
| 4554 | |
| 4555 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4556 | if xid != None: |
| 4557 | self.xid = xid |
| 4558 | else: |
| 4559 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4560 | if code != None: |
| 4561 | self.code = code |
| 4562 | else: |
| 4563 | self.code = 0 |
| 4564 | if data != None: |
| 4565 | self.data = data |
| 4566 | else: |
| 4567 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4568 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4569 | |
| 4570 | def pack(self): |
| 4571 | packed = [] |
| 4572 | packed.append(struct.pack("!B", self.version)) |
| 4573 | packed.append(struct.pack("!B", self.type)) |
| 4574 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4575 | packed.append(struct.pack("!L", self.xid)) |
| 4576 | packed.append(struct.pack("!H", self.err_type)) |
| 4577 | packed.append(struct.pack("!H", self.code)) |
| 4578 | packed.append(self.data) |
| 4579 | length = sum([len(x) for x in packed]) |
| 4580 | packed[2] = struct.pack("!H", length) |
| 4581 | return ''.join(packed) |
| 4582 | |
| 4583 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4584 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4585 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4586 | _version = reader.read("!B")[0] |
| 4587 | assert(_version == 3) |
| 4588 | _type = reader.read("!B")[0] |
| 4589 | assert(_type == 1) |
| 4590 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4591 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4592 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4593 | obj.xid = reader.read("!L")[0] |
| 4594 | _err_type = reader.read("!H")[0] |
| 4595 | assert(_err_type == 5) |
| 4596 | obj.code = reader.read("!H")[0] |
| 4597 | obj.data = str(reader.read_all()) |
| 4598 | return obj |
| 4599 | |
| 4600 | def __eq__(self, other): |
| 4601 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4602 | if self.xid != other.xid: return False |
| 4603 | if self.code != other.code: return False |
| 4604 | if self.data != other.data: return False |
| 4605 | return True |
| 4606 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 4607 | def pretty_print(self, q): |
| 4608 | q.text("flow_mod_failed_error_msg {") |
| 4609 | with q.group(): |
| 4610 | with q.indent(2): |
| 4611 | q.breakable() |
| 4612 | q.text("xid = "); |
| 4613 | if self.xid != None: |
| 4614 | q.text("%#x" % self.xid) |
| 4615 | else: |
| 4616 | q.text('None') |
| 4617 | q.text(","); q.breakable() |
| 4618 | q.text("code = "); |
| 4619 | q.text("%#x" % self.code) |
| 4620 | q.text(","); q.breakable() |
| 4621 | q.text("data = "); |
| 4622 | q.pp(self.data) |
| 4623 | q.breakable() |
| 4624 | q.text('}') |
| 4625 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4626 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 4627 | |
| 4628 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4629 | version = 3 |
| 4630 | type = 14 |
| 4631 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4632 | |
| 4633 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4634 | if xid != None: |
| 4635 | self.xid = xid |
| 4636 | else: |
| 4637 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4638 | if cookie != None: |
| 4639 | self.cookie = cookie |
| 4640 | else: |
| 4641 | self.cookie = 0 |
| 4642 | if cookie_mask != None: |
| 4643 | self.cookie_mask = cookie_mask |
| 4644 | else: |
| 4645 | self.cookie_mask = 0 |
| 4646 | if table_id != None: |
| 4647 | self.table_id = table_id |
| 4648 | else: |
| 4649 | self.table_id = 0 |
| 4650 | if idle_timeout != None: |
| 4651 | self.idle_timeout = idle_timeout |
| 4652 | else: |
| 4653 | self.idle_timeout = 0 |
| 4654 | if hard_timeout != None: |
| 4655 | self.hard_timeout = hard_timeout |
| 4656 | else: |
| 4657 | self.hard_timeout = 0 |
| 4658 | if priority != None: |
| 4659 | self.priority = priority |
| 4660 | else: |
| 4661 | self.priority = 0 |
| 4662 | if buffer_id != None: |
| 4663 | self.buffer_id = buffer_id |
| 4664 | else: |
| 4665 | self.buffer_id = 0 |
| 4666 | if out_port != None: |
| 4667 | self.out_port = out_port |
| 4668 | else: |
| 4669 | self.out_port = 0 |
| 4670 | if out_group != None: |
| 4671 | self.out_group = out_group |
| 4672 | else: |
| 4673 | self.out_group = 0 |
| 4674 | if flags != None: |
| 4675 | self.flags = flags |
| 4676 | else: |
| 4677 | self.flags = 0 |
| 4678 | if match != None: |
| 4679 | self.match = match |
| 4680 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4681 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4682 | if instructions != None: |
| 4683 | self.instructions = instructions |
| 4684 | else: |
| 4685 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4686 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4687 | |
| 4688 | def pack(self): |
| 4689 | packed = [] |
| 4690 | packed.append(struct.pack("!B", self.version)) |
| 4691 | packed.append(struct.pack("!B", self.type)) |
| 4692 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4693 | packed.append(struct.pack("!L", self.xid)) |
| 4694 | packed.append(struct.pack("!Q", self.cookie)) |
| 4695 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4696 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4697 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4698 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4699 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4700 | packed.append(struct.pack("!H", self.priority)) |
| 4701 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4702 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4703 | packed.append(struct.pack("!L", self.out_group)) |
| 4704 | packed.append(struct.pack("!H", self.flags)) |
| 4705 | packed.append('\x00' * 2) |
| 4706 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4707 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4708 | length = sum([len(x) for x in packed]) |
| 4709 | packed[2] = struct.pack("!H", length) |
| 4710 | return ''.join(packed) |
| 4711 | |
| 4712 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4713 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4714 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4715 | _version = reader.read("!B")[0] |
| 4716 | assert(_version == 3) |
| 4717 | _type = reader.read("!B")[0] |
| 4718 | assert(_type == 14) |
| 4719 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4720 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4721 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4722 | obj.xid = reader.read("!L")[0] |
| 4723 | obj.cookie = reader.read("!Q")[0] |
| 4724 | obj.cookie_mask = reader.read("!Q")[0] |
| 4725 | obj.table_id = reader.read("!B")[0] |
| 4726 | __command = util.unpack_fm_cmd(reader) |
| 4727 | assert(__command == 1) |
| 4728 | obj.idle_timeout = reader.read("!H")[0] |
| 4729 | obj.hard_timeout = reader.read("!H")[0] |
| 4730 | obj.priority = reader.read("!H")[0] |
| 4731 | obj.buffer_id = reader.read("!L")[0] |
| 4732 | obj.out_port = util.unpack_port_no(reader) |
| 4733 | obj.out_group = reader.read("!L")[0] |
| 4734 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4735 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4736 | obj.match = ofp.match.unpack(reader) |
| 4737 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4738 | return obj |
| 4739 | |
| 4740 | def __eq__(self, other): |
| 4741 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4742 | if self.xid != other.xid: return False |
| 4743 | if self.cookie != other.cookie: return False |
| 4744 | if self.cookie_mask != other.cookie_mask: return False |
| 4745 | if self.table_id != other.table_id: return False |
| 4746 | if self.idle_timeout != other.idle_timeout: return False |
| 4747 | if self.hard_timeout != other.hard_timeout: return False |
| 4748 | if self.priority != other.priority: return False |
| 4749 | if self.buffer_id != other.buffer_id: return False |
| 4750 | if self.out_port != other.out_port: return False |
| 4751 | if self.out_group != other.out_group: return False |
| 4752 | if self.flags != other.flags: return False |
| 4753 | if self.match != other.match: return False |
| 4754 | if self.instructions != other.instructions: return False |
| 4755 | return True |
| 4756 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4757 | def pretty_print(self, q): |
| 4758 | q.text("flow_modify {") |
| 4759 | with q.group(): |
| 4760 | with q.indent(2): |
| 4761 | q.breakable() |
| 4762 | q.text("xid = "); |
| 4763 | if self.xid != None: |
| 4764 | q.text("%#x" % self.xid) |
| 4765 | else: |
| 4766 | q.text('None') |
| 4767 | q.text(","); q.breakable() |
| 4768 | q.text("cookie = "); |
| 4769 | q.text("%#x" % self.cookie) |
| 4770 | q.text(","); q.breakable() |
| 4771 | q.text("cookie_mask = "); |
| 4772 | q.text("%#x" % self.cookie_mask) |
| 4773 | q.text(","); q.breakable() |
| 4774 | q.text("table_id = "); |
| 4775 | q.text("%#x" % self.table_id) |
| 4776 | q.text(","); q.breakable() |
| 4777 | q.text("idle_timeout = "); |
| 4778 | q.text("%#x" % self.idle_timeout) |
| 4779 | q.text(","); q.breakable() |
| 4780 | q.text("hard_timeout = "); |
| 4781 | q.text("%#x" % self.hard_timeout) |
| 4782 | q.text(","); q.breakable() |
| 4783 | q.text("priority = "); |
| 4784 | q.text("%#x" % self.priority) |
| 4785 | q.text(","); q.breakable() |
| 4786 | q.text("buffer_id = "); |
| 4787 | q.text("%#x" % self.buffer_id) |
| 4788 | q.text(","); q.breakable() |
| 4789 | q.text("out_port = "); |
| 4790 | q.text(util.pretty_port(self.out_port)) |
| 4791 | q.text(","); q.breakable() |
| 4792 | q.text("out_group = "); |
| 4793 | q.text("%#x" % self.out_group) |
| 4794 | q.text(","); q.breakable() |
| 4795 | q.text("flags = "); |
| 4796 | q.text("%#x" % self.flags) |
| 4797 | q.text(","); q.breakable() |
| 4798 | q.text("match = "); |
| 4799 | q.pp(self.match) |
| 4800 | q.text(","); q.breakable() |
| 4801 | q.text("instructions = "); |
| 4802 | q.pp(self.instructions) |
| 4803 | q.breakable() |
| 4804 | q.text('}') |
| 4805 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4806 | flow_mod.subtypes[1] = flow_modify |
| 4807 | |
| 4808 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4809 | version = 3 |
| 4810 | type = 14 |
| 4811 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4812 | |
| 4813 | def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4814 | if xid != None: |
| 4815 | self.xid = xid |
| 4816 | else: |
| 4817 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4818 | if cookie != None: |
| 4819 | self.cookie = cookie |
| 4820 | else: |
| 4821 | self.cookie = 0 |
| 4822 | if cookie_mask != None: |
| 4823 | self.cookie_mask = cookie_mask |
| 4824 | else: |
| 4825 | self.cookie_mask = 0 |
| 4826 | if table_id != None: |
| 4827 | self.table_id = table_id |
| 4828 | else: |
| 4829 | self.table_id = 0 |
| 4830 | if idle_timeout != None: |
| 4831 | self.idle_timeout = idle_timeout |
| 4832 | else: |
| 4833 | self.idle_timeout = 0 |
| 4834 | if hard_timeout != None: |
| 4835 | self.hard_timeout = hard_timeout |
| 4836 | else: |
| 4837 | self.hard_timeout = 0 |
| 4838 | if priority != None: |
| 4839 | self.priority = priority |
| 4840 | else: |
| 4841 | self.priority = 0 |
| 4842 | if buffer_id != None: |
| 4843 | self.buffer_id = buffer_id |
| 4844 | else: |
| 4845 | self.buffer_id = 0 |
| 4846 | if out_port != None: |
| 4847 | self.out_port = out_port |
| 4848 | else: |
| 4849 | self.out_port = 0 |
| 4850 | if out_group != None: |
| 4851 | self.out_group = out_group |
| 4852 | else: |
| 4853 | self.out_group = 0 |
| 4854 | if flags != None: |
| 4855 | self.flags = flags |
| 4856 | else: |
| 4857 | self.flags = 0 |
| 4858 | if match != None: |
| 4859 | self.match = match |
| 4860 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4861 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4862 | if instructions != None: |
| 4863 | self.instructions = instructions |
| 4864 | else: |
| 4865 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4866 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4867 | |
| 4868 | def pack(self): |
| 4869 | packed = [] |
| 4870 | packed.append(struct.pack("!B", self.version)) |
| 4871 | packed.append(struct.pack("!B", self.type)) |
| 4872 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4873 | packed.append(struct.pack("!L", self.xid)) |
| 4874 | packed.append(struct.pack("!Q", self.cookie)) |
| 4875 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 4876 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4877 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4878 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4879 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4880 | packed.append(struct.pack("!H", self.priority)) |
| 4881 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4882 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4883 | packed.append(struct.pack("!L", self.out_group)) |
| 4884 | packed.append(struct.pack("!H", self.flags)) |
| 4885 | packed.append('\x00' * 2) |
| 4886 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4887 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4888 | length = sum([len(x) for x in packed]) |
| 4889 | packed[2] = struct.pack("!H", length) |
| 4890 | return ''.join(packed) |
| 4891 | |
| 4892 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4893 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4894 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4895 | _version = reader.read("!B")[0] |
| 4896 | assert(_version == 3) |
| 4897 | _type = reader.read("!B")[0] |
| 4898 | assert(_type == 14) |
| 4899 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4900 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4901 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4902 | obj.xid = reader.read("!L")[0] |
| 4903 | obj.cookie = reader.read("!Q")[0] |
| 4904 | obj.cookie_mask = reader.read("!Q")[0] |
| 4905 | obj.table_id = reader.read("!B")[0] |
| 4906 | __command = util.unpack_fm_cmd(reader) |
| 4907 | assert(__command == 2) |
| 4908 | obj.idle_timeout = reader.read("!H")[0] |
| 4909 | obj.hard_timeout = reader.read("!H")[0] |
| 4910 | obj.priority = reader.read("!H")[0] |
| 4911 | obj.buffer_id = reader.read("!L")[0] |
| 4912 | obj.out_port = util.unpack_port_no(reader) |
| 4913 | obj.out_group = reader.read("!L")[0] |
| 4914 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4915 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4916 | obj.match = ofp.match.unpack(reader) |
| 4917 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4918 | return obj |
| 4919 | |
| 4920 | def __eq__(self, other): |
| 4921 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4922 | if self.xid != other.xid: return False |
| 4923 | if self.cookie != other.cookie: return False |
| 4924 | if self.cookie_mask != other.cookie_mask: return False |
| 4925 | if self.table_id != other.table_id: return False |
| 4926 | if self.idle_timeout != other.idle_timeout: return False |
| 4927 | if self.hard_timeout != other.hard_timeout: return False |
| 4928 | if self.priority != other.priority: return False |
| 4929 | if self.buffer_id != other.buffer_id: return False |
| 4930 | if self.out_port != other.out_port: return False |
| 4931 | if self.out_group != other.out_group: return False |
| 4932 | if self.flags != other.flags: return False |
| 4933 | if self.match != other.match: return False |
| 4934 | if self.instructions != other.instructions: return False |
| 4935 | return True |
| 4936 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4937 | def pretty_print(self, q): |
| 4938 | q.text("flow_modify_strict {") |
| 4939 | with q.group(): |
| 4940 | with q.indent(2): |
| 4941 | q.breakable() |
| 4942 | q.text("xid = "); |
| 4943 | if self.xid != None: |
| 4944 | q.text("%#x" % self.xid) |
| 4945 | else: |
| 4946 | q.text('None') |
| 4947 | q.text(","); q.breakable() |
| 4948 | q.text("cookie = "); |
| 4949 | q.text("%#x" % self.cookie) |
| 4950 | q.text(","); q.breakable() |
| 4951 | q.text("cookie_mask = "); |
| 4952 | q.text("%#x" % self.cookie_mask) |
| 4953 | q.text(","); q.breakable() |
| 4954 | q.text("table_id = "); |
| 4955 | q.text("%#x" % self.table_id) |
| 4956 | q.text(","); q.breakable() |
| 4957 | q.text("idle_timeout = "); |
| 4958 | q.text("%#x" % self.idle_timeout) |
| 4959 | q.text(","); q.breakable() |
| 4960 | q.text("hard_timeout = "); |
| 4961 | q.text("%#x" % self.hard_timeout) |
| 4962 | q.text(","); q.breakable() |
| 4963 | q.text("priority = "); |
| 4964 | q.text("%#x" % self.priority) |
| 4965 | q.text(","); q.breakable() |
| 4966 | q.text("buffer_id = "); |
| 4967 | q.text("%#x" % self.buffer_id) |
| 4968 | q.text(","); q.breakable() |
| 4969 | q.text("out_port = "); |
| 4970 | q.text(util.pretty_port(self.out_port)) |
| 4971 | q.text(","); q.breakable() |
| 4972 | q.text("out_group = "); |
| 4973 | q.text("%#x" % self.out_group) |
| 4974 | q.text(","); q.breakable() |
| 4975 | q.text("flags = "); |
| 4976 | q.text("%#x" % self.flags) |
| 4977 | q.text(","); q.breakable() |
| 4978 | q.text("match = "); |
| 4979 | q.pp(self.match) |
| 4980 | q.text(","); q.breakable() |
| 4981 | q.text("instructions = "); |
| 4982 | q.pp(self.instructions) |
| 4983 | q.breakable() |
| 4984 | q.text('}') |
| 4985 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4986 | flow_mod.subtypes[2] = flow_modify_strict |
| 4987 | |
| 4988 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4989 | version = 3 |
| 4990 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4991 | |
| 4992 | def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4993 | if xid != None: |
| 4994 | self.xid = xid |
| 4995 | else: |
| 4996 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4997 | if cookie != None: |
| 4998 | self.cookie = cookie |
| 4999 | else: |
| 5000 | self.cookie = 0 |
| 5001 | if priority != None: |
| 5002 | self.priority = priority |
| 5003 | else: |
| 5004 | self.priority = 0 |
| 5005 | if reason != None: |
| 5006 | self.reason = reason |
| 5007 | else: |
| 5008 | self.reason = 0 |
| 5009 | if table_id != None: |
| 5010 | self.table_id = table_id |
| 5011 | else: |
| 5012 | self.table_id = 0 |
| 5013 | if duration_sec != None: |
| 5014 | self.duration_sec = duration_sec |
| 5015 | else: |
| 5016 | self.duration_sec = 0 |
| 5017 | if duration_nsec != None: |
| 5018 | self.duration_nsec = duration_nsec |
| 5019 | else: |
| 5020 | self.duration_nsec = 0 |
| 5021 | if idle_timeout != None: |
| 5022 | self.idle_timeout = idle_timeout |
| 5023 | else: |
| 5024 | self.idle_timeout = 0 |
| 5025 | if hard_timeout != None: |
| 5026 | self.hard_timeout = hard_timeout |
| 5027 | else: |
| 5028 | self.hard_timeout = 0 |
| 5029 | if packet_count != None: |
| 5030 | self.packet_count = packet_count |
| 5031 | else: |
| 5032 | self.packet_count = 0 |
| 5033 | if byte_count != None: |
| 5034 | self.byte_count = byte_count |
| 5035 | else: |
| 5036 | self.byte_count = 0 |
| 5037 | if match != None: |
| 5038 | self.match = match |
| 5039 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5040 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5041 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5042 | |
| 5043 | def pack(self): |
| 5044 | packed = [] |
| 5045 | packed.append(struct.pack("!B", self.version)) |
| 5046 | packed.append(struct.pack("!B", self.type)) |
| 5047 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5048 | packed.append(struct.pack("!L", self.xid)) |
| 5049 | packed.append(struct.pack("!Q", self.cookie)) |
| 5050 | packed.append(struct.pack("!H", self.priority)) |
| 5051 | packed.append(struct.pack("!B", self.reason)) |
| 5052 | packed.append(struct.pack("!B", self.table_id)) |
| 5053 | packed.append(struct.pack("!L", self.duration_sec)) |
| 5054 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 5055 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5056 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5057 | packed.append(struct.pack("!Q", self.packet_count)) |
| 5058 | packed.append(struct.pack("!Q", self.byte_count)) |
| 5059 | packed.append(self.match.pack()) |
| 5060 | length = sum([len(x) for x in packed]) |
| 5061 | packed[2] = struct.pack("!H", length) |
| 5062 | return ''.join(packed) |
| 5063 | |
| 5064 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5065 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5066 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5067 | _version = reader.read("!B")[0] |
| 5068 | assert(_version == 3) |
| 5069 | _type = reader.read("!B")[0] |
| 5070 | assert(_type == 11) |
| 5071 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5072 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5073 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5074 | obj.xid = reader.read("!L")[0] |
| 5075 | obj.cookie = reader.read("!Q")[0] |
| 5076 | obj.priority = reader.read("!H")[0] |
| 5077 | obj.reason = reader.read("!B")[0] |
| 5078 | obj.table_id = reader.read("!B")[0] |
| 5079 | obj.duration_sec = reader.read("!L")[0] |
| 5080 | obj.duration_nsec = reader.read("!L")[0] |
| 5081 | obj.idle_timeout = reader.read("!H")[0] |
| 5082 | obj.hard_timeout = reader.read("!H")[0] |
| 5083 | obj.packet_count = reader.read("!Q")[0] |
| 5084 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5085 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5086 | return obj |
| 5087 | |
| 5088 | def __eq__(self, other): |
| 5089 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5090 | if self.xid != other.xid: return False |
| 5091 | if self.cookie != other.cookie: return False |
| 5092 | if self.priority != other.priority: return False |
| 5093 | if self.reason != other.reason: return False |
| 5094 | if self.table_id != other.table_id: return False |
| 5095 | if self.duration_sec != other.duration_sec: return False |
| 5096 | if self.duration_nsec != other.duration_nsec: return False |
| 5097 | if self.idle_timeout != other.idle_timeout: return False |
| 5098 | if self.hard_timeout != other.hard_timeout: return False |
| 5099 | if self.packet_count != other.packet_count: return False |
| 5100 | if self.byte_count != other.byte_count: return False |
| 5101 | if self.match != other.match: return False |
| 5102 | return True |
| 5103 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5104 | def pretty_print(self, q): |
| 5105 | q.text("flow_removed {") |
| 5106 | with q.group(): |
| 5107 | with q.indent(2): |
| 5108 | q.breakable() |
| 5109 | q.text("xid = "); |
| 5110 | if self.xid != None: |
| 5111 | q.text("%#x" % self.xid) |
| 5112 | else: |
| 5113 | q.text('None') |
| 5114 | q.text(","); q.breakable() |
| 5115 | q.text("cookie = "); |
| 5116 | q.text("%#x" % self.cookie) |
| 5117 | q.text(","); q.breakable() |
| 5118 | q.text("priority = "); |
| 5119 | q.text("%#x" % self.priority) |
| 5120 | q.text(","); q.breakable() |
| 5121 | q.text("reason = "); |
| 5122 | q.text("%#x" % self.reason) |
| 5123 | q.text(","); q.breakable() |
| 5124 | q.text("table_id = "); |
| 5125 | q.text("%#x" % self.table_id) |
| 5126 | q.text(","); q.breakable() |
| 5127 | q.text("duration_sec = "); |
| 5128 | q.text("%#x" % self.duration_sec) |
| 5129 | q.text(","); q.breakable() |
| 5130 | q.text("duration_nsec = "); |
| 5131 | q.text("%#x" % self.duration_nsec) |
| 5132 | q.text(","); q.breakable() |
| 5133 | q.text("idle_timeout = "); |
| 5134 | q.text("%#x" % self.idle_timeout) |
| 5135 | q.text(","); q.breakable() |
| 5136 | q.text("hard_timeout = "); |
| 5137 | q.text("%#x" % self.hard_timeout) |
| 5138 | q.text(","); q.breakable() |
| 5139 | q.text("packet_count = "); |
| 5140 | q.text("%#x" % self.packet_count) |
| 5141 | q.text(","); q.breakable() |
| 5142 | q.text("byte_count = "); |
| 5143 | q.text("%#x" % self.byte_count) |
| 5144 | q.text(","); q.breakable() |
| 5145 | q.text("match = "); |
| 5146 | q.pp(self.match) |
| 5147 | q.breakable() |
| 5148 | q.text('}') |
| 5149 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5150 | message.subtypes[11] = flow_removed |
| 5151 | |
| 5152 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5153 | version = 3 |
| 5154 | type = 19 |
| 5155 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5156 | |
| 5157 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5158 | if xid != None: |
| 5159 | self.xid = xid |
| 5160 | else: |
| 5161 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5162 | if flags != None: |
| 5163 | self.flags = flags |
| 5164 | else: |
| 5165 | self.flags = 0 |
| 5166 | if entries != None: |
| 5167 | self.entries = entries |
| 5168 | else: |
| 5169 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5170 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5171 | |
| 5172 | def pack(self): |
| 5173 | packed = [] |
| 5174 | packed.append(struct.pack("!B", self.version)) |
| 5175 | packed.append(struct.pack("!B", self.type)) |
| 5176 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5177 | packed.append(struct.pack("!L", self.xid)) |
| 5178 | packed.append(struct.pack("!H", self.stats_type)) |
| 5179 | packed.append(struct.pack("!H", self.flags)) |
| 5180 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5181 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5182 | length = sum([len(x) for x in packed]) |
| 5183 | packed[2] = struct.pack("!H", length) |
| 5184 | return ''.join(packed) |
| 5185 | |
| 5186 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5187 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5188 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5189 | _version = reader.read("!B")[0] |
| 5190 | assert(_version == 3) |
| 5191 | _type = reader.read("!B")[0] |
| 5192 | assert(_type == 19) |
| 5193 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5194 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5195 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5196 | obj.xid = reader.read("!L")[0] |
| 5197 | _stats_type = reader.read("!H")[0] |
| 5198 | assert(_stats_type == 1) |
| 5199 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5200 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5201 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5202 | return obj |
| 5203 | |
| 5204 | def __eq__(self, other): |
| 5205 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5206 | if self.xid != other.xid: return False |
| 5207 | if self.flags != other.flags: return False |
| 5208 | if self.entries != other.entries: return False |
| 5209 | return True |
| 5210 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5211 | def pretty_print(self, q): |
| 5212 | q.text("flow_stats_reply {") |
| 5213 | with q.group(): |
| 5214 | with q.indent(2): |
| 5215 | q.breakable() |
| 5216 | q.text("xid = "); |
| 5217 | if self.xid != None: |
| 5218 | q.text("%#x" % self.xid) |
| 5219 | else: |
| 5220 | q.text('None') |
| 5221 | q.text(","); q.breakable() |
| 5222 | q.text("flags = "); |
| 5223 | q.text("%#x" % self.flags) |
| 5224 | q.text(","); q.breakable() |
| 5225 | q.text("entries = "); |
| 5226 | q.pp(self.entries) |
| 5227 | q.breakable() |
| 5228 | q.text('}') |
| 5229 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5230 | stats_reply.subtypes[1] = flow_stats_reply |
| 5231 | |
| 5232 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5233 | version = 3 |
| 5234 | type = 18 |
| 5235 | stats_type = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5236 | |
| 5237 | def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5238 | if xid != None: |
| 5239 | self.xid = xid |
| 5240 | else: |
| 5241 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5242 | if flags != None: |
| 5243 | self.flags = flags |
| 5244 | else: |
| 5245 | self.flags = 0 |
| 5246 | if table_id != None: |
| 5247 | self.table_id = table_id |
| 5248 | else: |
| 5249 | self.table_id = 0 |
| 5250 | if out_port != None: |
| 5251 | self.out_port = out_port |
| 5252 | else: |
| 5253 | self.out_port = 0 |
| 5254 | if out_group != None: |
| 5255 | self.out_group = out_group |
| 5256 | else: |
| 5257 | self.out_group = 0 |
| 5258 | if cookie != None: |
| 5259 | self.cookie = cookie |
| 5260 | else: |
| 5261 | self.cookie = 0 |
| 5262 | if cookie_mask != None: |
| 5263 | self.cookie_mask = cookie_mask |
| 5264 | else: |
| 5265 | self.cookie_mask = 0 |
| 5266 | if match != None: |
| 5267 | self.match = match |
| 5268 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5269 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5270 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5271 | |
| 5272 | def pack(self): |
| 5273 | packed = [] |
| 5274 | packed.append(struct.pack("!B", self.version)) |
| 5275 | packed.append(struct.pack("!B", self.type)) |
| 5276 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5277 | packed.append(struct.pack("!L", self.xid)) |
| 5278 | packed.append(struct.pack("!H", self.stats_type)) |
| 5279 | packed.append(struct.pack("!H", self.flags)) |
| 5280 | packed.append('\x00' * 4) |
| 5281 | packed.append(struct.pack("!B", self.table_id)) |
| 5282 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5283 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5284 | packed.append(struct.pack("!L", self.out_group)) |
| 5285 | packed.append('\x00' * 4) |
| 5286 | packed.append(struct.pack("!Q", self.cookie)) |
| 5287 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 5288 | packed.append(self.match.pack()) |
| 5289 | length = sum([len(x) for x in packed]) |
| 5290 | packed[2] = struct.pack("!H", length) |
| 5291 | return ''.join(packed) |
| 5292 | |
| 5293 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5294 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5295 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5296 | _version = reader.read("!B")[0] |
| 5297 | assert(_version == 3) |
| 5298 | _type = reader.read("!B")[0] |
| 5299 | assert(_type == 18) |
| 5300 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5301 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5302 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5303 | obj.xid = reader.read("!L")[0] |
| 5304 | _stats_type = reader.read("!H")[0] |
| 5305 | assert(_stats_type == 1) |
| 5306 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5307 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5308 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5309 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5310 | obj.out_port = util.unpack_port_no(reader) |
| 5311 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5312 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5313 | obj.cookie = reader.read("!Q")[0] |
| 5314 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5315 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5316 | return obj |
| 5317 | |
| 5318 | def __eq__(self, other): |
| 5319 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5320 | if self.xid != other.xid: return False |
| 5321 | if self.flags != other.flags: return False |
| 5322 | if self.table_id != other.table_id: return False |
| 5323 | if self.out_port != other.out_port: return False |
| 5324 | if self.out_group != other.out_group: return False |
| 5325 | if self.cookie != other.cookie: return False |
| 5326 | if self.cookie_mask != other.cookie_mask: return False |
| 5327 | if self.match != other.match: return False |
| 5328 | return True |
| 5329 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5330 | def pretty_print(self, q): |
| 5331 | q.text("flow_stats_request {") |
| 5332 | with q.group(): |
| 5333 | with q.indent(2): |
| 5334 | q.breakable() |
| 5335 | q.text("xid = "); |
| 5336 | if self.xid != None: |
| 5337 | q.text("%#x" % self.xid) |
| 5338 | else: |
| 5339 | q.text('None') |
| 5340 | q.text(","); q.breakable() |
| 5341 | q.text("flags = "); |
| 5342 | q.text("%#x" % self.flags) |
| 5343 | q.text(","); q.breakable() |
| 5344 | q.text("table_id = "); |
| 5345 | q.text("%#x" % self.table_id) |
| 5346 | q.text(","); q.breakable() |
| 5347 | q.text("out_port = "); |
| 5348 | q.text(util.pretty_port(self.out_port)) |
| 5349 | q.text(","); q.breakable() |
| 5350 | q.text("out_group = "); |
| 5351 | q.text("%#x" % self.out_group) |
| 5352 | q.text(","); q.breakable() |
| 5353 | q.text("cookie = "); |
| 5354 | q.text("%#x" % self.cookie) |
| 5355 | q.text(","); q.breakable() |
| 5356 | q.text("cookie_mask = "); |
| 5357 | q.text("%#x" % self.cookie_mask) |
| 5358 | q.text(","); q.breakable() |
| 5359 | q.text("match = "); |
| 5360 | q.pp(self.match) |
| 5361 | q.breakable() |
| 5362 | q.text('}') |
| 5363 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5364 | stats_request.subtypes[1] = flow_stats_request |
| 5365 | |
| 5366 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5367 | version = 3 |
| 5368 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5369 | |
| 5370 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5371 | if xid != None: |
| 5372 | self.xid = xid |
| 5373 | else: |
| 5374 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5375 | if flags != None: |
| 5376 | self.flags = flags |
| 5377 | else: |
| 5378 | self.flags = 0 |
| 5379 | if miss_send_len != None: |
| 5380 | self.miss_send_len = miss_send_len |
| 5381 | else: |
| 5382 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5383 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5384 | |
| 5385 | def pack(self): |
| 5386 | packed = [] |
| 5387 | packed.append(struct.pack("!B", self.version)) |
| 5388 | packed.append(struct.pack("!B", self.type)) |
| 5389 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5390 | packed.append(struct.pack("!L", self.xid)) |
| 5391 | packed.append(struct.pack("!H", self.flags)) |
| 5392 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 5393 | length = sum([len(x) for x in packed]) |
| 5394 | packed[2] = struct.pack("!H", length) |
| 5395 | return ''.join(packed) |
| 5396 | |
| 5397 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5398 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5399 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5400 | _version = reader.read("!B")[0] |
| 5401 | assert(_version == 3) |
| 5402 | _type = reader.read("!B")[0] |
| 5403 | assert(_type == 8) |
| 5404 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5405 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5406 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5407 | obj.xid = reader.read("!L")[0] |
| 5408 | obj.flags = reader.read("!H")[0] |
| 5409 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5410 | return obj |
| 5411 | |
| 5412 | def __eq__(self, other): |
| 5413 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5414 | if self.xid != other.xid: return False |
| 5415 | if self.flags != other.flags: return False |
| 5416 | if self.miss_send_len != other.miss_send_len: return False |
| 5417 | return True |
| 5418 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5419 | def pretty_print(self, q): |
| 5420 | q.text("get_config_reply {") |
| 5421 | with q.group(): |
| 5422 | with q.indent(2): |
| 5423 | q.breakable() |
| 5424 | q.text("xid = "); |
| 5425 | if self.xid != None: |
| 5426 | q.text("%#x" % self.xid) |
| 5427 | else: |
| 5428 | q.text('None') |
| 5429 | q.text(","); q.breakable() |
| 5430 | q.text("flags = "); |
| 5431 | q.text("%#x" % self.flags) |
| 5432 | q.text(","); q.breakable() |
| 5433 | q.text("miss_send_len = "); |
| 5434 | q.text("%#x" % self.miss_send_len) |
| 5435 | q.breakable() |
| 5436 | q.text('}') |
| 5437 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5438 | message.subtypes[8] = get_config_reply |
| 5439 | |
| 5440 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5441 | version = 3 |
| 5442 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5443 | |
| 5444 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5445 | if xid != None: |
| 5446 | self.xid = xid |
| 5447 | else: |
| 5448 | self.xid = None |
| 5449 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5450 | |
| 5451 | def pack(self): |
| 5452 | packed = [] |
| 5453 | packed.append(struct.pack("!B", self.version)) |
| 5454 | packed.append(struct.pack("!B", self.type)) |
| 5455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5456 | packed.append(struct.pack("!L", self.xid)) |
| 5457 | length = sum([len(x) for x in packed]) |
| 5458 | packed[2] = struct.pack("!H", length) |
| 5459 | return ''.join(packed) |
| 5460 | |
| 5461 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5462 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5463 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5464 | _version = reader.read("!B")[0] |
| 5465 | assert(_version == 3) |
| 5466 | _type = reader.read("!B")[0] |
| 5467 | assert(_type == 7) |
| 5468 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5469 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5470 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5471 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5472 | return obj |
| 5473 | |
| 5474 | def __eq__(self, other): |
| 5475 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5476 | if self.xid != other.xid: return False |
| 5477 | return True |
| 5478 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5479 | def pretty_print(self, q): |
| 5480 | q.text("get_config_request {") |
| 5481 | with q.group(): |
| 5482 | with q.indent(2): |
| 5483 | q.breakable() |
| 5484 | q.text("xid = "); |
| 5485 | if self.xid != None: |
| 5486 | q.text("%#x" % self.xid) |
| 5487 | else: |
| 5488 | q.text('None') |
| 5489 | q.breakable() |
| 5490 | q.text('}') |
| 5491 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5492 | message.subtypes[7] = get_config_request |
| 5493 | |
| 5494 | class group_mod(message): |
| 5495 | subtypes = {} |
| 5496 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5497 | version = 3 |
| 5498 | type = 15 |
| 5499 | |
| 5500 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 5501 | if xid != None: |
| 5502 | self.xid = xid |
| 5503 | else: |
| 5504 | self.xid = None |
| 5505 | if command != None: |
| 5506 | self.command = command |
| 5507 | else: |
| 5508 | self.command = 0 |
| 5509 | if group_type != None: |
| 5510 | self.group_type = group_type |
| 5511 | else: |
| 5512 | self.group_type = 0 |
| 5513 | if group_id != None: |
| 5514 | self.group_id = group_id |
| 5515 | else: |
| 5516 | self.group_id = 0 |
| 5517 | if buckets != None: |
| 5518 | self.buckets = buckets |
| 5519 | else: |
| 5520 | self.buckets = [] |
| 5521 | return |
| 5522 | |
| 5523 | def pack(self): |
| 5524 | packed = [] |
| 5525 | packed.append(struct.pack("!B", self.version)) |
| 5526 | packed.append(struct.pack("!B", self.type)) |
| 5527 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5528 | packed.append(struct.pack("!L", self.xid)) |
| 5529 | packed.append(struct.pack("!H", self.command)) |
| 5530 | packed.append(struct.pack("!B", self.group_type)) |
| 5531 | packed.append('\x00' * 1) |
| 5532 | packed.append(struct.pack("!L", self.group_id)) |
| 5533 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 5534 | length = sum([len(x) for x in packed]) |
| 5535 | packed[2] = struct.pack("!H", length) |
| 5536 | return ''.join(packed) |
| 5537 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5538 | @staticmethod |
| 5539 | def unpack(reader): |
| 5540 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5541 | subclass = group_mod.subtypes.get(subtype) |
| 5542 | if subclass: |
| 5543 | return subclass.unpack(reader) |
| 5544 | |
| 5545 | obj = group_mod() |
| 5546 | _version = reader.read("!B")[0] |
| 5547 | assert(_version == 3) |
| 5548 | _type = reader.read("!B")[0] |
| 5549 | assert(_type == 15) |
| 5550 | _length = reader.read("!H")[0] |
| 5551 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5552 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5553 | obj.xid = reader.read("!L")[0] |
| 5554 | obj.command = reader.read("!H")[0] |
| 5555 | obj.group_type = reader.read("!B")[0] |
| 5556 | reader.skip(1) |
| 5557 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5558 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 5559 | return obj |
| 5560 | |
| 5561 | def __eq__(self, other): |
| 5562 | if type(self) != type(other): return False |
| 5563 | if self.xid != other.xid: return False |
| 5564 | if self.command != other.command: return False |
| 5565 | if self.group_type != other.group_type: return False |
| 5566 | if self.group_id != other.group_id: return False |
| 5567 | if self.buckets != other.buckets: return False |
| 5568 | return True |
| 5569 | |
| 5570 | def pretty_print(self, q): |
| 5571 | q.text("group_mod {") |
| 5572 | with q.group(): |
| 5573 | with q.indent(2): |
| 5574 | q.breakable() |
| 5575 | q.text("xid = "); |
| 5576 | if self.xid != None: |
| 5577 | q.text("%#x" % self.xid) |
| 5578 | else: |
| 5579 | q.text('None') |
| 5580 | q.text(","); q.breakable() |
| 5581 | q.text("group_type = "); |
| 5582 | q.text("%#x" % self.group_type) |
| 5583 | q.text(","); q.breakable() |
| 5584 | q.text("group_id = "); |
| 5585 | q.text("%#x" % self.group_id) |
| 5586 | q.text(","); q.breakable() |
| 5587 | q.text("buckets = "); |
| 5588 | q.pp(self.buckets) |
| 5589 | q.breakable() |
| 5590 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5591 | |
| 5592 | message.subtypes[15] = group_mod |
| 5593 | |
| 5594 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5595 | version = 3 |
| 5596 | type = 15 |
| 5597 | command = 0 |
| 5598 | |
| 5599 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5600 | if xid != None: |
| 5601 | self.xid = xid |
| 5602 | else: |
| 5603 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5604 | if group_type != None: |
| 5605 | self.group_type = group_type |
| 5606 | else: |
| 5607 | self.group_type = 0 |
| 5608 | if group_id != None: |
| 5609 | self.group_id = group_id |
| 5610 | else: |
| 5611 | self.group_id = 0 |
| 5612 | if buckets != None: |
| 5613 | self.buckets = buckets |
| 5614 | else: |
| 5615 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5616 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5617 | |
| 5618 | def pack(self): |
| 5619 | packed = [] |
| 5620 | packed.append(struct.pack("!B", self.version)) |
| 5621 | packed.append(struct.pack("!B", self.type)) |
| 5622 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5623 | packed.append(struct.pack("!L", self.xid)) |
| 5624 | packed.append(struct.pack("!H", self.command)) |
| 5625 | packed.append(struct.pack("!B", self.group_type)) |
| 5626 | packed.append('\x00' * 1) |
| 5627 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5628 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5629 | length = sum([len(x) for x in packed]) |
| 5630 | packed[2] = struct.pack("!H", length) |
| 5631 | return ''.join(packed) |
| 5632 | |
| 5633 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5634 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5635 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5636 | _version = reader.read("!B")[0] |
| 5637 | assert(_version == 3) |
| 5638 | _type = reader.read("!B")[0] |
| 5639 | assert(_type == 15) |
| 5640 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5641 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5642 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5643 | obj.xid = reader.read("!L")[0] |
| 5644 | _command = reader.read("!H")[0] |
| 5645 | assert(_command == 0) |
| 5646 | obj.group_type = reader.read("!B")[0] |
| 5647 | reader.skip(1) |
| 5648 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5649 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5650 | return obj |
| 5651 | |
| 5652 | def __eq__(self, other): |
| 5653 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5654 | if self.xid != other.xid: return False |
| 5655 | if self.group_type != other.group_type: return False |
| 5656 | if self.group_id != other.group_id: return False |
| 5657 | if self.buckets != other.buckets: return False |
| 5658 | return True |
| 5659 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5660 | def pretty_print(self, q): |
| 5661 | q.text("group_add {") |
| 5662 | with q.group(): |
| 5663 | with q.indent(2): |
| 5664 | q.breakable() |
| 5665 | q.text("xid = "); |
| 5666 | if self.xid != None: |
| 5667 | q.text("%#x" % self.xid) |
| 5668 | else: |
| 5669 | q.text('None') |
| 5670 | q.text(","); q.breakable() |
| 5671 | q.text("group_type = "); |
| 5672 | q.text("%#x" % self.group_type) |
| 5673 | q.text(","); q.breakable() |
| 5674 | q.text("group_id = "); |
| 5675 | q.text("%#x" % self.group_id) |
| 5676 | q.text(","); q.breakable() |
| 5677 | q.text("buckets = "); |
| 5678 | q.pp(self.buckets) |
| 5679 | q.breakable() |
| 5680 | q.text('}') |
| 5681 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5682 | group_mod.subtypes[0] = group_add |
| 5683 | |
| 5684 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5685 | version = 3 |
| 5686 | type = 15 |
| 5687 | command = 2 |
| 5688 | |
| 5689 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5690 | if xid != None: |
| 5691 | self.xid = xid |
| 5692 | else: |
| 5693 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5694 | if group_type != None: |
| 5695 | self.group_type = group_type |
| 5696 | else: |
| 5697 | self.group_type = 0 |
| 5698 | if group_id != None: |
| 5699 | self.group_id = group_id |
| 5700 | else: |
| 5701 | self.group_id = 0 |
| 5702 | if buckets != None: |
| 5703 | self.buckets = buckets |
| 5704 | else: |
| 5705 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5706 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5707 | |
| 5708 | def pack(self): |
| 5709 | packed = [] |
| 5710 | packed.append(struct.pack("!B", self.version)) |
| 5711 | packed.append(struct.pack("!B", self.type)) |
| 5712 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5713 | packed.append(struct.pack("!L", self.xid)) |
| 5714 | packed.append(struct.pack("!H", self.command)) |
| 5715 | packed.append(struct.pack("!B", self.group_type)) |
| 5716 | packed.append('\x00' * 1) |
| 5717 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5718 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5719 | length = sum([len(x) for x in packed]) |
| 5720 | packed[2] = struct.pack("!H", length) |
| 5721 | return ''.join(packed) |
| 5722 | |
| 5723 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5724 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5725 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5726 | _version = reader.read("!B")[0] |
| 5727 | assert(_version == 3) |
| 5728 | _type = reader.read("!B")[0] |
| 5729 | assert(_type == 15) |
| 5730 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5731 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5732 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5733 | obj.xid = reader.read("!L")[0] |
| 5734 | _command = reader.read("!H")[0] |
| 5735 | assert(_command == 2) |
| 5736 | obj.group_type = reader.read("!B")[0] |
| 5737 | reader.skip(1) |
| 5738 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5739 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5740 | return obj |
| 5741 | |
| 5742 | def __eq__(self, other): |
| 5743 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5744 | if self.xid != other.xid: return False |
| 5745 | if self.group_type != other.group_type: return False |
| 5746 | if self.group_id != other.group_id: return False |
| 5747 | if self.buckets != other.buckets: return False |
| 5748 | return True |
| 5749 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5750 | def pretty_print(self, q): |
| 5751 | q.text("group_delete {") |
| 5752 | with q.group(): |
| 5753 | with q.indent(2): |
| 5754 | q.breakable() |
| 5755 | q.text("xid = "); |
| 5756 | if self.xid != None: |
| 5757 | q.text("%#x" % self.xid) |
| 5758 | else: |
| 5759 | q.text('None') |
| 5760 | q.text(","); q.breakable() |
| 5761 | q.text("group_type = "); |
| 5762 | q.text("%#x" % self.group_type) |
| 5763 | q.text(","); q.breakable() |
| 5764 | q.text("group_id = "); |
| 5765 | q.text("%#x" % self.group_id) |
| 5766 | q.text(","); q.breakable() |
| 5767 | q.text("buckets = "); |
| 5768 | q.pp(self.buckets) |
| 5769 | q.breakable() |
| 5770 | q.text('}') |
| 5771 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5772 | group_mod.subtypes[2] = group_delete |
| 5773 | |
| 5774 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5775 | version = 3 |
| 5776 | type = 19 |
| 5777 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5778 | |
| 5779 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5780 | if xid != None: |
| 5781 | self.xid = xid |
| 5782 | else: |
| 5783 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5784 | if flags != None: |
| 5785 | self.flags = flags |
| 5786 | else: |
| 5787 | self.flags = 0 |
| 5788 | if entries != None: |
| 5789 | self.entries = entries |
| 5790 | else: |
| 5791 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5792 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5793 | |
| 5794 | def pack(self): |
| 5795 | packed = [] |
| 5796 | packed.append(struct.pack("!B", self.version)) |
| 5797 | packed.append(struct.pack("!B", self.type)) |
| 5798 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5799 | packed.append(struct.pack("!L", self.xid)) |
| 5800 | packed.append(struct.pack("!H", self.stats_type)) |
| 5801 | packed.append(struct.pack("!H", self.flags)) |
| 5802 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5803 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5804 | length = sum([len(x) for x in packed]) |
| 5805 | packed[2] = struct.pack("!H", length) |
| 5806 | return ''.join(packed) |
| 5807 | |
| 5808 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5809 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5810 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5811 | _version = reader.read("!B")[0] |
| 5812 | assert(_version == 3) |
| 5813 | _type = reader.read("!B")[0] |
| 5814 | assert(_type == 19) |
| 5815 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5816 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5817 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5818 | obj.xid = reader.read("!L")[0] |
| 5819 | _stats_type = reader.read("!H")[0] |
| 5820 | assert(_stats_type == 7) |
| 5821 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5822 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5823 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_desc_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5824 | return obj |
| 5825 | |
| 5826 | def __eq__(self, other): |
| 5827 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5828 | if self.xid != other.xid: return False |
| 5829 | if self.flags != other.flags: return False |
| 5830 | if self.entries != other.entries: return False |
| 5831 | return True |
| 5832 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5833 | def pretty_print(self, q): |
| 5834 | q.text("group_desc_stats_reply {") |
| 5835 | with q.group(): |
| 5836 | with q.indent(2): |
| 5837 | q.breakable() |
| 5838 | q.text("xid = "); |
| 5839 | if self.xid != None: |
| 5840 | q.text("%#x" % self.xid) |
| 5841 | else: |
| 5842 | q.text('None') |
| 5843 | q.text(","); q.breakable() |
| 5844 | q.text("flags = "); |
| 5845 | q.text("%#x" % self.flags) |
| 5846 | q.text(","); q.breakable() |
| 5847 | q.text("entries = "); |
| 5848 | q.pp(self.entries) |
| 5849 | q.breakable() |
| 5850 | q.text('}') |
| 5851 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5852 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 5853 | |
| 5854 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5855 | version = 3 |
| 5856 | type = 18 |
| 5857 | stats_type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5858 | |
| 5859 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5860 | if xid != None: |
| 5861 | self.xid = xid |
| 5862 | else: |
| 5863 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5864 | if flags != None: |
| 5865 | self.flags = flags |
| 5866 | else: |
| 5867 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5868 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5869 | |
| 5870 | def pack(self): |
| 5871 | packed = [] |
| 5872 | packed.append(struct.pack("!B", self.version)) |
| 5873 | packed.append(struct.pack("!B", self.type)) |
| 5874 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5875 | packed.append(struct.pack("!L", self.xid)) |
| 5876 | packed.append(struct.pack("!H", self.stats_type)) |
| 5877 | packed.append(struct.pack("!H", self.flags)) |
| 5878 | packed.append('\x00' * 4) |
| 5879 | length = sum([len(x) for x in packed]) |
| 5880 | packed[2] = struct.pack("!H", length) |
| 5881 | return ''.join(packed) |
| 5882 | |
| 5883 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5884 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5885 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5886 | _version = reader.read("!B")[0] |
| 5887 | assert(_version == 3) |
| 5888 | _type = reader.read("!B")[0] |
| 5889 | assert(_type == 18) |
| 5890 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5891 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5892 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5893 | obj.xid = reader.read("!L")[0] |
| 5894 | _stats_type = reader.read("!H")[0] |
| 5895 | assert(_stats_type == 7) |
| 5896 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5897 | reader.skip(4) |
| 5898 | return obj |
| 5899 | |
| 5900 | def __eq__(self, other): |
| 5901 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5902 | if self.xid != other.xid: return False |
| 5903 | if self.flags != other.flags: return False |
| 5904 | return True |
| 5905 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5906 | def pretty_print(self, q): |
| 5907 | q.text("group_desc_stats_request {") |
| 5908 | with q.group(): |
| 5909 | with q.indent(2): |
| 5910 | q.breakable() |
| 5911 | q.text("xid = "); |
| 5912 | if self.xid != None: |
| 5913 | q.text("%#x" % self.xid) |
| 5914 | else: |
| 5915 | q.text('None') |
| 5916 | q.text(","); q.breakable() |
| 5917 | q.text("flags = "); |
| 5918 | q.text("%#x" % self.flags) |
| 5919 | q.breakable() |
| 5920 | q.text('}') |
| 5921 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5922 | stats_request.subtypes[7] = group_desc_stats_request |
| 5923 | |
| 5924 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5925 | version = 3 |
| 5926 | type = 19 |
| 5927 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5928 | |
| 5929 | def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5930 | if xid != None: |
| 5931 | self.xid = xid |
| 5932 | else: |
| 5933 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5934 | if flags != None: |
| 5935 | self.flags = flags |
| 5936 | else: |
| 5937 | self.flags = 0 |
| 5938 | if types != None: |
| 5939 | self.types = types |
| 5940 | else: |
| 5941 | self.types = 0 |
| 5942 | if capabilities != None: |
| 5943 | self.capabilities = capabilities |
| 5944 | else: |
| 5945 | self.capabilities = 0 |
| 5946 | if max_groups_all != None: |
| 5947 | self.max_groups_all = max_groups_all |
| 5948 | else: |
| 5949 | self.max_groups_all = 0 |
| 5950 | if max_groups_select != None: |
| 5951 | self.max_groups_select = max_groups_select |
| 5952 | else: |
| 5953 | self.max_groups_select = 0 |
| 5954 | if max_groups_indirect != None: |
| 5955 | self.max_groups_indirect = max_groups_indirect |
| 5956 | else: |
| 5957 | self.max_groups_indirect = 0 |
| 5958 | if max_groups_ff != None: |
| 5959 | self.max_groups_ff = max_groups_ff |
| 5960 | else: |
| 5961 | self.max_groups_ff = 0 |
| 5962 | if actions_all != None: |
| 5963 | self.actions_all = actions_all |
| 5964 | else: |
| 5965 | self.actions_all = 0 |
| 5966 | if actions_select != None: |
| 5967 | self.actions_select = actions_select |
| 5968 | else: |
| 5969 | self.actions_select = 0 |
| 5970 | if actions_indirect != None: |
| 5971 | self.actions_indirect = actions_indirect |
| 5972 | else: |
| 5973 | self.actions_indirect = 0 |
| 5974 | if actions_ff != None: |
| 5975 | self.actions_ff = actions_ff |
| 5976 | else: |
| 5977 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5978 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5979 | |
| 5980 | def pack(self): |
| 5981 | packed = [] |
| 5982 | packed.append(struct.pack("!B", self.version)) |
| 5983 | packed.append(struct.pack("!B", self.type)) |
| 5984 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5985 | packed.append(struct.pack("!L", self.xid)) |
| 5986 | packed.append(struct.pack("!H", self.stats_type)) |
| 5987 | packed.append(struct.pack("!H", self.flags)) |
| 5988 | packed.append('\x00' * 4) |
| 5989 | packed.append(struct.pack("!L", self.types)) |
| 5990 | packed.append(struct.pack("!L", self.capabilities)) |
| 5991 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 5992 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 5993 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 5994 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 5995 | packed.append(struct.pack("!L", self.actions_all)) |
| 5996 | packed.append(struct.pack("!L", self.actions_select)) |
| 5997 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 5998 | packed.append(struct.pack("!L", self.actions_ff)) |
| 5999 | length = sum([len(x) for x in packed]) |
| 6000 | packed[2] = struct.pack("!H", length) |
| 6001 | return ''.join(packed) |
| 6002 | |
| 6003 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6004 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6005 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6006 | _version = reader.read("!B")[0] |
| 6007 | assert(_version == 3) |
| 6008 | _type = reader.read("!B")[0] |
| 6009 | assert(_type == 19) |
| 6010 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6011 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6012 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6013 | obj.xid = reader.read("!L")[0] |
| 6014 | _stats_type = reader.read("!H")[0] |
| 6015 | assert(_stats_type == 8) |
| 6016 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6017 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6018 | obj.types = reader.read("!L")[0] |
| 6019 | obj.capabilities = reader.read("!L")[0] |
| 6020 | obj.max_groups_all = reader.read("!L")[0] |
| 6021 | obj.max_groups_select = reader.read("!L")[0] |
| 6022 | obj.max_groups_indirect = reader.read("!L")[0] |
| 6023 | obj.max_groups_ff = reader.read("!L")[0] |
| 6024 | obj.actions_all = reader.read("!L")[0] |
| 6025 | obj.actions_select = reader.read("!L")[0] |
| 6026 | obj.actions_indirect = reader.read("!L")[0] |
| 6027 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6028 | return obj |
| 6029 | |
| 6030 | def __eq__(self, other): |
| 6031 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6032 | if self.xid != other.xid: return False |
| 6033 | if self.flags != other.flags: return False |
| 6034 | if self.types != other.types: return False |
| 6035 | if self.capabilities != other.capabilities: return False |
| 6036 | if self.max_groups_all != other.max_groups_all: return False |
| 6037 | if self.max_groups_select != other.max_groups_select: return False |
| 6038 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 6039 | if self.max_groups_ff != other.max_groups_ff: return False |
| 6040 | if self.actions_all != other.actions_all: return False |
| 6041 | if self.actions_select != other.actions_select: return False |
| 6042 | if self.actions_indirect != other.actions_indirect: return False |
| 6043 | if self.actions_ff != other.actions_ff: return False |
| 6044 | return True |
| 6045 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6046 | def pretty_print(self, q): |
| 6047 | q.text("group_features_stats_reply {") |
| 6048 | with q.group(): |
| 6049 | with q.indent(2): |
| 6050 | q.breakable() |
| 6051 | q.text("xid = "); |
| 6052 | if self.xid != None: |
| 6053 | q.text("%#x" % self.xid) |
| 6054 | else: |
| 6055 | q.text('None') |
| 6056 | q.text(","); q.breakable() |
| 6057 | q.text("flags = "); |
| 6058 | q.text("%#x" % self.flags) |
| 6059 | q.text(","); q.breakable() |
| 6060 | q.text("types = "); |
| 6061 | q.text("%#x" % self.types) |
| 6062 | q.text(","); q.breakable() |
| 6063 | q.text("capabilities = "); |
| 6064 | q.text("%#x" % self.capabilities) |
| 6065 | q.text(","); q.breakable() |
| 6066 | q.text("max_groups_all = "); |
| 6067 | q.text("%#x" % self.max_groups_all) |
| 6068 | q.text(","); q.breakable() |
| 6069 | q.text("max_groups_select = "); |
| 6070 | q.text("%#x" % self.max_groups_select) |
| 6071 | q.text(","); q.breakable() |
| 6072 | q.text("max_groups_indirect = "); |
| 6073 | q.text("%#x" % self.max_groups_indirect) |
| 6074 | q.text(","); q.breakable() |
| 6075 | q.text("max_groups_ff = "); |
| 6076 | q.text("%#x" % self.max_groups_ff) |
| 6077 | q.text(","); q.breakable() |
| 6078 | q.text("actions_all = "); |
| 6079 | q.text("%#x" % self.actions_all) |
| 6080 | q.text(","); q.breakable() |
| 6081 | q.text("actions_select = "); |
| 6082 | q.text("%#x" % self.actions_select) |
| 6083 | q.text(","); q.breakable() |
| 6084 | q.text("actions_indirect = "); |
| 6085 | q.text("%#x" % self.actions_indirect) |
| 6086 | q.text(","); q.breakable() |
| 6087 | q.text("actions_ff = "); |
| 6088 | q.text("%#x" % self.actions_ff) |
| 6089 | q.breakable() |
| 6090 | q.text('}') |
| 6091 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6092 | stats_reply.subtypes[8] = group_features_stats_reply |
| 6093 | |
| 6094 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6095 | version = 3 |
| 6096 | type = 18 |
| 6097 | stats_type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6098 | |
| 6099 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6100 | if xid != None: |
| 6101 | self.xid = xid |
| 6102 | else: |
| 6103 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6104 | if flags != None: |
| 6105 | self.flags = flags |
| 6106 | else: |
| 6107 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6108 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6109 | |
| 6110 | def pack(self): |
| 6111 | packed = [] |
| 6112 | packed.append(struct.pack("!B", self.version)) |
| 6113 | packed.append(struct.pack("!B", self.type)) |
| 6114 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6115 | packed.append(struct.pack("!L", self.xid)) |
| 6116 | packed.append(struct.pack("!H", self.stats_type)) |
| 6117 | packed.append(struct.pack("!H", self.flags)) |
| 6118 | packed.append('\x00' * 4) |
| 6119 | length = sum([len(x) for x in packed]) |
| 6120 | packed[2] = struct.pack("!H", length) |
| 6121 | return ''.join(packed) |
| 6122 | |
| 6123 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6124 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6125 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6126 | _version = reader.read("!B")[0] |
| 6127 | assert(_version == 3) |
| 6128 | _type = reader.read("!B")[0] |
| 6129 | assert(_type == 18) |
| 6130 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6131 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6132 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6133 | obj.xid = reader.read("!L")[0] |
| 6134 | _stats_type = reader.read("!H")[0] |
| 6135 | assert(_stats_type == 8) |
| 6136 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6137 | reader.skip(4) |
| 6138 | return obj |
| 6139 | |
| 6140 | def __eq__(self, other): |
| 6141 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6142 | if self.xid != other.xid: return False |
| 6143 | if self.flags != other.flags: return False |
| 6144 | return True |
| 6145 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6146 | def pretty_print(self, q): |
| 6147 | q.text("group_features_stats_request {") |
| 6148 | with q.group(): |
| 6149 | with q.indent(2): |
| 6150 | q.breakable() |
| 6151 | q.text("xid = "); |
| 6152 | if self.xid != None: |
| 6153 | q.text("%#x" % self.xid) |
| 6154 | else: |
| 6155 | q.text('None') |
| 6156 | q.text(","); q.breakable() |
| 6157 | q.text("flags = "); |
| 6158 | q.text("%#x" % self.flags) |
| 6159 | q.breakable() |
| 6160 | q.text('}') |
| 6161 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6162 | stats_request.subtypes[8] = group_features_stats_request |
| 6163 | |
| 6164 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6165 | version = 3 |
| 6166 | type = 1 |
| 6167 | err_type = 6 |
| 6168 | |
| 6169 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6170 | if xid != None: |
| 6171 | self.xid = xid |
| 6172 | else: |
| 6173 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6174 | if code != None: |
| 6175 | self.code = code |
| 6176 | else: |
| 6177 | self.code = 0 |
| 6178 | if data != None: |
| 6179 | self.data = data |
| 6180 | else: |
| 6181 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6182 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6183 | |
| 6184 | def pack(self): |
| 6185 | packed = [] |
| 6186 | packed.append(struct.pack("!B", self.version)) |
| 6187 | packed.append(struct.pack("!B", self.type)) |
| 6188 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6189 | packed.append(struct.pack("!L", self.xid)) |
| 6190 | packed.append(struct.pack("!H", self.err_type)) |
| 6191 | packed.append(struct.pack("!H", self.code)) |
| 6192 | packed.append(self.data) |
| 6193 | length = sum([len(x) for x in packed]) |
| 6194 | packed[2] = struct.pack("!H", length) |
| 6195 | return ''.join(packed) |
| 6196 | |
| 6197 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6198 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6199 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6200 | _version = reader.read("!B")[0] |
| 6201 | assert(_version == 3) |
| 6202 | _type = reader.read("!B")[0] |
| 6203 | assert(_type == 1) |
| 6204 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6205 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6206 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6207 | obj.xid = reader.read("!L")[0] |
| 6208 | _err_type = reader.read("!H")[0] |
| 6209 | assert(_err_type == 6) |
| 6210 | obj.code = reader.read("!H")[0] |
| 6211 | obj.data = str(reader.read_all()) |
| 6212 | return obj |
| 6213 | |
| 6214 | def __eq__(self, other): |
| 6215 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6216 | if self.xid != other.xid: return False |
| 6217 | if self.code != other.code: return False |
| 6218 | if self.data != other.data: return False |
| 6219 | return True |
| 6220 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6221 | def pretty_print(self, q): |
| 6222 | q.text("group_mod_failed_error_msg {") |
| 6223 | with q.group(): |
| 6224 | with q.indent(2): |
| 6225 | q.breakable() |
| 6226 | q.text("xid = "); |
| 6227 | if self.xid != None: |
| 6228 | q.text("%#x" % self.xid) |
| 6229 | else: |
| 6230 | q.text('None') |
| 6231 | q.text(","); q.breakable() |
| 6232 | q.text("code = "); |
| 6233 | q.text("%#x" % self.code) |
| 6234 | q.text(","); q.breakable() |
| 6235 | q.text("data = "); |
| 6236 | q.pp(self.data) |
| 6237 | q.breakable() |
| 6238 | q.text('}') |
| 6239 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6240 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 6241 | |
| 6242 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6243 | version = 3 |
| 6244 | type = 15 |
| 6245 | command = 1 |
| 6246 | |
| 6247 | def __init__(self, xid=None, group_type=None, group_id=None, buckets=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6248 | if xid != None: |
| 6249 | self.xid = xid |
| 6250 | else: |
| 6251 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6252 | if group_type != None: |
| 6253 | self.group_type = group_type |
| 6254 | else: |
| 6255 | self.group_type = 0 |
| 6256 | if group_id != None: |
| 6257 | self.group_id = group_id |
| 6258 | else: |
| 6259 | self.group_id = 0 |
| 6260 | if buckets != None: |
| 6261 | self.buckets = buckets |
| 6262 | else: |
| 6263 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6264 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6265 | |
| 6266 | def pack(self): |
| 6267 | packed = [] |
| 6268 | packed.append(struct.pack("!B", self.version)) |
| 6269 | packed.append(struct.pack("!B", self.type)) |
| 6270 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6271 | packed.append(struct.pack("!L", self.xid)) |
| 6272 | packed.append(struct.pack("!H", self.command)) |
| 6273 | packed.append(struct.pack("!B", self.group_type)) |
| 6274 | packed.append('\x00' * 1) |
| 6275 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6276 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6277 | length = sum([len(x) for x in packed]) |
| 6278 | packed[2] = struct.pack("!H", length) |
| 6279 | return ''.join(packed) |
| 6280 | |
| 6281 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6282 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6283 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6284 | _version = reader.read("!B")[0] |
| 6285 | assert(_version == 3) |
| 6286 | _type = reader.read("!B")[0] |
| 6287 | assert(_type == 15) |
| 6288 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6289 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6290 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6291 | obj.xid = reader.read("!L")[0] |
| 6292 | _command = reader.read("!H")[0] |
| 6293 | assert(_command == 1) |
| 6294 | obj.group_type = reader.read("!B")[0] |
| 6295 | reader.skip(1) |
| 6296 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6297 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6298 | return obj |
| 6299 | |
| 6300 | def __eq__(self, other): |
| 6301 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6302 | if self.xid != other.xid: return False |
| 6303 | if self.group_type != other.group_type: return False |
| 6304 | if self.group_id != other.group_id: return False |
| 6305 | if self.buckets != other.buckets: return False |
| 6306 | return True |
| 6307 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6308 | def pretty_print(self, q): |
| 6309 | q.text("group_modify {") |
| 6310 | with q.group(): |
| 6311 | with q.indent(2): |
| 6312 | q.breakable() |
| 6313 | q.text("xid = "); |
| 6314 | if self.xid != None: |
| 6315 | q.text("%#x" % self.xid) |
| 6316 | else: |
| 6317 | q.text('None') |
| 6318 | q.text(","); q.breakable() |
| 6319 | q.text("group_type = "); |
| 6320 | q.text("%#x" % self.group_type) |
| 6321 | q.text(","); q.breakable() |
| 6322 | q.text("group_id = "); |
| 6323 | q.text("%#x" % self.group_id) |
| 6324 | q.text(","); q.breakable() |
| 6325 | q.text("buckets = "); |
| 6326 | q.pp(self.buckets) |
| 6327 | q.breakable() |
| 6328 | q.text('}') |
| 6329 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6330 | group_mod.subtypes[1] = group_modify |
| 6331 | |
| 6332 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6333 | version = 3 |
| 6334 | type = 19 |
| 6335 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6336 | |
| 6337 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6338 | if xid != None: |
| 6339 | self.xid = xid |
| 6340 | else: |
| 6341 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6342 | if flags != None: |
| 6343 | self.flags = flags |
| 6344 | else: |
| 6345 | self.flags = 0 |
| 6346 | if entries != None: |
| 6347 | self.entries = entries |
| 6348 | else: |
| 6349 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6350 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6351 | |
| 6352 | def pack(self): |
| 6353 | packed = [] |
| 6354 | packed.append(struct.pack("!B", self.version)) |
| 6355 | packed.append(struct.pack("!B", self.type)) |
| 6356 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6357 | packed.append(struct.pack("!L", self.xid)) |
| 6358 | packed.append(struct.pack("!H", self.stats_type)) |
| 6359 | packed.append(struct.pack("!H", self.flags)) |
| 6360 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6361 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6362 | length = sum([len(x) for x in packed]) |
| 6363 | packed[2] = struct.pack("!H", length) |
| 6364 | return ''.join(packed) |
| 6365 | |
| 6366 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6367 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6368 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6369 | _version = reader.read("!B")[0] |
| 6370 | assert(_version == 3) |
| 6371 | _type = reader.read("!B")[0] |
| 6372 | assert(_type == 19) |
| 6373 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6374 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6375 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6376 | obj.xid = reader.read("!L")[0] |
| 6377 | _stats_type = reader.read("!H")[0] |
| 6378 | assert(_stats_type == 6) |
| 6379 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6380 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6381 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.group_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6382 | return obj |
| 6383 | |
| 6384 | def __eq__(self, other): |
| 6385 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6386 | if self.xid != other.xid: return False |
| 6387 | if self.flags != other.flags: return False |
| 6388 | if self.entries != other.entries: return False |
| 6389 | return True |
| 6390 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6391 | def pretty_print(self, q): |
| 6392 | q.text("group_stats_reply {") |
| 6393 | with q.group(): |
| 6394 | with q.indent(2): |
| 6395 | q.breakable() |
| 6396 | q.text("xid = "); |
| 6397 | if self.xid != None: |
| 6398 | q.text("%#x" % self.xid) |
| 6399 | else: |
| 6400 | q.text('None') |
| 6401 | q.text(","); q.breakable() |
| 6402 | q.text("flags = "); |
| 6403 | q.text("%#x" % self.flags) |
| 6404 | q.text(","); q.breakable() |
| 6405 | q.text("entries = "); |
| 6406 | q.pp(self.entries) |
| 6407 | q.breakable() |
| 6408 | q.text('}') |
| 6409 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6410 | stats_reply.subtypes[6] = group_stats_reply |
| 6411 | |
| 6412 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6413 | version = 3 |
| 6414 | type = 18 |
| 6415 | stats_type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6416 | |
| 6417 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6418 | if xid != None: |
| 6419 | self.xid = xid |
| 6420 | else: |
| 6421 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6422 | if flags != None: |
| 6423 | self.flags = flags |
| 6424 | else: |
| 6425 | self.flags = 0 |
| 6426 | if group_id != None: |
| 6427 | self.group_id = group_id |
| 6428 | else: |
| 6429 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6430 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6431 | |
| 6432 | def pack(self): |
| 6433 | packed = [] |
| 6434 | packed.append(struct.pack("!B", self.version)) |
| 6435 | packed.append(struct.pack("!B", self.type)) |
| 6436 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6437 | packed.append(struct.pack("!L", self.xid)) |
| 6438 | packed.append(struct.pack("!H", self.stats_type)) |
| 6439 | packed.append(struct.pack("!H", self.flags)) |
| 6440 | packed.append('\x00' * 4) |
| 6441 | packed.append(struct.pack("!L", self.group_id)) |
| 6442 | packed.append('\x00' * 4) |
| 6443 | length = sum([len(x) for x in packed]) |
| 6444 | packed[2] = struct.pack("!H", length) |
| 6445 | return ''.join(packed) |
| 6446 | |
| 6447 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6448 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6449 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6450 | _version = reader.read("!B")[0] |
| 6451 | assert(_version == 3) |
| 6452 | _type = reader.read("!B")[0] |
| 6453 | assert(_type == 18) |
| 6454 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6455 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6456 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6457 | obj.xid = reader.read("!L")[0] |
| 6458 | _stats_type = reader.read("!H")[0] |
| 6459 | assert(_stats_type == 6) |
| 6460 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6461 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6462 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6463 | reader.skip(4) |
| 6464 | return obj |
| 6465 | |
| 6466 | def __eq__(self, other): |
| 6467 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6468 | if self.xid != other.xid: return False |
| 6469 | if self.flags != other.flags: return False |
| 6470 | if self.group_id != other.group_id: return False |
| 6471 | return True |
| 6472 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6473 | def pretty_print(self, q): |
| 6474 | q.text("group_stats_request {") |
| 6475 | with q.group(): |
| 6476 | with q.indent(2): |
| 6477 | q.breakable() |
| 6478 | q.text("xid = "); |
| 6479 | if self.xid != None: |
| 6480 | q.text("%#x" % self.xid) |
| 6481 | else: |
| 6482 | q.text('None') |
| 6483 | q.text(","); q.breakable() |
| 6484 | q.text("flags = "); |
| 6485 | q.text("%#x" % self.flags) |
| 6486 | q.text(","); q.breakable() |
| 6487 | q.text("group_id = "); |
| 6488 | q.text("%#x" % self.group_id) |
| 6489 | q.breakable() |
| 6490 | q.text('}') |
| 6491 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6492 | stats_request.subtypes[6] = group_stats_request |
| 6493 | |
| 6494 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6495 | version = 3 |
| 6496 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6497 | |
| 6498 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6499 | if xid != None: |
| 6500 | self.xid = xid |
| 6501 | else: |
| 6502 | self.xid = None |
| 6503 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6504 | |
| 6505 | def pack(self): |
| 6506 | packed = [] |
| 6507 | packed.append(struct.pack("!B", self.version)) |
| 6508 | packed.append(struct.pack("!B", self.type)) |
| 6509 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6510 | packed.append(struct.pack("!L", self.xid)) |
| 6511 | length = sum([len(x) for x in packed]) |
| 6512 | packed[2] = struct.pack("!H", length) |
| 6513 | return ''.join(packed) |
| 6514 | |
| 6515 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6516 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6517 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6518 | _version = reader.read("!B")[0] |
| 6519 | assert(_version == 3) |
| 6520 | _type = reader.read("!B")[0] |
| 6521 | assert(_type == 0) |
| 6522 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6523 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6524 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6525 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6526 | return obj |
| 6527 | |
| 6528 | def __eq__(self, other): |
| 6529 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6530 | if self.xid != other.xid: return False |
| 6531 | return True |
| 6532 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6533 | def pretty_print(self, q): |
| 6534 | q.text("hello {") |
| 6535 | with q.group(): |
| 6536 | with q.indent(2): |
| 6537 | q.breakable() |
| 6538 | q.text("xid = "); |
| 6539 | if self.xid != None: |
| 6540 | q.text("%#x" % self.xid) |
| 6541 | else: |
| 6542 | q.text('None') |
| 6543 | q.breakable() |
| 6544 | q.text('}') |
| 6545 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6546 | message.subtypes[0] = hello |
| 6547 | |
| 6548 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6549 | version = 3 |
| 6550 | type = 1 |
| 6551 | err_type = 0 |
| 6552 | |
| 6553 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6554 | if xid != None: |
| 6555 | self.xid = xid |
| 6556 | else: |
| 6557 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6558 | if code != None: |
| 6559 | self.code = code |
| 6560 | else: |
| 6561 | self.code = 0 |
| 6562 | if data != None: |
| 6563 | self.data = data |
| 6564 | else: |
| 6565 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6566 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6567 | |
| 6568 | def pack(self): |
| 6569 | packed = [] |
| 6570 | packed.append(struct.pack("!B", self.version)) |
| 6571 | packed.append(struct.pack("!B", self.type)) |
| 6572 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6573 | packed.append(struct.pack("!L", self.xid)) |
| 6574 | packed.append(struct.pack("!H", self.err_type)) |
| 6575 | packed.append(struct.pack("!H", self.code)) |
| 6576 | packed.append(self.data) |
| 6577 | length = sum([len(x) for x in packed]) |
| 6578 | packed[2] = struct.pack("!H", length) |
| 6579 | return ''.join(packed) |
| 6580 | |
| 6581 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6582 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6583 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6584 | _version = reader.read("!B")[0] |
| 6585 | assert(_version == 3) |
| 6586 | _type = reader.read("!B")[0] |
| 6587 | assert(_type == 1) |
| 6588 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6589 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6590 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6591 | obj.xid = reader.read("!L")[0] |
| 6592 | _err_type = reader.read("!H")[0] |
| 6593 | assert(_err_type == 0) |
| 6594 | obj.code = reader.read("!H")[0] |
| 6595 | obj.data = str(reader.read_all()) |
| 6596 | return obj |
| 6597 | |
| 6598 | def __eq__(self, other): |
| 6599 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6600 | if self.xid != other.xid: return False |
| 6601 | if self.code != other.code: return False |
| 6602 | if self.data != other.data: return False |
| 6603 | return True |
| 6604 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6605 | def pretty_print(self, q): |
| 6606 | q.text("hello_failed_error_msg {") |
| 6607 | with q.group(): |
| 6608 | with q.indent(2): |
| 6609 | q.breakable() |
| 6610 | q.text("xid = "); |
| 6611 | if self.xid != None: |
| 6612 | q.text("%#x" % self.xid) |
| 6613 | else: |
| 6614 | q.text('None') |
| 6615 | q.text(","); q.breakable() |
| 6616 | q.text("code = "); |
| 6617 | q.text("%#x" % self.code) |
| 6618 | q.text(","); q.breakable() |
| 6619 | q.text("data = "); |
| 6620 | q.pp(self.data) |
| 6621 | q.breakable() |
| 6622 | q.text('}') |
| 6623 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6624 | error_msg.subtypes[0] = hello_failed_error_msg |
| 6625 | |
| 6626 | class nicira_header(experimenter): |
| 6627 | subtypes = {} |
| 6628 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6629 | version = 3 |
| 6630 | type = 4 |
| 6631 | experimenter = 8992 |
| 6632 | |
| 6633 | def __init__(self, xid=None, subtype=None): |
| 6634 | if xid != None: |
| 6635 | self.xid = xid |
| 6636 | else: |
| 6637 | self.xid = None |
| 6638 | if subtype != None: |
| 6639 | self.subtype = subtype |
| 6640 | else: |
| 6641 | self.subtype = 0 |
| 6642 | return |
| 6643 | |
| 6644 | def pack(self): |
| 6645 | packed = [] |
| 6646 | packed.append(struct.pack("!B", self.version)) |
| 6647 | packed.append(struct.pack("!B", self.type)) |
| 6648 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6649 | packed.append(struct.pack("!L", self.xid)) |
| 6650 | packed.append(struct.pack("!L", self.experimenter)) |
| 6651 | packed.append(struct.pack("!L", self.subtype)) |
| 6652 | length = sum([len(x) for x in packed]) |
| 6653 | packed[2] = struct.pack("!H", length) |
| 6654 | return ''.join(packed) |
| 6655 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6656 | @staticmethod |
| 6657 | def unpack(reader): |
| 6658 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6659 | subclass = nicira_header.subtypes.get(subtype) |
| 6660 | if subclass: |
| 6661 | return subclass.unpack(reader) |
| 6662 | |
| 6663 | obj = nicira_header() |
| 6664 | _version = reader.read("!B")[0] |
| 6665 | assert(_version == 3) |
| 6666 | _type = reader.read("!B")[0] |
| 6667 | assert(_type == 4) |
| 6668 | _length = reader.read("!H")[0] |
| 6669 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6670 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6671 | obj.xid = reader.read("!L")[0] |
| 6672 | _experimenter = reader.read("!L")[0] |
| 6673 | assert(_experimenter == 8992) |
| 6674 | obj.subtype = reader.read("!L")[0] |
| 6675 | return obj |
| 6676 | |
| 6677 | def __eq__(self, other): |
| 6678 | if type(self) != type(other): return False |
| 6679 | if self.xid != other.xid: return False |
| 6680 | if self.subtype != other.subtype: return False |
| 6681 | return True |
| 6682 | |
| 6683 | def pretty_print(self, q): |
| 6684 | q.text("nicira_header {") |
| 6685 | with q.group(): |
| 6686 | with q.indent(2): |
| 6687 | q.breakable() |
| 6688 | q.text("xid = "); |
| 6689 | if self.xid != None: |
| 6690 | q.text("%#x" % self.xid) |
| 6691 | else: |
| 6692 | q.text('None') |
| 6693 | q.breakable() |
| 6694 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6695 | |
| 6696 | experimenter.subtypes[8992] = nicira_header |
| 6697 | |
| 6698 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6699 | version = 3 |
| 6700 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6701 | |
| 6702 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, match=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6703 | if xid != None: |
| 6704 | self.xid = xid |
| 6705 | else: |
| 6706 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6707 | if buffer_id != None: |
| 6708 | self.buffer_id = buffer_id |
| 6709 | else: |
| 6710 | self.buffer_id = 0 |
| 6711 | if total_len != None: |
| 6712 | self.total_len = total_len |
| 6713 | else: |
| 6714 | self.total_len = 0 |
| 6715 | if reason != None: |
| 6716 | self.reason = reason |
| 6717 | else: |
| 6718 | self.reason = 0 |
| 6719 | if table_id != None: |
| 6720 | self.table_id = table_id |
| 6721 | else: |
| 6722 | self.table_id = 0 |
| 6723 | if match != None: |
| 6724 | self.match = match |
| 6725 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6726 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6727 | if data != None: |
| 6728 | self.data = data |
| 6729 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6730 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6731 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6732 | |
| 6733 | def pack(self): |
| 6734 | packed = [] |
| 6735 | packed.append(struct.pack("!B", self.version)) |
| 6736 | packed.append(struct.pack("!B", self.type)) |
| 6737 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6738 | packed.append(struct.pack("!L", self.xid)) |
| 6739 | packed.append(struct.pack("!L", self.buffer_id)) |
| 6740 | packed.append(struct.pack("!H", self.total_len)) |
| 6741 | packed.append(struct.pack("!B", self.reason)) |
| 6742 | packed.append(struct.pack("!B", self.table_id)) |
| 6743 | packed.append(self.match.pack()) |
| 6744 | packed.append('\x00' * 2) |
| 6745 | packed.append(self.data) |
| 6746 | length = sum([len(x) for x in packed]) |
| 6747 | packed[2] = struct.pack("!H", length) |
| 6748 | return ''.join(packed) |
| 6749 | |
| 6750 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6751 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6752 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6753 | _version = reader.read("!B")[0] |
| 6754 | assert(_version == 3) |
| 6755 | _type = reader.read("!B")[0] |
| 6756 | assert(_type == 10) |
| 6757 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6758 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6759 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6760 | obj.xid = reader.read("!L")[0] |
| 6761 | obj.buffer_id = reader.read("!L")[0] |
| 6762 | obj.total_len = reader.read("!H")[0] |
| 6763 | obj.reason = reader.read("!B")[0] |
| 6764 | obj.table_id = reader.read("!B")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6765 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6766 | reader.skip(2) |
| 6767 | obj.data = str(reader.read_all()) |
| 6768 | return obj |
| 6769 | |
| 6770 | def __eq__(self, other): |
| 6771 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6772 | if self.xid != other.xid: return False |
| 6773 | if self.buffer_id != other.buffer_id: return False |
| 6774 | if self.total_len != other.total_len: return False |
| 6775 | if self.reason != other.reason: return False |
| 6776 | if self.table_id != other.table_id: return False |
| 6777 | if self.match != other.match: return False |
| 6778 | if self.data != other.data: return False |
| 6779 | return True |
| 6780 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6781 | def pretty_print(self, q): |
| 6782 | q.text("packet_in {") |
| 6783 | with q.group(): |
| 6784 | with q.indent(2): |
| 6785 | q.breakable() |
| 6786 | q.text("xid = "); |
| 6787 | if self.xid != None: |
| 6788 | q.text("%#x" % self.xid) |
| 6789 | else: |
| 6790 | q.text('None') |
| 6791 | q.text(","); q.breakable() |
| 6792 | q.text("buffer_id = "); |
| 6793 | q.text("%#x" % self.buffer_id) |
| 6794 | q.text(","); q.breakable() |
| 6795 | q.text("total_len = "); |
| 6796 | q.text("%#x" % self.total_len) |
| 6797 | q.text(","); q.breakable() |
| 6798 | q.text("reason = "); |
| 6799 | q.text("%#x" % self.reason) |
| 6800 | q.text(","); q.breakable() |
| 6801 | q.text("table_id = "); |
| 6802 | q.text("%#x" % self.table_id) |
| 6803 | q.text(","); q.breakable() |
| 6804 | q.text("match = "); |
| 6805 | q.pp(self.match) |
| 6806 | q.text(","); q.breakable() |
| 6807 | q.text("data = "); |
| 6808 | q.pp(self.data) |
| 6809 | q.breakable() |
| 6810 | q.text('}') |
| 6811 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6812 | message.subtypes[10] = packet_in |
| 6813 | |
| 6814 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6815 | version = 3 |
| 6816 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6817 | |
| 6818 | 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] | 6819 | if xid != None: |
| 6820 | self.xid = xid |
| 6821 | else: |
| 6822 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6823 | if buffer_id != None: |
| 6824 | self.buffer_id = buffer_id |
| 6825 | else: |
| 6826 | self.buffer_id = 0 |
| 6827 | if in_port != None: |
| 6828 | self.in_port = in_port |
| 6829 | else: |
| 6830 | self.in_port = 0 |
| 6831 | if actions != None: |
| 6832 | self.actions = actions |
| 6833 | else: |
| 6834 | self.actions = [] |
| 6835 | if data != None: |
| 6836 | self.data = data |
| 6837 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6838 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6839 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6840 | |
| 6841 | def pack(self): |
| 6842 | packed = [] |
| 6843 | packed.append(struct.pack("!B", self.version)) |
| 6844 | packed.append(struct.pack("!B", self.type)) |
| 6845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6846 | packed.append(struct.pack("!L", self.xid)) |
| 6847 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6848 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6849 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 6850 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6851 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6852 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 6853 | packed.append(self.data) |
| 6854 | length = sum([len(x) for x in packed]) |
| 6855 | packed[2] = struct.pack("!H", length) |
| 6856 | return ''.join(packed) |
| 6857 | |
| 6858 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6859 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6860 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6861 | _version = reader.read("!B")[0] |
| 6862 | assert(_version == 3) |
| 6863 | _type = reader.read("!B")[0] |
| 6864 | assert(_type == 13) |
| 6865 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6866 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6867 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6868 | obj.xid = reader.read("!L")[0] |
| 6869 | obj.buffer_id = reader.read("!L")[0] |
| 6870 | obj.in_port = util.unpack_port_no(reader) |
| 6871 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6872 | reader.skip(6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6873 | obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), ofp.action.action.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6874 | obj.data = str(reader.read_all()) |
| 6875 | return obj |
| 6876 | |
| 6877 | def __eq__(self, other): |
| 6878 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6879 | if self.xid != other.xid: return False |
| 6880 | if self.buffer_id != other.buffer_id: return False |
| 6881 | if self.in_port != other.in_port: return False |
| 6882 | if self.actions != other.actions: return False |
| 6883 | if self.data != other.data: return False |
| 6884 | return True |
| 6885 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6886 | def pretty_print(self, q): |
| 6887 | q.text("packet_out {") |
| 6888 | with q.group(): |
| 6889 | with q.indent(2): |
| 6890 | q.breakable() |
| 6891 | q.text("xid = "); |
| 6892 | if self.xid != None: |
| 6893 | q.text("%#x" % self.xid) |
| 6894 | else: |
| 6895 | q.text('None') |
| 6896 | q.text(","); q.breakable() |
| 6897 | q.text("buffer_id = "); |
| 6898 | q.text("%#x" % self.buffer_id) |
| 6899 | q.text(","); q.breakable() |
| 6900 | q.text("in_port = "); |
| 6901 | q.text(util.pretty_port(self.in_port)) |
| 6902 | q.text(","); q.breakable() |
| 6903 | q.text("actions = "); |
| 6904 | q.pp(self.actions) |
| 6905 | q.text(","); q.breakable() |
| 6906 | q.text("data = "); |
| 6907 | q.pp(self.data) |
| 6908 | q.breakable() |
| 6909 | q.text('}') |
| 6910 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6911 | message.subtypes[13] = packet_out |
| 6912 | |
| 6913 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6914 | version = 3 |
| 6915 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6916 | |
| 6917 | 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] | 6918 | if xid != None: |
| 6919 | self.xid = xid |
| 6920 | else: |
| 6921 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6922 | if port_no != None: |
| 6923 | self.port_no = port_no |
| 6924 | else: |
| 6925 | self.port_no = 0 |
| 6926 | if hw_addr != None: |
| 6927 | self.hw_addr = hw_addr |
| 6928 | else: |
| 6929 | self.hw_addr = [0,0,0,0,0,0] |
| 6930 | if config != None: |
| 6931 | self.config = config |
| 6932 | else: |
| 6933 | self.config = 0 |
| 6934 | if mask != None: |
| 6935 | self.mask = mask |
| 6936 | else: |
| 6937 | self.mask = 0 |
| 6938 | if advertise != None: |
| 6939 | self.advertise = advertise |
| 6940 | else: |
| 6941 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6942 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6943 | |
| 6944 | def pack(self): |
| 6945 | packed = [] |
| 6946 | packed.append(struct.pack("!B", self.version)) |
| 6947 | packed.append(struct.pack("!B", self.type)) |
| 6948 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6949 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6950 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6951 | packed.append('\x00' * 4) |
| 6952 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6953 | packed.append('\x00' * 2) |
| 6954 | packed.append(struct.pack("!L", self.config)) |
| 6955 | packed.append(struct.pack("!L", self.mask)) |
| 6956 | packed.append(struct.pack("!L", self.advertise)) |
| 6957 | packed.append('\x00' * 4) |
| 6958 | length = sum([len(x) for x in packed]) |
| 6959 | packed[2] = struct.pack("!H", length) |
| 6960 | return ''.join(packed) |
| 6961 | |
| 6962 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6963 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6964 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6965 | _version = reader.read("!B")[0] |
| 6966 | assert(_version == 3) |
| 6967 | _type = reader.read("!B")[0] |
| 6968 | assert(_type == 16) |
| 6969 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6970 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6971 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6972 | obj.xid = reader.read("!L")[0] |
| 6973 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6974 | reader.skip(4) |
| 6975 | obj.hw_addr = list(reader.read('!6B')) |
| 6976 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6977 | obj.config = reader.read("!L")[0] |
| 6978 | obj.mask = reader.read("!L")[0] |
| 6979 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6980 | reader.skip(4) |
| 6981 | return obj |
| 6982 | |
| 6983 | def __eq__(self, other): |
| 6984 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6985 | if self.xid != other.xid: return False |
| 6986 | if self.port_no != other.port_no: return False |
| 6987 | if self.hw_addr != other.hw_addr: return False |
| 6988 | if self.config != other.config: return False |
| 6989 | if self.mask != other.mask: return False |
| 6990 | if self.advertise != other.advertise: return False |
| 6991 | return True |
| 6992 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6993 | def pretty_print(self, q): |
| 6994 | q.text("port_mod {") |
| 6995 | with q.group(): |
| 6996 | with q.indent(2): |
| 6997 | q.breakable() |
| 6998 | q.text("xid = "); |
| 6999 | if self.xid != None: |
| 7000 | q.text("%#x" % self.xid) |
| 7001 | else: |
| 7002 | q.text('None') |
| 7003 | q.text(","); q.breakable() |
| 7004 | q.text("port_no = "); |
| 7005 | q.text(util.pretty_port(self.port_no)) |
| 7006 | q.text(","); q.breakable() |
| 7007 | q.text("hw_addr = "); |
| 7008 | q.text(util.pretty_mac(self.hw_addr)) |
| 7009 | q.text(","); q.breakable() |
| 7010 | q.text("config = "); |
| 7011 | q.text("%#x" % self.config) |
| 7012 | q.text(","); q.breakable() |
| 7013 | q.text("mask = "); |
| 7014 | q.text("%#x" % self.mask) |
| 7015 | q.text(","); q.breakable() |
| 7016 | q.text("advertise = "); |
| 7017 | q.text("%#x" % self.advertise) |
| 7018 | q.breakable() |
| 7019 | q.text('}') |
| 7020 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7021 | message.subtypes[16] = port_mod |
| 7022 | |
| 7023 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7024 | version = 3 |
| 7025 | type = 1 |
| 7026 | err_type = 7 |
| 7027 | |
| 7028 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7029 | if xid != None: |
| 7030 | self.xid = xid |
| 7031 | else: |
| 7032 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7033 | if code != None: |
| 7034 | self.code = code |
| 7035 | else: |
| 7036 | self.code = 0 |
| 7037 | if data != None: |
| 7038 | self.data = data |
| 7039 | else: |
| 7040 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7041 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7042 | |
| 7043 | def pack(self): |
| 7044 | packed = [] |
| 7045 | packed.append(struct.pack("!B", self.version)) |
| 7046 | packed.append(struct.pack("!B", self.type)) |
| 7047 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7048 | packed.append(struct.pack("!L", self.xid)) |
| 7049 | packed.append(struct.pack("!H", self.err_type)) |
| 7050 | packed.append(struct.pack("!H", self.code)) |
| 7051 | packed.append(self.data) |
| 7052 | length = sum([len(x) for x in packed]) |
| 7053 | packed[2] = struct.pack("!H", length) |
| 7054 | return ''.join(packed) |
| 7055 | |
| 7056 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7057 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7058 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7059 | _version = reader.read("!B")[0] |
| 7060 | assert(_version == 3) |
| 7061 | _type = reader.read("!B")[0] |
| 7062 | assert(_type == 1) |
| 7063 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7064 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7065 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7066 | obj.xid = reader.read("!L")[0] |
| 7067 | _err_type = reader.read("!H")[0] |
| 7068 | assert(_err_type == 7) |
| 7069 | obj.code = reader.read("!H")[0] |
| 7070 | obj.data = str(reader.read_all()) |
| 7071 | return obj |
| 7072 | |
| 7073 | def __eq__(self, other): |
| 7074 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7075 | if self.xid != other.xid: return False |
| 7076 | if self.code != other.code: return False |
| 7077 | if self.data != other.data: return False |
| 7078 | return True |
| 7079 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7080 | def pretty_print(self, q): |
| 7081 | q.text("port_mod_failed_error_msg {") |
| 7082 | with q.group(): |
| 7083 | with q.indent(2): |
| 7084 | q.breakable() |
| 7085 | q.text("xid = "); |
| 7086 | if self.xid != None: |
| 7087 | q.text("%#x" % self.xid) |
| 7088 | else: |
| 7089 | q.text('None') |
| 7090 | q.text(","); q.breakable() |
| 7091 | q.text("code = "); |
| 7092 | q.text("%#x" % self.code) |
| 7093 | q.text(","); q.breakable() |
| 7094 | q.text("data = "); |
| 7095 | q.pp(self.data) |
| 7096 | q.breakable() |
| 7097 | q.text('}') |
| 7098 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7099 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 7100 | |
| 7101 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7102 | version = 3 |
| 7103 | type = 19 |
| 7104 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7105 | |
| 7106 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7107 | if xid != None: |
| 7108 | self.xid = xid |
| 7109 | else: |
| 7110 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7111 | if flags != None: |
| 7112 | self.flags = flags |
| 7113 | else: |
| 7114 | self.flags = 0 |
| 7115 | if entries != None: |
| 7116 | self.entries = entries |
| 7117 | else: |
| 7118 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7119 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7120 | |
| 7121 | def pack(self): |
| 7122 | packed = [] |
| 7123 | packed.append(struct.pack("!B", self.version)) |
| 7124 | packed.append(struct.pack("!B", self.type)) |
| 7125 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7126 | packed.append(struct.pack("!L", self.xid)) |
| 7127 | packed.append(struct.pack("!H", self.stats_type)) |
| 7128 | packed.append(struct.pack("!H", self.flags)) |
| 7129 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7130 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7131 | length = sum([len(x) for x in packed]) |
| 7132 | packed[2] = struct.pack("!H", length) |
| 7133 | return ''.join(packed) |
| 7134 | |
| 7135 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7136 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7137 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7138 | _version = reader.read("!B")[0] |
| 7139 | assert(_version == 3) |
| 7140 | _type = reader.read("!B")[0] |
| 7141 | assert(_type == 19) |
| 7142 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7143 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7144 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7145 | obj.xid = reader.read("!L")[0] |
| 7146 | _stats_type = reader.read("!H")[0] |
| 7147 | assert(_stats_type == 4) |
| 7148 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7149 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7150 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7151 | return obj |
| 7152 | |
| 7153 | def __eq__(self, other): |
| 7154 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7155 | if self.xid != other.xid: return False |
| 7156 | if self.flags != other.flags: return False |
| 7157 | if self.entries != other.entries: return False |
| 7158 | return True |
| 7159 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7160 | def pretty_print(self, q): |
| 7161 | q.text("port_stats_reply {") |
| 7162 | with q.group(): |
| 7163 | with q.indent(2): |
| 7164 | q.breakable() |
| 7165 | q.text("xid = "); |
| 7166 | if self.xid != None: |
| 7167 | q.text("%#x" % self.xid) |
| 7168 | else: |
| 7169 | q.text('None') |
| 7170 | q.text(","); q.breakable() |
| 7171 | q.text("flags = "); |
| 7172 | q.text("%#x" % self.flags) |
| 7173 | q.text(","); q.breakable() |
| 7174 | q.text("entries = "); |
| 7175 | q.pp(self.entries) |
| 7176 | q.breakable() |
| 7177 | q.text('}') |
| 7178 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7179 | stats_reply.subtypes[4] = port_stats_reply |
| 7180 | |
| 7181 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7182 | version = 3 |
| 7183 | type = 18 |
| 7184 | stats_type = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7185 | |
| 7186 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7187 | if xid != None: |
| 7188 | self.xid = xid |
| 7189 | else: |
| 7190 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7191 | if flags != None: |
| 7192 | self.flags = flags |
| 7193 | else: |
| 7194 | self.flags = 0 |
| 7195 | if port_no != None: |
| 7196 | self.port_no = port_no |
| 7197 | else: |
| 7198 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7199 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7200 | |
| 7201 | def pack(self): |
| 7202 | packed = [] |
| 7203 | packed.append(struct.pack("!B", self.version)) |
| 7204 | packed.append(struct.pack("!B", self.type)) |
| 7205 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7206 | packed.append(struct.pack("!L", self.xid)) |
| 7207 | packed.append(struct.pack("!H", self.stats_type)) |
| 7208 | packed.append(struct.pack("!H", self.flags)) |
| 7209 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7210 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7211 | packed.append('\x00' * 4) |
| 7212 | length = sum([len(x) for x in packed]) |
| 7213 | packed[2] = struct.pack("!H", length) |
| 7214 | return ''.join(packed) |
| 7215 | |
| 7216 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7217 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7218 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7219 | _version = reader.read("!B")[0] |
| 7220 | assert(_version == 3) |
| 7221 | _type = reader.read("!B")[0] |
| 7222 | assert(_type == 18) |
| 7223 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7224 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7225 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7226 | obj.xid = reader.read("!L")[0] |
| 7227 | _stats_type = reader.read("!H")[0] |
| 7228 | assert(_stats_type == 4) |
| 7229 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7230 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7231 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7232 | reader.skip(4) |
| 7233 | return obj |
| 7234 | |
| 7235 | def __eq__(self, other): |
| 7236 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7237 | if self.xid != other.xid: return False |
| 7238 | if self.flags != other.flags: return False |
| 7239 | if self.port_no != other.port_no: return False |
| 7240 | return True |
| 7241 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7242 | def pretty_print(self, q): |
| 7243 | q.text("port_stats_request {") |
| 7244 | with q.group(): |
| 7245 | with q.indent(2): |
| 7246 | q.breakable() |
| 7247 | q.text("xid = "); |
| 7248 | if self.xid != None: |
| 7249 | q.text("%#x" % self.xid) |
| 7250 | else: |
| 7251 | q.text('None') |
| 7252 | q.text(","); q.breakable() |
| 7253 | q.text("flags = "); |
| 7254 | q.text("%#x" % self.flags) |
| 7255 | q.text(","); q.breakable() |
| 7256 | q.text("port_no = "); |
| 7257 | q.text(util.pretty_port(self.port_no)) |
| 7258 | q.breakable() |
| 7259 | q.text('}') |
| 7260 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7261 | stats_request.subtypes[4] = port_stats_request |
| 7262 | |
| 7263 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7264 | version = 3 |
| 7265 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7266 | |
| 7267 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7268 | if xid != None: |
| 7269 | self.xid = xid |
| 7270 | else: |
| 7271 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7272 | if reason != None: |
| 7273 | self.reason = reason |
| 7274 | else: |
| 7275 | self.reason = 0 |
| 7276 | if desc != None: |
| 7277 | self.desc = desc |
| 7278 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7279 | self.desc = ofp.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7280 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7281 | |
| 7282 | def pack(self): |
| 7283 | packed = [] |
| 7284 | packed.append(struct.pack("!B", self.version)) |
| 7285 | packed.append(struct.pack("!B", self.type)) |
| 7286 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7287 | packed.append(struct.pack("!L", self.xid)) |
| 7288 | packed.append(struct.pack("!B", self.reason)) |
| 7289 | packed.append('\x00' * 7) |
| 7290 | packed.append(self.desc.pack()) |
| 7291 | length = sum([len(x) for x in packed]) |
| 7292 | packed[2] = struct.pack("!H", length) |
| 7293 | return ''.join(packed) |
| 7294 | |
| 7295 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7296 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7297 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7298 | _version = reader.read("!B")[0] |
| 7299 | assert(_version == 3) |
| 7300 | _type = reader.read("!B")[0] |
| 7301 | assert(_type == 12) |
| 7302 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7303 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7304 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7305 | obj.xid = reader.read("!L")[0] |
| 7306 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7307 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7308 | obj.desc = ofp.port_desc.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7309 | return obj |
| 7310 | |
| 7311 | def __eq__(self, other): |
| 7312 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7313 | if self.xid != other.xid: return False |
| 7314 | if self.reason != other.reason: return False |
| 7315 | if self.desc != other.desc: return False |
| 7316 | return True |
| 7317 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7318 | def pretty_print(self, q): |
| 7319 | q.text("port_status {") |
| 7320 | with q.group(): |
| 7321 | with q.indent(2): |
| 7322 | q.breakable() |
| 7323 | q.text("xid = "); |
| 7324 | if self.xid != None: |
| 7325 | q.text("%#x" % self.xid) |
| 7326 | else: |
| 7327 | q.text('None') |
| 7328 | q.text(","); q.breakable() |
| 7329 | q.text("reason = "); |
| 7330 | q.text("%#x" % self.reason) |
| 7331 | q.text(","); q.breakable() |
| 7332 | q.text("desc = "); |
| 7333 | q.pp(self.desc) |
| 7334 | q.breakable() |
| 7335 | q.text('}') |
| 7336 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7337 | message.subtypes[12] = port_status |
| 7338 | |
| 7339 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7340 | version = 3 |
| 7341 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7342 | |
| 7343 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7344 | if xid != None: |
| 7345 | self.xid = xid |
| 7346 | else: |
| 7347 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7348 | if port != None: |
| 7349 | self.port = port |
| 7350 | else: |
| 7351 | self.port = 0 |
| 7352 | if queues != None: |
| 7353 | self.queues = queues |
| 7354 | else: |
| 7355 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7356 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7357 | |
| 7358 | def pack(self): |
| 7359 | packed = [] |
| 7360 | packed.append(struct.pack("!B", self.version)) |
| 7361 | packed.append(struct.pack("!B", self.type)) |
| 7362 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7363 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7364 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7365 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7366 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7367 | length = sum([len(x) for x in packed]) |
| 7368 | packed[2] = struct.pack("!H", length) |
| 7369 | return ''.join(packed) |
| 7370 | |
| 7371 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7372 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7373 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7374 | _version = reader.read("!B")[0] |
| 7375 | assert(_version == 3) |
| 7376 | _type = reader.read("!B")[0] |
| 7377 | assert(_type == 23) |
| 7378 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7379 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7380 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7381 | obj.xid = reader.read("!L")[0] |
| 7382 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7383 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7384 | obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7385 | return obj |
| 7386 | |
| 7387 | def __eq__(self, other): |
| 7388 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7389 | if self.xid != other.xid: return False |
| 7390 | if self.port != other.port: return False |
| 7391 | if self.queues != other.queues: return False |
| 7392 | return True |
| 7393 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7394 | def pretty_print(self, q): |
| 7395 | q.text("queue_get_config_reply {") |
| 7396 | with q.group(): |
| 7397 | with q.indent(2): |
| 7398 | q.breakable() |
| 7399 | q.text("xid = "); |
| 7400 | if self.xid != None: |
| 7401 | q.text("%#x" % self.xid) |
| 7402 | else: |
| 7403 | q.text('None') |
| 7404 | q.text(","); q.breakable() |
| 7405 | q.text("port = "); |
| 7406 | q.text(util.pretty_port(self.port)) |
| 7407 | q.text(","); q.breakable() |
| 7408 | q.text("queues = "); |
| 7409 | q.pp(self.queues) |
| 7410 | q.breakable() |
| 7411 | q.text('}') |
| 7412 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7413 | message.subtypes[23] = queue_get_config_reply |
| 7414 | |
| 7415 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7416 | version = 3 |
| 7417 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7418 | |
| 7419 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7420 | if xid != None: |
| 7421 | self.xid = xid |
| 7422 | else: |
| 7423 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7424 | if port != None: |
| 7425 | self.port = port |
| 7426 | else: |
| 7427 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7428 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7429 | |
| 7430 | def pack(self): |
| 7431 | packed = [] |
| 7432 | packed.append(struct.pack("!B", self.version)) |
| 7433 | packed.append(struct.pack("!B", self.type)) |
| 7434 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7435 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7436 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7437 | packed.append('\x00' * 4) |
| 7438 | length = sum([len(x) for x in packed]) |
| 7439 | packed[2] = struct.pack("!H", length) |
| 7440 | return ''.join(packed) |
| 7441 | |
| 7442 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7443 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7444 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7445 | _version = reader.read("!B")[0] |
| 7446 | assert(_version == 3) |
| 7447 | _type = reader.read("!B")[0] |
| 7448 | assert(_type == 22) |
| 7449 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7450 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7451 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7452 | obj.xid = reader.read("!L")[0] |
| 7453 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7454 | reader.skip(4) |
| 7455 | return obj |
| 7456 | |
| 7457 | def __eq__(self, other): |
| 7458 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7459 | if self.xid != other.xid: return False |
| 7460 | if self.port != other.port: return False |
| 7461 | return True |
| 7462 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7463 | def pretty_print(self, q): |
| 7464 | q.text("queue_get_config_request {") |
| 7465 | with q.group(): |
| 7466 | with q.indent(2): |
| 7467 | q.breakable() |
| 7468 | q.text("xid = "); |
| 7469 | if self.xid != None: |
| 7470 | q.text("%#x" % self.xid) |
| 7471 | else: |
| 7472 | q.text('None') |
| 7473 | q.text(","); q.breakable() |
| 7474 | q.text("port = "); |
| 7475 | q.text(util.pretty_port(self.port)) |
| 7476 | q.breakable() |
| 7477 | q.text('}') |
| 7478 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7479 | message.subtypes[22] = queue_get_config_request |
| 7480 | |
| 7481 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7482 | version = 3 |
| 7483 | type = 1 |
| 7484 | err_type = 9 |
| 7485 | |
| 7486 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7487 | if xid != None: |
| 7488 | self.xid = xid |
| 7489 | else: |
| 7490 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7491 | if code != None: |
| 7492 | self.code = code |
| 7493 | else: |
| 7494 | self.code = 0 |
| 7495 | if data != None: |
| 7496 | self.data = data |
| 7497 | else: |
| 7498 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7499 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7500 | |
| 7501 | def pack(self): |
| 7502 | packed = [] |
| 7503 | packed.append(struct.pack("!B", self.version)) |
| 7504 | packed.append(struct.pack("!B", self.type)) |
| 7505 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7506 | packed.append(struct.pack("!L", self.xid)) |
| 7507 | packed.append(struct.pack("!H", self.err_type)) |
| 7508 | packed.append(struct.pack("!H", self.code)) |
| 7509 | packed.append(self.data) |
| 7510 | length = sum([len(x) for x in packed]) |
| 7511 | packed[2] = struct.pack("!H", length) |
| 7512 | return ''.join(packed) |
| 7513 | |
| 7514 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7515 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7516 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7517 | _version = reader.read("!B")[0] |
| 7518 | assert(_version == 3) |
| 7519 | _type = reader.read("!B")[0] |
| 7520 | assert(_type == 1) |
| 7521 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7522 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7523 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7524 | obj.xid = reader.read("!L")[0] |
| 7525 | _err_type = reader.read("!H")[0] |
| 7526 | assert(_err_type == 9) |
| 7527 | obj.code = reader.read("!H")[0] |
| 7528 | obj.data = str(reader.read_all()) |
| 7529 | return obj |
| 7530 | |
| 7531 | def __eq__(self, other): |
| 7532 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7533 | if self.xid != other.xid: return False |
| 7534 | if self.code != other.code: return False |
| 7535 | if self.data != other.data: return False |
| 7536 | return True |
| 7537 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7538 | def pretty_print(self, q): |
| 7539 | q.text("queue_op_failed_error_msg {") |
| 7540 | with q.group(): |
| 7541 | with q.indent(2): |
| 7542 | q.breakable() |
| 7543 | q.text("xid = "); |
| 7544 | if self.xid != None: |
| 7545 | q.text("%#x" % self.xid) |
| 7546 | else: |
| 7547 | q.text('None') |
| 7548 | q.text(","); q.breakable() |
| 7549 | q.text("code = "); |
| 7550 | q.text("%#x" % self.code) |
| 7551 | q.text(","); q.breakable() |
| 7552 | q.text("data = "); |
| 7553 | q.pp(self.data) |
| 7554 | q.breakable() |
| 7555 | q.text('}') |
| 7556 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7557 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 7558 | |
| 7559 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7560 | version = 3 |
| 7561 | type = 19 |
| 7562 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7563 | |
| 7564 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7565 | if xid != None: |
| 7566 | self.xid = xid |
| 7567 | else: |
| 7568 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7569 | if flags != None: |
| 7570 | self.flags = flags |
| 7571 | else: |
| 7572 | self.flags = 0 |
| 7573 | if entries != None: |
| 7574 | self.entries = entries |
| 7575 | else: |
| 7576 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7577 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7578 | |
| 7579 | def pack(self): |
| 7580 | packed = [] |
| 7581 | packed.append(struct.pack("!B", self.version)) |
| 7582 | packed.append(struct.pack("!B", self.type)) |
| 7583 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7584 | packed.append(struct.pack("!L", self.xid)) |
| 7585 | packed.append(struct.pack("!H", self.stats_type)) |
| 7586 | packed.append(struct.pack("!H", self.flags)) |
| 7587 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7588 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7589 | length = sum([len(x) for x in packed]) |
| 7590 | packed[2] = struct.pack("!H", length) |
| 7591 | return ''.join(packed) |
| 7592 | |
| 7593 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7594 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7595 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7596 | _version = reader.read("!B")[0] |
| 7597 | assert(_version == 3) |
| 7598 | _type = reader.read("!B")[0] |
| 7599 | assert(_type == 19) |
| 7600 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7601 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7602 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7603 | obj.xid = reader.read("!L")[0] |
| 7604 | _stats_type = reader.read("!H")[0] |
| 7605 | assert(_stats_type == 5) |
| 7606 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7607 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7608 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7609 | return obj |
| 7610 | |
| 7611 | def __eq__(self, other): |
| 7612 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7613 | if self.xid != other.xid: return False |
| 7614 | if self.flags != other.flags: return False |
| 7615 | if self.entries != other.entries: return False |
| 7616 | return True |
| 7617 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7618 | def pretty_print(self, q): |
| 7619 | q.text("queue_stats_reply {") |
| 7620 | with q.group(): |
| 7621 | with q.indent(2): |
| 7622 | q.breakable() |
| 7623 | q.text("xid = "); |
| 7624 | if self.xid != None: |
| 7625 | q.text("%#x" % self.xid) |
| 7626 | else: |
| 7627 | q.text('None') |
| 7628 | q.text(","); q.breakable() |
| 7629 | q.text("flags = "); |
| 7630 | q.text("%#x" % self.flags) |
| 7631 | q.text(","); q.breakable() |
| 7632 | q.text("entries = "); |
| 7633 | q.pp(self.entries) |
| 7634 | q.breakable() |
| 7635 | q.text('}') |
| 7636 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7637 | stats_reply.subtypes[5] = queue_stats_reply |
| 7638 | |
| 7639 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7640 | version = 3 |
| 7641 | type = 18 |
| 7642 | stats_type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7643 | |
| 7644 | 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] | 7645 | if xid != None: |
| 7646 | self.xid = xid |
| 7647 | else: |
| 7648 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7649 | if flags != None: |
| 7650 | self.flags = flags |
| 7651 | else: |
| 7652 | self.flags = 0 |
| 7653 | if port_no != None: |
| 7654 | self.port_no = port_no |
| 7655 | else: |
| 7656 | self.port_no = 0 |
| 7657 | if queue_id != None: |
| 7658 | self.queue_id = queue_id |
| 7659 | else: |
| 7660 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7661 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7662 | |
| 7663 | def pack(self): |
| 7664 | packed = [] |
| 7665 | packed.append(struct.pack("!B", self.version)) |
| 7666 | packed.append(struct.pack("!B", self.type)) |
| 7667 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7668 | packed.append(struct.pack("!L", self.xid)) |
| 7669 | packed.append(struct.pack("!H", self.stats_type)) |
| 7670 | packed.append(struct.pack("!H", self.flags)) |
| 7671 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7672 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7673 | packed.append(struct.pack("!L", self.queue_id)) |
| 7674 | length = sum([len(x) for x in packed]) |
| 7675 | packed[2] = struct.pack("!H", length) |
| 7676 | return ''.join(packed) |
| 7677 | |
| 7678 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7679 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7680 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7681 | _version = reader.read("!B")[0] |
| 7682 | assert(_version == 3) |
| 7683 | _type = reader.read("!B")[0] |
| 7684 | assert(_type == 18) |
| 7685 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7686 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7687 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7688 | obj.xid = reader.read("!L")[0] |
| 7689 | _stats_type = reader.read("!H")[0] |
| 7690 | assert(_stats_type == 5) |
| 7691 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7692 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7693 | obj.port_no = util.unpack_port_no(reader) |
| 7694 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7695 | return obj |
| 7696 | |
| 7697 | def __eq__(self, other): |
| 7698 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7699 | if self.xid != other.xid: return False |
| 7700 | if self.flags != other.flags: return False |
| 7701 | if self.port_no != other.port_no: return False |
| 7702 | if self.queue_id != other.queue_id: return False |
| 7703 | return True |
| 7704 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7705 | def pretty_print(self, q): |
| 7706 | q.text("queue_stats_request {") |
| 7707 | with q.group(): |
| 7708 | with q.indent(2): |
| 7709 | q.breakable() |
| 7710 | q.text("xid = "); |
| 7711 | if self.xid != None: |
| 7712 | q.text("%#x" % self.xid) |
| 7713 | else: |
| 7714 | q.text('None') |
| 7715 | q.text(","); q.breakable() |
| 7716 | q.text("flags = "); |
| 7717 | q.text("%#x" % self.flags) |
| 7718 | q.text(","); q.breakable() |
| 7719 | q.text("port_no = "); |
| 7720 | q.text(util.pretty_port(self.port_no)) |
| 7721 | q.text(","); q.breakable() |
| 7722 | q.text("queue_id = "); |
| 7723 | q.text("%#x" % self.queue_id) |
| 7724 | q.breakable() |
| 7725 | q.text('}') |
| 7726 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7727 | stats_request.subtypes[5] = queue_stats_request |
| 7728 | |
| 7729 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7730 | version = 3 |
| 7731 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7732 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7733 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7734 | if xid != None: |
| 7735 | self.xid = xid |
| 7736 | else: |
| 7737 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7738 | if role != None: |
| 7739 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7740 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7741 | self.role = 0 |
| 7742 | if generation_id != None: |
| 7743 | self.generation_id = generation_id |
| 7744 | else: |
| 7745 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7746 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7747 | |
| 7748 | def pack(self): |
| 7749 | packed = [] |
| 7750 | packed.append(struct.pack("!B", self.version)) |
| 7751 | packed.append(struct.pack("!B", self.type)) |
| 7752 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7753 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7754 | packed.append(struct.pack("!L", self.role)) |
| 7755 | packed.append('\x00' * 4) |
| 7756 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7757 | length = sum([len(x) for x in packed]) |
| 7758 | packed[2] = struct.pack("!H", length) |
| 7759 | return ''.join(packed) |
| 7760 | |
| 7761 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7762 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7763 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7764 | _version = reader.read("!B")[0] |
| 7765 | assert(_version == 3) |
| 7766 | _type = reader.read("!B")[0] |
| 7767 | assert(_type == 25) |
| 7768 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7769 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7770 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7771 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7772 | obj.role = reader.read("!L")[0] |
| 7773 | reader.skip(4) |
| 7774 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7775 | return obj |
| 7776 | |
| 7777 | def __eq__(self, other): |
| 7778 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7779 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7780 | if self.role != other.role: return False |
| 7781 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7782 | return True |
| 7783 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7784 | def pretty_print(self, q): |
| 7785 | q.text("role_reply {") |
| 7786 | with q.group(): |
| 7787 | with q.indent(2): |
| 7788 | q.breakable() |
| 7789 | q.text("xid = "); |
| 7790 | if self.xid != None: |
| 7791 | q.text("%#x" % self.xid) |
| 7792 | else: |
| 7793 | q.text('None') |
| 7794 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 7795 | q.text("role = "); |
| 7796 | q.text("%#x" % self.role) |
| 7797 | q.text(","); q.breakable() |
| 7798 | q.text("generation_id = "); |
| 7799 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7800 | q.breakable() |
| 7801 | q.text('}') |
| 7802 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7803 | message.subtypes[25] = role_reply |
| 7804 | |
| 7805 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7806 | version = 3 |
| 7807 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7808 | |
| 7809 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7810 | if xid != None: |
| 7811 | self.xid = xid |
| 7812 | else: |
| 7813 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7814 | if role != None: |
| 7815 | self.role = role |
| 7816 | else: |
| 7817 | self.role = 0 |
| 7818 | if generation_id != None: |
| 7819 | self.generation_id = generation_id |
| 7820 | else: |
| 7821 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7822 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7823 | |
| 7824 | def pack(self): |
| 7825 | packed = [] |
| 7826 | packed.append(struct.pack("!B", self.version)) |
| 7827 | packed.append(struct.pack("!B", self.type)) |
| 7828 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7829 | packed.append(struct.pack("!L", self.xid)) |
| 7830 | packed.append(struct.pack("!L", self.role)) |
| 7831 | packed.append('\x00' * 4) |
| 7832 | packed.append(struct.pack("!Q", self.generation_id)) |
| 7833 | length = sum([len(x) for x in packed]) |
| 7834 | packed[2] = struct.pack("!H", length) |
| 7835 | return ''.join(packed) |
| 7836 | |
| 7837 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7838 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7839 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7840 | _version = reader.read("!B")[0] |
| 7841 | assert(_version == 3) |
| 7842 | _type = reader.read("!B")[0] |
| 7843 | assert(_type == 24) |
| 7844 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7845 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7846 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7847 | obj.xid = reader.read("!L")[0] |
| 7848 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7849 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7850 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7851 | return obj |
| 7852 | |
| 7853 | def __eq__(self, other): |
| 7854 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7855 | if self.xid != other.xid: return False |
| 7856 | if self.role != other.role: return False |
| 7857 | if self.generation_id != other.generation_id: return False |
| 7858 | return True |
| 7859 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7860 | def pretty_print(self, q): |
| 7861 | q.text("role_request {") |
| 7862 | with q.group(): |
| 7863 | with q.indent(2): |
| 7864 | q.breakable() |
| 7865 | q.text("xid = "); |
| 7866 | if self.xid != None: |
| 7867 | q.text("%#x" % self.xid) |
| 7868 | else: |
| 7869 | q.text('None') |
| 7870 | q.text(","); q.breakable() |
| 7871 | q.text("role = "); |
| 7872 | q.text("%#x" % self.role) |
| 7873 | q.text(","); q.breakable() |
| 7874 | q.text("generation_id = "); |
| 7875 | q.text("%#x" % self.generation_id) |
| 7876 | q.breakable() |
| 7877 | q.text('}') |
| 7878 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7879 | message.subtypes[24] = role_request |
| 7880 | |
| 7881 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7882 | version = 3 |
| 7883 | type = 1 |
| 7884 | err_type = 11 |
| 7885 | |
| 7886 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7887 | if xid != None: |
| 7888 | self.xid = xid |
| 7889 | else: |
| 7890 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7891 | if code != None: |
| 7892 | self.code = code |
| 7893 | else: |
| 7894 | self.code = 0 |
| 7895 | if data != None: |
| 7896 | self.data = data |
| 7897 | else: |
| 7898 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7899 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7900 | |
| 7901 | def pack(self): |
| 7902 | packed = [] |
| 7903 | packed.append(struct.pack("!B", self.version)) |
| 7904 | packed.append(struct.pack("!B", self.type)) |
| 7905 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7906 | packed.append(struct.pack("!L", self.xid)) |
| 7907 | packed.append(struct.pack("!H", self.err_type)) |
| 7908 | packed.append(struct.pack("!H", self.code)) |
| 7909 | packed.append(self.data) |
| 7910 | length = sum([len(x) for x in packed]) |
| 7911 | packed[2] = struct.pack("!H", length) |
| 7912 | return ''.join(packed) |
| 7913 | |
| 7914 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7915 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7916 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7917 | _version = reader.read("!B")[0] |
| 7918 | assert(_version == 3) |
| 7919 | _type = reader.read("!B")[0] |
| 7920 | assert(_type == 1) |
| 7921 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7922 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7923 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7924 | obj.xid = reader.read("!L")[0] |
| 7925 | _err_type = reader.read("!H")[0] |
| 7926 | assert(_err_type == 11) |
| 7927 | obj.code = reader.read("!H")[0] |
| 7928 | obj.data = str(reader.read_all()) |
| 7929 | return obj |
| 7930 | |
| 7931 | def __eq__(self, other): |
| 7932 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7933 | if self.xid != other.xid: return False |
| 7934 | if self.code != other.code: return False |
| 7935 | if self.data != other.data: return False |
| 7936 | return True |
| 7937 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7938 | def pretty_print(self, q): |
| 7939 | q.text("role_request_failed_error_msg {") |
| 7940 | with q.group(): |
| 7941 | with q.indent(2): |
| 7942 | q.breakable() |
| 7943 | q.text("xid = "); |
| 7944 | if self.xid != None: |
| 7945 | q.text("%#x" % self.xid) |
| 7946 | else: |
| 7947 | q.text('None') |
| 7948 | q.text(","); q.breakable() |
| 7949 | q.text("code = "); |
| 7950 | q.text("%#x" % self.code) |
| 7951 | q.text(","); q.breakable() |
| 7952 | q.text("data = "); |
| 7953 | q.pp(self.data) |
| 7954 | q.breakable() |
| 7955 | q.text('}') |
| 7956 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7957 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 7958 | |
| 7959 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7960 | version = 3 |
| 7961 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7962 | |
| 7963 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7964 | if xid != None: |
| 7965 | self.xid = xid |
| 7966 | else: |
| 7967 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7968 | if flags != None: |
| 7969 | self.flags = flags |
| 7970 | else: |
| 7971 | self.flags = 0 |
| 7972 | if miss_send_len != None: |
| 7973 | self.miss_send_len = miss_send_len |
| 7974 | else: |
| 7975 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7976 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7977 | |
| 7978 | def pack(self): |
| 7979 | packed = [] |
| 7980 | packed.append(struct.pack("!B", self.version)) |
| 7981 | packed.append(struct.pack("!B", self.type)) |
| 7982 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7983 | packed.append(struct.pack("!L", self.xid)) |
| 7984 | packed.append(struct.pack("!H", self.flags)) |
| 7985 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7986 | length = sum([len(x) for x in packed]) |
| 7987 | packed[2] = struct.pack("!H", length) |
| 7988 | return ''.join(packed) |
| 7989 | |
| 7990 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7991 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7992 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7993 | _version = reader.read("!B")[0] |
| 7994 | assert(_version == 3) |
| 7995 | _type = reader.read("!B")[0] |
| 7996 | assert(_type == 9) |
| 7997 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7998 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7999 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8000 | obj.xid = reader.read("!L")[0] |
| 8001 | obj.flags = reader.read("!H")[0] |
| 8002 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8003 | return obj |
| 8004 | |
| 8005 | def __eq__(self, other): |
| 8006 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8007 | if self.xid != other.xid: return False |
| 8008 | if self.flags != other.flags: return False |
| 8009 | if self.miss_send_len != other.miss_send_len: return False |
| 8010 | return True |
| 8011 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8012 | def pretty_print(self, q): |
| 8013 | q.text("set_config {") |
| 8014 | with q.group(): |
| 8015 | with q.indent(2): |
| 8016 | q.breakable() |
| 8017 | q.text("xid = "); |
| 8018 | if self.xid != None: |
| 8019 | q.text("%#x" % self.xid) |
| 8020 | else: |
| 8021 | q.text('None') |
| 8022 | q.text(","); q.breakable() |
| 8023 | q.text("flags = "); |
| 8024 | q.text("%#x" % self.flags) |
| 8025 | q.text(","); q.breakable() |
| 8026 | q.text("miss_send_len = "); |
| 8027 | q.text("%#x" % self.miss_send_len) |
| 8028 | q.breakable() |
| 8029 | q.text('}') |
| 8030 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8031 | message.subtypes[9] = set_config |
| 8032 | |
| 8033 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8034 | version = 3 |
| 8035 | type = 1 |
| 8036 | err_type = 10 |
| 8037 | |
| 8038 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8039 | if xid != None: |
| 8040 | self.xid = xid |
| 8041 | else: |
| 8042 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8043 | if code != None: |
| 8044 | self.code = code |
| 8045 | else: |
| 8046 | self.code = 0 |
| 8047 | if data != None: |
| 8048 | self.data = data |
| 8049 | else: |
| 8050 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8051 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8052 | |
| 8053 | def pack(self): |
| 8054 | packed = [] |
| 8055 | packed.append(struct.pack("!B", self.version)) |
| 8056 | packed.append(struct.pack("!B", self.type)) |
| 8057 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8058 | packed.append(struct.pack("!L", self.xid)) |
| 8059 | packed.append(struct.pack("!H", self.err_type)) |
| 8060 | packed.append(struct.pack("!H", self.code)) |
| 8061 | packed.append(self.data) |
| 8062 | length = sum([len(x) for x in packed]) |
| 8063 | packed[2] = struct.pack("!H", length) |
| 8064 | return ''.join(packed) |
| 8065 | |
| 8066 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8067 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8068 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8069 | _version = reader.read("!B")[0] |
| 8070 | assert(_version == 3) |
| 8071 | _type = reader.read("!B")[0] |
| 8072 | assert(_type == 1) |
| 8073 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8074 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8075 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8076 | obj.xid = reader.read("!L")[0] |
| 8077 | _err_type = reader.read("!H")[0] |
| 8078 | assert(_err_type == 10) |
| 8079 | obj.code = reader.read("!H")[0] |
| 8080 | obj.data = str(reader.read_all()) |
| 8081 | return obj |
| 8082 | |
| 8083 | def __eq__(self, other): |
| 8084 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8085 | if self.xid != other.xid: return False |
| 8086 | if self.code != other.code: return False |
| 8087 | if self.data != other.data: return False |
| 8088 | return True |
| 8089 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8090 | def pretty_print(self, q): |
| 8091 | q.text("switch_config_failed_error_msg {") |
| 8092 | with q.group(): |
| 8093 | with q.indent(2): |
| 8094 | q.breakable() |
| 8095 | q.text("xid = "); |
| 8096 | if self.xid != None: |
| 8097 | q.text("%#x" % self.xid) |
| 8098 | else: |
| 8099 | q.text('None') |
| 8100 | q.text(","); q.breakable() |
| 8101 | q.text("code = "); |
| 8102 | q.text("%#x" % self.code) |
| 8103 | q.text(","); q.breakable() |
| 8104 | q.text("data = "); |
| 8105 | q.pp(self.data) |
| 8106 | q.breakable() |
| 8107 | q.text('}') |
| 8108 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8109 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 8110 | |
| 8111 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8112 | version = 3 |
| 8113 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8114 | |
| 8115 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8116 | if xid != None: |
| 8117 | self.xid = xid |
| 8118 | else: |
| 8119 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8120 | if table_id != None: |
| 8121 | self.table_id = table_id |
| 8122 | else: |
| 8123 | self.table_id = 0 |
| 8124 | if config != None: |
| 8125 | self.config = config |
| 8126 | else: |
| 8127 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8128 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8129 | |
| 8130 | def pack(self): |
| 8131 | packed = [] |
| 8132 | packed.append(struct.pack("!B", self.version)) |
| 8133 | packed.append(struct.pack("!B", self.type)) |
| 8134 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8135 | packed.append(struct.pack("!L", self.xid)) |
| 8136 | packed.append(struct.pack("!B", self.table_id)) |
| 8137 | packed.append('\x00' * 3) |
| 8138 | packed.append(struct.pack("!L", self.config)) |
| 8139 | length = sum([len(x) for x in packed]) |
| 8140 | packed[2] = struct.pack("!H", length) |
| 8141 | return ''.join(packed) |
| 8142 | |
| 8143 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8144 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8145 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8146 | _version = reader.read("!B")[0] |
| 8147 | assert(_version == 3) |
| 8148 | _type = reader.read("!B")[0] |
| 8149 | assert(_type == 17) |
| 8150 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8151 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8152 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8153 | obj.xid = reader.read("!L")[0] |
| 8154 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8155 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8156 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8157 | return obj |
| 8158 | |
| 8159 | def __eq__(self, other): |
| 8160 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8161 | if self.xid != other.xid: return False |
| 8162 | if self.table_id != other.table_id: return False |
| 8163 | if self.config != other.config: return False |
| 8164 | return True |
| 8165 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8166 | def pretty_print(self, q): |
| 8167 | q.text("table_mod {") |
| 8168 | with q.group(): |
| 8169 | with q.indent(2): |
| 8170 | q.breakable() |
| 8171 | q.text("xid = "); |
| 8172 | if self.xid != None: |
| 8173 | q.text("%#x" % self.xid) |
| 8174 | else: |
| 8175 | q.text('None') |
| 8176 | q.text(","); q.breakable() |
| 8177 | q.text("table_id = "); |
| 8178 | q.text("%#x" % self.table_id) |
| 8179 | q.text(","); q.breakable() |
| 8180 | q.text("config = "); |
| 8181 | q.text("%#x" % self.config) |
| 8182 | q.breakable() |
| 8183 | q.text('}') |
| 8184 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8185 | message.subtypes[17] = table_mod |
| 8186 | |
| 8187 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8188 | version = 3 |
| 8189 | type = 1 |
| 8190 | err_type = 8 |
| 8191 | |
| 8192 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8193 | if xid != None: |
| 8194 | self.xid = xid |
| 8195 | else: |
| 8196 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8197 | if code != None: |
| 8198 | self.code = code |
| 8199 | else: |
| 8200 | self.code = 0 |
| 8201 | if data != None: |
| 8202 | self.data = data |
| 8203 | else: |
| 8204 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8205 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8206 | |
| 8207 | def pack(self): |
| 8208 | packed = [] |
| 8209 | packed.append(struct.pack("!B", self.version)) |
| 8210 | packed.append(struct.pack("!B", self.type)) |
| 8211 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8212 | packed.append(struct.pack("!L", self.xid)) |
| 8213 | packed.append(struct.pack("!H", self.err_type)) |
| 8214 | packed.append(struct.pack("!H", self.code)) |
| 8215 | packed.append(self.data) |
| 8216 | length = sum([len(x) for x in packed]) |
| 8217 | packed[2] = struct.pack("!H", length) |
| 8218 | return ''.join(packed) |
| 8219 | |
| 8220 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8221 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8222 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8223 | _version = reader.read("!B")[0] |
| 8224 | assert(_version == 3) |
| 8225 | _type = reader.read("!B")[0] |
| 8226 | assert(_type == 1) |
| 8227 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8228 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8229 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8230 | obj.xid = reader.read("!L")[0] |
| 8231 | _err_type = reader.read("!H")[0] |
| 8232 | assert(_err_type == 8) |
| 8233 | obj.code = reader.read("!H")[0] |
| 8234 | obj.data = str(reader.read_all()) |
| 8235 | return obj |
| 8236 | |
| 8237 | def __eq__(self, other): |
| 8238 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8239 | if self.xid != other.xid: return False |
| 8240 | if self.code != other.code: return False |
| 8241 | if self.data != other.data: return False |
| 8242 | return True |
| 8243 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 8244 | def pretty_print(self, q): |
| 8245 | q.text("table_mod_failed_error_msg {") |
| 8246 | with q.group(): |
| 8247 | with q.indent(2): |
| 8248 | q.breakable() |
| 8249 | q.text("xid = "); |
| 8250 | if self.xid != None: |
| 8251 | q.text("%#x" % self.xid) |
| 8252 | else: |
| 8253 | q.text('None') |
| 8254 | q.text(","); q.breakable() |
| 8255 | q.text("code = "); |
| 8256 | q.text("%#x" % self.code) |
| 8257 | q.text(","); q.breakable() |
| 8258 | q.text("data = "); |
| 8259 | q.pp(self.data) |
| 8260 | q.breakable() |
| 8261 | q.text('}') |
| 8262 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8263 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 8264 | |
| 8265 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8266 | version = 3 |
| 8267 | type = 19 |
| 8268 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8269 | |
| 8270 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8271 | if xid != None: |
| 8272 | self.xid = xid |
| 8273 | else: |
| 8274 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8275 | if flags != None: |
| 8276 | self.flags = flags |
| 8277 | else: |
| 8278 | self.flags = 0 |
| 8279 | if entries != None: |
| 8280 | self.entries = entries |
| 8281 | else: |
| 8282 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8283 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8284 | |
| 8285 | def pack(self): |
| 8286 | packed = [] |
| 8287 | packed.append(struct.pack("!B", self.version)) |
| 8288 | packed.append(struct.pack("!B", self.type)) |
| 8289 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8290 | packed.append(struct.pack("!L", self.xid)) |
| 8291 | packed.append(struct.pack("!H", self.stats_type)) |
| 8292 | packed.append(struct.pack("!H", self.flags)) |
| 8293 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8294 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8295 | length = sum([len(x) for x in packed]) |
| 8296 | packed[2] = struct.pack("!H", length) |
| 8297 | return ''.join(packed) |
| 8298 | |
| 8299 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8300 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8301 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8302 | _version = reader.read("!B")[0] |
| 8303 | assert(_version == 3) |
| 8304 | _type = reader.read("!B")[0] |
| 8305 | assert(_type == 19) |
| 8306 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8307 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8308 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8309 | obj.xid = reader.read("!L")[0] |
| 8310 | _stats_type = reader.read("!H")[0] |
| 8311 | assert(_stats_type == 3) |
| 8312 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8313 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8314 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8315 | return obj |
| 8316 | |
| 8317 | def __eq__(self, other): |
| 8318 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8319 | if self.xid != other.xid: return False |
| 8320 | if self.flags != other.flags: return False |
| 8321 | if self.entries != other.entries: return False |
| 8322 | return True |
| 8323 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8324 | def pretty_print(self, q): |
| 8325 | q.text("table_stats_reply {") |
| 8326 | with q.group(): |
| 8327 | with q.indent(2): |
| 8328 | q.breakable() |
| 8329 | q.text("xid = "); |
| 8330 | if self.xid != None: |
| 8331 | q.text("%#x" % self.xid) |
| 8332 | else: |
| 8333 | q.text('None') |
| 8334 | q.text(","); q.breakable() |
| 8335 | q.text("flags = "); |
| 8336 | q.text("%#x" % self.flags) |
| 8337 | q.text(","); q.breakable() |
| 8338 | q.text("entries = "); |
| 8339 | q.pp(self.entries) |
| 8340 | q.breakable() |
| 8341 | q.text('}') |
| 8342 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8343 | stats_reply.subtypes[3] = table_stats_reply |
| 8344 | |
| 8345 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8346 | version = 3 |
| 8347 | type = 18 |
| 8348 | stats_type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8349 | |
| 8350 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8351 | if xid != None: |
| 8352 | self.xid = xid |
| 8353 | else: |
| 8354 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8355 | if flags != None: |
| 8356 | self.flags = flags |
| 8357 | else: |
| 8358 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8359 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8360 | |
| 8361 | def pack(self): |
| 8362 | packed = [] |
| 8363 | packed.append(struct.pack("!B", self.version)) |
| 8364 | packed.append(struct.pack("!B", self.type)) |
| 8365 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8366 | packed.append(struct.pack("!L", self.xid)) |
| 8367 | packed.append(struct.pack("!H", self.stats_type)) |
| 8368 | packed.append(struct.pack("!H", self.flags)) |
| 8369 | packed.append('\x00' * 4) |
| 8370 | length = sum([len(x) for x in packed]) |
| 8371 | packed[2] = struct.pack("!H", length) |
| 8372 | return ''.join(packed) |
| 8373 | |
| 8374 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8375 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8376 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8377 | _version = reader.read("!B")[0] |
| 8378 | assert(_version == 3) |
| 8379 | _type = reader.read("!B")[0] |
| 8380 | assert(_type == 18) |
| 8381 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8382 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8383 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8384 | obj.xid = reader.read("!L")[0] |
| 8385 | _stats_type = reader.read("!H")[0] |
| 8386 | assert(_stats_type == 3) |
| 8387 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8388 | reader.skip(4) |
| 8389 | return obj |
| 8390 | |
| 8391 | def __eq__(self, other): |
| 8392 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8393 | if self.xid != other.xid: return False |
| 8394 | if self.flags != other.flags: return False |
| 8395 | return True |
| 8396 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8397 | def pretty_print(self, q): |
| 8398 | q.text("table_stats_request {") |
| 8399 | with q.group(): |
| 8400 | with q.indent(2): |
| 8401 | q.breakable() |
| 8402 | q.text("xid = "); |
| 8403 | if self.xid != None: |
| 8404 | q.text("%#x" % self.xid) |
| 8405 | else: |
| 8406 | q.text('None') |
| 8407 | q.text(","); q.breakable() |
| 8408 | q.text("flags = "); |
| 8409 | q.text("%#x" % self.flags) |
| 8410 | q.breakable() |
| 8411 | q.text('}') |
| 8412 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8413 | stats_request.subtypes[3] = table_stats_request |
| 8414 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8415 | |
| 8416 | def parse_header(buf): |
| 8417 | if len(buf) < 8: |
| 8418 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 8419 | return struct.unpack_from("!BBHL", buf) |
| 8420 | |
| 8421 | def parse_message(buf): |
| 8422 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8423 | if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO: |
| 8424 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8425 | if len(buf) != msg_len: |
| 8426 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8427 | return message.unpack(loxi.generic_util.OFReader(buf)) |