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.of13'] |
| 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 = 4 |
| 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 == 4) |
| 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 = 4 |
| 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 == 4) |
| 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 = 4 |
| 162 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 163 | stats_type = 2 |
| 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 == 4) |
| 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] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 217 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 = 4 |
| 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 == 4) |
| 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 = 4 |
| 344 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 345 | stats_type = 2 |
| 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 == 4) |
| 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] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 415 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 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 async_get_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 477 | version = 4 |
| 478 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 479 | |
| 480 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 481 | if xid != None: |
| 482 | self.xid = xid |
| 483 | else: |
| 484 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 485 | if packet_in_mask_equal_master != None: |
| 486 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 487 | else: |
| 488 | self.packet_in_mask_equal_master = 0 |
| 489 | if packet_in_mask_slave != None: |
| 490 | self.packet_in_mask_slave = packet_in_mask_slave |
| 491 | else: |
| 492 | self.packet_in_mask_slave = 0 |
| 493 | if port_status_mask_equal_master != None: |
| 494 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 495 | else: |
| 496 | self.port_status_mask_equal_master = 0 |
| 497 | if port_status_mask_slave != None: |
| 498 | self.port_status_mask_slave = port_status_mask_slave |
| 499 | else: |
| 500 | self.port_status_mask_slave = 0 |
| 501 | if flow_removed_mask_equal_master != None: |
| 502 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 503 | else: |
| 504 | self.flow_removed_mask_equal_master = 0 |
| 505 | if flow_removed_mask_slave != None: |
| 506 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 507 | else: |
| 508 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 509 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 510 | |
| 511 | def pack(self): |
| 512 | packed = [] |
| 513 | packed.append(struct.pack("!B", self.version)) |
| 514 | packed.append(struct.pack("!B", self.type)) |
| 515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 516 | packed.append(struct.pack("!L", self.xid)) |
| 517 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 518 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 519 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 520 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 521 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 522 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 523 | length = sum([len(x) for x in packed]) |
| 524 | packed[2] = struct.pack("!H", length) |
| 525 | return ''.join(packed) |
| 526 | |
| 527 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 528 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 529 | obj = async_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 530 | _version = reader.read("!B")[0] |
| 531 | assert(_version == 4) |
| 532 | _type = reader.read("!B")[0] |
| 533 | assert(_type == 27) |
| 534 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 535 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 536 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 537 | obj.xid = reader.read("!L")[0] |
| 538 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 539 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 540 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 541 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 542 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 543 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 544 | return obj |
| 545 | |
| 546 | def __eq__(self, other): |
| 547 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 548 | if self.xid != other.xid: return False |
| 549 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 550 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 551 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 552 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 553 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 554 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 555 | return True |
| 556 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 557 | def pretty_print(self, q): |
| 558 | q.text("async_get_reply {") |
| 559 | with q.group(): |
| 560 | with q.indent(2): |
| 561 | q.breakable() |
| 562 | q.text("xid = "); |
| 563 | if self.xid != None: |
| 564 | q.text("%#x" % self.xid) |
| 565 | else: |
| 566 | q.text('None') |
| 567 | q.text(","); q.breakable() |
| 568 | q.text("packet_in_mask_equal_master = "); |
| 569 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 570 | q.text(","); q.breakable() |
| 571 | q.text("packet_in_mask_slave = "); |
| 572 | q.text("%#x" % self.packet_in_mask_slave) |
| 573 | q.text(","); q.breakable() |
| 574 | q.text("port_status_mask_equal_master = "); |
| 575 | q.text("%#x" % self.port_status_mask_equal_master) |
| 576 | q.text(","); q.breakable() |
| 577 | q.text("port_status_mask_slave = "); |
| 578 | q.text("%#x" % self.port_status_mask_slave) |
| 579 | q.text(","); q.breakable() |
| 580 | q.text("flow_removed_mask_equal_master = "); |
| 581 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 582 | q.text(","); q.breakable() |
| 583 | q.text("flow_removed_mask_slave = "); |
| 584 | q.text("%#x" % self.flow_removed_mask_slave) |
| 585 | q.breakable() |
| 586 | q.text('}') |
| 587 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 588 | message.subtypes[27] = async_get_reply |
| 589 | |
| 590 | class async_get_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 591 | version = 4 |
| 592 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 593 | |
| 594 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 595 | if xid != None: |
| 596 | self.xid = xid |
| 597 | else: |
| 598 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 599 | if packet_in_mask_equal_master != None: |
| 600 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 601 | else: |
| 602 | self.packet_in_mask_equal_master = 0 |
| 603 | if packet_in_mask_slave != None: |
| 604 | self.packet_in_mask_slave = packet_in_mask_slave |
| 605 | else: |
| 606 | self.packet_in_mask_slave = 0 |
| 607 | if port_status_mask_equal_master != None: |
| 608 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 609 | else: |
| 610 | self.port_status_mask_equal_master = 0 |
| 611 | if port_status_mask_slave != None: |
| 612 | self.port_status_mask_slave = port_status_mask_slave |
| 613 | else: |
| 614 | self.port_status_mask_slave = 0 |
| 615 | if flow_removed_mask_equal_master != None: |
| 616 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 617 | else: |
| 618 | self.flow_removed_mask_equal_master = 0 |
| 619 | if flow_removed_mask_slave != None: |
| 620 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 621 | else: |
| 622 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 623 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 624 | |
| 625 | def pack(self): |
| 626 | packed = [] |
| 627 | packed.append(struct.pack("!B", self.version)) |
| 628 | packed.append(struct.pack("!B", self.type)) |
| 629 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 630 | packed.append(struct.pack("!L", self.xid)) |
| 631 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 632 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 633 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 634 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 635 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 636 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 637 | length = sum([len(x) for x in packed]) |
| 638 | packed[2] = struct.pack("!H", length) |
| 639 | return ''.join(packed) |
| 640 | |
| 641 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 642 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 643 | obj = async_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 644 | _version = reader.read("!B")[0] |
| 645 | assert(_version == 4) |
| 646 | _type = reader.read("!B")[0] |
| 647 | assert(_type == 26) |
| 648 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 650 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 651 | obj.xid = reader.read("!L")[0] |
| 652 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 653 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 654 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 655 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 656 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 657 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 658 | return obj |
| 659 | |
| 660 | def __eq__(self, other): |
| 661 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 662 | if self.xid != other.xid: return False |
| 663 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 664 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 665 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 666 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 667 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 668 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 669 | return True |
| 670 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 671 | def pretty_print(self, q): |
| 672 | q.text("async_get_request {") |
| 673 | with q.group(): |
| 674 | with q.indent(2): |
| 675 | q.breakable() |
| 676 | q.text("xid = "); |
| 677 | if self.xid != None: |
| 678 | q.text("%#x" % self.xid) |
| 679 | else: |
| 680 | q.text('None') |
| 681 | q.text(","); q.breakable() |
| 682 | q.text("packet_in_mask_equal_master = "); |
| 683 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 684 | q.text(","); q.breakable() |
| 685 | q.text("packet_in_mask_slave = "); |
| 686 | q.text("%#x" % self.packet_in_mask_slave) |
| 687 | q.text(","); q.breakable() |
| 688 | q.text("port_status_mask_equal_master = "); |
| 689 | q.text("%#x" % self.port_status_mask_equal_master) |
| 690 | q.text(","); q.breakable() |
| 691 | q.text("port_status_mask_slave = "); |
| 692 | q.text("%#x" % self.port_status_mask_slave) |
| 693 | q.text(","); q.breakable() |
| 694 | q.text("flow_removed_mask_equal_master = "); |
| 695 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 696 | q.text(","); q.breakable() |
| 697 | q.text("flow_removed_mask_slave = "); |
| 698 | q.text("%#x" % self.flow_removed_mask_slave) |
| 699 | q.breakable() |
| 700 | q.text('}') |
| 701 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 702 | message.subtypes[26] = async_get_request |
| 703 | |
| 704 | class async_set(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 705 | version = 4 |
| 706 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 707 | |
| 708 | def __init__(self, xid=None, packet_in_mask_equal_master=None, packet_in_mask_slave=None, port_status_mask_equal_master=None, port_status_mask_slave=None, flow_removed_mask_equal_master=None, flow_removed_mask_slave=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 709 | if xid != None: |
| 710 | self.xid = xid |
| 711 | else: |
| 712 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 713 | if packet_in_mask_equal_master != None: |
| 714 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 715 | else: |
| 716 | self.packet_in_mask_equal_master = 0 |
| 717 | if packet_in_mask_slave != None: |
| 718 | self.packet_in_mask_slave = packet_in_mask_slave |
| 719 | else: |
| 720 | self.packet_in_mask_slave = 0 |
| 721 | if port_status_mask_equal_master != None: |
| 722 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 723 | else: |
| 724 | self.port_status_mask_equal_master = 0 |
| 725 | if port_status_mask_slave != None: |
| 726 | self.port_status_mask_slave = port_status_mask_slave |
| 727 | else: |
| 728 | self.port_status_mask_slave = 0 |
| 729 | if flow_removed_mask_equal_master != None: |
| 730 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 731 | else: |
| 732 | self.flow_removed_mask_equal_master = 0 |
| 733 | if flow_removed_mask_slave != None: |
| 734 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 735 | else: |
| 736 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 737 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 738 | |
| 739 | def pack(self): |
| 740 | packed = [] |
| 741 | packed.append(struct.pack("!B", self.version)) |
| 742 | packed.append(struct.pack("!B", self.type)) |
| 743 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 744 | packed.append(struct.pack("!L", self.xid)) |
| 745 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 746 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 747 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 748 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 749 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 750 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 751 | length = sum([len(x) for x in packed]) |
| 752 | packed[2] = struct.pack("!H", length) |
| 753 | return ''.join(packed) |
| 754 | |
| 755 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 756 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 757 | obj = async_set() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 758 | _version = reader.read("!B")[0] |
| 759 | assert(_version == 4) |
| 760 | _type = reader.read("!B")[0] |
| 761 | assert(_type == 28) |
| 762 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 763 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 764 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 765 | obj.xid = reader.read("!L")[0] |
| 766 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 767 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 768 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 769 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 770 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 771 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 772 | return obj |
| 773 | |
| 774 | def __eq__(self, other): |
| 775 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 776 | if self.xid != other.xid: return False |
| 777 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 778 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 779 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 780 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 781 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 782 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 783 | return True |
| 784 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 785 | def pretty_print(self, q): |
| 786 | q.text("async_set {") |
| 787 | with q.group(): |
| 788 | with q.indent(2): |
| 789 | q.breakable() |
| 790 | q.text("xid = "); |
| 791 | if self.xid != None: |
| 792 | q.text("%#x" % self.xid) |
| 793 | else: |
| 794 | q.text('None') |
| 795 | q.text(","); q.breakable() |
| 796 | q.text("packet_in_mask_equal_master = "); |
| 797 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 798 | q.text(","); q.breakable() |
| 799 | q.text("packet_in_mask_slave = "); |
| 800 | q.text("%#x" % self.packet_in_mask_slave) |
| 801 | q.text(","); q.breakable() |
| 802 | q.text("port_status_mask_equal_master = "); |
| 803 | q.text("%#x" % self.port_status_mask_equal_master) |
| 804 | q.text(","); q.breakable() |
| 805 | q.text("port_status_mask_slave = "); |
| 806 | q.text("%#x" % self.port_status_mask_slave) |
| 807 | q.text(","); q.breakable() |
| 808 | q.text("flow_removed_mask_equal_master = "); |
| 809 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 810 | q.text(","); q.breakable() |
| 811 | q.text("flow_removed_mask_slave = "); |
| 812 | q.text("%#x" % self.flow_removed_mask_slave) |
| 813 | q.breakable() |
| 814 | q.text('}') |
| 815 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 816 | message.subtypes[28] = async_set |
| 817 | |
| 818 | class error_msg(message): |
| 819 | subtypes = {} |
| 820 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 821 | version = 4 |
| 822 | type = 1 |
| 823 | |
| 824 | def __init__(self, xid=None, err_type=None): |
| 825 | if xid != None: |
| 826 | self.xid = xid |
| 827 | else: |
| 828 | self.xid = None |
| 829 | if err_type != None: |
| 830 | self.err_type = err_type |
| 831 | else: |
| 832 | self.err_type = 0 |
| 833 | return |
| 834 | |
| 835 | def pack(self): |
| 836 | packed = [] |
| 837 | packed.append(struct.pack("!B", self.version)) |
| 838 | packed.append(struct.pack("!B", self.type)) |
| 839 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 840 | packed.append(struct.pack("!L", self.xid)) |
| 841 | packed.append(struct.pack("!H", self.err_type)) |
| 842 | length = sum([len(x) for x in packed]) |
| 843 | packed[2] = struct.pack("!H", length) |
| 844 | return ''.join(packed) |
| 845 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 846 | @staticmethod |
| 847 | def unpack(reader): |
| 848 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 849 | subclass = error_msg.subtypes.get(subtype) |
| 850 | if subclass: |
| 851 | return subclass.unpack(reader) |
| 852 | |
| 853 | obj = error_msg() |
| 854 | _version = reader.read("!B")[0] |
| 855 | assert(_version == 4) |
| 856 | _type = reader.read("!B")[0] |
| 857 | assert(_type == 1) |
| 858 | _length = reader.read("!H")[0] |
| 859 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 860 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 861 | obj.xid = reader.read("!L")[0] |
| 862 | obj.err_type = reader.read("!H")[0] |
| 863 | return obj |
| 864 | |
| 865 | def __eq__(self, other): |
| 866 | if type(self) != type(other): return False |
| 867 | if self.xid != other.xid: return False |
| 868 | if self.err_type != other.err_type: return False |
| 869 | return True |
| 870 | |
| 871 | def pretty_print(self, q): |
| 872 | q.text("error_msg {") |
| 873 | with q.group(): |
| 874 | with q.indent(2): |
| 875 | q.breakable() |
| 876 | q.text("xid = "); |
| 877 | if self.xid != None: |
| 878 | q.text("%#x" % self.xid) |
| 879 | else: |
| 880 | q.text('None') |
| 881 | q.breakable() |
| 882 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 883 | |
| 884 | message.subtypes[1] = error_msg |
| 885 | |
| 886 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 887 | version = 4 |
| 888 | type = 1 |
| 889 | err_type = 2 |
| 890 | |
| 891 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 892 | if xid != None: |
| 893 | self.xid = xid |
| 894 | else: |
| 895 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 896 | if code != None: |
| 897 | self.code = code |
| 898 | else: |
| 899 | self.code = 0 |
| 900 | if data != None: |
| 901 | self.data = data |
| 902 | else: |
| 903 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 904 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 905 | |
| 906 | def pack(self): |
| 907 | packed = [] |
| 908 | packed.append(struct.pack("!B", self.version)) |
| 909 | packed.append(struct.pack("!B", self.type)) |
| 910 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 911 | packed.append(struct.pack("!L", self.xid)) |
| 912 | packed.append(struct.pack("!H", self.err_type)) |
| 913 | packed.append(struct.pack("!H", self.code)) |
| 914 | packed.append(self.data) |
| 915 | length = sum([len(x) for x in packed]) |
| 916 | packed[2] = struct.pack("!H", length) |
| 917 | return ''.join(packed) |
| 918 | |
| 919 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 920 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 921 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 922 | _version = reader.read("!B")[0] |
| 923 | assert(_version == 4) |
| 924 | _type = reader.read("!B")[0] |
| 925 | assert(_type == 1) |
| 926 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 927 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 928 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 929 | obj.xid = reader.read("!L")[0] |
| 930 | _err_type = reader.read("!H")[0] |
| 931 | assert(_err_type == 2) |
| 932 | obj.code = reader.read("!H")[0] |
| 933 | obj.data = str(reader.read_all()) |
| 934 | return obj |
| 935 | |
| 936 | def __eq__(self, other): |
| 937 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 938 | if self.xid != other.xid: return False |
| 939 | if self.code != other.code: return False |
| 940 | if self.data != other.data: return False |
| 941 | return True |
| 942 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 943 | def pretty_print(self, q): |
| 944 | q.text("bad_action_error_msg {") |
| 945 | with q.group(): |
| 946 | with q.indent(2): |
| 947 | q.breakable() |
| 948 | q.text("xid = "); |
| 949 | if self.xid != None: |
| 950 | q.text("%#x" % self.xid) |
| 951 | else: |
| 952 | q.text('None') |
| 953 | q.text(","); q.breakable() |
| 954 | q.text("code = "); |
| 955 | q.text("%#x" % self.code) |
| 956 | q.text(","); q.breakable() |
| 957 | q.text("data = "); |
| 958 | q.pp(self.data) |
| 959 | q.breakable() |
| 960 | q.text('}') |
| 961 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 962 | error_msg.subtypes[2] = bad_action_error_msg |
| 963 | |
| 964 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 965 | version = 4 |
| 966 | type = 1 |
| 967 | err_type = 3 |
| 968 | |
| 969 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 970 | if xid != None: |
| 971 | self.xid = xid |
| 972 | else: |
| 973 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 974 | if code != None: |
| 975 | self.code = code |
| 976 | else: |
| 977 | self.code = 0 |
| 978 | if data != None: |
| 979 | self.data = data |
| 980 | else: |
| 981 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 982 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 983 | |
| 984 | def pack(self): |
| 985 | packed = [] |
| 986 | packed.append(struct.pack("!B", self.version)) |
| 987 | packed.append(struct.pack("!B", self.type)) |
| 988 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 989 | packed.append(struct.pack("!L", self.xid)) |
| 990 | packed.append(struct.pack("!H", self.err_type)) |
| 991 | packed.append(struct.pack("!H", self.code)) |
| 992 | packed.append(self.data) |
| 993 | length = sum([len(x) for x in packed]) |
| 994 | packed[2] = struct.pack("!H", length) |
| 995 | return ''.join(packed) |
| 996 | |
| 997 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 998 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 999 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1000 | _version = reader.read("!B")[0] |
| 1001 | assert(_version == 4) |
| 1002 | _type = reader.read("!B")[0] |
| 1003 | assert(_type == 1) |
| 1004 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1005 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1006 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1007 | obj.xid = reader.read("!L")[0] |
| 1008 | _err_type = reader.read("!H")[0] |
| 1009 | assert(_err_type == 3) |
| 1010 | obj.code = reader.read("!H")[0] |
| 1011 | obj.data = str(reader.read_all()) |
| 1012 | return obj |
| 1013 | |
| 1014 | def __eq__(self, other): |
| 1015 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1016 | if self.xid != other.xid: return False |
| 1017 | if self.code != other.code: return False |
| 1018 | if self.data != other.data: return False |
| 1019 | return True |
| 1020 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1021 | def pretty_print(self, q): |
| 1022 | q.text("bad_instruction_error_msg {") |
| 1023 | with q.group(): |
| 1024 | with q.indent(2): |
| 1025 | q.breakable() |
| 1026 | q.text("xid = "); |
| 1027 | if self.xid != None: |
| 1028 | q.text("%#x" % self.xid) |
| 1029 | else: |
| 1030 | q.text('None') |
| 1031 | q.text(","); q.breakable() |
| 1032 | q.text("code = "); |
| 1033 | q.text("%#x" % self.code) |
| 1034 | q.text(","); q.breakable() |
| 1035 | q.text("data = "); |
| 1036 | q.pp(self.data) |
| 1037 | q.breakable() |
| 1038 | q.text('}') |
| 1039 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1040 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 1041 | |
| 1042 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1043 | version = 4 |
| 1044 | type = 1 |
| 1045 | err_type = 4 |
| 1046 | |
| 1047 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1048 | if xid != None: |
| 1049 | self.xid = xid |
| 1050 | else: |
| 1051 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1052 | if code != None: |
| 1053 | self.code = code |
| 1054 | else: |
| 1055 | self.code = 0 |
| 1056 | if data != None: |
| 1057 | self.data = data |
| 1058 | else: |
| 1059 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1060 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1061 | |
| 1062 | def pack(self): |
| 1063 | packed = [] |
| 1064 | packed.append(struct.pack("!B", self.version)) |
| 1065 | packed.append(struct.pack("!B", self.type)) |
| 1066 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1067 | packed.append(struct.pack("!L", self.xid)) |
| 1068 | packed.append(struct.pack("!H", self.err_type)) |
| 1069 | packed.append(struct.pack("!H", self.code)) |
| 1070 | packed.append(self.data) |
| 1071 | length = sum([len(x) for x in packed]) |
| 1072 | packed[2] = struct.pack("!H", length) |
| 1073 | return ''.join(packed) |
| 1074 | |
| 1075 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1076 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1077 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1078 | _version = reader.read("!B")[0] |
| 1079 | assert(_version == 4) |
| 1080 | _type = reader.read("!B")[0] |
| 1081 | assert(_type == 1) |
| 1082 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1083 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1084 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1085 | obj.xid = reader.read("!L")[0] |
| 1086 | _err_type = reader.read("!H")[0] |
| 1087 | assert(_err_type == 4) |
| 1088 | obj.code = reader.read("!H")[0] |
| 1089 | obj.data = str(reader.read_all()) |
| 1090 | return obj |
| 1091 | |
| 1092 | def __eq__(self, other): |
| 1093 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1094 | if self.xid != other.xid: return False |
| 1095 | if self.code != other.code: return False |
| 1096 | if self.data != other.data: return False |
| 1097 | return True |
| 1098 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1099 | def pretty_print(self, q): |
| 1100 | q.text("bad_match_error_msg {") |
| 1101 | with q.group(): |
| 1102 | with q.indent(2): |
| 1103 | q.breakable() |
| 1104 | q.text("xid = "); |
| 1105 | if self.xid != None: |
| 1106 | q.text("%#x" % self.xid) |
| 1107 | else: |
| 1108 | q.text('None') |
| 1109 | q.text(","); q.breakable() |
| 1110 | q.text("code = "); |
| 1111 | q.text("%#x" % self.code) |
| 1112 | q.text(","); q.breakable() |
| 1113 | q.text("data = "); |
| 1114 | q.pp(self.data) |
| 1115 | q.breakable() |
| 1116 | q.text('}') |
| 1117 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1118 | error_msg.subtypes[4] = bad_match_error_msg |
| 1119 | |
| 1120 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1121 | version = 4 |
| 1122 | type = 1 |
| 1123 | err_type = 1 |
| 1124 | |
| 1125 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1126 | if xid != None: |
| 1127 | self.xid = xid |
| 1128 | else: |
| 1129 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1130 | if code != None: |
| 1131 | self.code = code |
| 1132 | else: |
| 1133 | self.code = 0 |
| 1134 | if data != None: |
| 1135 | self.data = data |
| 1136 | else: |
| 1137 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1138 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1139 | |
| 1140 | def pack(self): |
| 1141 | packed = [] |
| 1142 | packed.append(struct.pack("!B", self.version)) |
| 1143 | packed.append(struct.pack("!B", self.type)) |
| 1144 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1145 | packed.append(struct.pack("!L", self.xid)) |
| 1146 | packed.append(struct.pack("!H", self.err_type)) |
| 1147 | packed.append(struct.pack("!H", self.code)) |
| 1148 | packed.append(self.data) |
| 1149 | length = sum([len(x) for x in packed]) |
| 1150 | packed[2] = struct.pack("!H", length) |
| 1151 | return ''.join(packed) |
| 1152 | |
| 1153 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1154 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1155 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1156 | _version = reader.read("!B")[0] |
| 1157 | assert(_version == 4) |
| 1158 | _type = reader.read("!B")[0] |
| 1159 | assert(_type == 1) |
| 1160 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1161 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1162 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1163 | obj.xid = reader.read("!L")[0] |
| 1164 | _err_type = reader.read("!H")[0] |
| 1165 | assert(_err_type == 1) |
| 1166 | obj.code = reader.read("!H")[0] |
| 1167 | obj.data = str(reader.read_all()) |
| 1168 | return obj |
| 1169 | |
| 1170 | def __eq__(self, other): |
| 1171 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1172 | if self.xid != other.xid: return False |
| 1173 | if self.code != other.code: return False |
| 1174 | if self.data != other.data: return False |
| 1175 | return True |
| 1176 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1177 | def pretty_print(self, q): |
| 1178 | q.text("bad_request_error_msg {") |
| 1179 | with q.group(): |
| 1180 | with q.indent(2): |
| 1181 | q.breakable() |
| 1182 | q.text("xid = "); |
| 1183 | if self.xid != None: |
| 1184 | q.text("%#x" % self.xid) |
| 1185 | else: |
| 1186 | q.text('None') |
| 1187 | q.text(","); q.breakable() |
| 1188 | q.text("code = "); |
| 1189 | q.text("%#x" % self.code) |
| 1190 | q.text(","); q.breakable() |
| 1191 | q.text("data = "); |
| 1192 | q.pp(self.data) |
| 1193 | q.breakable() |
| 1194 | q.text('}') |
| 1195 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1196 | error_msg.subtypes[1] = bad_request_error_msg |
| 1197 | |
| 1198 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1199 | version = 4 |
| 1200 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 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 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -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 | length = sum([len(x) for x in packed]) |
| 1216 | packed[2] = struct.pack("!H", length) |
| 1217 | return ''.join(packed) |
| 1218 | |
| 1219 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1220 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1221 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1222 | _version = reader.read("!B")[0] |
| 1223 | assert(_version == 4) |
| 1224 | _type = reader.read("!B")[0] |
| 1225 | assert(_type == 21) |
| 1226 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1227 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1228 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1229 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1230 | return obj |
| 1231 | |
| 1232 | def __eq__(self, other): |
| 1233 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1234 | if self.xid != other.xid: return False |
| 1235 | return True |
| 1236 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1237 | def pretty_print(self, q): |
| 1238 | q.text("barrier_reply {") |
| 1239 | with q.group(): |
| 1240 | with q.indent(2): |
| 1241 | q.breakable() |
| 1242 | q.text("xid = "); |
| 1243 | if self.xid != None: |
| 1244 | q.text("%#x" % self.xid) |
| 1245 | else: |
| 1246 | q.text('None') |
| 1247 | q.breakable() |
| 1248 | q.text('}') |
| 1249 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1250 | message.subtypes[21] = barrier_reply |
| 1251 | |
| 1252 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1253 | version = 4 |
| 1254 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1255 | |
| 1256 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1257 | if xid != None: |
| 1258 | self.xid = xid |
| 1259 | else: |
| 1260 | self.xid = None |
| 1261 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1262 | |
| 1263 | def pack(self): |
| 1264 | packed = [] |
| 1265 | packed.append(struct.pack("!B", self.version)) |
| 1266 | packed.append(struct.pack("!B", self.type)) |
| 1267 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1268 | packed.append(struct.pack("!L", self.xid)) |
| 1269 | length = sum([len(x) for x in packed]) |
| 1270 | packed[2] = struct.pack("!H", length) |
| 1271 | return ''.join(packed) |
| 1272 | |
| 1273 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1274 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1275 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1276 | _version = reader.read("!B")[0] |
| 1277 | assert(_version == 4) |
| 1278 | _type = reader.read("!B")[0] |
| 1279 | assert(_type == 20) |
| 1280 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1281 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1282 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1283 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1284 | return obj |
| 1285 | |
| 1286 | def __eq__(self, other): |
| 1287 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1288 | if self.xid != other.xid: return False |
| 1289 | return True |
| 1290 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1291 | def pretty_print(self, q): |
| 1292 | q.text("barrier_request {") |
| 1293 | with q.group(): |
| 1294 | with q.indent(2): |
| 1295 | q.breakable() |
| 1296 | q.text("xid = "); |
| 1297 | if self.xid != None: |
| 1298 | q.text("%#x" % self.xid) |
| 1299 | else: |
| 1300 | q.text('None') |
| 1301 | q.breakable() |
| 1302 | q.text('}') |
| 1303 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1304 | message.subtypes[20] = barrier_request |
| 1305 | |
| 1306 | class experimenter(message): |
| 1307 | subtypes = {} |
| 1308 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1309 | version = 4 |
| 1310 | type = 4 |
| 1311 | |
| 1312 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 1313 | if xid != None: |
| 1314 | self.xid = xid |
| 1315 | else: |
| 1316 | self.xid = None |
| 1317 | if experimenter != None: |
| 1318 | self.experimenter = experimenter |
| 1319 | else: |
| 1320 | self.experimenter = 0 |
| 1321 | if subtype != None: |
| 1322 | self.subtype = subtype |
| 1323 | else: |
| 1324 | self.subtype = 0 |
| 1325 | if data != None: |
| 1326 | self.data = data |
| 1327 | else: |
| 1328 | self.data = '' |
| 1329 | return |
| 1330 | |
| 1331 | def pack(self): |
| 1332 | packed = [] |
| 1333 | packed.append(struct.pack("!B", self.version)) |
| 1334 | packed.append(struct.pack("!B", self.type)) |
| 1335 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1336 | packed.append(struct.pack("!L", self.xid)) |
| 1337 | packed.append(struct.pack("!L", self.experimenter)) |
| 1338 | packed.append(struct.pack("!L", self.subtype)) |
| 1339 | packed.append(self.data) |
| 1340 | length = sum([len(x) for x in packed]) |
| 1341 | packed[2] = struct.pack("!H", length) |
| 1342 | return ''.join(packed) |
| 1343 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1344 | @staticmethod |
| 1345 | def unpack(reader): |
| 1346 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1347 | subclass = experimenter.subtypes.get(subtype) |
| 1348 | if subclass: |
| 1349 | return subclass.unpack(reader) |
| 1350 | |
| 1351 | obj = experimenter() |
| 1352 | _version = reader.read("!B")[0] |
| 1353 | assert(_version == 4) |
| 1354 | _type = reader.read("!B")[0] |
| 1355 | assert(_type == 4) |
| 1356 | _length = reader.read("!H")[0] |
| 1357 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1358 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1359 | obj.xid = reader.read("!L")[0] |
| 1360 | obj.experimenter = reader.read("!L")[0] |
| 1361 | obj.subtype = reader.read("!L")[0] |
| 1362 | obj.data = str(reader.read_all()) |
| 1363 | return obj |
| 1364 | |
| 1365 | def __eq__(self, other): |
| 1366 | if type(self) != type(other): return False |
| 1367 | if self.xid != other.xid: return False |
| 1368 | if self.experimenter != other.experimenter: return False |
| 1369 | if self.subtype != other.subtype: return False |
| 1370 | if self.data != other.data: return False |
| 1371 | return True |
| 1372 | |
| 1373 | def pretty_print(self, q): |
| 1374 | q.text("experimenter {") |
| 1375 | with q.group(): |
| 1376 | with q.indent(2): |
| 1377 | q.breakable() |
| 1378 | q.text("xid = "); |
| 1379 | if self.xid != None: |
| 1380 | q.text("%#x" % self.xid) |
| 1381 | else: |
| 1382 | q.text('None') |
| 1383 | q.text(","); q.breakable() |
| 1384 | q.text("subtype = "); |
| 1385 | q.text("%#x" % self.subtype) |
| 1386 | q.text(","); q.breakable() |
| 1387 | q.text("data = "); |
| 1388 | q.pp(self.data) |
| 1389 | q.breakable() |
| 1390 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1391 | |
| 1392 | message.subtypes[4] = experimenter |
| 1393 | |
| 1394 | class bsn_header(experimenter): |
| 1395 | subtypes = {} |
| 1396 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1397 | version = 4 |
| 1398 | type = 4 |
| 1399 | experimenter = 6035143 |
| 1400 | |
| 1401 | def __init__(self, xid=None, subtype=None): |
| 1402 | if xid != None: |
| 1403 | self.xid = xid |
| 1404 | else: |
| 1405 | self.xid = None |
| 1406 | if subtype != None: |
| 1407 | self.subtype = subtype |
| 1408 | else: |
| 1409 | self.subtype = 0 |
| 1410 | return |
| 1411 | |
| 1412 | def pack(self): |
| 1413 | packed = [] |
| 1414 | packed.append(struct.pack("!B", self.version)) |
| 1415 | packed.append(struct.pack("!B", self.type)) |
| 1416 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1417 | packed.append(struct.pack("!L", self.xid)) |
| 1418 | packed.append(struct.pack("!L", self.experimenter)) |
| 1419 | packed.append(struct.pack("!L", self.subtype)) |
| 1420 | length = sum([len(x) for x in packed]) |
| 1421 | packed[2] = struct.pack("!H", length) |
| 1422 | return ''.join(packed) |
| 1423 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1424 | @staticmethod |
| 1425 | def unpack(reader): |
| 1426 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1427 | subclass = bsn_header.subtypes.get(subtype) |
| 1428 | if subclass: |
| 1429 | return subclass.unpack(reader) |
| 1430 | |
| 1431 | obj = bsn_header() |
| 1432 | _version = reader.read("!B")[0] |
| 1433 | assert(_version == 4) |
| 1434 | _type = reader.read("!B")[0] |
| 1435 | assert(_type == 4) |
| 1436 | _length = reader.read("!H")[0] |
| 1437 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1438 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1439 | obj.xid = reader.read("!L")[0] |
| 1440 | _experimenter = reader.read("!L")[0] |
| 1441 | assert(_experimenter == 6035143) |
| 1442 | obj.subtype = reader.read("!L")[0] |
| 1443 | return obj |
| 1444 | |
| 1445 | def __eq__(self, other): |
| 1446 | if type(self) != type(other): return False |
| 1447 | if self.xid != other.xid: return False |
| 1448 | if self.subtype != other.subtype: return False |
| 1449 | return True |
| 1450 | |
| 1451 | def pretty_print(self, q): |
| 1452 | q.text("bsn_header {") |
| 1453 | with q.group(): |
| 1454 | with q.indent(2): |
| 1455 | q.breakable() |
| 1456 | q.text("xid = "); |
| 1457 | if self.xid != None: |
| 1458 | q.text("%#x" % self.xid) |
| 1459 | else: |
| 1460 | q.text('None') |
| 1461 | q.breakable() |
| 1462 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1463 | |
| 1464 | experimenter.subtypes[6035143] = bsn_header |
| 1465 | |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1466 | class bsn_arp_idle(bsn_header): |
| 1467 | version = 4 |
| 1468 | type = 4 |
| 1469 | experimenter = 6035143 |
| 1470 | subtype = 60 |
| 1471 | |
| 1472 | def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None): |
| 1473 | if xid != None: |
| 1474 | self.xid = xid |
| 1475 | else: |
| 1476 | self.xid = None |
| 1477 | if vlan_vid != None: |
| 1478 | self.vlan_vid = vlan_vid |
| 1479 | else: |
| 1480 | self.vlan_vid = 0 |
| 1481 | if ipv4_addr != None: |
| 1482 | self.ipv4_addr = ipv4_addr |
| 1483 | else: |
| 1484 | self.ipv4_addr = 0 |
| 1485 | return |
| 1486 | |
| 1487 | def pack(self): |
| 1488 | packed = [] |
| 1489 | packed.append(struct.pack("!B", self.version)) |
| 1490 | packed.append(struct.pack("!B", self.type)) |
| 1491 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1492 | packed.append(struct.pack("!L", self.xid)) |
| 1493 | packed.append(struct.pack("!L", self.experimenter)) |
| 1494 | packed.append(struct.pack("!L", self.subtype)) |
| 1495 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 1496 | packed.append('\x00' * 2) |
| 1497 | packed.append(struct.pack("!L", self.ipv4_addr)) |
| 1498 | length = sum([len(x) for x in packed]) |
| 1499 | packed[2] = struct.pack("!H", length) |
| 1500 | return ''.join(packed) |
| 1501 | |
| 1502 | @staticmethod |
| 1503 | def unpack(reader): |
| 1504 | obj = bsn_arp_idle() |
| 1505 | _version = reader.read("!B")[0] |
| 1506 | assert(_version == 4) |
| 1507 | _type = reader.read("!B")[0] |
| 1508 | assert(_type == 4) |
| 1509 | _length = reader.read("!H")[0] |
| 1510 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1511 | reader = orig_reader.slice(_length, 4) |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1512 | obj.xid = reader.read("!L")[0] |
| 1513 | _experimenter = reader.read("!L")[0] |
| 1514 | assert(_experimenter == 6035143) |
| 1515 | _subtype = reader.read("!L")[0] |
| 1516 | assert(_subtype == 60) |
| 1517 | obj.vlan_vid = reader.read("!H")[0] |
| 1518 | reader.skip(2) |
| 1519 | obj.ipv4_addr = reader.read("!L")[0] |
| 1520 | return obj |
| 1521 | |
| 1522 | def __eq__(self, other): |
| 1523 | if type(self) != type(other): return False |
| 1524 | if self.xid != other.xid: return False |
| 1525 | if self.vlan_vid != other.vlan_vid: return False |
| 1526 | if self.ipv4_addr != other.ipv4_addr: return False |
| 1527 | return True |
| 1528 | |
| 1529 | def pretty_print(self, q): |
| 1530 | q.text("bsn_arp_idle {") |
| 1531 | with q.group(): |
| 1532 | with q.indent(2): |
| 1533 | q.breakable() |
| 1534 | q.text("xid = "); |
| 1535 | if self.xid != None: |
| 1536 | q.text("%#x" % self.xid) |
| 1537 | else: |
| 1538 | q.text('None') |
| 1539 | q.text(","); q.breakable() |
| 1540 | q.text("vlan_vid = "); |
| 1541 | q.text("%#x" % self.vlan_vid) |
| 1542 | q.text(","); q.breakable() |
| 1543 | q.text("ipv4_addr = "); |
| 1544 | q.text(util.pretty_ipv4(self.ipv4_addr)) |
| 1545 | q.breakable() |
| 1546 | q.text('}') |
| 1547 | |
| 1548 | bsn_header.subtypes[60] = bsn_arp_idle |
| 1549 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1550 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1551 | version = 4 |
| 1552 | type = 4 |
| 1553 | experimenter = 6035143 |
| 1554 | subtype = 22 |
| 1555 | |
| 1556 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1557 | if xid != None: |
| 1558 | self.xid = xid |
| 1559 | else: |
| 1560 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1561 | if status != None: |
| 1562 | self.status = status |
| 1563 | else: |
| 1564 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1565 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1566 | |
| 1567 | def pack(self): |
| 1568 | packed = [] |
| 1569 | packed.append(struct.pack("!B", self.version)) |
| 1570 | packed.append(struct.pack("!B", self.type)) |
| 1571 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1572 | packed.append(struct.pack("!L", self.xid)) |
| 1573 | packed.append(struct.pack("!L", self.experimenter)) |
| 1574 | packed.append(struct.pack("!L", self.subtype)) |
| 1575 | packed.append(struct.pack("!L", self.status)) |
| 1576 | length = sum([len(x) for x in packed]) |
| 1577 | packed[2] = struct.pack("!H", length) |
| 1578 | return ''.join(packed) |
| 1579 | |
| 1580 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1581 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1582 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1583 | _version = reader.read("!B")[0] |
| 1584 | assert(_version == 4) |
| 1585 | _type = reader.read("!B")[0] |
| 1586 | assert(_type == 4) |
| 1587 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1588 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1589 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1590 | obj.xid = reader.read("!L")[0] |
| 1591 | _experimenter = reader.read("!L")[0] |
| 1592 | assert(_experimenter == 6035143) |
| 1593 | _subtype = reader.read("!L")[0] |
| 1594 | assert(_subtype == 22) |
| 1595 | obj.status = reader.read("!L")[0] |
| 1596 | return obj |
| 1597 | |
| 1598 | def __eq__(self, other): |
| 1599 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1600 | if self.xid != other.xid: return False |
| 1601 | if self.status != other.status: return False |
| 1602 | return True |
| 1603 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1604 | def pretty_print(self, q): |
| 1605 | q.text("bsn_bw_clear_data_reply {") |
| 1606 | with q.group(): |
| 1607 | with q.indent(2): |
| 1608 | q.breakable() |
| 1609 | q.text("xid = "); |
| 1610 | if self.xid != None: |
| 1611 | q.text("%#x" % self.xid) |
| 1612 | else: |
| 1613 | q.text('None') |
| 1614 | q.text(","); q.breakable() |
| 1615 | q.text("status = "); |
| 1616 | q.text("%#x" % self.status) |
| 1617 | q.breakable() |
| 1618 | q.text('}') |
| 1619 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1620 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1621 | |
| 1622 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1623 | version = 4 |
| 1624 | type = 4 |
| 1625 | experimenter = 6035143 |
| 1626 | subtype = 21 |
| 1627 | |
| 1628 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1629 | if xid != None: |
| 1630 | self.xid = xid |
| 1631 | else: |
| 1632 | self.xid = None |
| 1633 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1634 | |
| 1635 | def pack(self): |
| 1636 | packed = [] |
| 1637 | packed.append(struct.pack("!B", self.version)) |
| 1638 | packed.append(struct.pack("!B", self.type)) |
| 1639 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1640 | packed.append(struct.pack("!L", self.xid)) |
| 1641 | packed.append(struct.pack("!L", self.experimenter)) |
| 1642 | packed.append(struct.pack("!L", self.subtype)) |
| 1643 | length = sum([len(x) for x in packed]) |
| 1644 | packed[2] = struct.pack("!H", length) |
| 1645 | return ''.join(packed) |
| 1646 | |
| 1647 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1648 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1649 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1650 | _version = reader.read("!B")[0] |
| 1651 | assert(_version == 4) |
| 1652 | _type = reader.read("!B")[0] |
| 1653 | assert(_type == 4) |
| 1654 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1655 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1656 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1657 | obj.xid = reader.read("!L")[0] |
| 1658 | _experimenter = reader.read("!L")[0] |
| 1659 | assert(_experimenter == 6035143) |
| 1660 | _subtype = reader.read("!L")[0] |
| 1661 | assert(_subtype == 21) |
| 1662 | return obj |
| 1663 | |
| 1664 | def __eq__(self, other): |
| 1665 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1666 | if self.xid != other.xid: return False |
| 1667 | return True |
| 1668 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1669 | def pretty_print(self, q): |
| 1670 | q.text("bsn_bw_clear_data_request {") |
| 1671 | with q.group(): |
| 1672 | with q.indent(2): |
| 1673 | q.breakable() |
| 1674 | q.text("xid = "); |
| 1675 | if self.xid != None: |
| 1676 | q.text("%#x" % self.xid) |
| 1677 | else: |
| 1678 | q.text('None') |
| 1679 | q.breakable() |
| 1680 | q.text('}') |
| 1681 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1682 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1683 | |
| 1684 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1685 | version = 4 |
| 1686 | type = 4 |
| 1687 | experimenter = 6035143 |
| 1688 | subtype = 20 |
| 1689 | |
| 1690 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1691 | if xid != None: |
| 1692 | self.xid = xid |
| 1693 | else: |
| 1694 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1695 | if enabled != None: |
| 1696 | self.enabled = enabled |
| 1697 | else: |
| 1698 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1699 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1700 | |
| 1701 | def pack(self): |
| 1702 | packed = [] |
| 1703 | packed.append(struct.pack("!B", self.version)) |
| 1704 | packed.append(struct.pack("!B", self.type)) |
| 1705 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1706 | packed.append(struct.pack("!L", self.xid)) |
| 1707 | packed.append(struct.pack("!L", self.experimenter)) |
| 1708 | packed.append(struct.pack("!L", self.subtype)) |
| 1709 | packed.append(struct.pack("!L", self.enabled)) |
| 1710 | length = sum([len(x) for x in packed]) |
| 1711 | packed[2] = struct.pack("!H", length) |
| 1712 | return ''.join(packed) |
| 1713 | |
| 1714 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1715 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1716 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1717 | _version = reader.read("!B")[0] |
| 1718 | assert(_version == 4) |
| 1719 | _type = reader.read("!B")[0] |
| 1720 | assert(_type == 4) |
| 1721 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1722 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1723 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1724 | obj.xid = reader.read("!L")[0] |
| 1725 | _experimenter = reader.read("!L")[0] |
| 1726 | assert(_experimenter == 6035143) |
| 1727 | _subtype = reader.read("!L")[0] |
| 1728 | assert(_subtype == 20) |
| 1729 | obj.enabled = reader.read("!L")[0] |
| 1730 | return obj |
| 1731 | |
| 1732 | def __eq__(self, other): |
| 1733 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1734 | if self.xid != other.xid: return False |
| 1735 | if self.enabled != other.enabled: return False |
| 1736 | return True |
| 1737 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1738 | def pretty_print(self, q): |
| 1739 | q.text("bsn_bw_enable_get_reply {") |
| 1740 | with q.group(): |
| 1741 | with q.indent(2): |
| 1742 | q.breakable() |
| 1743 | q.text("xid = "); |
| 1744 | if self.xid != None: |
| 1745 | q.text("%#x" % self.xid) |
| 1746 | else: |
| 1747 | q.text('None') |
| 1748 | q.text(","); q.breakable() |
| 1749 | q.text("enabled = "); |
| 1750 | q.text("%#x" % self.enabled) |
| 1751 | q.breakable() |
| 1752 | q.text('}') |
| 1753 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1754 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1755 | |
| 1756 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1757 | version = 4 |
| 1758 | type = 4 |
| 1759 | experimenter = 6035143 |
| 1760 | subtype = 19 |
| 1761 | |
| 1762 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1763 | if xid != None: |
| 1764 | self.xid = xid |
| 1765 | else: |
| 1766 | self.xid = None |
| 1767 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1768 | |
| 1769 | def pack(self): |
| 1770 | packed = [] |
| 1771 | packed.append(struct.pack("!B", self.version)) |
| 1772 | packed.append(struct.pack("!B", self.type)) |
| 1773 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1774 | packed.append(struct.pack("!L", self.xid)) |
| 1775 | packed.append(struct.pack("!L", self.experimenter)) |
| 1776 | packed.append(struct.pack("!L", self.subtype)) |
| 1777 | length = sum([len(x) for x in packed]) |
| 1778 | packed[2] = struct.pack("!H", length) |
| 1779 | return ''.join(packed) |
| 1780 | |
| 1781 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1782 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1783 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1784 | _version = reader.read("!B")[0] |
| 1785 | assert(_version == 4) |
| 1786 | _type = reader.read("!B")[0] |
| 1787 | assert(_type == 4) |
| 1788 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1789 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1790 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1791 | obj.xid = reader.read("!L")[0] |
| 1792 | _experimenter = reader.read("!L")[0] |
| 1793 | assert(_experimenter == 6035143) |
| 1794 | _subtype = reader.read("!L")[0] |
| 1795 | assert(_subtype == 19) |
| 1796 | return obj |
| 1797 | |
| 1798 | def __eq__(self, other): |
| 1799 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1800 | if self.xid != other.xid: return False |
| 1801 | return True |
| 1802 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1803 | def pretty_print(self, q): |
| 1804 | q.text("bsn_bw_enable_get_request {") |
| 1805 | with q.group(): |
| 1806 | with q.indent(2): |
| 1807 | q.breakable() |
| 1808 | q.text("xid = "); |
| 1809 | if self.xid != None: |
| 1810 | q.text("%#x" % self.xid) |
| 1811 | else: |
| 1812 | q.text('None') |
| 1813 | q.breakable() |
| 1814 | q.text('}') |
| 1815 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1816 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1817 | |
| 1818 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1819 | version = 4 |
| 1820 | type = 4 |
| 1821 | experimenter = 6035143 |
| 1822 | subtype = 23 |
| 1823 | |
| 1824 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1825 | if xid != None: |
| 1826 | self.xid = xid |
| 1827 | else: |
| 1828 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1829 | if enable != None: |
| 1830 | self.enable = enable |
| 1831 | else: |
| 1832 | self.enable = 0 |
| 1833 | if status != None: |
| 1834 | self.status = status |
| 1835 | else: |
| 1836 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1837 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1838 | |
| 1839 | def pack(self): |
| 1840 | packed = [] |
| 1841 | packed.append(struct.pack("!B", self.version)) |
| 1842 | packed.append(struct.pack("!B", self.type)) |
| 1843 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1844 | packed.append(struct.pack("!L", self.xid)) |
| 1845 | packed.append(struct.pack("!L", self.experimenter)) |
| 1846 | packed.append(struct.pack("!L", self.subtype)) |
| 1847 | packed.append(struct.pack("!L", self.enable)) |
| 1848 | packed.append(struct.pack("!L", self.status)) |
| 1849 | length = sum([len(x) for x in packed]) |
| 1850 | packed[2] = struct.pack("!H", length) |
| 1851 | return ''.join(packed) |
| 1852 | |
| 1853 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1854 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1855 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1856 | _version = reader.read("!B")[0] |
| 1857 | assert(_version == 4) |
| 1858 | _type = reader.read("!B")[0] |
| 1859 | assert(_type == 4) |
| 1860 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1861 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1862 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1863 | obj.xid = reader.read("!L")[0] |
| 1864 | _experimenter = reader.read("!L")[0] |
| 1865 | assert(_experimenter == 6035143) |
| 1866 | _subtype = reader.read("!L")[0] |
| 1867 | assert(_subtype == 23) |
| 1868 | obj.enable = reader.read("!L")[0] |
| 1869 | obj.status = reader.read("!L")[0] |
| 1870 | return obj |
| 1871 | |
| 1872 | def __eq__(self, other): |
| 1873 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1874 | if self.xid != other.xid: return False |
| 1875 | if self.enable != other.enable: return False |
| 1876 | if self.status != other.status: return False |
| 1877 | return True |
| 1878 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1879 | def pretty_print(self, q): |
| 1880 | q.text("bsn_bw_enable_set_reply {") |
| 1881 | with q.group(): |
| 1882 | with q.indent(2): |
| 1883 | q.breakable() |
| 1884 | q.text("xid = "); |
| 1885 | if self.xid != None: |
| 1886 | q.text("%#x" % self.xid) |
| 1887 | else: |
| 1888 | q.text('None') |
| 1889 | q.text(","); q.breakable() |
| 1890 | q.text("enable = "); |
| 1891 | q.text("%#x" % self.enable) |
| 1892 | q.text(","); q.breakable() |
| 1893 | q.text("status = "); |
| 1894 | q.text("%#x" % self.status) |
| 1895 | q.breakable() |
| 1896 | q.text('}') |
| 1897 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1898 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1899 | |
| 1900 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1901 | version = 4 |
| 1902 | type = 4 |
| 1903 | experimenter = 6035143 |
| 1904 | subtype = 18 |
| 1905 | |
| 1906 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1907 | if xid != None: |
| 1908 | self.xid = xid |
| 1909 | else: |
| 1910 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1911 | if enable != None: |
| 1912 | self.enable = enable |
| 1913 | else: |
| 1914 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1915 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1916 | |
| 1917 | def pack(self): |
| 1918 | packed = [] |
| 1919 | packed.append(struct.pack("!B", self.version)) |
| 1920 | packed.append(struct.pack("!B", self.type)) |
| 1921 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1922 | packed.append(struct.pack("!L", self.xid)) |
| 1923 | packed.append(struct.pack("!L", self.experimenter)) |
| 1924 | packed.append(struct.pack("!L", self.subtype)) |
| 1925 | packed.append(struct.pack("!L", self.enable)) |
| 1926 | length = sum([len(x) for x in packed]) |
| 1927 | packed[2] = struct.pack("!H", length) |
| 1928 | return ''.join(packed) |
| 1929 | |
| 1930 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1931 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1932 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1933 | _version = reader.read("!B")[0] |
| 1934 | assert(_version == 4) |
| 1935 | _type = reader.read("!B")[0] |
| 1936 | assert(_type == 4) |
| 1937 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1938 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1939 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1940 | obj.xid = reader.read("!L")[0] |
| 1941 | _experimenter = reader.read("!L")[0] |
| 1942 | assert(_experimenter == 6035143) |
| 1943 | _subtype = reader.read("!L")[0] |
| 1944 | assert(_subtype == 18) |
| 1945 | obj.enable = reader.read("!L")[0] |
| 1946 | return obj |
| 1947 | |
| 1948 | def __eq__(self, other): |
| 1949 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1950 | if self.xid != other.xid: return False |
| 1951 | if self.enable != other.enable: return False |
| 1952 | return True |
| 1953 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1954 | def pretty_print(self, q): |
| 1955 | q.text("bsn_bw_enable_set_request {") |
| 1956 | with q.group(): |
| 1957 | with q.indent(2): |
| 1958 | q.breakable() |
| 1959 | q.text("xid = "); |
| 1960 | if self.xid != None: |
| 1961 | q.text("%#x" % self.xid) |
| 1962 | else: |
| 1963 | q.text('None') |
| 1964 | q.text(","); q.breakable() |
| 1965 | q.text("enable = "); |
| 1966 | q.text("%#x" % self.enable) |
| 1967 | q.breakable() |
| 1968 | q.text('}') |
| 1969 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1970 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1971 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1972 | class bsn_controller_connections_reply(bsn_header): |
| 1973 | version = 4 |
| 1974 | type = 4 |
| 1975 | experimenter = 6035143 |
| 1976 | subtype = 57 |
| 1977 | |
| 1978 | def __init__(self, xid=None, connections=None): |
| 1979 | if xid != None: |
| 1980 | self.xid = xid |
| 1981 | else: |
| 1982 | self.xid = None |
| 1983 | if connections != None: |
| 1984 | self.connections = connections |
| 1985 | else: |
| 1986 | self.connections = [] |
| 1987 | return |
| 1988 | |
| 1989 | def pack(self): |
| 1990 | packed = [] |
| 1991 | packed.append(struct.pack("!B", self.version)) |
| 1992 | packed.append(struct.pack("!B", self.type)) |
| 1993 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1994 | packed.append(struct.pack("!L", self.xid)) |
| 1995 | packed.append(struct.pack("!L", self.experimenter)) |
| 1996 | packed.append(struct.pack("!L", self.subtype)) |
| 1997 | packed.append(loxi.generic_util.pack_list(self.connections)) |
| 1998 | length = sum([len(x) for x in packed]) |
| 1999 | packed[2] = struct.pack("!H", length) |
| 2000 | return ''.join(packed) |
| 2001 | |
| 2002 | @staticmethod |
| 2003 | def unpack(reader): |
| 2004 | obj = bsn_controller_connections_reply() |
| 2005 | _version = reader.read("!B")[0] |
| 2006 | assert(_version == 4) |
| 2007 | _type = reader.read("!B")[0] |
| 2008 | assert(_type == 4) |
| 2009 | _length = reader.read("!H")[0] |
| 2010 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2011 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2012 | obj.xid = reader.read("!L")[0] |
| 2013 | _experimenter = reader.read("!L")[0] |
| 2014 | assert(_experimenter == 6035143) |
| 2015 | _subtype = reader.read("!L")[0] |
| 2016 | assert(_subtype == 57) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 2017 | obj.connections = loxi.generic_util.unpack_list(reader, ofp.common.bsn_controller_connection.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2018 | return obj |
| 2019 | |
| 2020 | def __eq__(self, other): |
| 2021 | if type(self) != type(other): return False |
| 2022 | if self.xid != other.xid: return False |
| 2023 | if self.connections != other.connections: return False |
| 2024 | return True |
| 2025 | |
| 2026 | def pretty_print(self, q): |
| 2027 | q.text("bsn_controller_connections_reply {") |
| 2028 | with q.group(): |
| 2029 | with q.indent(2): |
| 2030 | q.breakable() |
| 2031 | q.text("xid = "); |
| 2032 | if self.xid != None: |
| 2033 | q.text("%#x" % self.xid) |
| 2034 | else: |
| 2035 | q.text('None') |
| 2036 | q.text(","); q.breakable() |
| 2037 | q.text("connections = "); |
| 2038 | q.pp(self.connections) |
| 2039 | q.breakable() |
| 2040 | q.text('}') |
| 2041 | |
| 2042 | bsn_header.subtypes[57] = bsn_controller_connections_reply |
| 2043 | |
| 2044 | class bsn_controller_connections_request(bsn_header): |
| 2045 | version = 4 |
| 2046 | type = 4 |
| 2047 | experimenter = 6035143 |
| 2048 | subtype = 56 |
| 2049 | |
| 2050 | def __init__(self, xid=None): |
| 2051 | if xid != None: |
| 2052 | self.xid = xid |
| 2053 | else: |
| 2054 | self.xid = None |
| 2055 | return |
| 2056 | |
| 2057 | def pack(self): |
| 2058 | packed = [] |
| 2059 | packed.append(struct.pack("!B", self.version)) |
| 2060 | packed.append(struct.pack("!B", self.type)) |
| 2061 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2062 | packed.append(struct.pack("!L", self.xid)) |
| 2063 | packed.append(struct.pack("!L", self.experimenter)) |
| 2064 | packed.append(struct.pack("!L", self.subtype)) |
| 2065 | length = sum([len(x) for x in packed]) |
| 2066 | packed[2] = struct.pack("!H", length) |
| 2067 | return ''.join(packed) |
| 2068 | |
| 2069 | @staticmethod |
| 2070 | def unpack(reader): |
| 2071 | obj = bsn_controller_connections_request() |
| 2072 | _version = reader.read("!B")[0] |
| 2073 | assert(_version == 4) |
| 2074 | _type = reader.read("!B")[0] |
| 2075 | assert(_type == 4) |
| 2076 | _length = reader.read("!H")[0] |
| 2077 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2078 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2079 | obj.xid = reader.read("!L")[0] |
| 2080 | _experimenter = reader.read("!L")[0] |
| 2081 | assert(_experimenter == 6035143) |
| 2082 | _subtype = reader.read("!L")[0] |
| 2083 | assert(_subtype == 56) |
| 2084 | return obj |
| 2085 | |
| 2086 | def __eq__(self, other): |
| 2087 | if type(self) != type(other): return False |
| 2088 | if self.xid != other.xid: return False |
| 2089 | return True |
| 2090 | |
| 2091 | def pretty_print(self, q): |
| 2092 | q.text("bsn_controller_connections_request {") |
| 2093 | with q.group(): |
| 2094 | with q.indent(2): |
| 2095 | q.breakable() |
| 2096 | q.text("xid = "); |
| 2097 | if self.xid != None: |
| 2098 | q.text("%#x" % self.xid) |
| 2099 | else: |
| 2100 | q.text('None') |
| 2101 | q.breakable() |
| 2102 | q.text('}') |
| 2103 | |
| 2104 | bsn_header.subtypes[56] = bsn_controller_connections_request |
| 2105 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2106 | class experimenter_stats_reply(stats_reply): |
| 2107 | subtypes = {} |
| 2108 | |
| 2109 | version = 4 |
| 2110 | type = 19 |
| 2111 | stats_type = 65535 |
| 2112 | |
| 2113 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2114 | if xid != None: |
| 2115 | self.xid = xid |
| 2116 | else: |
| 2117 | self.xid = None |
| 2118 | if flags != None: |
| 2119 | self.flags = flags |
| 2120 | else: |
| 2121 | self.flags = 0 |
| 2122 | if experimenter != None: |
| 2123 | self.experimenter = experimenter |
| 2124 | else: |
| 2125 | self.experimenter = 0 |
| 2126 | if subtype != None: |
| 2127 | self.subtype = subtype |
| 2128 | else: |
| 2129 | self.subtype = 0 |
| 2130 | return |
| 2131 | |
| 2132 | def pack(self): |
| 2133 | packed = [] |
| 2134 | packed.append(struct.pack("!B", self.version)) |
| 2135 | packed.append(struct.pack("!B", self.type)) |
| 2136 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2137 | packed.append(struct.pack("!L", self.xid)) |
| 2138 | packed.append(struct.pack("!H", self.stats_type)) |
| 2139 | packed.append(struct.pack("!H", self.flags)) |
| 2140 | packed.append('\x00' * 4) |
| 2141 | packed.append(struct.pack("!L", self.experimenter)) |
| 2142 | packed.append(struct.pack("!L", self.subtype)) |
| 2143 | length = sum([len(x) for x in packed]) |
| 2144 | packed[2] = struct.pack("!H", length) |
| 2145 | return ''.join(packed) |
| 2146 | |
| 2147 | @staticmethod |
| 2148 | def unpack(reader): |
| 2149 | subtype, = reader.peek('!L', 16) |
| 2150 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2151 | if subclass: |
| 2152 | return subclass.unpack(reader) |
| 2153 | |
| 2154 | obj = experimenter_stats_reply() |
| 2155 | _version = reader.read("!B")[0] |
| 2156 | assert(_version == 4) |
| 2157 | _type = reader.read("!B")[0] |
| 2158 | assert(_type == 19) |
| 2159 | _length = reader.read("!H")[0] |
| 2160 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2161 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2162 | obj.xid = reader.read("!L")[0] |
| 2163 | _stats_type = reader.read("!H")[0] |
| 2164 | assert(_stats_type == 65535) |
| 2165 | obj.flags = reader.read("!H")[0] |
| 2166 | reader.skip(4) |
| 2167 | obj.experimenter = reader.read("!L")[0] |
| 2168 | obj.subtype = reader.read("!L")[0] |
| 2169 | return obj |
| 2170 | |
| 2171 | def __eq__(self, other): |
| 2172 | if type(self) != type(other): return False |
| 2173 | if self.xid != other.xid: return False |
| 2174 | if self.flags != other.flags: return False |
| 2175 | if self.experimenter != other.experimenter: return False |
| 2176 | if self.subtype != other.subtype: return False |
| 2177 | return True |
| 2178 | |
| 2179 | def pretty_print(self, q): |
| 2180 | q.text("experimenter_stats_reply {") |
| 2181 | with q.group(): |
| 2182 | with q.indent(2): |
| 2183 | q.breakable() |
| 2184 | q.text("xid = "); |
| 2185 | if self.xid != None: |
| 2186 | q.text("%#x" % self.xid) |
| 2187 | else: |
| 2188 | q.text('None') |
| 2189 | q.text(","); q.breakable() |
| 2190 | q.text("flags = "); |
| 2191 | q.text("%#x" % self.flags) |
| 2192 | q.text(","); q.breakable() |
| 2193 | q.text("subtype = "); |
| 2194 | q.text("%#x" % self.subtype) |
| 2195 | q.breakable() |
| 2196 | q.text('}') |
| 2197 | |
| 2198 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2199 | |
| 2200 | class bsn_stats_reply(experimenter_stats_reply): |
| 2201 | subtypes = {} |
| 2202 | |
| 2203 | version = 4 |
| 2204 | type = 19 |
| 2205 | stats_type = 65535 |
| 2206 | experimenter = 6035143 |
| 2207 | |
| 2208 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2209 | if xid != None: |
| 2210 | self.xid = xid |
| 2211 | else: |
| 2212 | self.xid = None |
| 2213 | if flags != None: |
| 2214 | self.flags = flags |
| 2215 | else: |
| 2216 | self.flags = 0 |
| 2217 | if subtype != None: |
| 2218 | self.subtype = subtype |
| 2219 | else: |
| 2220 | self.subtype = 0 |
| 2221 | return |
| 2222 | |
| 2223 | def pack(self): |
| 2224 | packed = [] |
| 2225 | packed.append(struct.pack("!B", self.version)) |
| 2226 | packed.append(struct.pack("!B", self.type)) |
| 2227 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2228 | packed.append(struct.pack("!L", self.xid)) |
| 2229 | packed.append(struct.pack("!H", self.stats_type)) |
| 2230 | packed.append(struct.pack("!H", self.flags)) |
| 2231 | packed.append('\x00' * 4) |
| 2232 | packed.append(struct.pack("!L", self.experimenter)) |
| 2233 | packed.append(struct.pack("!L", self.subtype)) |
| 2234 | length = sum([len(x) for x in packed]) |
| 2235 | packed[2] = struct.pack("!H", length) |
| 2236 | return ''.join(packed) |
| 2237 | |
| 2238 | @staticmethod |
| 2239 | def unpack(reader): |
| 2240 | subtype, = reader.peek('!L', 20) |
| 2241 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2242 | if subclass: |
| 2243 | return subclass.unpack(reader) |
| 2244 | |
| 2245 | obj = bsn_stats_reply() |
| 2246 | _version = reader.read("!B")[0] |
| 2247 | assert(_version == 4) |
| 2248 | _type = reader.read("!B")[0] |
| 2249 | assert(_type == 19) |
| 2250 | _length = reader.read("!H")[0] |
| 2251 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2252 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2253 | obj.xid = reader.read("!L")[0] |
| 2254 | _stats_type = reader.read("!H")[0] |
| 2255 | assert(_stats_type == 65535) |
| 2256 | obj.flags = reader.read("!H")[0] |
| 2257 | reader.skip(4) |
| 2258 | _experimenter = reader.read("!L")[0] |
| 2259 | assert(_experimenter == 6035143) |
| 2260 | obj.subtype = reader.read("!L")[0] |
| 2261 | return obj |
| 2262 | |
| 2263 | def __eq__(self, other): |
| 2264 | if type(self) != type(other): return False |
| 2265 | if self.xid != other.xid: return False |
| 2266 | if self.flags != other.flags: return False |
| 2267 | if self.subtype != other.subtype: return False |
| 2268 | return True |
| 2269 | |
| 2270 | def pretty_print(self, q): |
| 2271 | q.text("bsn_stats_reply {") |
| 2272 | with q.group(): |
| 2273 | with q.indent(2): |
| 2274 | q.breakable() |
| 2275 | q.text("xid = "); |
| 2276 | if self.xid != None: |
| 2277 | q.text("%#x" % self.xid) |
| 2278 | else: |
| 2279 | q.text('None') |
| 2280 | q.text(","); q.breakable() |
| 2281 | q.text("flags = "); |
| 2282 | q.text("%#x" % self.flags) |
| 2283 | q.breakable() |
| 2284 | q.text('}') |
| 2285 | |
| 2286 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2287 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2288 | class bsn_debug_counter_desc_stats_reply(bsn_stats_reply): |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2289 | version = 4 |
| 2290 | type = 19 |
| 2291 | stats_type = 65535 |
| 2292 | experimenter = 6035143 |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2293 | subtype = 13 |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2294 | |
| 2295 | def __init__(self, xid=None, flags=None, entries=None): |
| 2296 | if xid != None: |
| 2297 | self.xid = xid |
| 2298 | else: |
| 2299 | self.xid = None |
| 2300 | if flags != None: |
| 2301 | self.flags = flags |
| 2302 | else: |
| 2303 | self.flags = 0 |
| 2304 | if entries != None: |
| 2305 | self.entries = entries |
| 2306 | else: |
| 2307 | self.entries = [] |
| 2308 | return |
| 2309 | |
| 2310 | def pack(self): |
| 2311 | packed = [] |
| 2312 | packed.append(struct.pack("!B", self.version)) |
| 2313 | packed.append(struct.pack("!B", self.type)) |
| 2314 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2315 | packed.append(struct.pack("!L", self.xid)) |
| 2316 | packed.append(struct.pack("!H", self.stats_type)) |
| 2317 | packed.append(struct.pack("!H", self.flags)) |
| 2318 | packed.append('\x00' * 4) |
| 2319 | packed.append(struct.pack("!L", self.experimenter)) |
| 2320 | packed.append(struct.pack("!L", self.subtype)) |
| 2321 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2322 | length = sum([len(x) for x in packed]) |
| 2323 | packed[2] = struct.pack("!H", length) |
| 2324 | return ''.join(packed) |
| 2325 | |
| 2326 | @staticmethod |
| 2327 | def unpack(reader): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2328 | obj = bsn_debug_counter_desc_stats_reply() |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2329 | _version = reader.read("!B")[0] |
| 2330 | assert(_version == 4) |
| 2331 | _type = reader.read("!B")[0] |
| 2332 | assert(_type == 19) |
| 2333 | _length = reader.read("!H")[0] |
| 2334 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2335 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2336 | obj.xid = reader.read("!L")[0] |
| 2337 | _stats_type = reader.read("!H")[0] |
| 2338 | assert(_stats_type == 65535) |
| 2339 | obj.flags = reader.read("!H")[0] |
| 2340 | reader.skip(4) |
| 2341 | _experimenter = reader.read("!L")[0] |
| 2342 | assert(_experimenter == 6035143) |
| 2343 | _subtype = reader.read("!L")[0] |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2344 | assert(_subtype == 13) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 2345 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_desc_stats_entry.unpack) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2346 | return obj |
| 2347 | |
| 2348 | def __eq__(self, other): |
| 2349 | if type(self) != type(other): return False |
| 2350 | if self.xid != other.xid: return False |
| 2351 | if self.flags != other.flags: return False |
| 2352 | if self.entries != other.entries: return False |
| 2353 | return True |
| 2354 | |
| 2355 | def pretty_print(self, q): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2356 | q.text("bsn_debug_counter_desc_stats_reply {") |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2357 | with q.group(): |
| 2358 | with q.indent(2): |
| 2359 | q.breakable() |
| 2360 | q.text("xid = "); |
| 2361 | if self.xid != None: |
| 2362 | q.text("%#x" % self.xid) |
| 2363 | else: |
| 2364 | q.text('None') |
| 2365 | q.text(","); q.breakable() |
| 2366 | q.text("flags = "); |
| 2367 | q.text("%#x" % self.flags) |
| 2368 | q.text(","); q.breakable() |
| 2369 | q.text("entries = "); |
| 2370 | q.pp(self.entries) |
| 2371 | q.breakable() |
| 2372 | q.text('}') |
| 2373 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2374 | bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2375 | |
| 2376 | class experimenter_stats_request(stats_request): |
| 2377 | subtypes = {} |
| 2378 | |
| 2379 | version = 4 |
| 2380 | type = 18 |
| 2381 | stats_type = 65535 |
| 2382 | |
| 2383 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2384 | if xid != None: |
| 2385 | self.xid = xid |
| 2386 | else: |
| 2387 | self.xid = None |
| 2388 | if flags != None: |
| 2389 | self.flags = flags |
| 2390 | else: |
| 2391 | self.flags = 0 |
| 2392 | if experimenter != None: |
| 2393 | self.experimenter = experimenter |
| 2394 | else: |
| 2395 | self.experimenter = 0 |
| 2396 | if subtype != None: |
| 2397 | self.subtype = subtype |
| 2398 | else: |
| 2399 | self.subtype = 0 |
| 2400 | return |
| 2401 | |
| 2402 | def pack(self): |
| 2403 | packed = [] |
| 2404 | packed.append(struct.pack("!B", self.version)) |
| 2405 | packed.append(struct.pack("!B", self.type)) |
| 2406 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2407 | packed.append(struct.pack("!L", self.xid)) |
| 2408 | packed.append(struct.pack("!H", self.stats_type)) |
| 2409 | packed.append(struct.pack("!H", self.flags)) |
| 2410 | packed.append('\x00' * 4) |
| 2411 | packed.append(struct.pack("!L", self.experimenter)) |
| 2412 | packed.append(struct.pack("!L", self.subtype)) |
| 2413 | length = sum([len(x) for x in packed]) |
| 2414 | packed[2] = struct.pack("!H", length) |
| 2415 | return ''.join(packed) |
| 2416 | |
| 2417 | @staticmethod |
| 2418 | def unpack(reader): |
| 2419 | subtype, = reader.peek('!L', 16) |
| 2420 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2421 | if subclass: |
| 2422 | return subclass.unpack(reader) |
| 2423 | |
| 2424 | obj = experimenter_stats_request() |
| 2425 | _version = reader.read("!B")[0] |
| 2426 | assert(_version == 4) |
| 2427 | _type = reader.read("!B")[0] |
| 2428 | assert(_type == 18) |
| 2429 | _length = reader.read("!H")[0] |
| 2430 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2431 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2432 | obj.xid = reader.read("!L")[0] |
| 2433 | _stats_type = reader.read("!H")[0] |
| 2434 | assert(_stats_type == 65535) |
| 2435 | obj.flags = reader.read("!H")[0] |
| 2436 | reader.skip(4) |
| 2437 | obj.experimenter = reader.read("!L")[0] |
| 2438 | obj.subtype = reader.read("!L")[0] |
| 2439 | return obj |
| 2440 | |
| 2441 | def __eq__(self, other): |
| 2442 | if type(self) != type(other): return False |
| 2443 | if self.xid != other.xid: return False |
| 2444 | if self.flags != other.flags: return False |
| 2445 | if self.experimenter != other.experimenter: return False |
| 2446 | if self.subtype != other.subtype: return False |
| 2447 | return True |
| 2448 | |
| 2449 | def pretty_print(self, q): |
| 2450 | q.text("experimenter_stats_request {") |
| 2451 | with q.group(): |
| 2452 | with q.indent(2): |
| 2453 | q.breakable() |
| 2454 | q.text("xid = "); |
| 2455 | if self.xid != None: |
| 2456 | q.text("%#x" % self.xid) |
| 2457 | else: |
| 2458 | q.text('None') |
| 2459 | q.text(","); q.breakable() |
| 2460 | q.text("flags = "); |
| 2461 | q.text("%#x" % self.flags) |
| 2462 | q.text(","); q.breakable() |
| 2463 | q.text("subtype = "); |
| 2464 | q.text("%#x" % self.subtype) |
| 2465 | q.breakable() |
| 2466 | q.text('}') |
| 2467 | |
| 2468 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2469 | |
| 2470 | class bsn_stats_request(experimenter_stats_request): |
| 2471 | subtypes = {} |
| 2472 | |
| 2473 | version = 4 |
| 2474 | type = 18 |
| 2475 | stats_type = 65535 |
| 2476 | experimenter = 6035143 |
| 2477 | |
| 2478 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2479 | if xid != None: |
| 2480 | self.xid = xid |
| 2481 | else: |
| 2482 | self.xid = None |
| 2483 | if flags != None: |
| 2484 | self.flags = flags |
| 2485 | else: |
| 2486 | self.flags = 0 |
| 2487 | if subtype != None: |
| 2488 | self.subtype = subtype |
| 2489 | else: |
| 2490 | self.subtype = 0 |
| 2491 | return |
| 2492 | |
| 2493 | def pack(self): |
| 2494 | packed = [] |
| 2495 | packed.append(struct.pack("!B", self.version)) |
| 2496 | packed.append(struct.pack("!B", self.type)) |
| 2497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2498 | packed.append(struct.pack("!L", self.xid)) |
| 2499 | packed.append(struct.pack("!H", self.stats_type)) |
| 2500 | packed.append(struct.pack("!H", self.flags)) |
| 2501 | packed.append('\x00' * 4) |
| 2502 | packed.append(struct.pack("!L", self.experimenter)) |
| 2503 | packed.append(struct.pack("!L", self.subtype)) |
| 2504 | length = sum([len(x) for x in packed]) |
| 2505 | packed[2] = struct.pack("!H", length) |
| 2506 | return ''.join(packed) |
| 2507 | |
| 2508 | @staticmethod |
| 2509 | def unpack(reader): |
| 2510 | subtype, = reader.peek('!L', 20) |
| 2511 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2512 | if subclass: |
| 2513 | return subclass.unpack(reader) |
| 2514 | |
| 2515 | obj = bsn_stats_request() |
| 2516 | _version = reader.read("!B")[0] |
| 2517 | assert(_version == 4) |
| 2518 | _type = reader.read("!B")[0] |
| 2519 | assert(_type == 18) |
| 2520 | _length = reader.read("!H")[0] |
| 2521 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2522 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2523 | obj.xid = reader.read("!L")[0] |
| 2524 | _stats_type = reader.read("!H")[0] |
| 2525 | assert(_stats_type == 65535) |
| 2526 | obj.flags = reader.read("!H")[0] |
| 2527 | reader.skip(4) |
| 2528 | _experimenter = reader.read("!L")[0] |
| 2529 | assert(_experimenter == 6035143) |
| 2530 | obj.subtype = reader.read("!L")[0] |
| 2531 | return obj |
| 2532 | |
| 2533 | def __eq__(self, other): |
| 2534 | if type(self) != type(other): return False |
| 2535 | if self.xid != other.xid: return False |
| 2536 | if self.flags != other.flags: return False |
| 2537 | if self.subtype != other.subtype: return False |
| 2538 | return True |
| 2539 | |
| 2540 | def pretty_print(self, q): |
| 2541 | q.text("bsn_stats_request {") |
| 2542 | with q.group(): |
| 2543 | with q.indent(2): |
| 2544 | q.breakable() |
| 2545 | q.text("xid = "); |
| 2546 | if self.xid != None: |
| 2547 | q.text("%#x" % self.xid) |
| 2548 | else: |
| 2549 | q.text('None') |
| 2550 | q.text(","); q.breakable() |
| 2551 | q.text("flags = "); |
| 2552 | q.text("%#x" % self.flags) |
| 2553 | q.breakable() |
| 2554 | q.text('}') |
| 2555 | |
| 2556 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2557 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2558 | class bsn_debug_counter_desc_stats_request(bsn_stats_request): |
| 2559 | version = 4 |
| 2560 | type = 18 |
| 2561 | stats_type = 65535 |
| 2562 | experimenter = 6035143 |
| 2563 | subtype = 13 |
| 2564 | |
| 2565 | def __init__(self, xid=None, flags=None): |
| 2566 | if xid != None: |
| 2567 | self.xid = xid |
| 2568 | else: |
| 2569 | self.xid = None |
| 2570 | if flags != None: |
| 2571 | self.flags = flags |
| 2572 | else: |
| 2573 | self.flags = 0 |
| 2574 | return |
| 2575 | |
| 2576 | def pack(self): |
| 2577 | packed = [] |
| 2578 | packed.append(struct.pack("!B", self.version)) |
| 2579 | packed.append(struct.pack("!B", self.type)) |
| 2580 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2581 | packed.append(struct.pack("!L", self.xid)) |
| 2582 | packed.append(struct.pack("!H", self.stats_type)) |
| 2583 | packed.append(struct.pack("!H", self.flags)) |
| 2584 | packed.append('\x00' * 4) |
| 2585 | packed.append(struct.pack("!L", self.experimenter)) |
| 2586 | packed.append(struct.pack("!L", self.subtype)) |
| 2587 | length = sum([len(x) for x in packed]) |
| 2588 | packed[2] = struct.pack("!H", length) |
| 2589 | return ''.join(packed) |
| 2590 | |
| 2591 | @staticmethod |
| 2592 | def unpack(reader): |
| 2593 | obj = bsn_debug_counter_desc_stats_request() |
| 2594 | _version = reader.read("!B")[0] |
| 2595 | assert(_version == 4) |
| 2596 | _type = reader.read("!B")[0] |
| 2597 | assert(_type == 18) |
| 2598 | _length = reader.read("!H")[0] |
| 2599 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2600 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2601 | obj.xid = reader.read("!L")[0] |
| 2602 | _stats_type = reader.read("!H")[0] |
| 2603 | assert(_stats_type == 65535) |
| 2604 | obj.flags = reader.read("!H")[0] |
| 2605 | reader.skip(4) |
| 2606 | _experimenter = reader.read("!L")[0] |
| 2607 | assert(_experimenter == 6035143) |
| 2608 | _subtype = reader.read("!L")[0] |
| 2609 | assert(_subtype == 13) |
| 2610 | return obj |
| 2611 | |
| 2612 | def __eq__(self, other): |
| 2613 | if type(self) != type(other): return False |
| 2614 | if self.xid != other.xid: return False |
| 2615 | if self.flags != other.flags: return False |
| 2616 | return True |
| 2617 | |
| 2618 | def pretty_print(self, q): |
| 2619 | q.text("bsn_debug_counter_desc_stats_request {") |
| 2620 | with q.group(): |
| 2621 | with q.indent(2): |
| 2622 | q.breakable() |
| 2623 | q.text("xid = "); |
| 2624 | if self.xid != None: |
| 2625 | q.text("%#x" % self.xid) |
| 2626 | else: |
| 2627 | q.text('None') |
| 2628 | q.text(","); q.breakable() |
| 2629 | q.text("flags = "); |
| 2630 | q.text("%#x" % self.flags) |
| 2631 | q.breakable() |
| 2632 | q.text('}') |
| 2633 | |
| 2634 | bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request |
| 2635 | |
| 2636 | class bsn_debug_counter_stats_reply(bsn_stats_reply): |
| 2637 | version = 4 |
| 2638 | type = 19 |
| 2639 | stats_type = 65535 |
| 2640 | experimenter = 6035143 |
| 2641 | subtype = 12 |
| 2642 | |
| 2643 | def __init__(self, xid=None, flags=None, entries=None): |
| 2644 | if xid != None: |
| 2645 | self.xid = xid |
| 2646 | else: |
| 2647 | self.xid = None |
| 2648 | if flags != None: |
| 2649 | self.flags = flags |
| 2650 | else: |
| 2651 | self.flags = 0 |
| 2652 | if entries != None: |
| 2653 | self.entries = entries |
| 2654 | else: |
| 2655 | self.entries = [] |
| 2656 | return |
| 2657 | |
| 2658 | def pack(self): |
| 2659 | packed = [] |
| 2660 | packed.append(struct.pack("!B", self.version)) |
| 2661 | packed.append(struct.pack("!B", self.type)) |
| 2662 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2663 | packed.append(struct.pack("!L", self.xid)) |
| 2664 | packed.append(struct.pack("!H", self.stats_type)) |
| 2665 | packed.append(struct.pack("!H", self.flags)) |
| 2666 | packed.append('\x00' * 4) |
| 2667 | packed.append(struct.pack("!L", self.experimenter)) |
| 2668 | packed.append(struct.pack("!L", self.subtype)) |
| 2669 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2670 | length = sum([len(x) for x in packed]) |
| 2671 | packed[2] = struct.pack("!H", length) |
| 2672 | return ''.join(packed) |
| 2673 | |
| 2674 | @staticmethod |
| 2675 | def unpack(reader): |
| 2676 | obj = bsn_debug_counter_stats_reply() |
| 2677 | _version = reader.read("!B")[0] |
| 2678 | assert(_version == 4) |
| 2679 | _type = reader.read("!B")[0] |
| 2680 | assert(_type == 19) |
| 2681 | _length = reader.read("!H")[0] |
| 2682 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2683 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2684 | obj.xid = reader.read("!L")[0] |
| 2685 | _stats_type = reader.read("!H")[0] |
| 2686 | assert(_stats_type == 65535) |
| 2687 | obj.flags = reader.read("!H")[0] |
| 2688 | reader.skip(4) |
| 2689 | _experimenter = reader.read("!L")[0] |
| 2690 | assert(_experimenter == 6035143) |
| 2691 | _subtype = reader.read("!L")[0] |
| 2692 | assert(_subtype == 12) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 2693 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_debug_counter_stats_entry.unpack) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2694 | return obj |
| 2695 | |
| 2696 | def __eq__(self, other): |
| 2697 | if type(self) != type(other): return False |
| 2698 | if self.xid != other.xid: return False |
| 2699 | if self.flags != other.flags: return False |
| 2700 | if self.entries != other.entries: return False |
| 2701 | return True |
| 2702 | |
| 2703 | def pretty_print(self, q): |
| 2704 | q.text("bsn_debug_counter_stats_reply {") |
| 2705 | with q.group(): |
| 2706 | with q.indent(2): |
| 2707 | q.breakable() |
| 2708 | q.text("xid = "); |
| 2709 | if self.xid != None: |
| 2710 | q.text("%#x" % self.xid) |
| 2711 | else: |
| 2712 | q.text('None') |
| 2713 | q.text(","); q.breakable() |
| 2714 | q.text("flags = "); |
| 2715 | q.text("%#x" % self.flags) |
| 2716 | q.text(","); q.breakable() |
| 2717 | q.text("entries = "); |
| 2718 | q.pp(self.entries) |
| 2719 | q.breakable() |
| 2720 | q.text('}') |
| 2721 | |
| 2722 | bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply |
| 2723 | |
| 2724 | class bsn_debug_counter_stats_request(bsn_stats_request): |
| 2725 | version = 4 |
| 2726 | type = 18 |
| 2727 | stats_type = 65535 |
| 2728 | experimenter = 6035143 |
| 2729 | subtype = 12 |
| 2730 | |
| 2731 | def __init__(self, xid=None, flags=None): |
| 2732 | if xid != None: |
| 2733 | self.xid = xid |
| 2734 | else: |
| 2735 | self.xid = None |
| 2736 | if flags != None: |
| 2737 | self.flags = flags |
| 2738 | else: |
| 2739 | self.flags = 0 |
| 2740 | return |
| 2741 | |
| 2742 | def pack(self): |
| 2743 | packed = [] |
| 2744 | packed.append(struct.pack("!B", self.version)) |
| 2745 | packed.append(struct.pack("!B", self.type)) |
| 2746 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2747 | packed.append(struct.pack("!L", self.xid)) |
| 2748 | packed.append(struct.pack("!H", self.stats_type)) |
| 2749 | packed.append(struct.pack("!H", self.flags)) |
| 2750 | packed.append('\x00' * 4) |
| 2751 | packed.append(struct.pack("!L", self.experimenter)) |
| 2752 | packed.append(struct.pack("!L", self.subtype)) |
| 2753 | length = sum([len(x) for x in packed]) |
| 2754 | packed[2] = struct.pack("!H", length) |
| 2755 | return ''.join(packed) |
| 2756 | |
| 2757 | @staticmethod |
| 2758 | def unpack(reader): |
| 2759 | obj = bsn_debug_counter_stats_request() |
| 2760 | _version = reader.read("!B")[0] |
| 2761 | assert(_version == 4) |
| 2762 | _type = reader.read("!B")[0] |
| 2763 | assert(_type == 18) |
| 2764 | _length = reader.read("!H")[0] |
| 2765 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2766 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2767 | obj.xid = reader.read("!L")[0] |
| 2768 | _stats_type = reader.read("!H")[0] |
| 2769 | assert(_stats_type == 65535) |
| 2770 | obj.flags = reader.read("!H")[0] |
| 2771 | reader.skip(4) |
| 2772 | _experimenter = reader.read("!L")[0] |
| 2773 | assert(_experimenter == 6035143) |
| 2774 | _subtype = reader.read("!L")[0] |
| 2775 | assert(_subtype == 12) |
| 2776 | return obj |
| 2777 | |
| 2778 | def __eq__(self, other): |
| 2779 | if type(self) != type(other): return False |
| 2780 | if self.xid != other.xid: return False |
| 2781 | if self.flags != other.flags: return False |
| 2782 | return True |
| 2783 | |
| 2784 | def pretty_print(self, q): |
| 2785 | q.text("bsn_debug_counter_stats_request {") |
| 2786 | with q.group(): |
| 2787 | with q.indent(2): |
| 2788 | q.breakable() |
| 2789 | q.text("xid = "); |
| 2790 | if self.xid != None: |
| 2791 | q.text("%#x" % self.xid) |
| 2792 | else: |
| 2793 | q.text('None') |
| 2794 | q.text(","); q.breakable() |
| 2795 | q.text("flags = "); |
| 2796 | q.text("%#x" % self.flags) |
| 2797 | q.breakable() |
| 2798 | q.text('}') |
| 2799 | |
| 2800 | bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request |
| 2801 | |
| 2802 | class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply): |
| 2803 | version = 4 |
| 2804 | type = 19 |
| 2805 | stats_type = 65535 |
| 2806 | experimenter = 6035143 |
| 2807 | subtype = 10 |
| 2808 | |
| 2809 | def __init__(self, xid=None, flags=None, entries=None): |
| 2810 | if xid != None: |
| 2811 | self.xid = xid |
| 2812 | else: |
| 2813 | self.xid = None |
| 2814 | if flags != None: |
| 2815 | self.flags = flags |
| 2816 | else: |
| 2817 | self.flags = 0 |
| 2818 | if entries != None: |
| 2819 | self.entries = entries |
| 2820 | else: |
| 2821 | self.entries = [] |
| 2822 | return |
| 2823 | |
| 2824 | def pack(self): |
| 2825 | packed = [] |
| 2826 | packed.append(struct.pack("!B", self.version)) |
| 2827 | packed.append(struct.pack("!B", self.type)) |
| 2828 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2829 | packed.append(struct.pack("!L", self.xid)) |
| 2830 | packed.append(struct.pack("!H", self.stats_type)) |
| 2831 | packed.append(struct.pack("!H", self.flags)) |
| 2832 | packed.append('\x00' * 4) |
| 2833 | packed.append(struct.pack("!L", self.experimenter)) |
| 2834 | packed.append(struct.pack("!L", self.subtype)) |
| 2835 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2836 | length = sum([len(x) for x in packed]) |
| 2837 | packed[2] = struct.pack("!H", length) |
| 2838 | return ''.join(packed) |
| 2839 | |
| 2840 | @staticmethod |
| 2841 | def unpack(reader): |
| 2842 | obj = bsn_flow_checksum_bucket_stats_reply() |
| 2843 | _version = reader.read("!B")[0] |
| 2844 | assert(_version == 4) |
| 2845 | _type = reader.read("!B")[0] |
| 2846 | assert(_type == 19) |
| 2847 | _length = reader.read("!H")[0] |
| 2848 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2849 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2850 | obj.xid = reader.read("!L")[0] |
| 2851 | _stats_type = reader.read("!H")[0] |
| 2852 | assert(_stats_type == 65535) |
| 2853 | obj.flags = reader.read("!H")[0] |
| 2854 | reader.skip(4) |
| 2855 | _experimenter = reader.read("!L")[0] |
| 2856 | assert(_experimenter == 6035143) |
| 2857 | _subtype = reader.read("!L")[0] |
| 2858 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 2859 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_flow_checksum_bucket_stats_entry.unpack) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2860 | return obj |
| 2861 | |
| 2862 | def __eq__(self, other): |
| 2863 | if type(self) != type(other): return False |
| 2864 | if self.xid != other.xid: return False |
| 2865 | if self.flags != other.flags: return False |
| 2866 | if self.entries != other.entries: return False |
| 2867 | return True |
| 2868 | |
| 2869 | def pretty_print(self, q): |
| 2870 | q.text("bsn_flow_checksum_bucket_stats_reply {") |
| 2871 | with q.group(): |
| 2872 | with q.indent(2): |
| 2873 | q.breakable() |
| 2874 | q.text("xid = "); |
| 2875 | if self.xid != None: |
| 2876 | q.text("%#x" % self.xid) |
| 2877 | else: |
| 2878 | q.text('None') |
| 2879 | q.text(","); q.breakable() |
| 2880 | q.text("flags = "); |
| 2881 | q.text("%#x" % self.flags) |
| 2882 | q.text(","); q.breakable() |
| 2883 | q.text("entries = "); |
| 2884 | q.pp(self.entries) |
| 2885 | q.breakable() |
| 2886 | q.text('}') |
| 2887 | |
| 2888 | bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply |
| 2889 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2890 | class bsn_flow_checksum_bucket_stats_request(bsn_stats_request): |
| 2891 | version = 4 |
| 2892 | type = 18 |
| 2893 | stats_type = 65535 |
| 2894 | experimenter = 6035143 |
| 2895 | subtype = 10 |
| 2896 | |
| 2897 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2898 | if xid != None: |
| 2899 | self.xid = xid |
| 2900 | else: |
| 2901 | self.xid = None |
| 2902 | if flags != None: |
| 2903 | self.flags = flags |
| 2904 | else: |
| 2905 | self.flags = 0 |
| 2906 | if table_id != None: |
| 2907 | self.table_id = table_id |
| 2908 | else: |
| 2909 | self.table_id = 0 |
| 2910 | return |
| 2911 | |
| 2912 | def pack(self): |
| 2913 | packed = [] |
| 2914 | packed.append(struct.pack("!B", self.version)) |
| 2915 | packed.append(struct.pack("!B", self.type)) |
| 2916 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2917 | packed.append(struct.pack("!L", self.xid)) |
| 2918 | packed.append(struct.pack("!H", self.stats_type)) |
| 2919 | packed.append(struct.pack("!H", self.flags)) |
| 2920 | packed.append('\x00' * 4) |
| 2921 | packed.append(struct.pack("!L", self.experimenter)) |
| 2922 | packed.append(struct.pack("!L", self.subtype)) |
| 2923 | packed.append(struct.pack("!B", self.table_id)) |
| 2924 | length = sum([len(x) for x in packed]) |
| 2925 | packed[2] = struct.pack("!H", length) |
| 2926 | return ''.join(packed) |
| 2927 | |
| 2928 | @staticmethod |
| 2929 | def unpack(reader): |
| 2930 | obj = bsn_flow_checksum_bucket_stats_request() |
| 2931 | _version = reader.read("!B")[0] |
| 2932 | assert(_version == 4) |
| 2933 | _type = reader.read("!B")[0] |
| 2934 | assert(_type == 18) |
| 2935 | _length = reader.read("!H")[0] |
| 2936 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2937 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2938 | obj.xid = reader.read("!L")[0] |
| 2939 | _stats_type = reader.read("!H")[0] |
| 2940 | assert(_stats_type == 65535) |
| 2941 | obj.flags = reader.read("!H")[0] |
| 2942 | reader.skip(4) |
| 2943 | _experimenter = reader.read("!L")[0] |
| 2944 | assert(_experimenter == 6035143) |
| 2945 | _subtype = reader.read("!L")[0] |
| 2946 | assert(_subtype == 10) |
| 2947 | obj.table_id = reader.read("!B")[0] |
| 2948 | return obj |
| 2949 | |
| 2950 | def __eq__(self, other): |
| 2951 | if type(self) != type(other): return False |
| 2952 | if self.xid != other.xid: return False |
| 2953 | if self.flags != other.flags: return False |
| 2954 | if self.table_id != other.table_id: return False |
| 2955 | return True |
| 2956 | |
| 2957 | def pretty_print(self, q): |
| 2958 | q.text("bsn_flow_checksum_bucket_stats_request {") |
| 2959 | with q.group(): |
| 2960 | with q.indent(2): |
| 2961 | q.breakable() |
| 2962 | q.text("xid = "); |
| 2963 | if self.xid != None: |
| 2964 | q.text("%#x" % self.xid) |
| 2965 | else: |
| 2966 | q.text('None') |
| 2967 | q.text(","); q.breakable() |
| 2968 | q.text("flags = "); |
| 2969 | q.text("%#x" % self.flags) |
| 2970 | q.text(","); q.breakable() |
| 2971 | q.text("table_id = "); |
| 2972 | q.text("%#x" % self.table_id) |
| 2973 | q.breakable() |
| 2974 | q.text('}') |
| 2975 | |
| 2976 | bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request |
| 2977 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2978 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2979 | version = 4 |
| 2980 | type = 4 |
| 2981 | experimenter = 6035143 |
| 2982 | subtype = 40 |
| 2983 | |
| 2984 | def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2985 | if xid != None: |
| 2986 | self.xid = xid |
| 2987 | else: |
| 2988 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2989 | if cookie != None: |
| 2990 | self.cookie = cookie |
| 2991 | else: |
| 2992 | self.cookie = 0 |
| 2993 | if priority != None: |
| 2994 | self.priority = priority |
| 2995 | else: |
| 2996 | self.priority = 0 |
| 2997 | if table_id != None: |
| 2998 | self.table_id = table_id |
| 2999 | else: |
| 3000 | self.table_id = 0 |
| 3001 | if match != None: |
| 3002 | self.match = match |
| 3003 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3004 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3005 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3006 | |
| 3007 | def pack(self): |
| 3008 | packed = [] |
| 3009 | packed.append(struct.pack("!B", self.version)) |
| 3010 | packed.append(struct.pack("!B", self.type)) |
| 3011 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3012 | packed.append(struct.pack("!L", self.xid)) |
| 3013 | packed.append(struct.pack("!L", self.experimenter)) |
| 3014 | packed.append(struct.pack("!L", self.subtype)) |
| 3015 | packed.append(struct.pack("!Q", self.cookie)) |
| 3016 | packed.append(struct.pack("!H", self.priority)) |
| 3017 | packed.append(struct.pack("!B", self.table_id)) |
| 3018 | packed.append('\x00' * 5) |
| 3019 | packed.append(self.match.pack()) |
| 3020 | length = sum([len(x) for x in packed]) |
| 3021 | packed[2] = struct.pack("!H", length) |
| 3022 | return ''.join(packed) |
| 3023 | |
| 3024 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3025 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3026 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3027 | _version = reader.read("!B")[0] |
| 3028 | assert(_version == 4) |
| 3029 | _type = reader.read("!B")[0] |
| 3030 | assert(_type == 4) |
| 3031 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3032 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3033 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3034 | obj.xid = reader.read("!L")[0] |
| 3035 | _experimenter = reader.read("!L")[0] |
| 3036 | assert(_experimenter == 6035143) |
| 3037 | _subtype = reader.read("!L")[0] |
| 3038 | assert(_subtype == 40) |
| 3039 | obj.cookie = reader.read("!Q")[0] |
| 3040 | obj.priority = reader.read("!H")[0] |
| 3041 | obj.table_id = reader.read("!B")[0] |
| 3042 | reader.skip(5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3043 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3044 | return obj |
| 3045 | |
| 3046 | def __eq__(self, other): |
| 3047 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3048 | if self.xid != other.xid: return False |
| 3049 | if self.cookie != other.cookie: return False |
| 3050 | if self.priority != other.priority: return False |
| 3051 | if self.table_id != other.table_id: return False |
| 3052 | if self.match != other.match: return False |
| 3053 | return True |
| 3054 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3055 | def pretty_print(self, q): |
| 3056 | q.text("bsn_flow_idle {") |
| 3057 | with q.group(): |
| 3058 | with q.indent(2): |
| 3059 | q.breakable() |
| 3060 | q.text("xid = "); |
| 3061 | if self.xid != None: |
| 3062 | q.text("%#x" % self.xid) |
| 3063 | else: |
| 3064 | q.text('None') |
| 3065 | q.text(","); q.breakable() |
| 3066 | q.text("cookie = "); |
| 3067 | q.text("%#x" % self.cookie) |
| 3068 | q.text(","); q.breakable() |
| 3069 | q.text("priority = "); |
| 3070 | q.text("%#x" % self.priority) |
| 3071 | q.text(","); q.breakable() |
| 3072 | q.text("table_id = "); |
| 3073 | q.text("%#x" % self.table_id) |
| 3074 | q.text(","); q.breakable() |
| 3075 | q.text("match = "); |
| 3076 | q.pp(self.match) |
| 3077 | q.breakable() |
| 3078 | q.text('}') |
| 3079 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3080 | bsn_header.subtypes[40] = bsn_flow_idle |
| 3081 | |
| 3082 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3083 | version = 4 |
| 3084 | type = 4 |
| 3085 | experimenter = 6035143 |
| 3086 | subtype = 39 |
| 3087 | |
| 3088 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3089 | if xid != None: |
| 3090 | self.xid = xid |
| 3091 | else: |
| 3092 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3093 | if enabled != None: |
| 3094 | self.enabled = enabled |
| 3095 | else: |
| 3096 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3097 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3098 | |
| 3099 | def pack(self): |
| 3100 | packed = [] |
| 3101 | packed.append(struct.pack("!B", self.version)) |
| 3102 | packed.append(struct.pack("!B", self.type)) |
| 3103 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3104 | packed.append(struct.pack("!L", self.xid)) |
| 3105 | packed.append(struct.pack("!L", self.experimenter)) |
| 3106 | packed.append(struct.pack("!L", self.subtype)) |
| 3107 | packed.append(struct.pack("!L", self.enabled)) |
| 3108 | length = sum([len(x) for x in packed]) |
| 3109 | packed[2] = struct.pack("!H", length) |
| 3110 | return ''.join(packed) |
| 3111 | |
| 3112 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3113 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3114 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3115 | _version = reader.read("!B")[0] |
| 3116 | assert(_version == 4) |
| 3117 | _type = reader.read("!B")[0] |
| 3118 | assert(_type == 4) |
| 3119 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3120 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3121 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3122 | obj.xid = reader.read("!L")[0] |
| 3123 | _experimenter = reader.read("!L")[0] |
| 3124 | assert(_experimenter == 6035143) |
| 3125 | _subtype = reader.read("!L")[0] |
| 3126 | assert(_subtype == 39) |
| 3127 | obj.enabled = reader.read("!L")[0] |
| 3128 | return obj |
| 3129 | |
| 3130 | def __eq__(self, other): |
| 3131 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3132 | if self.xid != other.xid: return False |
| 3133 | if self.enabled != other.enabled: return False |
| 3134 | return True |
| 3135 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3136 | def pretty_print(self, q): |
| 3137 | q.text("bsn_flow_idle_enable_get_reply {") |
| 3138 | with q.group(): |
| 3139 | with q.indent(2): |
| 3140 | q.breakable() |
| 3141 | q.text("xid = "); |
| 3142 | if self.xid != None: |
| 3143 | q.text("%#x" % self.xid) |
| 3144 | else: |
| 3145 | q.text('None') |
| 3146 | q.text(","); q.breakable() |
| 3147 | q.text("enabled = "); |
| 3148 | q.text("%#x" % self.enabled) |
| 3149 | q.breakable() |
| 3150 | q.text('}') |
| 3151 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3152 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 3153 | |
| 3154 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3155 | version = 4 |
| 3156 | type = 4 |
| 3157 | experimenter = 6035143 |
| 3158 | subtype = 38 |
| 3159 | |
| 3160 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3161 | if xid != None: |
| 3162 | self.xid = xid |
| 3163 | else: |
| 3164 | self.xid = None |
| 3165 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3166 | |
| 3167 | def pack(self): |
| 3168 | packed = [] |
| 3169 | packed.append(struct.pack("!B", self.version)) |
| 3170 | packed.append(struct.pack("!B", self.type)) |
| 3171 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3172 | packed.append(struct.pack("!L", self.xid)) |
| 3173 | packed.append(struct.pack("!L", self.experimenter)) |
| 3174 | packed.append(struct.pack("!L", self.subtype)) |
| 3175 | length = sum([len(x) for x in packed]) |
| 3176 | packed[2] = struct.pack("!H", length) |
| 3177 | return ''.join(packed) |
| 3178 | |
| 3179 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3180 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3181 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3182 | _version = reader.read("!B")[0] |
| 3183 | assert(_version == 4) |
| 3184 | _type = reader.read("!B")[0] |
| 3185 | assert(_type == 4) |
| 3186 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3187 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3188 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3189 | obj.xid = reader.read("!L")[0] |
| 3190 | _experimenter = reader.read("!L")[0] |
| 3191 | assert(_experimenter == 6035143) |
| 3192 | _subtype = reader.read("!L")[0] |
| 3193 | assert(_subtype == 38) |
| 3194 | return obj |
| 3195 | |
| 3196 | def __eq__(self, other): |
| 3197 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3198 | if self.xid != other.xid: return False |
| 3199 | return True |
| 3200 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3201 | def pretty_print(self, q): |
| 3202 | q.text("bsn_flow_idle_enable_get_request {") |
| 3203 | with q.group(): |
| 3204 | with q.indent(2): |
| 3205 | q.breakable() |
| 3206 | q.text("xid = "); |
| 3207 | if self.xid != None: |
| 3208 | q.text("%#x" % self.xid) |
| 3209 | else: |
| 3210 | q.text('None') |
| 3211 | q.breakable() |
| 3212 | q.text('}') |
| 3213 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3214 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 3215 | |
| 3216 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3217 | version = 4 |
| 3218 | type = 4 |
| 3219 | experimenter = 6035143 |
| 3220 | subtype = 37 |
| 3221 | |
| 3222 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3223 | if xid != None: |
| 3224 | self.xid = xid |
| 3225 | else: |
| 3226 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3227 | if enable != None: |
| 3228 | self.enable = enable |
| 3229 | else: |
| 3230 | self.enable = 0 |
| 3231 | if status != None: |
| 3232 | self.status = status |
| 3233 | else: |
| 3234 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3235 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3236 | |
| 3237 | def pack(self): |
| 3238 | packed = [] |
| 3239 | packed.append(struct.pack("!B", self.version)) |
| 3240 | packed.append(struct.pack("!B", self.type)) |
| 3241 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3242 | packed.append(struct.pack("!L", self.xid)) |
| 3243 | packed.append(struct.pack("!L", self.experimenter)) |
| 3244 | packed.append(struct.pack("!L", self.subtype)) |
| 3245 | packed.append(struct.pack("!L", self.enable)) |
| 3246 | packed.append(struct.pack("!L", self.status)) |
| 3247 | length = sum([len(x) for x in packed]) |
| 3248 | packed[2] = struct.pack("!H", length) |
| 3249 | return ''.join(packed) |
| 3250 | |
| 3251 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3252 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3253 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3254 | _version = reader.read("!B")[0] |
| 3255 | assert(_version == 4) |
| 3256 | _type = reader.read("!B")[0] |
| 3257 | assert(_type == 4) |
| 3258 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3259 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3260 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3261 | obj.xid = reader.read("!L")[0] |
| 3262 | _experimenter = reader.read("!L")[0] |
| 3263 | assert(_experimenter == 6035143) |
| 3264 | _subtype = reader.read("!L")[0] |
| 3265 | assert(_subtype == 37) |
| 3266 | obj.enable = reader.read("!L")[0] |
| 3267 | obj.status = reader.read("!L")[0] |
| 3268 | return obj |
| 3269 | |
| 3270 | def __eq__(self, other): |
| 3271 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3272 | if self.xid != other.xid: return False |
| 3273 | if self.enable != other.enable: return False |
| 3274 | if self.status != other.status: return False |
| 3275 | return True |
| 3276 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3277 | def pretty_print(self, q): |
| 3278 | q.text("bsn_flow_idle_enable_set_reply {") |
| 3279 | with q.group(): |
| 3280 | with q.indent(2): |
| 3281 | q.breakable() |
| 3282 | q.text("xid = "); |
| 3283 | if self.xid != None: |
| 3284 | q.text("%#x" % self.xid) |
| 3285 | else: |
| 3286 | q.text('None') |
| 3287 | q.text(","); q.breakable() |
| 3288 | q.text("enable = "); |
| 3289 | q.text("%#x" % self.enable) |
| 3290 | q.text(","); q.breakable() |
| 3291 | q.text("status = "); |
| 3292 | q.text("%#x" % self.status) |
| 3293 | q.breakable() |
| 3294 | q.text('}') |
| 3295 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3296 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 3297 | |
| 3298 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3299 | version = 4 |
| 3300 | type = 4 |
| 3301 | experimenter = 6035143 |
| 3302 | subtype = 36 |
| 3303 | |
| 3304 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3305 | if xid != None: |
| 3306 | self.xid = xid |
| 3307 | else: |
| 3308 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3309 | if enable != None: |
| 3310 | self.enable = enable |
| 3311 | else: |
| 3312 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3313 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3314 | |
| 3315 | def pack(self): |
| 3316 | packed = [] |
| 3317 | packed.append(struct.pack("!B", self.version)) |
| 3318 | packed.append(struct.pack("!B", self.type)) |
| 3319 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3320 | packed.append(struct.pack("!L", self.xid)) |
| 3321 | packed.append(struct.pack("!L", self.experimenter)) |
| 3322 | packed.append(struct.pack("!L", self.subtype)) |
| 3323 | packed.append(struct.pack("!L", self.enable)) |
| 3324 | length = sum([len(x) for x in packed]) |
| 3325 | packed[2] = struct.pack("!H", length) |
| 3326 | return ''.join(packed) |
| 3327 | |
| 3328 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3329 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3330 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3331 | _version = reader.read("!B")[0] |
| 3332 | assert(_version == 4) |
| 3333 | _type = reader.read("!B")[0] |
| 3334 | assert(_type == 4) |
| 3335 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3336 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3337 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3338 | obj.xid = reader.read("!L")[0] |
| 3339 | _experimenter = reader.read("!L")[0] |
| 3340 | assert(_experimenter == 6035143) |
| 3341 | _subtype = reader.read("!L")[0] |
| 3342 | assert(_subtype == 36) |
| 3343 | obj.enable = reader.read("!L")[0] |
| 3344 | return obj |
| 3345 | |
| 3346 | def __eq__(self, other): |
| 3347 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3348 | if self.xid != other.xid: return False |
| 3349 | if self.enable != other.enable: return False |
| 3350 | return True |
| 3351 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3352 | def pretty_print(self, q): |
| 3353 | q.text("bsn_flow_idle_enable_set_request {") |
| 3354 | with q.group(): |
| 3355 | with q.indent(2): |
| 3356 | q.breakable() |
| 3357 | q.text("xid = "); |
| 3358 | if self.xid != None: |
| 3359 | q.text("%#x" % self.xid) |
| 3360 | else: |
| 3361 | q.text('None') |
| 3362 | q.text(","); q.breakable() |
| 3363 | q.text("enable = "); |
| 3364 | q.text("%#x" % self.enable) |
| 3365 | q.breakable() |
| 3366 | q.text('}') |
| 3367 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3368 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 3369 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3370 | class bsn_generic_stats_reply(bsn_stats_reply): |
| 3371 | version = 4 |
| 3372 | type = 19 |
| 3373 | stats_type = 65535 |
| 3374 | experimenter = 6035143 |
| 3375 | subtype = 16 |
| 3376 | |
| 3377 | def __init__(self, xid=None, flags=None, entries=None): |
| 3378 | if xid != None: |
| 3379 | self.xid = xid |
| 3380 | else: |
| 3381 | self.xid = None |
| 3382 | if flags != None: |
| 3383 | self.flags = flags |
| 3384 | else: |
| 3385 | self.flags = 0 |
| 3386 | if entries != None: |
| 3387 | self.entries = entries |
| 3388 | else: |
| 3389 | self.entries = [] |
| 3390 | return |
| 3391 | |
| 3392 | def pack(self): |
| 3393 | packed = [] |
| 3394 | packed.append(struct.pack("!B", self.version)) |
| 3395 | packed.append(struct.pack("!B", self.type)) |
| 3396 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3397 | packed.append(struct.pack("!L", self.xid)) |
| 3398 | packed.append(struct.pack("!H", self.stats_type)) |
| 3399 | packed.append(struct.pack("!H", self.flags)) |
| 3400 | packed.append('\x00' * 4) |
| 3401 | packed.append(struct.pack("!L", self.experimenter)) |
| 3402 | packed.append(struct.pack("!L", self.subtype)) |
| 3403 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3404 | length = sum([len(x) for x in packed]) |
| 3405 | packed[2] = struct.pack("!H", length) |
| 3406 | return ''.join(packed) |
| 3407 | |
| 3408 | @staticmethod |
| 3409 | def unpack(reader): |
| 3410 | obj = bsn_generic_stats_reply() |
| 3411 | _version = reader.read("!B")[0] |
| 3412 | assert(_version == 4) |
| 3413 | _type = reader.read("!B")[0] |
| 3414 | assert(_type == 19) |
| 3415 | _length = reader.read("!H")[0] |
| 3416 | orig_reader = reader |
| 3417 | reader = orig_reader.slice(_length, 4) |
| 3418 | obj.xid = reader.read("!L")[0] |
| 3419 | _stats_type = reader.read("!H")[0] |
| 3420 | assert(_stats_type == 65535) |
| 3421 | obj.flags = reader.read("!H")[0] |
| 3422 | reader.skip(4) |
| 3423 | _experimenter = reader.read("!L")[0] |
| 3424 | assert(_experimenter == 6035143) |
| 3425 | _subtype = reader.read("!L")[0] |
| 3426 | assert(_subtype == 16) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3427 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_generic_stats_entry.unpack) |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3428 | return obj |
| 3429 | |
| 3430 | def __eq__(self, other): |
| 3431 | if type(self) != type(other): return False |
| 3432 | if self.xid != other.xid: return False |
| 3433 | if self.flags != other.flags: return False |
| 3434 | if self.entries != other.entries: return False |
| 3435 | return True |
| 3436 | |
| 3437 | def pretty_print(self, q): |
| 3438 | q.text("bsn_generic_stats_reply {") |
| 3439 | with q.group(): |
| 3440 | with q.indent(2): |
| 3441 | q.breakable() |
| 3442 | q.text("xid = "); |
| 3443 | if self.xid != None: |
| 3444 | q.text("%#x" % self.xid) |
| 3445 | else: |
| 3446 | q.text('None') |
| 3447 | q.text(","); q.breakable() |
| 3448 | q.text("flags = "); |
| 3449 | q.text("%#x" % self.flags) |
| 3450 | q.text(","); q.breakable() |
| 3451 | q.text("entries = "); |
| 3452 | q.pp(self.entries) |
| 3453 | q.breakable() |
| 3454 | q.text('}') |
| 3455 | |
| 3456 | bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply |
| 3457 | |
| 3458 | class bsn_generic_stats_request(bsn_stats_request): |
| 3459 | version = 4 |
| 3460 | type = 18 |
| 3461 | stats_type = 65535 |
| 3462 | experimenter = 6035143 |
| 3463 | subtype = 16 |
| 3464 | |
| 3465 | def __init__(self, xid=None, flags=None, name=None, tlvs=None): |
| 3466 | if xid != None: |
| 3467 | self.xid = xid |
| 3468 | else: |
| 3469 | self.xid = None |
| 3470 | if flags != None: |
| 3471 | self.flags = flags |
| 3472 | else: |
| 3473 | self.flags = 0 |
| 3474 | if name != None: |
| 3475 | self.name = name |
| 3476 | else: |
| 3477 | self.name = "" |
| 3478 | if tlvs != None: |
| 3479 | self.tlvs = tlvs |
| 3480 | else: |
| 3481 | self.tlvs = [] |
| 3482 | return |
| 3483 | |
| 3484 | def pack(self): |
| 3485 | packed = [] |
| 3486 | packed.append(struct.pack("!B", self.version)) |
| 3487 | packed.append(struct.pack("!B", self.type)) |
| 3488 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3489 | packed.append(struct.pack("!L", self.xid)) |
| 3490 | packed.append(struct.pack("!H", self.stats_type)) |
| 3491 | packed.append(struct.pack("!H", self.flags)) |
| 3492 | packed.append('\x00' * 4) |
| 3493 | packed.append(struct.pack("!L", self.experimenter)) |
| 3494 | packed.append(struct.pack("!L", self.subtype)) |
| 3495 | packed.append(struct.pack("!64s", self.name)) |
| 3496 | packed.append(loxi.generic_util.pack_list(self.tlvs)) |
| 3497 | length = sum([len(x) for x in packed]) |
| 3498 | packed[2] = struct.pack("!H", length) |
| 3499 | return ''.join(packed) |
| 3500 | |
| 3501 | @staticmethod |
| 3502 | def unpack(reader): |
| 3503 | obj = bsn_generic_stats_request() |
| 3504 | _version = reader.read("!B")[0] |
| 3505 | assert(_version == 4) |
| 3506 | _type = reader.read("!B")[0] |
| 3507 | assert(_type == 18) |
| 3508 | _length = reader.read("!H")[0] |
| 3509 | orig_reader = reader |
| 3510 | reader = orig_reader.slice(_length, 4) |
| 3511 | obj.xid = reader.read("!L")[0] |
| 3512 | _stats_type = reader.read("!H")[0] |
| 3513 | assert(_stats_type == 65535) |
| 3514 | obj.flags = reader.read("!H")[0] |
| 3515 | reader.skip(4) |
| 3516 | _experimenter = reader.read("!L")[0] |
| 3517 | assert(_experimenter == 6035143) |
| 3518 | _subtype = reader.read("!L")[0] |
| 3519 | assert(_subtype == 16) |
| 3520 | obj.name = reader.read("!64s")[0].rstrip("\x00") |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3521 | obj.tlvs = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3522 | return obj |
| 3523 | |
| 3524 | def __eq__(self, other): |
| 3525 | if type(self) != type(other): return False |
| 3526 | if self.xid != other.xid: return False |
| 3527 | if self.flags != other.flags: return False |
| 3528 | if self.name != other.name: return False |
| 3529 | if self.tlvs != other.tlvs: return False |
| 3530 | return True |
| 3531 | |
| 3532 | def pretty_print(self, q): |
| 3533 | q.text("bsn_generic_stats_request {") |
| 3534 | with q.group(): |
| 3535 | with q.indent(2): |
| 3536 | q.breakable() |
| 3537 | q.text("xid = "); |
| 3538 | if self.xid != None: |
| 3539 | q.text("%#x" % self.xid) |
| 3540 | else: |
| 3541 | q.text('None') |
| 3542 | q.text(","); q.breakable() |
| 3543 | q.text("flags = "); |
| 3544 | q.text("%#x" % self.flags) |
| 3545 | q.text(","); q.breakable() |
| 3546 | q.text("name = "); |
| 3547 | q.pp(self.name) |
| 3548 | q.text(","); q.breakable() |
| 3549 | q.text("tlvs = "); |
| 3550 | q.pp(self.tlvs) |
| 3551 | q.breakable() |
| 3552 | q.text('}') |
| 3553 | |
| 3554 | bsn_stats_request.subtypes[16] = bsn_generic_stats_request |
| 3555 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3556 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3557 | version = 4 |
| 3558 | type = 19 |
| 3559 | stats_type = 65535 |
| 3560 | experimenter = 6035143 |
| 3561 | subtype = 5 |
| 3562 | |
| 3563 | def __init__(self, xid=None, flags=None, entries=None): |
| 3564 | if xid != None: |
| 3565 | self.xid = xid |
| 3566 | else: |
| 3567 | self.xid = None |
| 3568 | if flags != None: |
| 3569 | self.flags = flags |
| 3570 | else: |
| 3571 | self.flags = 0 |
| 3572 | if entries != None: |
| 3573 | self.entries = entries |
| 3574 | else: |
| 3575 | self.entries = [] |
| 3576 | return |
| 3577 | |
| 3578 | def pack(self): |
| 3579 | packed = [] |
| 3580 | packed.append(struct.pack("!B", self.version)) |
| 3581 | packed.append(struct.pack("!B", self.type)) |
| 3582 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3583 | packed.append(struct.pack("!L", self.xid)) |
| 3584 | packed.append(struct.pack("!H", self.stats_type)) |
| 3585 | packed.append(struct.pack("!H", self.flags)) |
| 3586 | packed.append('\x00' * 4) |
| 3587 | packed.append(struct.pack("!L", self.experimenter)) |
| 3588 | packed.append(struct.pack("!L", self.subtype)) |
| 3589 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3590 | length = sum([len(x) for x in packed]) |
| 3591 | packed[2] = struct.pack("!H", length) |
| 3592 | return ''.join(packed) |
| 3593 | |
| 3594 | @staticmethod |
| 3595 | def unpack(reader): |
| 3596 | obj = bsn_gentable_bucket_stats_reply() |
| 3597 | _version = reader.read("!B")[0] |
| 3598 | assert(_version == 4) |
| 3599 | _type = reader.read("!B")[0] |
| 3600 | assert(_type == 19) |
| 3601 | _length = reader.read("!H")[0] |
| 3602 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3603 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3604 | obj.xid = reader.read("!L")[0] |
| 3605 | _stats_type = reader.read("!H")[0] |
| 3606 | assert(_stats_type == 65535) |
| 3607 | obj.flags = reader.read("!H")[0] |
| 3608 | reader.skip(4) |
| 3609 | _experimenter = reader.read("!L")[0] |
| 3610 | assert(_experimenter == 6035143) |
| 3611 | _subtype = reader.read("!L")[0] |
| 3612 | assert(_subtype == 5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3613 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_bucket_stats_entry.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3614 | return obj |
| 3615 | |
| 3616 | def __eq__(self, other): |
| 3617 | if type(self) != type(other): return False |
| 3618 | if self.xid != other.xid: return False |
| 3619 | if self.flags != other.flags: return False |
| 3620 | if self.entries != other.entries: return False |
| 3621 | return True |
| 3622 | |
| 3623 | def pretty_print(self, q): |
| 3624 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3625 | with q.group(): |
| 3626 | with q.indent(2): |
| 3627 | q.breakable() |
| 3628 | q.text("xid = "); |
| 3629 | if self.xid != None: |
| 3630 | q.text("%#x" % self.xid) |
| 3631 | else: |
| 3632 | q.text('None') |
| 3633 | q.text(","); q.breakable() |
| 3634 | q.text("flags = "); |
| 3635 | q.text("%#x" % self.flags) |
| 3636 | q.text(","); q.breakable() |
| 3637 | q.text("entries = "); |
| 3638 | q.pp(self.entries) |
| 3639 | q.breakable() |
| 3640 | q.text('}') |
| 3641 | |
| 3642 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3643 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3644 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3645 | version = 4 |
| 3646 | type = 18 |
| 3647 | stats_type = 65535 |
| 3648 | experimenter = 6035143 |
| 3649 | subtype = 5 |
| 3650 | |
| 3651 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3652 | if xid != None: |
| 3653 | self.xid = xid |
| 3654 | else: |
| 3655 | self.xid = None |
| 3656 | if flags != None: |
| 3657 | self.flags = flags |
| 3658 | else: |
| 3659 | self.flags = 0 |
| 3660 | if table_id != None: |
| 3661 | self.table_id = table_id |
| 3662 | else: |
| 3663 | self.table_id = 0 |
| 3664 | return |
| 3665 | |
| 3666 | def pack(self): |
| 3667 | packed = [] |
| 3668 | packed.append(struct.pack("!B", self.version)) |
| 3669 | packed.append(struct.pack("!B", self.type)) |
| 3670 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3671 | packed.append(struct.pack("!L", self.xid)) |
| 3672 | packed.append(struct.pack("!H", self.stats_type)) |
| 3673 | packed.append(struct.pack("!H", self.flags)) |
| 3674 | packed.append('\x00' * 4) |
| 3675 | packed.append(struct.pack("!L", self.experimenter)) |
| 3676 | packed.append(struct.pack("!L", self.subtype)) |
| 3677 | packed.append(struct.pack("!H", self.table_id)) |
| 3678 | length = sum([len(x) for x in packed]) |
| 3679 | packed[2] = struct.pack("!H", length) |
| 3680 | return ''.join(packed) |
| 3681 | |
| 3682 | @staticmethod |
| 3683 | def unpack(reader): |
| 3684 | obj = bsn_gentable_bucket_stats_request() |
| 3685 | _version = reader.read("!B")[0] |
| 3686 | assert(_version == 4) |
| 3687 | _type = reader.read("!B")[0] |
| 3688 | assert(_type == 18) |
| 3689 | _length = reader.read("!H")[0] |
| 3690 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3691 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3692 | obj.xid = reader.read("!L")[0] |
| 3693 | _stats_type = reader.read("!H")[0] |
| 3694 | assert(_stats_type == 65535) |
| 3695 | obj.flags = reader.read("!H")[0] |
| 3696 | reader.skip(4) |
| 3697 | _experimenter = reader.read("!L")[0] |
| 3698 | assert(_experimenter == 6035143) |
| 3699 | _subtype = reader.read("!L")[0] |
| 3700 | assert(_subtype == 5) |
| 3701 | obj.table_id = reader.read("!H")[0] |
| 3702 | return obj |
| 3703 | |
| 3704 | def __eq__(self, other): |
| 3705 | if type(self) != type(other): return False |
| 3706 | if self.xid != other.xid: return False |
| 3707 | if self.flags != other.flags: return False |
| 3708 | if self.table_id != other.table_id: return False |
| 3709 | return True |
| 3710 | |
| 3711 | def pretty_print(self, q): |
| 3712 | q.text("bsn_gentable_bucket_stats_request {") |
| 3713 | with q.group(): |
| 3714 | with q.indent(2): |
| 3715 | q.breakable() |
| 3716 | q.text("xid = "); |
| 3717 | if self.xid != None: |
| 3718 | q.text("%#x" % self.xid) |
| 3719 | else: |
| 3720 | q.text('None') |
| 3721 | q.text(","); q.breakable() |
| 3722 | q.text("flags = "); |
| 3723 | q.text("%#x" % self.flags) |
| 3724 | q.text(","); q.breakable() |
| 3725 | q.text("table_id = "); |
| 3726 | q.text("%#x" % self.table_id) |
| 3727 | q.breakable() |
| 3728 | q.text('}') |
| 3729 | |
| 3730 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3731 | |
| 3732 | class bsn_gentable_clear_reply(bsn_header): |
| 3733 | version = 4 |
| 3734 | type = 4 |
| 3735 | experimenter = 6035143 |
| 3736 | subtype = 49 |
| 3737 | |
| 3738 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3739 | if xid != None: |
| 3740 | self.xid = xid |
| 3741 | else: |
| 3742 | self.xid = None |
| 3743 | if table_id != None: |
| 3744 | self.table_id = table_id |
| 3745 | else: |
| 3746 | self.table_id = 0 |
| 3747 | if deleted_count != None: |
| 3748 | self.deleted_count = deleted_count |
| 3749 | else: |
| 3750 | self.deleted_count = 0 |
| 3751 | if error_count != None: |
| 3752 | self.error_count = error_count |
| 3753 | else: |
| 3754 | self.error_count = 0 |
| 3755 | return |
| 3756 | |
| 3757 | def pack(self): |
| 3758 | packed = [] |
| 3759 | packed.append(struct.pack("!B", self.version)) |
| 3760 | packed.append(struct.pack("!B", self.type)) |
| 3761 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3762 | packed.append(struct.pack("!L", self.xid)) |
| 3763 | packed.append(struct.pack("!L", self.experimenter)) |
| 3764 | packed.append(struct.pack("!L", self.subtype)) |
| 3765 | packed.append(struct.pack("!H", self.table_id)) |
| 3766 | packed.append('\x00' * 2) |
| 3767 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3768 | packed.append(struct.pack("!L", self.error_count)) |
| 3769 | length = sum([len(x) for x in packed]) |
| 3770 | packed[2] = struct.pack("!H", length) |
| 3771 | return ''.join(packed) |
| 3772 | |
| 3773 | @staticmethod |
| 3774 | def unpack(reader): |
| 3775 | obj = bsn_gentable_clear_reply() |
| 3776 | _version = reader.read("!B")[0] |
| 3777 | assert(_version == 4) |
| 3778 | _type = reader.read("!B")[0] |
| 3779 | assert(_type == 4) |
| 3780 | _length = reader.read("!H")[0] |
| 3781 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3782 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3783 | obj.xid = reader.read("!L")[0] |
| 3784 | _experimenter = reader.read("!L")[0] |
| 3785 | assert(_experimenter == 6035143) |
| 3786 | _subtype = reader.read("!L")[0] |
| 3787 | assert(_subtype == 49) |
| 3788 | obj.table_id = reader.read("!H")[0] |
| 3789 | reader.skip(2) |
| 3790 | obj.deleted_count = reader.read("!L")[0] |
| 3791 | obj.error_count = reader.read("!L")[0] |
| 3792 | return obj |
| 3793 | |
| 3794 | def __eq__(self, other): |
| 3795 | if type(self) != type(other): return False |
| 3796 | if self.xid != other.xid: return False |
| 3797 | if self.table_id != other.table_id: return False |
| 3798 | if self.deleted_count != other.deleted_count: return False |
| 3799 | if self.error_count != other.error_count: return False |
| 3800 | return True |
| 3801 | |
| 3802 | def pretty_print(self, q): |
| 3803 | q.text("bsn_gentable_clear_reply {") |
| 3804 | with q.group(): |
| 3805 | with q.indent(2): |
| 3806 | q.breakable() |
| 3807 | q.text("xid = "); |
| 3808 | if self.xid != None: |
| 3809 | q.text("%#x" % self.xid) |
| 3810 | else: |
| 3811 | q.text('None') |
| 3812 | q.text(","); q.breakable() |
| 3813 | q.text("table_id = "); |
| 3814 | q.text("%#x" % self.table_id) |
| 3815 | q.text(","); q.breakable() |
| 3816 | q.text("deleted_count = "); |
| 3817 | q.text("%#x" % self.deleted_count) |
| 3818 | q.text(","); q.breakable() |
| 3819 | q.text("error_count = "); |
| 3820 | q.text("%#x" % self.error_count) |
| 3821 | q.breakable() |
| 3822 | q.text('}') |
| 3823 | |
| 3824 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3825 | |
| 3826 | class bsn_gentable_clear_request(bsn_header): |
| 3827 | version = 4 |
| 3828 | type = 4 |
| 3829 | experimenter = 6035143 |
| 3830 | subtype = 48 |
| 3831 | |
| 3832 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3833 | if xid != None: |
| 3834 | self.xid = xid |
| 3835 | else: |
| 3836 | self.xid = None |
| 3837 | if table_id != None: |
| 3838 | self.table_id = table_id |
| 3839 | else: |
| 3840 | self.table_id = 0 |
| 3841 | if checksum != None: |
| 3842 | self.checksum = checksum |
| 3843 | else: |
| 3844 | self.checksum = 0 |
| 3845 | if checksum_mask != None: |
| 3846 | self.checksum_mask = checksum_mask |
| 3847 | else: |
| 3848 | self.checksum_mask = 0 |
| 3849 | return |
| 3850 | |
| 3851 | def pack(self): |
| 3852 | packed = [] |
| 3853 | packed.append(struct.pack("!B", self.version)) |
| 3854 | packed.append(struct.pack("!B", self.type)) |
| 3855 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3856 | packed.append(struct.pack("!L", self.xid)) |
| 3857 | packed.append(struct.pack("!L", self.experimenter)) |
| 3858 | packed.append(struct.pack("!L", self.subtype)) |
| 3859 | packed.append(struct.pack("!H", self.table_id)) |
| 3860 | packed.append('\x00' * 2) |
| 3861 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3862 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3863 | length = sum([len(x) for x in packed]) |
| 3864 | packed[2] = struct.pack("!H", length) |
| 3865 | return ''.join(packed) |
| 3866 | |
| 3867 | @staticmethod |
| 3868 | def unpack(reader): |
| 3869 | obj = bsn_gentable_clear_request() |
| 3870 | _version = reader.read("!B")[0] |
| 3871 | assert(_version == 4) |
| 3872 | _type = reader.read("!B")[0] |
| 3873 | assert(_type == 4) |
| 3874 | _length = reader.read("!H")[0] |
| 3875 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3876 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3877 | obj.xid = reader.read("!L")[0] |
| 3878 | _experimenter = reader.read("!L")[0] |
| 3879 | assert(_experimenter == 6035143) |
| 3880 | _subtype = reader.read("!L")[0] |
| 3881 | assert(_subtype == 48) |
| 3882 | obj.table_id = reader.read("!H")[0] |
| 3883 | reader.skip(2) |
| 3884 | obj.checksum = util.unpack_checksum_128(reader) |
| 3885 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3886 | return obj |
| 3887 | |
| 3888 | def __eq__(self, other): |
| 3889 | if type(self) != type(other): return False |
| 3890 | if self.xid != other.xid: return False |
| 3891 | if self.table_id != other.table_id: return False |
| 3892 | if self.checksum != other.checksum: return False |
| 3893 | if self.checksum_mask != other.checksum_mask: return False |
| 3894 | return True |
| 3895 | |
| 3896 | def pretty_print(self, q): |
| 3897 | q.text("bsn_gentable_clear_request {") |
| 3898 | with q.group(): |
| 3899 | with q.indent(2): |
| 3900 | q.breakable() |
| 3901 | q.text("xid = "); |
| 3902 | if self.xid != None: |
| 3903 | q.text("%#x" % self.xid) |
| 3904 | else: |
| 3905 | q.text('None') |
| 3906 | q.text(","); q.breakable() |
| 3907 | q.text("table_id = "); |
| 3908 | q.text("%#x" % self.table_id) |
| 3909 | q.text(","); q.breakable() |
| 3910 | q.text("checksum = "); |
| 3911 | q.pp(self.checksum) |
| 3912 | q.text(","); q.breakable() |
| 3913 | q.text("checksum_mask = "); |
| 3914 | q.pp(self.checksum_mask) |
| 3915 | q.breakable() |
| 3916 | q.text('}') |
| 3917 | |
| 3918 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3919 | |
| 3920 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3921 | version = 4 |
| 3922 | type = 19 |
| 3923 | stats_type = 65535 |
| 3924 | experimenter = 6035143 |
| 3925 | subtype = 4 |
| 3926 | |
| 3927 | def __init__(self, xid=None, flags=None, entries=None): |
| 3928 | if xid != None: |
| 3929 | self.xid = xid |
| 3930 | else: |
| 3931 | self.xid = None |
| 3932 | if flags != None: |
| 3933 | self.flags = flags |
| 3934 | else: |
| 3935 | self.flags = 0 |
| 3936 | if entries != None: |
| 3937 | self.entries = entries |
| 3938 | else: |
| 3939 | self.entries = [] |
| 3940 | return |
| 3941 | |
| 3942 | def pack(self): |
| 3943 | packed = [] |
| 3944 | packed.append(struct.pack("!B", self.version)) |
| 3945 | packed.append(struct.pack("!B", self.type)) |
| 3946 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3947 | packed.append(struct.pack("!L", self.xid)) |
| 3948 | packed.append(struct.pack("!H", self.stats_type)) |
| 3949 | packed.append(struct.pack("!H", self.flags)) |
| 3950 | packed.append('\x00' * 4) |
| 3951 | packed.append(struct.pack("!L", self.experimenter)) |
| 3952 | packed.append(struct.pack("!L", self.subtype)) |
| 3953 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3954 | length = sum([len(x) for x in packed]) |
| 3955 | packed[2] = struct.pack("!H", length) |
| 3956 | return ''.join(packed) |
| 3957 | |
| 3958 | @staticmethod |
| 3959 | def unpack(reader): |
| 3960 | obj = bsn_gentable_desc_stats_reply() |
| 3961 | _version = reader.read("!B")[0] |
| 3962 | assert(_version == 4) |
| 3963 | _type = reader.read("!B")[0] |
| 3964 | assert(_type == 19) |
| 3965 | _length = reader.read("!H")[0] |
| 3966 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3967 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3968 | obj.xid = reader.read("!L")[0] |
| 3969 | _stats_type = reader.read("!H")[0] |
| 3970 | assert(_stats_type == 65535) |
| 3971 | obj.flags = reader.read("!H")[0] |
| 3972 | reader.skip(4) |
| 3973 | _experimenter = reader.read("!L")[0] |
| 3974 | assert(_experimenter == 6035143) |
| 3975 | _subtype = reader.read("!L")[0] |
| 3976 | assert(_subtype == 4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 3977 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_desc_stats_entry.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3978 | return obj |
| 3979 | |
| 3980 | def __eq__(self, other): |
| 3981 | if type(self) != type(other): return False |
| 3982 | if self.xid != other.xid: return False |
| 3983 | if self.flags != other.flags: return False |
| 3984 | if self.entries != other.entries: return False |
| 3985 | return True |
| 3986 | |
| 3987 | def pretty_print(self, q): |
| 3988 | q.text("bsn_gentable_desc_stats_reply {") |
| 3989 | with q.group(): |
| 3990 | with q.indent(2): |
| 3991 | q.breakable() |
| 3992 | q.text("xid = "); |
| 3993 | if self.xid != None: |
| 3994 | q.text("%#x" % self.xid) |
| 3995 | else: |
| 3996 | q.text('None') |
| 3997 | q.text(","); q.breakable() |
| 3998 | q.text("flags = "); |
| 3999 | q.text("%#x" % self.flags) |
| 4000 | q.text(","); q.breakable() |
| 4001 | q.text("entries = "); |
| 4002 | q.pp(self.entries) |
| 4003 | q.breakable() |
| 4004 | q.text('}') |
| 4005 | |
| 4006 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 4007 | |
| 4008 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 4009 | version = 4 |
| 4010 | type = 18 |
| 4011 | stats_type = 65535 |
| 4012 | experimenter = 6035143 |
| 4013 | subtype = 4 |
| 4014 | |
| 4015 | def __init__(self, xid=None, flags=None): |
| 4016 | if xid != None: |
| 4017 | self.xid = xid |
| 4018 | else: |
| 4019 | self.xid = None |
| 4020 | if flags != None: |
| 4021 | self.flags = flags |
| 4022 | else: |
| 4023 | self.flags = 0 |
| 4024 | return |
| 4025 | |
| 4026 | def pack(self): |
| 4027 | packed = [] |
| 4028 | packed.append(struct.pack("!B", self.version)) |
| 4029 | packed.append(struct.pack("!B", self.type)) |
| 4030 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4031 | packed.append(struct.pack("!L", self.xid)) |
| 4032 | packed.append(struct.pack("!H", self.stats_type)) |
| 4033 | packed.append(struct.pack("!H", self.flags)) |
| 4034 | packed.append('\x00' * 4) |
| 4035 | packed.append(struct.pack("!L", self.experimenter)) |
| 4036 | packed.append(struct.pack("!L", self.subtype)) |
| 4037 | length = sum([len(x) for x in packed]) |
| 4038 | packed[2] = struct.pack("!H", length) |
| 4039 | return ''.join(packed) |
| 4040 | |
| 4041 | @staticmethod |
| 4042 | def unpack(reader): |
| 4043 | obj = bsn_gentable_desc_stats_request() |
| 4044 | _version = reader.read("!B")[0] |
| 4045 | assert(_version == 4) |
| 4046 | _type = reader.read("!B")[0] |
| 4047 | assert(_type == 18) |
| 4048 | _length = reader.read("!H")[0] |
| 4049 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4050 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4051 | obj.xid = reader.read("!L")[0] |
| 4052 | _stats_type = reader.read("!H")[0] |
| 4053 | assert(_stats_type == 65535) |
| 4054 | obj.flags = reader.read("!H")[0] |
| 4055 | reader.skip(4) |
| 4056 | _experimenter = reader.read("!L")[0] |
| 4057 | assert(_experimenter == 6035143) |
| 4058 | _subtype = reader.read("!L")[0] |
| 4059 | assert(_subtype == 4) |
| 4060 | return obj |
| 4061 | |
| 4062 | def __eq__(self, other): |
| 4063 | if type(self) != type(other): return False |
| 4064 | if self.xid != other.xid: return False |
| 4065 | if self.flags != other.flags: return False |
| 4066 | return True |
| 4067 | |
| 4068 | def pretty_print(self, q): |
| 4069 | q.text("bsn_gentable_desc_stats_request {") |
| 4070 | with q.group(): |
| 4071 | with q.indent(2): |
| 4072 | q.breakable() |
| 4073 | q.text("xid = "); |
| 4074 | if self.xid != None: |
| 4075 | q.text("%#x" % self.xid) |
| 4076 | else: |
| 4077 | q.text('None') |
| 4078 | q.text(","); q.breakable() |
| 4079 | q.text("flags = "); |
| 4080 | q.text("%#x" % self.flags) |
| 4081 | q.breakable() |
| 4082 | q.text('}') |
| 4083 | |
| 4084 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 4085 | |
| 4086 | class bsn_gentable_entry_add(bsn_header): |
| 4087 | version = 4 |
| 4088 | type = 4 |
| 4089 | experimenter = 6035143 |
| 4090 | subtype = 46 |
| 4091 | |
| 4092 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 4093 | if xid != None: |
| 4094 | self.xid = xid |
| 4095 | else: |
| 4096 | self.xid = None |
| 4097 | if table_id != None: |
| 4098 | self.table_id = table_id |
| 4099 | else: |
| 4100 | self.table_id = 0 |
| 4101 | if checksum != None: |
| 4102 | self.checksum = checksum |
| 4103 | else: |
| 4104 | self.checksum = 0 |
| 4105 | if key != None: |
| 4106 | self.key = key |
| 4107 | else: |
| 4108 | self.key = [] |
| 4109 | if value != None: |
| 4110 | self.value = value |
| 4111 | else: |
| 4112 | self.value = [] |
| 4113 | return |
| 4114 | |
| 4115 | def pack(self): |
| 4116 | packed = [] |
| 4117 | packed.append(struct.pack("!B", self.version)) |
| 4118 | packed.append(struct.pack("!B", self.type)) |
| 4119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4120 | packed.append(struct.pack("!L", self.xid)) |
| 4121 | packed.append(struct.pack("!L", self.experimenter)) |
| 4122 | packed.append(struct.pack("!L", self.subtype)) |
| 4123 | packed.append(struct.pack("!H", self.table_id)) |
| 4124 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 4125 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4126 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4127 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 4128 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 4129 | length = sum([len(x) for x in packed]) |
| 4130 | packed[2] = struct.pack("!H", length) |
| 4131 | return ''.join(packed) |
| 4132 | |
| 4133 | @staticmethod |
| 4134 | def unpack(reader): |
| 4135 | obj = bsn_gentable_entry_add() |
| 4136 | _version = reader.read("!B")[0] |
| 4137 | assert(_version == 4) |
| 4138 | _type = reader.read("!B")[0] |
| 4139 | assert(_type == 4) |
| 4140 | _length = reader.read("!H")[0] |
| 4141 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4142 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4143 | obj.xid = reader.read("!L")[0] |
| 4144 | _experimenter = reader.read("!L")[0] |
| 4145 | assert(_experimenter == 6035143) |
| 4146 | _subtype = reader.read("!L")[0] |
| 4147 | assert(_subtype == 46) |
| 4148 | obj.table_id = reader.read("!H")[0] |
| 4149 | _key_length = reader.read("!H")[0] |
| 4150 | obj.checksum = util.unpack_checksum_128(reader) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4151 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack) |
| 4152 | obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4153 | return obj |
| 4154 | |
| 4155 | def __eq__(self, other): |
| 4156 | if type(self) != type(other): return False |
| 4157 | if self.xid != other.xid: return False |
| 4158 | if self.table_id != other.table_id: return False |
| 4159 | if self.checksum != other.checksum: return False |
| 4160 | if self.key != other.key: return False |
| 4161 | if self.value != other.value: return False |
| 4162 | return True |
| 4163 | |
| 4164 | def pretty_print(self, q): |
| 4165 | q.text("bsn_gentable_entry_add {") |
| 4166 | with q.group(): |
| 4167 | with q.indent(2): |
| 4168 | q.breakable() |
| 4169 | q.text("xid = "); |
| 4170 | if self.xid != None: |
| 4171 | q.text("%#x" % self.xid) |
| 4172 | else: |
| 4173 | q.text('None') |
| 4174 | q.text(","); q.breakable() |
| 4175 | q.text("table_id = "); |
| 4176 | q.text("%#x" % self.table_id) |
| 4177 | q.text(","); q.breakable() |
| 4178 | q.text("checksum = "); |
| 4179 | q.pp(self.checksum) |
| 4180 | q.text(","); q.breakable() |
| 4181 | q.text("key = "); |
| 4182 | q.pp(self.key) |
| 4183 | q.text(","); q.breakable() |
| 4184 | q.text("value = "); |
| 4185 | q.pp(self.value) |
| 4186 | q.breakable() |
| 4187 | q.text('}') |
| 4188 | |
| 4189 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4190 | |
| 4191 | class bsn_gentable_entry_delete(bsn_header): |
| 4192 | version = 4 |
| 4193 | type = 4 |
| 4194 | experimenter = 6035143 |
| 4195 | subtype = 47 |
| 4196 | |
| 4197 | def __init__(self, xid=None, table_id=None, key=None): |
| 4198 | if xid != None: |
| 4199 | self.xid = xid |
| 4200 | else: |
| 4201 | self.xid = None |
| 4202 | if table_id != None: |
| 4203 | self.table_id = table_id |
| 4204 | else: |
| 4205 | self.table_id = 0 |
| 4206 | if key != None: |
| 4207 | self.key = key |
| 4208 | else: |
| 4209 | self.key = [] |
| 4210 | return |
| 4211 | |
| 4212 | def pack(self): |
| 4213 | packed = [] |
| 4214 | packed.append(struct.pack("!B", self.version)) |
| 4215 | packed.append(struct.pack("!B", self.type)) |
| 4216 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4217 | packed.append(struct.pack("!L", self.xid)) |
| 4218 | packed.append(struct.pack("!L", self.experimenter)) |
| 4219 | packed.append(struct.pack("!L", self.subtype)) |
| 4220 | packed.append(struct.pack("!H", self.table_id)) |
| 4221 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4222 | length = sum([len(x) for x in packed]) |
| 4223 | packed[2] = struct.pack("!H", length) |
| 4224 | return ''.join(packed) |
| 4225 | |
| 4226 | @staticmethod |
| 4227 | def unpack(reader): |
| 4228 | obj = bsn_gentable_entry_delete() |
| 4229 | _version = reader.read("!B")[0] |
| 4230 | assert(_version == 4) |
| 4231 | _type = reader.read("!B")[0] |
| 4232 | assert(_type == 4) |
| 4233 | _length = reader.read("!H")[0] |
| 4234 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4235 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4236 | obj.xid = reader.read("!L")[0] |
| 4237 | _experimenter = reader.read("!L")[0] |
| 4238 | assert(_experimenter == 6035143) |
| 4239 | _subtype = reader.read("!L")[0] |
| 4240 | assert(_subtype == 47) |
| 4241 | obj.table_id = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4242 | obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4243 | return obj |
| 4244 | |
| 4245 | def __eq__(self, other): |
| 4246 | if type(self) != type(other): return False |
| 4247 | if self.xid != other.xid: return False |
| 4248 | if self.table_id != other.table_id: return False |
| 4249 | if self.key != other.key: return False |
| 4250 | return True |
| 4251 | |
| 4252 | def pretty_print(self, q): |
| 4253 | q.text("bsn_gentable_entry_delete {") |
| 4254 | with q.group(): |
| 4255 | with q.indent(2): |
| 4256 | q.breakable() |
| 4257 | q.text("xid = "); |
| 4258 | if self.xid != None: |
| 4259 | q.text("%#x" % self.xid) |
| 4260 | else: |
| 4261 | q.text('None') |
| 4262 | q.text(","); q.breakable() |
| 4263 | q.text("table_id = "); |
| 4264 | q.text("%#x" % self.table_id) |
| 4265 | q.text(","); q.breakable() |
| 4266 | q.text("key = "); |
| 4267 | q.pp(self.key) |
| 4268 | q.breakable() |
| 4269 | q.text('}') |
| 4270 | |
| 4271 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4272 | |
| 4273 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4274 | version = 4 |
| 4275 | type = 19 |
| 4276 | stats_type = 65535 |
| 4277 | experimenter = 6035143 |
| 4278 | subtype = 2 |
| 4279 | |
| 4280 | def __init__(self, xid=None, flags=None, entries=None): |
| 4281 | if xid != None: |
| 4282 | self.xid = xid |
| 4283 | else: |
| 4284 | self.xid = None |
| 4285 | if flags != None: |
| 4286 | self.flags = flags |
| 4287 | else: |
| 4288 | self.flags = 0 |
| 4289 | if entries != None: |
| 4290 | self.entries = entries |
| 4291 | else: |
| 4292 | self.entries = [] |
| 4293 | return |
| 4294 | |
| 4295 | def pack(self): |
| 4296 | packed = [] |
| 4297 | packed.append(struct.pack("!B", self.version)) |
| 4298 | packed.append(struct.pack("!B", self.type)) |
| 4299 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4300 | packed.append(struct.pack("!L", self.xid)) |
| 4301 | packed.append(struct.pack("!H", self.stats_type)) |
| 4302 | packed.append(struct.pack("!H", self.flags)) |
| 4303 | packed.append('\x00' * 4) |
| 4304 | packed.append(struct.pack("!L", self.experimenter)) |
| 4305 | packed.append(struct.pack("!L", self.subtype)) |
| 4306 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4307 | length = sum([len(x) for x in packed]) |
| 4308 | packed[2] = struct.pack("!H", length) |
| 4309 | return ''.join(packed) |
| 4310 | |
| 4311 | @staticmethod |
| 4312 | def unpack(reader): |
| 4313 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4314 | _version = reader.read("!B")[0] |
| 4315 | assert(_version == 4) |
| 4316 | _type = reader.read("!B")[0] |
| 4317 | assert(_type == 19) |
| 4318 | _length = reader.read("!H")[0] |
| 4319 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4320 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4321 | obj.xid = reader.read("!L")[0] |
| 4322 | _stats_type = reader.read("!H")[0] |
| 4323 | assert(_stats_type == 65535) |
| 4324 | obj.flags = reader.read("!H")[0] |
| 4325 | reader.skip(4) |
| 4326 | _experimenter = reader.read("!L")[0] |
| 4327 | assert(_experimenter == 6035143) |
| 4328 | _subtype = reader.read("!L")[0] |
| 4329 | assert(_subtype == 2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4330 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_desc_stats_entry.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4331 | return obj |
| 4332 | |
| 4333 | def __eq__(self, other): |
| 4334 | if type(self) != type(other): return False |
| 4335 | if self.xid != other.xid: return False |
| 4336 | if self.flags != other.flags: return False |
| 4337 | if self.entries != other.entries: return False |
| 4338 | return True |
| 4339 | |
| 4340 | def pretty_print(self, q): |
| 4341 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4342 | with q.group(): |
| 4343 | with q.indent(2): |
| 4344 | q.breakable() |
| 4345 | q.text("xid = "); |
| 4346 | if self.xid != None: |
| 4347 | q.text("%#x" % self.xid) |
| 4348 | else: |
| 4349 | q.text('None') |
| 4350 | q.text(","); q.breakable() |
| 4351 | q.text("flags = "); |
| 4352 | q.text("%#x" % self.flags) |
| 4353 | q.text(","); q.breakable() |
| 4354 | q.text("entries = "); |
| 4355 | q.pp(self.entries) |
| 4356 | q.breakable() |
| 4357 | q.text('}') |
| 4358 | |
| 4359 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4360 | |
| 4361 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4362 | version = 4 |
| 4363 | type = 18 |
| 4364 | stats_type = 65535 |
| 4365 | experimenter = 6035143 |
| 4366 | subtype = 2 |
| 4367 | |
| 4368 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4369 | if xid != None: |
| 4370 | self.xid = xid |
| 4371 | else: |
| 4372 | self.xid = None |
| 4373 | if flags != None: |
| 4374 | self.flags = flags |
| 4375 | else: |
| 4376 | self.flags = 0 |
| 4377 | if table_id != None: |
| 4378 | self.table_id = table_id |
| 4379 | else: |
| 4380 | self.table_id = 0 |
| 4381 | if checksum != None: |
| 4382 | self.checksum = checksum |
| 4383 | else: |
| 4384 | self.checksum = 0 |
| 4385 | if checksum_mask != None: |
| 4386 | self.checksum_mask = checksum_mask |
| 4387 | else: |
| 4388 | self.checksum_mask = 0 |
| 4389 | return |
| 4390 | |
| 4391 | def pack(self): |
| 4392 | packed = [] |
| 4393 | packed.append(struct.pack("!B", self.version)) |
| 4394 | packed.append(struct.pack("!B", self.type)) |
| 4395 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4396 | packed.append(struct.pack("!L", self.xid)) |
| 4397 | packed.append(struct.pack("!H", self.stats_type)) |
| 4398 | packed.append(struct.pack("!H", self.flags)) |
| 4399 | packed.append('\x00' * 4) |
| 4400 | packed.append(struct.pack("!L", self.experimenter)) |
| 4401 | packed.append(struct.pack("!L", self.subtype)) |
| 4402 | packed.append(struct.pack("!H", self.table_id)) |
| 4403 | packed.append('\x00' * 2) |
| 4404 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4405 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4406 | length = sum([len(x) for x in packed]) |
| 4407 | packed[2] = struct.pack("!H", length) |
| 4408 | return ''.join(packed) |
| 4409 | |
| 4410 | @staticmethod |
| 4411 | def unpack(reader): |
| 4412 | obj = bsn_gentable_entry_desc_stats_request() |
| 4413 | _version = reader.read("!B")[0] |
| 4414 | assert(_version == 4) |
| 4415 | _type = reader.read("!B")[0] |
| 4416 | assert(_type == 18) |
| 4417 | _length = reader.read("!H")[0] |
| 4418 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4419 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4420 | obj.xid = reader.read("!L")[0] |
| 4421 | _stats_type = reader.read("!H")[0] |
| 4422 | assert(_stats_type == 65535) |
| 4423 | obj.flags = reader.read("!H")[0] |
| 4424 | reader.skip(4) |
| 4425 | _experimenter = reader.read("!L")[0] |
| 4426 | assert(_experimenter == 6035143) |
| 4427 | _subtype = reader.read("!L")[0] |
| 4428 | assert(_subtype == 2) |
| 4429 | obj.table_id = reader.read("!H")[0] |
| 4430 | reader.skip(2) |
| 4431 | obj.checksum = util.unpack_checksum_128(reader) |
| 4432 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4433 | return obj |
| 4434 | |
| 4435 | def __eq__(self, other): |
| 4436 | if type(self) != type(other): return False |
| 4437 | if self.xid != other.xid: return False |
| 4438 | if self.flags != other.flags: return False |
| 4439 | if self.table_id != other.table_id: return False |
| 4440 | if self.checksum != other.checksum: return False |
| 4441 | if self.checksum_mask != other.checksum_mask: return False |
| 4442 | return True |
| 4443 | |
| 4444 | def pretty_print(self, q): |
| 4445 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4446 | with q.group(): |
| 4447 | with q.indent(2): |
| 4448 | q.breakable() |
| 4449 | q.text("xid = "); |
| 4450 | if self.xid != None: |
| 4451 | q.text("%#x" % self.xid) |
| 4452 | else: |
| 4453 | q.text('None') |
| 4454 | q.text(","); q.breakable() |
| 4455 | q.text("flags = "); |
| 4456 | q.text("%#x" % self.flags) |
| 4457 | q.text(","); q.breakable() |
| 4458 | q.text("table_id = "); |
| 4459 | q.text("%#x" % self.table_id) |
| 4460 | q.text(","); q.breakable() |
| 4461 | q.text("checksum = "); |
| 4462 | q.pp(self.checksum) |
| 4463 | q.text(","); q.breakable() |
| 4464 | q.text("checksum_mask = "); |
| 4465 | q.pp(self.checksum_mask) |
| 4466 | q.breakable() |
| 4467 | q.text('}') |
| 4468 | |
| 4469 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4470 | |
| 4471 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4472 | version = 4 |
| 4473 | type = 19 |
| 4474 | stats_type = 65535 |
| 4475 | experimenter = 6035143 |
| 4476 | subtype = 3 |
| 4477 | |
| 4478 | def __init__(self, xid=None, flags=None, entries=None): |
| 4479 | if xid != None: |
| 4480 | self.xid = xid |
| 4481 | else: |
| 4482 | self.xid = None |
| 4483 | if flags != None: |
| 4484 | self.flags = flags |
| 4485 | else: |
| 4486 | self.flags = 0 |
| 4487 | if entries != None: |
| 4488 | self.entries = entries |
| 4489 | else: |
| 4490 | self.entries = [] |
| 4491 | return |
| 4492 | |
| 4493 | def pack(self): |
| 4494 | packed = [] |
| 4495 | packed.append(struct.pack("!B", self.version)) |
| 4496 | packed.append(struct.pack("!B", self.type)) |
| 4497 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4498 | packed.append(struct.pack("!L", self.xid)) |
| 4499 | packed.append(struct.pack("!H", self.stats_type)) |
| 4500 | packed.append(struct.pack("!H", self.flags)) |
| 4501 | packed.append('\x00' * 4) |
| 4502 | packed.append(struct.pack("!L", self.experimenter)) |
| 4503 | packed.append(struct.pack("!L", self.subtype)) |
| 4504 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4505 | length = sum([len(x) for x in packed]) |
| 4506 | packed[2] = struct.pack("!H", length) |
| 4507 | return ''.join(packed) |
| 4508 | |
| 4509 | @staticmethod |
| 4510 | def unpack(reader): |
| 4511 | obj = bsn_gentable_entry_stats_reply() |
| 4512 | _version = reader.read("!B")[0] |
| 4513 | assert(_version == 4) |
| 4514 | _type = reader.read("!B")[0] |
| 4515 | assert(_type == 19) |
| 4516 | _length = reader.read("!H")[0] |
| 4517 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4518 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4519 | obj.xid = reader.read("!L")[0] |
| 4520 | _stats_type = reader.read("!H")[0] |
| 4521 | assert(_stats_type == 65535) |
| 4522 | obj.flags = reader.read("!H")[0] |
| 4523 | reader.skip(4) |
| 4524 | _experimenter = reader.read("!L")[0] |
| 4525 | assert(_experimenter == 6035143) |
| 4526 | _subtype = reader.read("!L")[0] |
| 4527 | assert(_subtype == 3) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4528 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_entry_stats_entry.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4529 | return obj |
| 4530 | |
| 4531 | def __eq__(self, other): |
| 4532 | if type(self) != type(other): return False |
| 4533 | if self.xid != other.xid: return False |
| 4534 | if self.flags != other.flags: return False |
| 4535 | if self.entries != other.entries: return False |
| 4536 | return True |
| 4537 | |
| 4538 | def pretty_print(self, q): |
| 4539 | q.text("bsn_gentable_entry_stats_reply {") |
| 4540 | with q.group(): |
| 4541 | with q.indent(2): |
| 4542 | q.breakable() |
| 4543 | q.text("xid = "); |
| 4544 | if self.xid != None: |
| 4545 | q.text("%#x" % self.xid) |
| 4546 | else: |
| 4547 | q.text('None') |
| 4548 | q.text(","); q.breakable() |
| 4549 | q.text("flags = "); |
| 4550 | q.text("%#x" % self.flags) |
| 4551 | q.text(","); q.breakable() |
| 4552 | q.text("entries = "); |
| 4553 | q.pp(self.entries) |
| 4554 | q.breakable() |
| 4555 | q.text('}') |
| 4556 | |
| 4557 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4558 | |
| 4559 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4560 | version = 4 |
| 4561 | type = 18 |
| 4562 | stats_type = 65535 |
| 4563 | experimenter = 6035143 |
| 4564 | subtype = 3 |
| 4565 | |
| 4566 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4567 | if xid != None: |
| 4568 | self.xid = xid |
| 4569 | else: |
| 4570 | self.xid = None |
| 4571 | if flags != None: |
| 4572 | self.flags = flags |
| 4573 | else: |
| 4574 | self.flags = 0 |
| 4575 | if table_id != None: |
| 4576 | self.table_id = table_id |
| 4577 | else: |
| 4578 | self.table_id = 0 |
| 4579 | if checksum != None: |
| 4580 | self.checksum = checksum |
| 4581 | else: |
| 4582 | self.checksum = 0 |
| 4583 | if checksum_mask != None: |
| 4584 | self.checksum_mask = checksum_mask |
| 4585 | else: |
| 4586 | self.checksum_mask = 0 |
| 4587 | return |
| 4588 | |
| 4589 | def pack(self): |
| 4590 | packed = [] |
| 4591 | packed.append(struct.pack("!B", self.version)) |
| 4592 | packed.append(struct.pack("!B", self.type)) |
| 4593 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4594 | packed.append(struct.pack("!L", self.xid)) |
| 4595 | packed.append(struct.pack("!H", self.stats_type)) |
| 4596 | packed.append(struct.pack("!H", self.flags)) |
| 4597 | packed.append('\x00' * 4) |
| 4598 | packed.append(struct.pack("!L", self.experimenter)) |
| 4599 | packed.append(struct.pack("!L", self.subtype)) |
| 4600 | packed.append(struct.pack("!H", self.table_id)) |
| 4601 | packed.append('\x00' * 2) |
| 4602 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4603 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4604 | length = sum([len(x) for x in packed]) |
| 4605 | packed[2] = struct.pack("!H", length) |
| 4606 | return ''.join(packed) |
| 4607 | |
| 4608 | @staticmethod |
| 4609 | def unpack(reader): |
| 4610 | obj = bsn_gentable_entry_stats_request() |
| 4611 | _version = reader.read("!B")[0] |
| 4612 | assert(_version == 4) |
| 4613 | _type = reader.read("!B")[0] |
| 4614 | assert(_type == 18) |
| 4615 | _length = reader.read("!H")[0] |
| 4616 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4617 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4618 | obj.xid = reader.read("!L")[0] |
| 4619 | _stats_type = reader.read("!H")[0] |
| 4620 | assert(_stats_type == 65535) |
| 4621 | obj.flags = reader.read("!H")[0] |
| 4622 | reader.skip(4) |
| 4623 | _experimenter = reader.read("!L")[0] |
| 4624 | assert(_experimenter == 6035143) |
| 4625 | _subtype = reader.read("!L")[0] |
| 4626 | assert(_subtype == 3) |
| 4627 | obj.table_id = reader.read("!H")[0] |
| 4628 | reader.skip(2) |
| 4629 | obj.checksum = util.unpack_checksum_128(reader) |
| 4630 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4631 | return obj |
| 4632 | |
| 4633 | def __eq__(self, other): |
| 4634 | if type(self) != type(other): return False |
| 4635 | if self.xid != other.xid: return False |
| 4636 | if self.flags != other.flags: return False |
| 4637 | if self.table_id != other.table_id: return False |
| 4638 | if self.checksum != other.checksum: return False |
| 4639 | if self.checksum_mask != other.checksum_mask: return False |
| 4640 | return True |
| 4641 | |
| 4642 | def pretty_print(self, q): |
| 4643 | q.text("bsn_gentable_entry_stats_request {") |
| 4644 | with q.group(): |
| 4645 | with q.indent(2): |
| 4646 | q.breakable() |
| 4647 | q.text("xid = "); |
| 4648 | if self.xid != None: |
| 4649 | q.text("%#x" % self.xid) |
| 4650 | else: |
| 4651 | q.text('None') |
| 4652 | q.text(","); q.breakable() |
| 4653 | q.text("flags = "); |
| 4654 | q.text("%#x" % self.flags) |
| 4655 | q.text(","); q.breakable() |
| 4656 | q.text("table_id = "); |
| 4657 | q.text("%#x" % self.table_id) |
| 4658 | q.text(","); q.breakable() |
| 4659 | q.text("checksum = "); |
| 4660 | q.pp(self.checksum) |
| 4661 | q.text(","); q.breakable() |
| 4662 | q.text("checksum_mask = "); |
| 4663 | q.pp(self.checksum_mask) |
| 4664 | q.breakable() |
| 4665 | q.text('}') |
| 4666 | |
| 4667 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4668 | |
| 4669 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4670 | version = 4 |
| 4671 | type = 4 |
| 4672 | experimenter = 6035143 |
| 4673 | subtype = 50 |
| 4674 | |
| 4675 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4676 | if xid != None: |
| 4677 | self.xid = xid |
| 4678 | else: |
| 4679 | self.xid = None |
| 4680 | if table_id != None: |
| 4681 | self.table_id = table_id |
| 4682 | else: |
| 4683 | self.table_id = 0 |
| 4684 | if buckets_size != None: |
| 4685 | self.buckets_size = buckets_size |
| 4686 | else: |
| 4687 | self.buckets_size = 0 |
| 4688 | return |
| 4689 | |
| 4690 | def pack(self): |
| 4691 | packed = [] |
| 4692 | packed.append(struct.pack("!B", self.version)) |
| 4693 | packed.append(struct.pack("!B", self.type)) |
| 4694 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4695 | packed.append(struct.pack("!L", self.xid)) |
| 4696 | packed.append(struct.pack("!L", self.experimenter)) |
| 4697 | packed.append(struct.pack("!L", self.subtype)) |
| 4698 | packed.append(struct.pack("!H", self.table_id)) |
| 4699 | packed.append('\x00' * 2) |
| 4700 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4701 | length = sum([len(x) for x in packed]) |
| 4702 | packed[2] = struct.pack("!H", length) |
| 4703 | return ''.join(packed) |
| 4704 | |
| 4705 | @staticmethod |
| 4706 | def unpack(reader): |
| 4707 | obj = bsn_gentable_set_buckets_size() |
| 4708 | _version = reader.read("!B")[0] |
| 4709 | assert(_version == 4) |
| 4710 | _type = reader.read("!B")[0] |
| 4711 | assert(_type == 4) |
| 4712 | _length = reader.read("!H")[0] |
| 4713 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4714 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4715 | obj.xid = reader.read("!L")[0] |
| 4716 | _experimenter = reader.read("!L")[0] |
| 4717 | assert(_experimenter == 6035143) |
| 4718 | _subtype = reader.read("!L")[0] |
| 4719 | assert(_subtype == 50) |
| 4720 | obj.table_id = reader.read("!H")[0] |
| 4721 | reader.skip(2) |
| 4722 | obj.buckets_size = reader.read("!L")[0] |
| 4723 | return obj |
| 4724 | |
| 4725 | def __eq__(self, other): |
| 4726 | if type(self) != type(other): return False |
| 4727 | if self.xid != other.xid: return False |
| 4728 | if self.table_id != other.table_id: return False |
| 4729 | if self.buckets_size != other.buckets_size: return False |
| 4730 | return True |
| 4731 | |
| 4732 | def pretty_print(self, q): |
| 4733 | q.text("bsn_gentable_set_buckets_size {") |
| 4734 | with q.group(): |
| 4735 | with q.indent(2): |
| 4736 | q.breakable() |
| 4737 | q.text("xid = "); |
| 4738 | if self.xid != None: |
| 4739 | q.text("%#x" % self.xid) |
| 4740 | else: |
| 4741 | q.text('None') |
| 4742 | q.text(","); q.breakable() |
| 4743 | q.text("table_id = "); |
| 4744 | q.text("%#x" % self.table_id) |
| 4745 | q.text(","); q.breakable() |
| 4746 | q.text("buckets_size = "); |
| 4747 | q.text("%#x" % self.buckets_size) |
| 4748 | q.breakable() |
| 4749 | q.text('}') |
| 4750 | |
| 4751 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4752 | |
| 4753 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4754 | version = 4 |
| 4755 | type = 19 |
| 4756 | stats_type = 65535 |
| 4757 | experimenter = 6035143 |
| 4758 | subtype = 7 |
| 4759 | |
| 4760 | def __init__(self, xid=None, flags=None, entries=None): |
| 4761 | if xid != None: |
| 4762 | self.xid = xid |
| 4763 | else: |
| 4764 | self.xid = None |
| 4765 | if flags != None: |
| 4766 | self.flags = flags |
| 4767 | else: |
| 4768 | self.flags = 0 |
| 4769 | if entries != None: |
| 4770 | self.entries = entries |
| 4771 | else: |
| 4772 | self.entries = [] |
| 4773 | return |
| 4774 | |
| 4775 | def pack(self): |
| 4776 | packed = [] |
| 4777 | packed.append(struct.pack("!B", self.version)) |
| 4778 | packed.append(struct.pack("!B", self.type)) |
| 4779 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4780 | packed.append(struct.pack("!L", self.xid)) |
| 4781 | packed.append(struct.pack("!H", self.stats_type)) |
| 4782 | packed.append(struct.pack("!H", self.flags)) |
| 4783 | packed.append('\x00' * 4) |
| 4784 | packed.append(struct.pack("!L", self.experimenter)) |
| 4785 | packed.append(struct.pack("!L", self.subtype)) |
| 4786 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4787 | length = sum([len(x) for x in packed]) |
| 4788 | packed[2] = struct.pack("!H", length) |
| 4789 | return ''.join(packed) |
| 4790 | |
| 4791 | @staticmethod |
| 4792 | def unpack(reader): |
| 4793 | obj = bsn_gentable_stats_reply() |
| 4794 | _version = reader.read("!B")[0] |
| 4795 | assert(_version == 4) |
| 4796 | _type = reader.read("!B")[0] |
| 4797 | assert(_type == 19) |
| 4798 | _length = reader.read("!H")[0] |
| 4799 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4800 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4801 | obj.xid = reader.read("!L")[0] |
| 4802 | _stats_type = reader.read("!H")[0] |
| 4803 | assert(_stats_type == 65535) |
| 4804 | obj.flags = reader.read("!H")[0] |
| 4805 | reader.skip(4) |
| 4806 | _experimenter = reader.read("!L")[0] |
| 4807 | assert(_experimenter == 6035143) |
| 4808 | _subtype = reader.read("!L")[0] |
| 4809 | assert(_subtype == 7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4810 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_gentable_stats_entry.unpack) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4811 | return obj |
| 4812 | |
| 4813 | def __eq__(self, other): |
| 4814 | if type(self) != type(other): return False |
| 4815 | if self.xid != other.xid: return False |
| 4816 | if self.flags != other.flags: return False |
| 4817 | if self.entries != other.entries: return False |
| 4818 | return True |
| 4819 | |
| 4820 | def pretty_print(self, q): |
| 4821 | q.text("bsn_gentable_stats_reply {") |
| 4822 | with q.group(): |
| 4823 | with q.indent(2): |
| 4824 | q.breakable() |
| 4825 | q.text("xid = "); |
| 4826 | if self.xid != None: |
| 4827 | q.text("%#x" % self.xid) |
| 4828 | else: |
| 4829 | q.text('None') |
| 4830 | q.text(","); q.breakable() |
| 4831 | q.text("flags = "); |
| 4832 | q.text("%#x" % self.flags) |
| 4833 | q.text(","); q.breakable() |
| 4834 | q.text("entries = "); |
| 4835 | q.pp(self.entries) |
| 4836 | q.breakable() |
| 4837 | q.text('}') |
| 4838 | |
| 4839 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4840 | |
| 4841 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4842 | version = 4 |
| 4843 | type = 18 |
| 4844 | stats_type = 65535 |
| 4845 | experimenter = 6035143 |
| 4846 | subtype = 7 |
| 4847 | |
| 4848 | def __init__(self, xid=None, flags=None): |
| 4849 | if xid != None: |
| 4850 | self.xid = xid |
| 4851 | else: |
| 4852 | self.xid = None |
| 4853 | if flags != None: |
| 4854 | self.flags = flags |
| 4855 | else: |
| 4856 | self.flags = 0 |
| 4857 | return |
| 4858 | |
| 4859 | def pack(self): |
| 4860 | packed = [] |
| 4861 | packed.append(struct.pack("!B", self.version)) |
| 4862 | packed.append(struct.pack("!B", self.type)) |
| 4863 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4864 | packed.append(struct.pack("!L", self.xid)) |
| 4865 | packed.append(struct.pack("!H", self.stats_type)) |
| 4866 | packed.append(struct.pack("!H", self.flags)) |
| 4867 | packed.append('\x00' * 4) |
| 4868 | packed.append(struct.pack("!L", self.experimenter)) |
| 4869 | packed.append(struct.pack("!L", self.subtype)) |
| 4870 | length = sum([len(x) for x in packed]) |
| 4871 | packed[2] = struct.pack("!H", length) |
| 4872 | return ''.join(packed) |
| 4873 | |
| 4874 | @staticmethod |
| 4875 | def unpack(reader): |
| 4876 | obj = bsn_gentable_stats_request() |
| 4877 | _version = reader.read("!B")[0] |
| 4878 | assert(_version == 4) |
| 4879 | _type = reader.read("!B")[0] |
| 4880 | assert(_type == 18) |
| 4881 | _length = reader.read("!H")[0] |
| 4882 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4883 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4884 | obj.xid = reader.read("!L")[0] |
| 4885 | _stats_type = reader.read("!H")[0] |
| 4886 | assert(_stats_type == 65535) |
| 4887 | obj.flags = reader.read("!H")[0] |
| 4888 | reader.skip(4) |
| 4889 | _experimenter = reader.read("!L")[0] |
| 4890 | assert(_experimenter == 6035143) |
| 4891 | _subtype = reader.read("!L")[0] |
| 4892 | assert(_subtype == 7) |
| 4893 | return obj |
| 4894 | |
| 4895 | def __eq__(self, other): |
| 4896 | if type(self) != type(other): return False |
| 4897 | if self.xid != other.xid: return False |
| 4898 | if self.flags != other.flags: return False |
| 4899 | return True |
| 4900 | |
| 4901 | def pretty_print(self, q): |
| 4902 | q.text("bsn_gentable_stats_request {") |
| 4903 | with q.group(): |
| 4904 | with q.indent(2): |
| 4905 | q.breakable() |
| 4906 | q.text("xid = "); |
| 4907 | if self.xid != None: |
| 4908 | q.text("%#x" % self.xid) |
| 4909 | else: |
| 4910 | q.text('None') |
| 4911 | q.text(","); q.breakable() |
| 4912 | q.text("flags = "); |
| 4913 | q.text("%#x" % self.flags) |
| 4914 | q.breakable() |
| 4915 | q.text('}') |
| 4916 | |
| 4917 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4918 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4919 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4920 | version = 4 |
| 4921 | type = 4 |
| 4922 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4923 | subtype = 10 |
| 4924 | |
| 4925 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4926 | if xid != None: |
| 4927 | self.xid = xid |
| 4928 | else: |
| 4929 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4930 | if interfaces != None: |
| 4931 | self.interfaces = interfaces |
| 4932 | else: |
| 4933 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4934 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4935 | |
| 4936 | def pack(self): |
| 4937 | packed = [] |
| 4938 | packed.append(struct.pack("!B", self.version)) |
| 4939 | packed.append(struct.pack("!B", self.type)) |
| 4940 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4941 | packed.append(struct.pack("!L", self.xid)) |
| 4942 | packed.append(struct.pack("!L", self.experimenter)) |
| 4943 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4944 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4945 | length = sum([len(x) for x in packed]) |
| 4946 | packed[2] = struct.pack("!H", length) |
| 4947 | return ''.join(packed) |
| 4948 | |
| 4949 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4950 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4951 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4952 | _version = reader.read("!B")[0] |
| 4953 | assert(_version == 4) |
| 4954 | _type = reader.read("!B")[0] |
| 4955 | assert(_type == 4) |
| 4956 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4957 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4958 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4959 | obj.xid = reader.read("!L")[0] |
| 4960 | _experimenter = reader.read("!L")[0] |
| 4961 | assert(_experimenter == 6035143) |
| 4962 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4963 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 4964 | 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] | 4965 | return obj |
| 4966 | |
| 4967 | def __eq__(self, other): |
| 4968 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4969 | if self.xid != other.xid: return False |
| 4970 | if self.interfaces != other.interfaces: return False |
| 4971 | return True |
| 4972 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4973 | def pretty_print(self, q): |
| 4974 | q.text("bsn_get_interfaces_reply {") |
| 4975 | with q.group(): |
| 4976 | with q.indent(2): |
| 4977 | q.breakable() |
| 4978 | q.text("xid = "); |
| 4979 | if self.xid != None: |
| 4980 | q.text("%#x" % self.xid) |
| 4981 | else: |
| 4982 | q.text('None') |
| 4983 | q.text(","); q.breakable() |
| 4984 | q.text("interfaces = "); |
| 4985 | q.pp(self.interfaces) |
| 4986 | q.breakable() |
| 4987 | q.text('}') |
| 4988 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4989 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 4990 | |
| 4991 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4992 | version = 4 |
| 4993 | type = 4 |
| 4994 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4995 | subtype = 9 |
| 4996 | |
| 4997 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4998 | if xid != None: |
| 4999 | self.xid = xid |
| 5000 | else: |
| 5001 | self.xid = None |
| 5002 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5003 | |
| 5004 | def pack(self): |
| 5005 | packed = [] |
| 5006 | packed.append(struct.pack("!B", self.version)) |
| 5007 | packed.append(struct.pack("!B", self.type)) |
| 5008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5009 | packed.append(struct.pack("!L", self.xid)) |
| 5010 | packed.append(struct.pack("!L", self.experimenter)) |
| 5011 | packed.append(struct.pack("!L", self.subtype)) |
| 5012 | length = sum([len(x) for x in packed]) |
| 5013 | packed[2] = struct.pack("!H", length) |
| 5014 | return ''.join(packed) |
| 5015 | |
| 5016 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5017 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5018 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5019 | _version = reader.read("!B")[0] |
| 5020 | assert(_version == 4) |
| 5021 | _type = reader.read("!B")[0] |
| 5022 | assert(_type == 4) |
| 5023 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5024 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5025 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5026 | obj.xid = reader.read("!L")[0] |
| 5027 | _experimenter = reader.read("!L")[0] |
| 5028 | assert(_experimenter == 6035143) |
| 5029 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5030 | assert(_subtype == 9) |
| 5031 | return obj |
| 5032 | |
| 5033 | def __eq__(self, other): |
| 5034 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5035 | if self.xid != other.xid: return False |
| 5036 | return True |
| 5037 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5038 | def pretty_print(self, q): |
| 5039 | q.text("bsn_get_interfaces_request {") |
| 5040 | with q.group(): |
| 5041 | with q.indent(2): |
| 5042 | q.breakable() |
| 5043 | q.text("xid = "); |
| 5044 | if self.xid != None: |
| 5045 | q.text("%#x" % self.xid) |
| 5046 | else: |
| 5047 | q.text('None') |
| 5048 | q.breakable() |
| 5049 | q.text('}') |
| 5050 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5051 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 5052 | |
| 5053 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5054 | version = 4 |
| 5055 | type = 4 |
| 5056 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5057 | subtype = 5 |
| 5058 | |
| 5059 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5060 | if xid != None: |
| 5061 | self.xid = xid |
| 5062 | else: |
| 5063 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5064 | if report_mirror_ports != None: |
| 5065 | self.report_mirror_ports = report_mirror_ports |
| 5066 | else: |
| 5067 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5068 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5069 | |
| 5070 | def pack(self): |
| 5071 | packed = [] |
| 5072 | packed.append(struct.pack("!B", self.version)) |
| 5073 | packed.append(struct.pack("!B", self.type)) |
| 5074 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5075 | packed.append(struct.pack("!L", self.xid)) |
| 5076 | packed.append(struct.pack("!L", self.experimenter)) |
| 5077 | packed.append(struct.pack("!L", self.subtype)) |
| 5078 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5079 | packed.append('\x00' * 3) |
| 5080 | length = sum([len(x) for x in packed]) |
| 5081 | packed[2] = struct.pack("!H", length) |
| 5082 | return ''.join(packed) |
| 5083 | |
| 5084 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5085 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5086 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5087 | _version = reader.read("!B")[0] |
| 5088 | assert(_version == 4) |
| 5089 | _type = reader.read("!B")[0] |
| 5090 | assert(_type == 4) |
| 5091 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5092 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5093 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5094 | obj.xid = reader.read("!L")[0] |
| 5095 | _experimenter = reader.read("!L")[0] |
| 5096 | assert(_experimenter == 6035143) |
| 5097 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5098 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5099 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5100 | reader.skip(3) |
| 5101 | return obj |
| 5102 | |
| 5103 | def __eq__(self, other): |
| 5104 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5105 | if self.xid != other.xid: return False |
| 5106 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5107 | return True |
| 5108 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5109 | def pretty_print(self, q): |
| 5110 | q.text("bsn_get_mirroring_reply {") |
| 5111 | with q.group(): |
| 5112 | with q.indent(2): |
| 5113 | q.breakable() |
| 5114 | q.text("xid = "); |
| 5115 | if self.xid != None: |
| 5116 | q.text("%#x" % self.xid) |
| 5117 | else: |
| 5118 | q.text('None') |
| 5119 | q.text(","); q.breakable() |
| 5120 | q.text("report_mirror_ports = "); |
| 5121 | q.text("%#x" % self.report_mirror_ports) |
| 5122 | q.breakable() |
| 5123 | q.text('}') |
| 5124 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5125 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 5126 | |
| 5127 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5128 | version = 4 |
| 5129 | type = 4 |
| 5130 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5131 | subtype = 4 |
| 5132 | |
| 5133 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5134 | if xid != None: |
| 5135 | self.xid = xid |
| 5136 | else: |
| 5137 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5138 | if report_mirror_ports != None: |
| 5139 | self.report_mirror_ports = report_mirror_ports |
| 5140 | else: |
| 5141 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5142 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5143 | |
| 5144 | def pack(self): |
| 5145 | packed = [] |
| 5146 | packed.append(struct.pack("!B", self.version)) |
| 5147 | packed.append(struct.pack("!B", self.type)) |
| 5148 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5149 | packed.append(struct.pack("!L", self.xid)) |
| 5150 | packed.append(struct.pack("!L", self.experimenter)) |
| 5151 | packed.append(struct.pack("!L", self.subtype)) |
| 5152 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5153 | packed.append('\x00' * 3) |
| 5154 | length = sum([len(x) for x in packed]) |
| 5155 | packed[2] = struct.pack("!H", length) |
| 5156 | return ''.join(packed) |
| 5157 | |
| 5158 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5159 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5160 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5161 | _version = reader.read("!B")[0] |
| 5162 | assert(_version == 4) |
| 5163 | _type = reader.read("!B")[0] |
| 5164 | assert(_type == 4) |
| 5165 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5166 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5167 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5168 | obj.xid = reader.read("!L")[0] |
| 5169 | _experimenter = reader.read("!L")[0] |
| 5170 | assert(_experimenter == 6035143) |
| 5171 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5172 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5173 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5174 | reader.skip(3) |
| 5175 | return obj |
| 5176 | |
| 5177 | def __eq__(self, other): |
| 5178 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5179 | if self.xid != other.xid: return False |
| 5180 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5181 | return True |
| 5182 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5183 | def pretty_print(self, q): |
| 5184 | q.text("bsn_get_mirroring_request {") |
| 5185 | with q.group(): |
| 5186 | with q.indent(2): |
| 5187 | q.breakable() |
| 5188 | q.text("xid = "); |
| 5189 | if self.xid != None: |
| 5190 | q.text("%#x" % self.xid) |
| 5191 | else: |
| 5192 | q.text('None') |
| 5193 | q.text(","); q.breakable() |
| 5194 | q.text("report_mirror_ports = "); |
| 5195 | q.text("%#x" % self.report_mirror_ports) |
| 5196 | q.breakable() |
| 5197 | q.text('}') |
| 5198 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5199 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5200 | |
| 5201 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5202 | version = 4 |
| 5203 | type = 4 |
| 5204 | experimenter = 6035143 |
| 5205 | subtype = 52 |
| 5206 | |
| 5207 | def __init__(self, xid=None, pipeline=None): |
| 5208 | if xid != None: |
| 5209 | self.xid = xid |
| 5210 | else: |
| 5211 | self.xid = None |
| 5212 | if pipeline != None: |
| 5213 | self.pipeline = pipeline |
| 5214 | else: |
| 5215 | self.pipeline = "" |
| 5216 | return |
| 5217 | |
| 5218 | def pack(self): |
| 5219 | packed = [] |
| 5220 | packed.append(struct.pack("!B", self.version)) |
| 5221 | packed.append(struct.pack("!B", self.type)) |
| 5222 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5223 | packed.append(struct.pack("!L", self.xid)) |
| 5224 | packed.append(struct.pack("!L", self.experimenter)) |
| 5225 | packed.append(struct.pack("!L", self.subtype)) |
| 5226 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5227 | length = sum([len(x) for x in packed]) |
| 5228 | packed[2] = struct.pack("!H", length) |
| 5229 | return ''.join(packed) |
| 5230 | |
| 5231 | @staticmethod |
| 5232 | def unpack(reader): |
| 5233 | obj = bsn_get_switch_pipeline_reply() |
| 5234 | _version = reader.read("!B")[0] |
| 5235 | assert(_version == 4) |
| 5236 | _type = reader.read("!B")[0] |
| 5237 | assert(_type == 4) |
| 5238 | _length = reader.read("!H")[0] |
| 5239 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5240 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5241 | obj.xid = reader.read("!L")[0] |
| 5242 | _experimenter = reader.read("!L")[0] |
| 5243 | assert(_experimenter == 6035143) |
| 5244 | _subtype = reader.read("!L")[0] |
| 5245 | assert(_subtype == 52) |
| 5246 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5247 | return obj |
| 5248 | |
| 5249 | def __eq__(self, other): |
| 5250 | if type(self) != type(other): return False |
| 5251 | if self.xid != other.xid: return False |
| 5252 | if self.pipeline != other.pipeline: return False |
| 5253 | return True |
| 5254 | |
| 5255 | def pretty_print(self, q): |
| 5256 | q.text("bsn_get_switch_pipeline_reply {") |
| 5257 | with q.group(): |
| 5258 | with q.indent(2): |
| 5259 | q.breakable() |
| 5260 | q.text("xid = "); |
| 5261 | if self.xid != None: |
| 5262 | q.text("%#x" % self.xid) |
| 5263 | else: |
| 5264 | q.text('None') |
| 5265 | q.text(","); q.breakable() |
| 5266 | q.text("pipeline = "); |
| 5267 | q.pp(self.pipeline) |
| 5268 | q.breakable() |
| 5269 | q.text('}') |
| 5270 | |
| 5271 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5272 | |
| 5273 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5274 | version = 4 |
| 5275 | type = 4 |
| 5276 | experimenter = 6035143 |
| 5277 | subtype = 51 |
| 5278 | |
| 5279 | def __init__(self, xid=None): |
| 5280 | if xid != None: |
| 5281 | self.xid = xid |
| 5282 | else: |
| 5283 | self.xid = None |
| 5284 | return |
| 5285 | |
| 5286 | def pack(self): |
| 5287 | packed = [] |
| 5288 | packed.append(struct.pack("!B", self.version)) |
| 5289 | packed.append(struct.pack("!B", self.type)) |
| 5290 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5291 | packed.append(struct.pack("!L", self.xid)) |
| 5292 | packed.append(struct.pack("!L", self.experimenter)) |
| 5293 | packed.append(struct.pack("!L", self.subtype)) |
| 5294 | length = sum([len(x) for x in packed]) |
| 5295 | packed[2] = struct.pack("!H", length) |
| 5296 | return ''.join(packed) |
| 5297 | |
| 5298 | @staticmethod |
| 5299 | def unpack(reader): |
| 5300 | obj = bsn_get_switch_pipeline_request() |
| 5301 | _version = reader.read("!B")[0] |
| 5302 | assert(_version == 4) |
| 5303 | _type = reader.read("!B")[0] |
| 5304 | assert(_type == 4) |
| 5305 | _length = reader.read("!H")[0] |
| 5306 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5307 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5308 | obj.xid = reader.read("!L")[0] |
| 5309 | _experimenter = reader.read("!L")[0] |
| 5310 | assert(_experimenter == 6035143) |
| 5311 | _subtype = reader.read("!L")[0] |
| 5312 | assert(_subtype == 51) |
| 5313 | return obj |
| 5314 | |
| 5315 | def __eq__(self, other): |
| 5316 | if type(self) != type(other): return False |
| 5317 | if self.xid != other.xid: return False |
| 5318 | return True |
| 5319 | |
| 5320 | def pretty_print(self, q): |
| 5321 | q.text("bsn_get_switch_pipeline_request {") |
| 5322 | with q.group(): |
| 5323 | with q.indent(2): |
| 5324 | q.breakable() |
| 5325 | q.text("xid = "); |
| 5326 | if self.xid != None: |
| 5327 | q.text("%#x" % self.xid) |
| 5328 | else: |
| 5329 | q.text('None') |
| 5330 | q.breakable() |
| 5331 | q.text('}') |
| 5332 | |
| 5333 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5334 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5335 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5336 | version = 4 |
| 5337 | type = 19 |
| 5338 | stats_type = 65535 |
| 5339 | experimenter = 6035143 |
| 5340 | subtype = 14 |
| 5341 | |
| 5342 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5343 | if xid != None: |
| 5344 | self.xid = xid |
| 5345 | else: |
| 5346 | self.xid = None |
| 5347 | if flags != None: |
| 5348 | self.flags = flags |
| 5349 | else: |
| 5350 | self.flags = 0 |
| 5351 | if image_checksum != None: |
| 5352 | self.image_checksum = image_checksum |
| 5353 | else: |
| 5354 | self.image_checksum = "" |
| 5355 | if startup_config_checksum != None: |
| 5356 | self.startup_config_checksum = startup_config_checksum |
| 5357 | else: |
| 5358 | self.startup_config_checksum = "" |
| 5359 | return |
| 5360 | |
| 5361 | def pack(self): |
| 5362 | packed = [] |
| 5363 | packed.append(struct.pack("!B", self.version)) |
| 5364 | packed.append(struct.pack("!B", self.type)) |
| 5365 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5366 | packed.append(struct.pack("!L", self.xid)) |
| 5367 | packed.append(struct.pack("!H", self.stats_type)) |
| 5368 | packed.append(struct.pack("!H", self.flags)) |
| 5369 | packed.append('\x00' * 4) |
| 5370 | packed.append(struct.pack("!L", self.experimenter)) |
| 5371 | packed.append(struct.pack("!L", self.subtype)) |
| 5372 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5373 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5374 | length = sum([len(x) for x in packed]) |
| 5375 | packed[2] = struct.pack("!H", length) |
| 5376 | return ''.join(packed) |
| 5377 | |
| 5378 | @staticmethod |
| 5379 | def unpack(reader): |
| 5380 | obj = bsn_image_desc_stats_reply() |
| 5381 | _version = reader.read("!B")[0] |
| 5382 | assert(_version == 4) |
| 5383 | _type = reader.read("!B")[0] |
| 5384 | assert(_type == 19) |
| 5385 | _length = reader.read("!H")[0] |
| 5386 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5387 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5388 | obj.xid = reader.read("!L")[0] |
| 5389 | _stats_type = reader.read("!H")[0] |
| 5390 | assert(_stats_type == 65535) |
| 5391 | obj.flags = reader.read("!H")[0] |
| 5392 | reader.skip(4) |
| 5393 | _experimenter = reader.read("!L")[0] |
| 5394 | assert(_experimenter == 6035143) |
| 5395 | _subtype = reader.read("!L")[0] |
| 5396 | assert(_subtype == 14) |
| 5397 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5398 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5399 | return obj |
| 5400 | |
| 5401 | def __eq__(self, other): |
| 5402 | if type(self) != type(other): return False |
| 5403 | if self.xid != other.xid: return False |
| 5404 | if self.flags != other.flags: return False |
| 5405 | if self.image_checksum != other.image_checksum: return False |
| 5406 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5407 | return True |
| 5408 | |
| 5409 | def pretty_print(self, q): |
| 5410 | q.text("bsn_image_desc_stats_reply {") |
| 5411 | with q.group(): |
| 5412 | with q.indent(2): |
| 5413 | q.breakable() |
| 5414 | q.text("xid = "); |
| 5415 | if self.xid != None: |
| 5416 | q.text("%#x" % self.xid) |
| 5417 | else: |
| 5418 | q.text('None') |
| 5419 | q.text(","); q.breakable() |
| 5420 | q.text("flags = "); |
| 5421 | q.text("%#x" % self.flags) |
| 5422 | q.text(","); q.breakable() |
| 5423 | q.text("image_checksum = "); |
| 5424 | q.pp(self.image_checksum) |
| 5425 | q.text(","); q.breakable() |
| 5426 | q.text("startup_config_checksum = "); |
| 5427 | q.pp(self.startup_config_checksum) |
| 5428 | q.breakable() |
| 5429 | q.text('}') |
| 5430 | |
| 5431 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5432 | |
| 5433 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5434 | version = 4 |
| 5435 | type = 18 |
| 5436 | stats_type = 65535 |
| 5437 | experimenter = 6035143 |
| 5438 | subtype = 14 |
| 5439 | |
| 5440 | def __init__(self, xid=None, flags=None): |
| 5441 | if xid != None: |
| 5442 | self.xid = xid |
| 5443 | else: |
| 5444 | self.xid = None |
| 5445 | if flags != None: |
| 5446 | self.flags = flags |
| 5447 | else: |
| 5448 | self.flags = 0 |
| 5449 | return |
| 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 | packed.append(struct.pack("!H", self.stats_type)) |
| 5458 | packed.append(struct.pack("!H", self.flags)) |
| 5459 | packed.append('\x00' * 4) |
| 5460 | packed.append(struct.pack("!L", self.experimenter)) |
| 5461 | packed.append(struct.pack("!L", self.subtype)) |
| 5462 | length = sum([len(x) for x in packed]) |
| 5463 | packed[2] = struct.pack("!H", length) |
| 5464 | return ''.join(packed) |
| 5465 | |
| 5466 | @staticmethod |
| 5467 | def unpack(reader): |
| 5468 | obj = bsn_image_desc_stats_request() |
| 5469 | _version = reader.read("!B")[0] |
| 5470 | assert(_version == 4) |
| 5471 | _type = reader.read("!B")[0] |
| 5472 | assert(_type == 18) |
| 5473 | _length = reader.read("!H")[0] |
| 5474 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5475 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5476 | obj.xid = reader.read("!L")[0] |
| 5477 | _stats_type = reader.read("!H")[0] |
| 5478 | assert(_stats_type == 65535) |
| 5479 | obj.flags = reader.read("!H")[0] |
| 5480 | reader.skip(4) |
| 5481 | _experimenter = reader.read("!L")[0] |
| 5482 | assert(_experimenter == 6035143) |
| 5483 | _subtype = reader.read("!L")[0] |
| 5484 | assert(_subtype == 14) |
| 5485 | return obj |
| 5486 | |
| 5487 | def __eq__(self, other): |
| 5488 | if type(self) != type(other): return False |
| 5489 | if self.xid != other.xid: return False |
| 5490 | if self.flags != other.flags: return False |
| 5491 | return True |
| 5492 | |
| 5493 | def pretty_print(self, q): |
| 5494 | q.text("bsn_image_desc_stats_request {") |
| 5495 | with q.group(): |
| 5496 | with q.indent(2): |
| 5497 | q.breakable() |
| 5498 | q.text("xid = "); |
| 5499 | if self.xid != None: |
| 5500 | q.text("%#x" % self.xid) |
| 5501 | else: |
| 5502 | q.text('None') |
| 5503 | q.text(","); q.breakable() |
| 5504 | q.text("flags = "); |
| 5505 | q.text("%#x" % self.flags) |
| 5506 | q.breakable() |
| 5507 | q.text('}') |
| 5508 | |
| 5509 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5510 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5511 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5512 | version = 4 |
| 5513 | type = 4 |
| 5514 | experimenter = 6035143 |
| 5515 | subtype = 43 |
| 5516 | |
| 5517 | def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5518 | if xid != None: |
| 5519 | self.xid = xid |
| 5520 | else: |
| 5521 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5522 | if convergence_status != None: |
| 5523 | self.convergence_status = convergence_status |
| 5524 | else: |
| 5525 | self.convergence_status = 0 |
| 5526 | if port_no != None: |
| 5527 | self.port_no = port_no |
| 5528 | else: |
| 5529 | self.port_no = 0 |
| 5530 | if actor_sys_priority != None: |
| 5531 | self.actor_sys_priority = actor_sys_priority |
| 5532 | else: |
| 5533 | self.actor_sys_priority = 0 |
| 5534 | if actor_sys_mac != None: |
| 5535 | self.actor_sys_mac = actor_sys_mac |
| 5536 | else: |
| 5537 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5538 | if actor_port_priority != None: |
| 5539 | self.actor_port_priority = actor_port_priority |
| 5540 | else: |
| 5541 | self.actor_port_priority = 0 |
| 5542 | if actor_port_num != None: |
| 5543 | self.actor_port_num = actor_port_num |
| 5544 | else: |
| 5545 | self.actor_port_num = 0 |
| 5546 | if actor_key != None: |
| 5547 | self.actor_key = actor_key |
| 5548 | else: |
| 5549 | self.actor_key = 0 |
| 5550 | if partner_sys_priority != None: |
| 5551 | self.partner_sys_priority = partner_sys_priority |
| 5552 | else: |
| 5553 | self.partner_sys_priority = 0 |
| 5554 | if partner_sys_mac != None: |
| 5555 | self.partner_sys_mac = partner_sys_mac |
| 5556 | else: |
| 5557 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5558 | if partner_port_priority != None: |
| 5559 | self.partner_port_priority = partner_port_priority |
| 5560 | else: |
| 5561 | self.partner_port_priority = 0 |
| 5562 | if partner_port_num != None: |
| 5563 | self.partner_port_num = partner_port_num |
| 5564 | else: |
| 5565 | self.partner_port_num = 0 |
| 5566 | if partner_key != None: |
| 5567 | self.partner_key = partner_key |
| 5568 | else: |
| 5569 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5570 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5571 | |
| 5572 | def pack(self): |
| 5573 | packed = [] |
| 5574 | packed.append(struct.pack("!B", self.version)) |
| 5575 | packed.append(struct.pack("!B", self.type)) |
| 5576 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5577 | packed.append(struct.pack("!L", self.xid)) |
| 5578 | packed.append(struct.pack("!L", self.experimenter)) |
| 5579 | packed.append(struct.pack("!L", self.subtype)) |
| 5580 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5581 | packed.append('\x00' * 3) |
| 5582 | packed.append(util.pack_port_no(self.port_no)) |
| 5583 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5584 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5585 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5586 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5587 | packed.append(struct.pack("!H", self.actor_key)) |
| 5588 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5589 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5590 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5591 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5592 | packed.append(struct.pack("!H", self.partner_key)) |
| 5593 | length = sum([len(x) for x in packed]) |
| 5594 | packed[2] = struct.pack("!H", length) |
| 5595 | return ''.join(packed) |
| 5596 | |
| 5597 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5598 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5599 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5600 | _version = reader.read("!B")[0] |
| 5601 | assert(_version == 4) |
| 5602 | _type = reader.read("!B")[0] |
| 5603 | assert(_type == 4) |
| 5604 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5605 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5606 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5607 | obj.xid = reader.read("!L")[0] |
| 5608 | _experimenter = reader.read("!L")[0] |
| 5609 | assert(_experimenter == 6035143) |
| 5610 | _subtype = reader.read("!L")[0] |
| 5611 | assert(_subtype == 43) |
| 5612 | obj.convergence_status = reader.read("!B")[0] |
| 5613 | reader.skip(3) |
| 5614 | obj.port_no = util.unpack_port_no(reader) |
| 5615 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5616 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5617 | obj.actor_port_priority = reader.read("!H")[0] |
| 5618 | obj.actor_port_num = reader.read("!H")[0] |
| 5619 | obj.actor_key = reader.read("!H")[0] |
| 5620 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5621 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5622 | obj.partner_port_priority = reader.read("!H")[0] |
| 5623 | obj.partner_port_num = reader.read("!H")[0] |
| 5624 | obj.partner_key = reader.read("!H")[0] |
| 5625 | return obj |
| 5626 | |
| 5627 | def __eq__(self, other): |
| 5628 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5629 | if self.xid != other.xid: return False |
| 5630 | if self.convergence_status != other.convergence_status: return False |
| 5631 | if self.port_no != other.port_no: return False |
| 5632 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5633 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5634 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5635 | if self.actor_port_num != other.actor_port_num: return False |
| 5636 | if self.actor_key != other.actor_key: return False |
| 5637 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5638 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5639 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5640 | if self.partner_port_num != other.partner_port_num: return False |
| 5641 | if self.partner_key != other.partner_key: return False |
| 5642 | return True |
| 5643 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5644 | def pretty_print(self, q): |
| 5645 | q.text("bsn_lacp_convergence_notif {") |
| 5646 | with q.group(): |
| 5647 | with q.indent(2): |
| 5648 | q.breakable() |
| 5649 | q.text("xid = "); |
| 5650 | if self.xid != None: |
| 5651 | q.text("%#x" % self.xid) |
| 5652 | else: |
| 5653 | q.text('None') |
| 5654 | q.text(","); q.breakable() |
| 5655 | q.text("convergence_status = "); |
| 5656 | q.text("%#x" % self.convergence_status) |
| 5657 | q.text(","); q.breakable() |
| 5658 | q.text("port_no = "); |
| 5659 | q.text(util.pretty_port(self.port_no)) |
| 5660 | q.text(","); q.breakable() |
| 5661 | q.text("actor_sys_priority = "); |
| 5662 | q.text("%#x" % self.actor_sys_priority) |
| 5663 | q.text(","); q.breakable() |
| 5664 | q.text("actor_sys_mac = "); |
| 5665 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5666 | q.text(","); q.breakable() |
| 5667 | q.text("actor_port_priority = "); |
| 5668 | q.text("%#x" % self.actor_port_priority) |
| 5669 | q.text(","); q.breakable() |
| 5670 | q.text("actor_port_num = "); |
| 5671 | q.text("%#x" % self.actor_port_num) |
| 5672 | q.text(","); q.breakable() |
| 5673 | q.text("actor_key = "); |
| 5674 | q.text("%#x" % self.actor_key) |
| 5675 | q.text(","); q.breakable() |
| 5676 | q.text("partner_sys_priority = "); |
| 5677 | q.text("%#x" % self.partner_sys_priority) |
| 5678 | q.text(","); q.breakable() |
| 5679 | q.text("partner_sys_mac = "); |
| 5680 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5681 | q.text(","); q.breakable() |
| 5682 | q.text("partner_port_priority = "); |
| 5683 | q.text("%#x" % self.partner_port_priority) |
| 5684 | q.text(","); q.breakable() |
| 5685 | q.text("partner_port_num = "); |
| 5686 | q.text("%#x" % self.partner_port_num) |
| 5687 | q.text(","); q.breakable() |
| 5688 | q.text("partner_key = "); |
| 5689 | q.text("%#x" % self.partner_key) |
| 5690 | q.breakable() |
| 5691 | q.text('}') |
| 5692 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5693 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5694 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5695 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5696 | version = 4 |
| 5697 | type = 19 |
| 5698 | stats_type = 65535 |
| 5699 | experimenter = 6035143 |
| 5700 | subtype = 1 |
| 5701 | |
| 5702 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5703 | if xid != None: |
| 5704 | self.xid = xid |
| 5705 | else: |
| 5706 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5707 | if flags != None: |
| 5708 | self.flags = flags |
| 5709 | else: |
| 5710 | self.flags = 0 |
| 5711 | if entries != None: |
| 5712 | self.entries = entries |
| 5713 | else: |
| 5714 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5715 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5716 | |
| 5717 | def pack(self): |
| 5718 | packed = [] |
| 5719 | packed.append(struct.pack("!B", self.version)) |
| 5720 | packed.append(struct.pack("!B", self.type)) |
| 5721 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5722 | packed.append(struct.pack("!L", self.xid)) |
| 5723 | packed.append(struct.pack("!H", self.stats_type)) |
| 5724 | packed.append(struct.pack("!H", self.flags)) |
| 5725 | packed.append('\x00' * 4) |
| 5726 | packed.append(struct.pack("!L", self.experimenter)) |
| 5727 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5728 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5729 | length = sum([len(x) for x in packed]) |
| 5730 | packed[2] = struct.pack("!H", length) |
| 5731 | return ''.join(packed) |
| 5732 | |
| 5733 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5734 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5735 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5736 | _version = reader.read("!B")[0] |
| 5737 | assert(_version == 4) |
| 5738 | _type = reader.read("!B")[0] |
| 5739 | assert(_type == 19) |
| 5740 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5741 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5742 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5743 | obj.xid = reader.read("!L")[0] |
| 5744 | _stats_type = reader.read("!H")[0] |
| 5745 | assert(_stats_type == 65535) |
| 5746 | obj.flags = reader.read("!H")[0] |
| 5747 | reader.skip(4) |
| 5748 | _experimenter = reader.read("!L")[0] |
| 5749 | assert(_experimenter == 6035143) |
| 5750 | _subtype = reader.read("!L")[0] |
| 5751 | assert(_subtype == 1) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 5752 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_lacp_stats_entry.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5753 | return obj |
| 5754 | |
| 5755 | def __eq__(self, other): |
| 5756 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5757 | if self.xid != other.xid: return False |
| 5758 | if self.flags != other.flags: return False |
| 5759 | if self.entries != other.entries: return False |
| 5760 | return True |
| 5761 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5762 | def pretty_print(self, q): |
| 5763 | q.text("bsn_lacp_stats_reply {") |
| 5764 | with q.group(): |
| 5765 | with q.indent(2): |
| 5766 | q.breakable() |
| 5767 | q.text("xid = "); |
| 5768 | if self.xid != None: |
| 5769 | q.text("%#x" % self.xid) |
| 5770 | else: |
| 5771 | q.text('None') |
| 5772 | q.text(","); q.breakable() |
| 5773 | q.text("flags = "); |
| 5774 | q.text("%#x" % self.flags) |
| 5775 | q.text(","); q.breakable() |
| 5776 | q.text("entries = "); |
| 5777 | q.pp(self.entries) |
| 5778 | q.breakable() |
| 5779 | q.text('}') |
| 5780 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5781 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5782 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5783 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5784 | version = 4 |
| 5785 | type = 18 |
| 5786 | stats_type = 65535 |
| 5787 | experimenter = 6035143 |
| 5788 | subtype = 1 |
| 5789 | |
| 5790 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5791 | if xid != None: |
| 5792 | self.xid = xid |
| 5793 | else: |
| 5794 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5795 | if flags != None: |
| 5796 | self.flags = flags |
| 5797 | else: |
| 5798 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5799 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5800 | |
| 5801 | def pack(self): |
| 5802 | packed = [] |
| 5803 | packed.append(struct.pack("!B", self.version)) |
| 5804 | packed.append(struct.pack("!B", self.type)) |
| 5805 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5806 | packed.append(struct.pack("!L", self.xid)) |
| 5807 | packed.append(struct.pack("!H", self.stats_type)) |
| 5808 | packed.append(struct.pack("!H", self.flags)) |
| 5809 | packed.append('\x00' * 4) |
| 5810 | packed.append(struct.pack("!L", self.experimenter)) |
| 5811 | packed.append(struct.pack("!L", self.subtype)) |
| 5812 | length = sum([len(x) for x in packed]) |
| 5813 | packed[2] = struct.pack("!H", length) |
| 5814 | return ''.join(packed) |
| 5815 | |
| 5816 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5817 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5818 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5819 | _version = reader.read("!B")[0] |
| 5820 | assert(_version == 4) |
| 5821 | _type = reader.read("!B")[0] |
| 5822 | assert(_type == 18) |
| 5823 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5824 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5825 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5826 | obj.xid = reader.read("!L")[0] |
| 5827 | _stats_type = reader.read("!H")[0] |
| 5828 | assert(_stats_type == 65535) |
| 5829 | obj.flags = reader.read("!H")[0] |
| 5830 | reader.skip(4) |
| 5831 | _experimenter = reader.read("!L")[0] |
| 5832 | assert(_experimenter == 6035143) |
| 5833 | _subtype = reader.read("!L")[0] |
| 5834 | assert(_subtype == 1) |
| 5835 | return obj |
| 5836 | |
| 5837 | def __eq__(self, other): |
| 5838 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5839 | if self.xid != other.xid: return False |
| 5840 | if self.flags != other.flags: return False |
| 5841 | return True |
| 5842 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5843 | def pretty_print(self, q): |
| 5844 | q.text("bsn_lacp_stats_request {") |
| 5845 | with q.group(): |
| 5846 | with q.indent(2): |
| 5847 | q.breakable() |
| 5848 | q.text("xid = "); |
| 5849 | if self.xid != None: |
| 5850 | q.text("%#x" % self.xid) |
| 5851 | else: |
| 5852 | q.text('None') |
| 5853 | q.text(","); q.breakable() |
| 5854 | q.text("flags = "); |
| 5855 | q.text("%#x" % self.flags) |
| 5856 | q.breakable() |
| 5857 | q.text('}') |
| 5858 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5859 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5860 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5861 | class bsn_log(bsn_header): |
| 5862 | version = 4 |
| 5863 | type = 4 |
| 5864 | experimenter = 6035143 |
| 5865 | subtype = 63 |
| 5866 | |
| 5867 | def __init__(self, xid=None, loglevel=None, data=None): |
| 5868 | if xid != None: |
| 5869 | self.xid = xid |
| 5870 | else: |
| 5871 | self.xid = None |
| 5872 | if loglevel != None: |
| 5873 | self.loglevel = loglevel |
| 5874 | else: |
| 5875 | self.loglevel = 0 |
| 5876 | if data != None: |
| 5877 | self.data = data |
| 5878 | else: |
| 5879 | self.data = '' |
| 5880 | return |
| 5881 | |
| 5882 | def pack(self): |
| 5883 | packed = [] |
| 5884 | packed.append(struct.pack("!B", self.version)) |
| 5885 | packed.append(struct.pack("!B", self.type)) |
| 5886 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5887 | packed.append(struct.pack("!L", self.xid)) |
| 5888 | packed.append(struct.pack("!L", self.experimenter)) |
| 5889 | packed.append(struct.pack("!L", self.subtype)) |
| 5890 | packed.append(struct.pack("!B", self.loglevel)) |
| 5891 | packed.append(self.data) |
| 5892 | length = sum([len(x) for x in packed]) |
| 5893 | packed[2] = struct.pack("!H", length) |
| 5894 | return ''.join(packed) |
| 5895 | |
| 5896 | @staticmethod |
| 5897 | def unpack(reader): |
| 5898 | obj = bsn_log() |
| 5899 | _version = reader.read("!B")[0] |
| 5900 | assert(_version == 4) |
| 5901 | _type = reader.read("!B")[0] |
| 5902 | assert(_type == 4) |
| 5903 | _length = reader.read("!H")[0] |
| 5904 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5905 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5906 | obj.xid = reader.read("!L")[0] |
| 5907 | _experimenter = reader.read("!L")[0] |
| 5908 | assert(_experimenter == 6035143) |
| 5909 | _subtype = reader.read("!L")[0] |
| 5910 | assert(_subtype == 63) |
| 5911 | obj.loglevel = reader.read("!B")[0] |
| 5912 | obj.data = str(reader.read_all()) |
| 5913 | return obj |
| 5914 | |
| 5915 | def __eq__(self, other): |
| 5916 | if type(self) != type(other): return False |
| 5917 | if self.xid != other.xid: return False |
| 5918 | if self.loglevel != other.loglevel: return False |
| 5919 | if self.data != other.data: return False |
| 5920 | return True |
| 5921 | |
| 5922 | def pretty_print(self, q): |
| 5923 | q.text("bsn_log {") |
| 5924 | with q.group(): |
| 5925 | with q.indent(2): |
| 5926 | q.breakable() |
| 5927 | q.text("xid = "); |
| 5928 | if self.xid != None: |
| 5929 | q.text("%#x" % self.xid) |
| 5930 | else: |
| 5931 | q.text('None') |
| 5932 | q.text(","); q.breakable() |
| 5933 | q.text("loglevel = "); |
| 5934 | q.text("%#x" % self.loglevel) |
| 5935 | q.text(","); q.breakable() |
| 5936 | q.text("data = "); |
| 5937 | q.pp(self.data) |
| 5938 | q.breakable() |
| 5939 | q.text('}') |
| 5940 | |
| 5941 | bsn_header.subtypes[63] = bsn_log |
| 5942 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 5943 | class bsn_lua_command_reply(bsn_header): |
| 5944 | version = 4 |
| 5945 | type = 4 |
| 5946 | experimenter = 6035143 |
| 5947 | subtype = 66 |
| 5948 | |
| 5949 | def __init__(self, xid=None, data=None): |
| 5950 | if xid != None: |
| 5951 | self.xid = xid |
| 5952 | else: |
| 5953 | self.xid = None |
| 5954 | if data != None: |
| 5955 | self.data = data |
| 5956 | else: |
| 5957 | self.data = '' |
| 5958 | return |
| 5959 | |
| 5960 | def pack(self): |
| 5961 | packed = [] |
| 5962 | packed.append(struct.pack("!B", self.version)) |
| 5963 | packed.append(struct.pack("!B", self.type)) |
| 5964 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5965 | packed.append(struct.pack("!L", self.xid)) |
| 5966 | packed.append(struct.pack("!L", self.experimenter)) |
| 5967 | packed.append(struct.pack("!L", self.subtype)) |
| 5968 | packed.append(self.data) |
| 5969 | length = sum([len(x) for x in packed]) |
| 5970 | packed[2] = struct.pack("!H", length) |
| 5971 | return ''.join(packed) |
| 5972 | |
| 5973 | @staticmethod |
| 5974 | def unpack(reader): |
| 5975 | obj = bsn_lua_command_reply() |
| 5976 | _version = reader.read("!B")[0] |
| 5977 | assert(_version == 4) |
| 5978 | _type = reader.read("!B")[0] |
| 5979 | assert(_type == 4) |
| 5980 | _length = reader.read("!H")[0] |
| 5981 | orig_reader = reader |
| 5982 | reader = orig_reader.slice(_length, 4) |
| 5983 | obj.xid = reader.read("!L")[0] |
| 5984 | _experimenter = reader.read("!L")[0] |
| 5985 | assert(_experimenter == 6035143) |
| 5986 | _subtype = reader.read("!L")[0] |
| 5987 | assert(_subtype == 66) |
| 5988 | obj.data = str(reader.read_all()) |
| 5989 | return obj |
| 5990 | |
| 5991 | def __eq__(self, other): |
| 5992 | if type(self) != type(other): return False |
| 5993 | if self.xid != other.xid: return False |
| 5994 | if self.data != other.data: return False |
| 5995 | return True |
| 5996 | |
| 5997 | def pretty_print(self, q): |
| 5998 | q.text("bsn_lua_command_reply {") |
| 5999 | with q.group(): |
| 6000 | with q.indent(2): |
| 6001 | q.breakable() |
| 6002 | q.text("xid = "); |
| 6003 | if self.xid != None: |
| 6004 | q.text("%#x" % self.xid) |
| 6005 | else: |
| 6006 | q.text('None') |
| 6007 | q.text(","); q.breakable() |
| 6008 | q.text("data = "); |
| 6009 | q.pp(self.data) |
| 6010 | q.breakable() |
| 6011 | q.text('}') |
| 6012 | |
| 6013 | bsn_header.subtypes[66] = bsn_lua_command_reply |
| 6014 | |
| 6015 | class bsn_lua_command_request(bsn_header): |
| 6016 | version = 4 |
| 6017 | type = 4 |
| 6018 | experimenter = 6035143 |
| 6019 | subtype = 65 |
| 6020 | |
| 6021 | def __init__(self, xid=None, data=None): |
| 6022 | if xid != None: |
| 6023 | self.xid = xid |
| 6024 | else: |
| 6025 | self.xid = None |
| 6026 | if data != None: |
| 6027 | self.data = data |
| 6028 | else: |
| 6029 | self.data = '' |
| 6030 | return |
| 6031 | |
| 6032 | def pack(self): |
| 6033 | packed = [] |
| 6034 | packed.append(struct.pack("!B", self.version)) |
| 6035 | packed.append(struct.pack("!B", self.type)) |
| 6036 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6037 | packed.append(struct.pack("!L", self.xid)) |
| 6038 | packed.append(struct.pack("!L", self.experimenter)) |
| 6039 | packed.append(struct.pack("!L", self.subtype)) |
| 6040 | packed.append(self.data) |
| 6041 | length = sum([len(x) for x in packed]) |
| 6042 | packed[2] = struct.pack("!H", length) |
| 6043 | return ''.join(packed) |
| 6044 | |
| 6045 | @staticmethod |
| 6046 | def unpack(reader): |
| 6047 | obj = bsn_lua_command_request() |
| 6048 | _version = reader.read("!B")[0] |
| 6049 | assert(_version == 4) |
| 6050 | _type = reader.read("!B")[0] |
| 6051 | assert(_type == 4) |
| 6052 | _length = reader.read("!H")[0] |
| 6053 | orig_reader = reader |
| 6054 | reader = orig_reader.slice(_length, 4) |
| 6055 | obj.xid = reader.read("!L")[0] |
| 6056 | _experimenter = reader.read("!L")[0] |
| 6057 | assert(_experimenter == 6035143) |
| 6058 | _subtype = reader.read("!L")[0] |
| 6059 | assert(_subtype == 65) |
| 6060 | obj.data = str(reader.read_all()) |
| 6061 | return obj |
| 6062 | |
| 6063 | def __eq__(self, other): |
| 6064 | if type(self) != type(other): return False |
| 6065 | if self.xid != other.xid: return False |
| 6066 | if self.data != other.data: return False |
| 6067 | return True |
| 6068 | |
| 6069 | def pretty_print(self, q): |
| 6070 | q.text("bsn_lua_command_request {") |
| 6071 | with q.group(): |
| 6072 | with q.indent(2): |
| 6073 | q.breakable() |
| 6074 | q.text("xid = "); |
| 6075 | if self.xid != None: |
| 6076 | q.text("%#x" % self.xid) |
| 6077 | else: |
| 6078 | q.text('None') |
| 6079 | q.text(","); q.breakable() |
| 6080 | q.text("data = "); |
| 6081 | q.pp(self.data) |
| 6082 | q.breakable() |
| 6083 | q.text('}') |
| 6084 | |
| 6085 | bsn_header.subtypes[65] = bsn_lua_command_request |
| 6086 | |
| 6087 | class bsn_lua_notification(bsn_header): |
| 6088 | version = 4 |
| 6089 | type = 4 |
| 6090 | experimenter = 6035143 |
| 6091 | subtype = 67 |
| 6092 | |
| 6093 | def __init__(self, xid=None, data=None): |
| 6094 | if xid != None: |
| 6095 | self.xid = xid |
| 6096 | else: |
| 6097 | self.xid = None |
| 6098 | if data != None: |
| 6099 | self.data = data |
| 6100 | else: |
| 6101 | self.data = '' |
| 6102 | return |
| 6103 | |
| 6104 | def pack(self): |
| 6105 | packed = [] |
| 6106 | packed.append(struct.pack("!B", self.version)) |
| 6107 | packed.append(struct.pack("!B", self.type)) |
| 6108 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6109 | packed.append(struct.pack("!L", self.xid)) |
| 6110 | packed.append(struct.pack("!L", self.experimenter)) |
| 6111 | packed.append(struct.pack("!L", self.subtype)) |
| 6112 | packed.append(self.data) |
| 6113 | length = sum([len(x) for x in packed]) |
| 6114 | packed[2] = struct.pack("!H", length) |
| 6115 | return ''.join(packed) |
| 6116 | |
| 6117 | @staticmethod |
| 6118 | def unpack(reader): |
| 6119 | obj = bsn_lua_notification() |
| 6120 | _version = reader.read("!B")[0] |
| 6121 | assert(_version == 4) |
| 6122 | _type = reader.read("!B")[0] |
| 6123 | assert(_type == 4) |
| 6124 | _length = reader.read("!H")[0] |
| 6125 | orig_reader = reader |
| 6126 | reader = orig_reader.slice(_length, 4) |
| 6127 | obj.xid = reader.read("!L")[0] |
| 6128 | _experimenter = reader.read("!L")[0] |
| 6129 | assert(_experimenter == 6035143) |
| 6130 | _subtype = reader.read("!L")[0] |
| 6131 | assert(_subtype == 67) |
| 6132 | obj.data = str(reader.read_all()) |
| 6133 | return obj |
| 6134 | |
| 6135 | def __eq__(self, other): |
| 6136 | if type(self) != type(other): return False |
| 6137 | if self.xid != other.xid: return False |
| 6138 | if self.data != other.data: return False |
| 6139 | return True |
| 6140 | |
| 6141 | def pretty_print(self, q): |
| 6142 | q.text("bsn_lua_notification {") |
| 6143 | with q.group(): |
| 6144 | with q.indent(2): |
| 6145 | q.breakable() |
| 6146 | q.text("xid = "); |
| 6147 | if self.xid != None: |
| 6148 | q.text("%#x" % self.xid) |
| 6149 | else: |
| 6150 | q.text('None') |
| 6151 | q.text(","); q.breakable() |
| 6152 | q.text("data = "); |
| 6153 | q.pp(self.data) |
| 6154 | q.breakable() |
| 6155 | q.text('}') |
| 6156 | |
| 6157 | bsn_header.subtypes[67] = bsn_lua_notification |
| 6158 | |
| 6159 | class bsn_lua_upload(bsn_header): |
| 6160 | version = 4 |
| 6161 | type = 4 |
| 6162 | experimenter = 6035143 |
| 6163 | subtype = 64 |
| 6164 | |
| 6165 | def __init__(self, xid=None, flags=None, filename=None, data=None): |
| 6166 | if xid != None: |
| 6167 | self.xid = xid |
| 6168 | else: |
| 6169 | self.xid = None |
| 6170 | if flags != None: |
| 6171 | self.flags = flags |
| 6172 | else: |
| 6173 | self.flags = 0 |
| 6174 | if filename != None: |
| 6175 | self.filename = filename |
| 6176 | else: |
| 6177 | self.filename = "" |
| 6178 | if data != None: |
| 6179 | self.data = data |
| 6180 | else: |
| 6181 | self.data = '' |
| 6182 | return |
| 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("!L", self.experimenter)) |
| 6191 | packed.append(struct.pack("!L", self.subtype)) |
| 6192 | packed.append(struct.pack("!H", self.flags)) |
| 6193 | packed.append(struct.pack("!64s", self.filename)) |
| 6194 | packed.append(self.data) |
| 6195 | length = sum([len(x) for x in packed]) |
| 6196 | packed[2] = struct.pack("!H", length) |
| 6197 | return ''.join(packed) |
| 6198 | |
| 6199 | @staticmethod |
| 6200 | def unpack(reader): |
| 6201 | obj = bsn_lua_upload() |
| 6202 | _version = reader.read("!B")[0] |
| 6203 | assert(_version == 4) |
| 6204 | _type = reader.read("!B")[0] |
| 6205 | assert(_type == 4) |
| 6206 | _length = reader.read("!H")[0] |
| 6207 | orig_reader = reader |
| 6208 | reader = orig_reader.slice(_length, 4) |
| 6209 | obj.xid = reader.read("!L")[0] |
| 6210 | _experimenter = reader.read("!L")[0] |
| 6211 | assert(_experimenter == 6035143) |
| 6212 | _subtype = reader.read("!L")[0] |
| 6213 | assert(_subtype == 64) |
| 6214 | obj.flags = reader.read("!H")[0] |
| 6215 | obj.filename = reader.read("!64s")[0].rstrip("\x00") |
| 6216 | obj.data = str(reader.read_all()) |
| 6217 | return obj |
| 6218 | |
| 6219 | def __eq__(self, other): |
| 6220 | if type(self) != type(other): return False |
| 6221 | if self.xid != other.xid: return False |
| 6222 | if self.flags != other.flags: return False |
| 6223 | if self.filename != other.filename: return False |
| 6224 | if self.data != other.data: return False |
| 6225 | return True |
| 6226 | |
| 6227 | def pretty_print(self, q): |
| 6228 | q.text("bsn_lua_upload {") |
| 6229 | with q.group(): |
| 6230 | with q.indent(2): |
| 6231 | q.breakable() |
| 6232 | q.text("xid = "); |
| 6233 | if self.xid != None: |
| 6234 | q.text("%#x" % self.xid) |
| 6235 | else: |
| 6236 | q.text('None') |
| 6237 | q.text(","); q.breakable() |
| 6238 | q.text("flags = "); |
| 6239 | q.text("%#x" % self.flags) |
| 6240 | q.text(","); q.breakable() |
| 6241 | q.text("filename = "); |
| 6242 | q.pp(self.filename) |
| 6243 | q.text(","); q.breakable() |
| 6244 | q.text("data = "); |
| 6245 | q.pp(self.data) |
| 6246 | q.breakable() |
| 6247 | q.text('}') |
| 6248 | |
| 6249 | bsn_header.subtypes[64] = bsn_lua_upload |
| 6250 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6251 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6252 | version = 4 |
| 6253 | type = 4 |
| 6254 | experimenter = 6035143 |
| 6255 | subtype = 34 |
| 6256 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6257 | 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] | 6258 | if xid != None: |
| 6259 | self.xid = xid |
| 6260 | else: |
| 6261 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6262 | if status != None: |
| 6263 | self.status = status |
| 6264 | else: |
| 6265 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6266 | if port_no != None: |
| 6267 | self.port_no = port_no |
| 6268 | else: |
| 6269 | self.port_no = 0 |
| 6270 | if slot_num != None: |
| 6271 | self.slot_num = slot_num |
| 6272 | else: |
| 6273 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6274 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6275 | |
| 6276 | def pack(self): |
| 6277 | packed = [] |
| 6278 | packed.append(struct.pack("!B", self.version)) |
| 6279 | packed.append(struct.pack("!B", self.type)) |
| 6280 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6281 | packed.append(struct.pack("!L", self.xid)) |
| 6282 | packed.append(struct.pack("!L", self.experimenter)) |
| 6283 | packed.append(struct.pack("!L", self.subtype)) |
| 6284 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6285 | packed.append(util.pack_port_no(self.port_no)) |
| 6286 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6287 | length = sum([len(x) for x in packed]) |
| 6288 | packed[2] = struct.pack("!H", length) |
| 6289 | return ''.join(packed) |
| 6290 | |
| 6291 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6292 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6293 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6294 | _version = reader.read("!B")[0] |
| 6295 | assert(_version == 4) |
| 6296 | _type = reader.read("!B")[0] |
| 6297 | assert(_type == 4) |
| 6298 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6299 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6300 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6301 | obj.xid = reader.read("!L")[0] |
| 6302 | _experimenter = reader.read("!L")[0] |
| 6303 | assert(_experimenter == 6035143) |
| 6304 | _subtype = reader.read("!L")[0] |
| 6305 | assert(_subtype == 34) |
| 6306 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6307 | obj.port_no = util.unpack_port_no(reader) |
| 6308 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6309 | return obj |
| 6310 | |
| 6311 | def __eq__(self, other): |
| 6312 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6313 | if self.xid != other.xid: return False |
| 6314 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6315 | if self.port_no != other.port_no: return False |
| 6316 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6317 | return True |
| 6318 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6319 | def pretty_print(self, q): |
| 6320 | q.text("bsn_pdu_rx_reply {") |
| 6321 | with q.group(): |
| 6322 | with q.indent(2): |
| 6323 | q.breakable() |
| 6324 | q.text("xid = "); |
| 6325 | if self.xid != None: |
| 6326 | q.text("%#x" % self.xid) |
| 6327 | else: |
| 6328 | q.text('None') |
| 6329 | q.text(","); q.breakable() |
| 6330 | q.text("status = "); |
| 6331 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6332 | q.text(","); q.breakable() |
| 6333 | q.text("port_no = "); |
| 6334 | q.text(util.pretty_port(self.port_no)) |
| 6335 | q.text(","); q.breakable() |
| 6336 | q.text("slot_num = "); |
| 6337 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6338 | q.breakable() |
| 6339 | q.text('}') |
| 6340 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6341 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 6342 | |
| 6343 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6344 | version = 4 |
| 6345 | type = 4 |
| 6346 | experimenter = 6035143 |
| 6347 | subtype = 33 |
| 6348 | |
| 6349 | 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] | 6350 | if xid != None: |
| 6351 | self.xid = xid |
| 6352 | else: |
| 6353 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6354 | if timeout_ms != None: |
| 6355 | self.timeout_ms = timeout_ms |
| 6356 | else: |
| 6357 | self.timeout_ms = 0 |
| 6358 | if port_no != None: |
| 6359 | self.port_no = port_no |
| 6360 | else: |
| 6361 | self.port_no = 0 |
| 6362 | if slot_num != None: |
| 6363 | self.slot_num = slot_num |
| 6364 | else: |
| 6365 | self.slot_num = 0 |
| 6366 | if data != None: |
| 6367 | self.data = data |
| 6368 | else: |
| 6369 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6370 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6371 | |
| 6372 | def pack(self): |
| 6373 | packed = [] |
| 6374 | packed.append(struct.pack("!B", self.version)) |
| 6375 | packed.append(struct.pack("!B", self.type)) |
| 6376 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6377 | packed.append(struct.pack("!L", self.xid)) |
| 6378 | packed.append(struct.pack("!L", self.experimenter)) |
| 6379 | packed.append(struct.pack("!L", self.subtype)) |
| 6380 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 6381 | packed.append(util.pack_port_no(self.port_no)) |
| 6382 | packed.append(struct.pack("!B", self.slot_num)) |
| 6383 | packed.append('\x00' * 3) |
| 6384 | packed.append(self.data) |
| 6385 | length = sum([len(x) for x in packed]) |
| 6386 | packed[2] = struct.pack("!H", length) |
| 6387 | return ''.join(packed) |
| 6388 | |
| 6389 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6390 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6391 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6392 | _version = reader.read("!B")[0] |
| 6393 | assert(_version == 4) |
| 6394 | _type = reader.read("!B")[0] |
| 6395 | assert(_type == 4) |
| 6396 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6397 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6398 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6399 | obj.xid = reader.read("!L")[0] |
| 6400 | _experimenter = reader.read("!L")[0] |
| 6401 | assert(_experimenter == 6035143) |
| 6402 | _subtype = reader.read("!L")[0] |
| 6403 | assert(_subtype == 33) |
| 6404 | obj.timeout_ms = reader.read("!L")[0] |
| 6405 | obj.port_no = util.unpack_port_no(reader) |
| 6406 | obj.slot_num = reader.read("!B")[0] |
| 6407 | reader.skip(3) |
| 6408 | obj.data = str(reader.read_all()) |
| 6409 | return obj |
| 6410 | |
| 6411 | def __eq__(self, other): |
| 6412 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6413 | if self.xid != other.xid: return False |
| 6414 | if self.timeout_ms != other.timeout_ms: return False |
| 6415 | if self.port_no != other.port_no: return False |
| 6416 | if self.slot_num != other.slot_num: return False |
| 6417 | if self.data != other.data: return False |
| 6418 | return True |
| 6419 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6420 | def pretty_print(self, q): |
| 6421 | q.text("bsn_pdu_rx_request {") |
| 6422 | with q.group(): |
| 6423 | with q.indent(2): |
| 6424 | q.breakable() |
| 6425 | q.text("xid = "); |
| 6426 | if self.xid != None: |
| 6427 | q.text("%#x" % self.xid) |
| 6428 | else: |
| 6429 | q.text('None') |
| 6430 | q.text(","); q.breakable() |
| 6431 | q.text("timeout_ms = "); |
| 6432 | q.text("%#x" % self.timeout_ms) |
| 6433 | q.text(","); q.breakable() |
| 6434 | q.text("port_no = "); |
| 6435 | q.text(util.pretty_port(self.port_no)) |
| 6436 | q.text(","); q.breakable() |
| 6437 | q.text("slot_num = "); |
| 6438 | q.text("%#x" % self.slot_num) |
| 6439 | q.text(","); q.breakable() |
| 6440 | q.text("data = "); |
| 6441 | q.pp(self.data) |
| 6442 | q.breakable() |
| 6443 | q.text('}') |
| 6444 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6445 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 6446 | |
| 6447 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6448 | version = 4 |
| 6449 | type = 4 |
| 6450 | experimenter = 6035143 |
| 6451 | subtype = 35 |
| 6452 | |
| 6453 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6454 | if xid != None: |
| 6455 | self.xid = xid |
| 6456 | else: |
| 6457 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6458 | if port_no != None: |
| 6459 | self.port_no = port_no |
| 6460 | else: |
| 6461 | self.port_no = 0 |
| 6462 | if slot_num != None: |
| 6463 | self.slot_num = slot_num |
| 6464 | else: |
| 6465 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6466 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6467 | |
| 6468 | def pack(self): |
| 6469 | packed = [] |
| 6470 | packed.append(struct.pack("!B", self.version)) |
| 6471 | packed.append(struct.pack("!B", self.type)) |
| 6472 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6473 | packed.append(struct.pack("!L", self.xid)) |
| 6474 | packed.append(struct.pack("!L", self.experimenter)) |
| 6475 | packed.append(struct.pack("!L", self.subtype)) |
| 6476 | packed.append(util.pack_port_no(self.port_no)) |
| 6477 | packed.append(struct.pack("!B", self.slot_num)) |
| 6478 | length = sum([len(x) for x in packed]) |
| 6479 | packed[2] = struct.pack("!H", length) |
| 6480 | return ''.join(packed) |
| 6481 | |
| 6482 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6483 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6484 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6485 | _version = reader.read("!B")[0] |
| 6486 | assert(_version == 4) |
| 6487 | _type = reader.read("!B")[0] |
| 6488 | assert(_type == 4) |
| 6489 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6490 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6491 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6492 | obj.xid = reader.read("!L")[0] |
| 6493 | _experimenter = reader.read("!L")[0] |
| 6494 | assert(_experimenter == 6035143) |
| 6495 | _subtype = reader.read("!L")[0] |
| 6496 | assert(_subtype == 35) |
| 6497 | obj.port_no = util.unpack_port_no(reader) |
| 6498 | obj.slot_num = reader.read("!B")[0] |
| 6499 | return obj |
| 6500 | |
| 6501 | def __eq__(self, other): |
| 6502 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6503 | if self.xid != other.xid: return False |
| 6504 | if self.port_no != other.port_no: return False |
| 6505 | if self.slot_num != other.slot_num: return False |
| 6506 | return True |
| 6507 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6508 | def pretty_print(self, q): |
| 6509 | q.text("bsn_pdu_rx_timeout {") |
| 6510 | with q.group(): |
| 6511 | with q.indent(2): |
| 6512 | q.breakable() |
| 6513 | q.text("xid = "); |
| 6514 | if self.xid != None: |
| 6515 | q.text("%#x" % self.xid) |
| 6516 | else: |
| 6517 | q.text('None') |
| 6518 | q.text(","); q.breakable() |
| 6519 | q.text("port_no = "); |
| 6520 | q.text(util.pretty_port(self.port_no)) |
| 6521 | q.text(","); q.breakable() |
| 6522 | q.text("slot_num = "); |
| 6523 | q.text("%#x" % self.slot_num) |
| 6524 | q.breakable() |
| 6525 | q.text('}') |
| 6526 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6527 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6528 | |
| 6529 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6530 | version = 4 |
| 6531 | type = 4 |
| 6532 | experimenter = 6035143 |
| 6533 | subtype = 32 |
| 6534 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6535 | 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] | 6536 | if xid != None: |
| 6537 | self.xid = xid |
| 6538 | else: |
| 6539 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6540 | if status != None: |
| 6541 | self.status = status |
| 6542 | else: |
| 6543 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6544 | if port_no != None: |
| 6545 | self.port_no = port_no |
| 6546 | else: |
| 6547 | self.port_no = 0 |
| 6548 | if slot_num != None: |
| 6549 | self.slot_num = slot_num |
| 6550 | else: |
| 6551 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6552 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6553 | |
| 6554 | def pack(self): |
| 6555 | packed = [] |
| 6556 | packed.append(struct.pack("!B", self.version)) |
| 6557 | packed.append(struct.pack("!B", self.type)) |
| 6558 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6559 | packed.append(struct.pack("!L", self.xid)) |
| 6560 | packed.append(struct.pack("!L", self.experimenter)) |
| 6561 | packed.append(struct.pack("!L", self.subtype)) |
| 6562 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6563 | packed.append(util.pack_port_no(self.port_no)) |
| 6564 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6565 | length = sum([len(x) for x in packed]) |
| 6566 | packed[2] = struct.pack("!H", length) |
| 6567 | return ''.join(packed) |
| 6568 | |
| 6569 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6570 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6571 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6572 | _version = reader.read("!B")[0] |
| 6573 | assert(_version == 4) |
| 6574 | _type = reader.read("!B")[0] |
| 6575 | assert(_type == 4) |
| 6576 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6577 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6578 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6579 | obj.xid = reader.read("!L")[0] |
| 6580 | _experimenter = reader.read("!L")[0] |
| 6581 | assert(_experimenter == 6035143) |
| 6582 | _subtype = reader.read("!L")[0] |
| 6583 | assert(_subtype == 32) |
| 6584 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6585 | obj.port_no = util.unpack_port_no(reader) |
| 6586 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6587 | return obj |
| 6588 | |
| 6589 | def __eq__(self, other): |
| 6590 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6591 | if self.xid != other.xid: return False |
| 6592 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6593 | if self.port_no != other.port_no: return False |
| 6594 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6595 | return True |
| 6596 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6597 | def pretty_print(self, q): |
| 6598 | q.text("bsn_pdu_tx_reply {") |
| 6599 | with q.group(): |
| 6600 | with q.indent(2): |
| 6601 | q.breakable() |
| 6602 | q.text("xid = "); |
| 6603 | if self.xid != None: |
| 6604 | q.text("%#x" % self.xid) |
| 6605 | else: |
| 6606 | q.text('None') |
| 6607 | q.text(","); q.breakable() |
| 6608 | q.text("status = "); |
| 6609 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6610 | q.text(","); q.breakable() |
| 6611 | q.text("port_no = "); |
| 6612 | q.text(util.pretty_port(self.port_no)) |
| 6613 | q.text(","); q.breakable() |
| 6614 | q.text("slot_num = "); |
| 6615 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6616 | q.breakable() |
| 6617 | q.text('}') |
| 6618 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6619 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6620 | |
| 6621 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6622 | version = 4 |
| 6623 | type = 4 |
| 6624 | experimenter = 6035143 |
| 6625 | subtype = 31 |
| 6626 | |
| 6627 | 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] | 6628 | if xid != None: |
| 6629 | self.xid = xid |
| 6630 | else: |
| 6631 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6632 | if tx_interval_ms != None: |
| 6633 | self.tx_interval_ms = tx_interval_ms |
| 6634 | else: |
| 6635 | self.tx_interval_ms = 0 |
| 6636 | if port_no != None: |
| 6637 | self.port_no = port_no |
| 6638 | else: |
| 6639 | self.port_no = 0 |
| 6640 | if slot_num != None: |
| 6641 | self.slot_num = slot_num |
| 6642 | else: |
| 6643 | self.slot_num = 0 |
| 6644 | if data != None: |
| 6645 | self.data = data |
| 6646 | else: |
| 6647 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6648 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6649 | |
| 6650 | def pack(self): |
| 6651 | packed = [] |
| 6652 | packed.append(struct.pack("!B", self.version)) |
| 6653 | packed.append(struct.pack("!B", self.type)) |
| 6654 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6655 | packed.append(struct.pack("!L", self.xid)) |
| 6656 | packed.append(struct.pack("!L", self.experimenter)) |
| 6657 | packed.append(struct.pack("!L", self.subtype)) |
| 6658 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6659 | packed.append(util.pack_port_no(self.port_no)) |
| 6660 | packed.append(struct.pack("!B", self.slot_num)) |
| 6661 | packed.append('\x00' * 3) |
| 6662 | packed.append(self.data) |
| 6663 | length = sum([len(x) for x in packed]) |
| 6664 | packed[2] = struct.pack("!H", length) |
| 6665 | return ''.join(packed) |
| 6666 | |
| 6667 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6668 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6669 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6670 | _version = reader.read("!B")[0] |
| 6671 | assert(_version == 4) |
| 6672 | _type = reader.read("!B")[0] |
| 6673 | assert(_type == 4) |
| 6674 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6675 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6676 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6677 | obj.xid = reader.read("!L")[0] |
| 6678 | _experimenter = reader.read("!L")[0] |
| 6679 | assert(_experimenter == 6035143) |
| 6680 | _subtype = reader.read("!L")[0] |
| 6681 | assert(_subtype == 31) |
| 6682 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6683 | obj.port_no = util.unpack_port_no(reader) |
| 6684 | obj.slot_num = reader.read("!B")[0] |
| 6685 | reader.skip(3) |
| 6686 | obj.data = str(reader.read_all()) |
| 6687 | return obj |
| 6688 | |
| 6689 | def __eq__(self, other): |
| 6690 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6691 | if self.xid != other.xid: return False |
| 6692 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6693 | if self.port_no != other.port_no: return False |
| 6694 | if self.slot_num != other.slot_num: return False |
| 6695 | if self.data != other.data: return False |
| 6696 | return True |
| 6697 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6698 | def pretty_print(self, q): |
| 6699 | q.text("bsn_pdu_tx_request {") |
| 6700 | with q.group(): |
| 6701 | with q.indent(2): |
| 6702 | q.breakable() |
| 6703 | q.text("xid = "); |
| 6704 | if self.xid != None: |
| 6705 | q.text("%#x" % self.xid) |
| 6706 | else: |
| 6707 | q.text('None') |
| 6708 | q.text(","); q.breakable() |
| 6709 | q.text("tx_interval_ms = "); |
| 6710 | q.text("%#x" % self.tx_interval_ms) |
| 6711 | q.text(","); q.breakable() |
| 6712 | q.text("port_no = "); |
| 6713 | q.text(util.pretty_port(self.port_no)) |
| 6714 | q.text(","); q.breakable() |
| 6715 | q.text("slot_num = "); |
| 6716 | q.text("%#x" % self.slot_num) |
| 6717 | q.text(","); q.breakable() |
| 6718 | q.text("data = "); |
| 6719 | q.pp(self.data) |
| 6720 | q.breakable() |
| 6721 | q.text('}') |
| 6722 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6723 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6724 | |
| 6725 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6726 | version = 4 |
| 6727 | type = 19 |
| 6728 | stats_type = 65535 |
| 6729 | experimenter = 6035143 |
| 6730 | subtype = 8 |
| 6731 | |
| 6732 | def __init__(self, xid=None, flags=None, entries=None): |
| 6733 | if xid != None: |
| 6734 | self.xid = xid |
| 6735 | else: |
| 6736 | self.xid = None |
| 6737 | if flags != None: |
| 6738 | self.flags = flags |
| 6739 | else: |
| 6740 | self.flags = 0 |
| 6741 | if entries != None: |
| 6742 | self.entries = entries |
| 6743 | else: |
| 6744 | self.entries = [] |
| 6745 | return |
| 6746 | |
| 6747 | def pack(self): |
| 6748 | packed = [] |
| 6749 | packed.append(struct.pack("!B", self.version)) |
| 6750 | packed.append(struct.pack("!B", self.type)) |
| 6751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6752 | packed.append(struct.pack("!L", self.xid)) |
| 6753 | packed.append(struct.pack("!H", self.stats_type)) |
| 6754 | packed.append(struct.pack("!H", self.flags)) |
| 6755 | packed.append('\x00' * 4) |
| 6756 | packed.append(struct.pack("!L", self.experimenter)) |
| 6757 | packed.append(struct.pack("!L", self.subtype)) |
| 6758 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6759 | length = sum([len(x) for x in packed]) |
| 6760 | packed[2] = struct.pack("!H", length) |
| 6761 | return ''.join(packed) |
| 6762 | |
| 6763 | @staticmethod |
| 6764 | def unpack(reader): |
| 6765 | obj = bsn_port_counter_stats_reply() |
| 6766 | _version = reader.read("!B")[0] |
| 6767 | assert(_version == 4) |
| 6768 | _type = reader.read("!B")[0] |
| 6769 | assert(_type == 19) |
| 6770 | _length = reader.read("!H")[0] |
| 6771 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6772 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6773 | obj.xid = reader.read("!L")[0] |
| 6774 | _stats_type = reader.read("!H")[0] |
| 6775 | assert(_stats_type == 65535) |
| 6776 | obj.flags = reader.read("!H")[0] |
| 6777 | reader.skip(4) |
| 6778 | _experimenter = reader.read("!L")[0] |
| 6779 | assert(_experimenter == 6035143) |
| 6780 | _subtype = reader.read("!L")[0] |
| 6781 | assert(_subtype == 8) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 6782 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_port_counter_stats_entry.unpack) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6783 | return obj |
| 6784 | |
| 6785 | def __eq__(self, other): |
| 6786 | if type(self) != type(other): return False |
| 6787 | if self.xid != other.xid: return False |
| 6788 | if self.flags != other.flags: return False |
| 6789 | if self.entries != other.entries: return False |
| 6790 | return True |
| 6791 | |
| 6792 | def pretty_print(self, q): |
| 6793 | q.text("bsn_port_counter_stats_reply {") |
| 6794 | with q.group(): |
| 6795 | with q.indent(2): |
| 6796 | q.breakable() |
| 6797 | q.text("xid = "); |
| 6798 | if self.xid != None: |
| 6799 | q.text("%#x" % self.xid) |
| 6800 | else: |
| 6801 | q.text('None') |
| 6802 | q.text(","); q.breakable() |
| 6803 | q.text("flags = "); |
| 6804 | q.text("%#x" % self.flags) |
| 6805 | q.text(","); q.breakable() |
| 6806 | q.text("entries = "); |
| 6807 | q.pp(self.entries) |
| 6808 | q.breakable() |
| 6809 | q.text('}') |
| 6810 | |
| 6811 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6812 | |
| 6813 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6814 | version = 4 |
| 6815 | type = 18 |
| 6816 | stats_type = 65535 |
| 6817 | experimenter = 6035143 |
| 6818 | subtype = 8 |
| 6819 | |
| 6820 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6821 | if xid != None: |
| 6822 | self.xid = xid |
| 6823 | else: |
| 6824 | self.xid = None |
| 6825 | if flags != None: |
| 6826 | self.flags = flags |
| 6827 | else: |
| 6828 | self.flags = 0 |
| 6829 | if port_no != None: |
| 6830 | self.port_no = port_no |
| 6831 | else: |
| 6832 | self.port_no = 0 |
| 6833 | return |
| 6834 | |
| 6835 | def pack(self): |
| 6836 | packed = [] |
| 6837 | packed.append(struct.pack("!B", self.version)) |
| 6838 | packed.append(struct.pack("!B", self.type)) |
| 6839 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6840 | packed.append(struct.pack("!L", self.xid)) |
| 6841 | packed.append(struct.pack("!H", self.stats_type)) |
| 6842 | packed.append(struct.pack("!H", self.flags)) |
| 6843 | packed.append('\x00' * 4) |
| 6844 | packed.append(struct.pack("!L", self.experimenter)) |
| 6845 | packed.append(struct.pack("!L", self.subtype)) |
| 6846 | packed.append(util.pack_port_no(self.port_no)) |
| 6847 | length = sum([len(x) for x in packed]) |
| 6848 | packed[2] = struct.pack("!H", length) |
| 6849 | return ''.join(packed) |
| 6850 | |
| 6851 | @staticmethod |
| 6852 | def unpack(reader): |
| 6853 | obj = bsn_port_counter_stats_request() |
| 6854 | _version = reader.read("!B")[0] |
| 6855 | assert(_version == 4) |
| 6856 | _type = reader.read("!B")[0] |
| 6857 | assert(_type == 18) |
| 6858 | _length = reader.read("!H")[0] |
| 6859 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6860 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6861 | obj.xid = reader.read("!L")[0] |
| 6862 | _stats_type = reader.read("!H")[0] |
| 6863 | assert(_stats_type == 65535) |
| 6864 | obj.flags = reader.read("!H")[0] |
| 6865 | reader.skip(4) |
| 6866 | _experimenter = reader.read("!L")[0] |
| 6867 | assert(_experimenter == 6035143) |
| 6868 | _subtype = reader.read("!L")[0] |
| 6869 | assert(_subtype == 8) |
| 6870 | obj.port_no = util.unpack_port_no(reader) |
| 6871 | return obj |
| 6872 | |
| 6873 | def __eq__(self, other): |
| 6874 | if type(self) != type(other): return False |
| 6875 | if self.xid != other.xid: return False |
| 6876 | if self.flags != other.flags: return False |
| 6877 | if self.port_no != other.port_no: return False |
| 6878 | return True |
| 6879 | |
| 6880 | def pretty_print(self, q): |
| 6881 | q.text("bsn_port_counter_stats_request {") |
| 6882 | with q.group(): |
| 6883 | with q.indent(2): |
| 6884 | q.breakable() |
| 6885 | q.text("xid = "); |
| 6886 | if self.xid != None: |
| 6887 | q.text("%#x" % self.xid) |
| 6888 | else: |
| 6889 | q.text('None') |
| 6890 | q.text(","); q.breakable() |
| 6891 | q.text("flags = "); |
| 6892 | q.text("%#x" % self.flags) |
| 6893 | q.text(","); q.breakable() |
| 6894 | q.text("port_no = "); |
| 6895 | q.text(util.pretty_port(self.port_no)) |
| 6896 | q.breakable() |
| 6897 | q.text('}') |
| 6898 | |
| 6899 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6900 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6901 | class bsn_role_status(bsn_header): |
| 6902 | version = 4 |
| 6903 | type = 4 |
| 6904 | experimenter = 6035143 |
| 6905 | subtype = 55 |
| 6906 | |
| 6907 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6908 | if xid != None: |
| 6909 | self.xid = xid |
| 6910 | else: |
| 6911 | self.xid = None |
| 6912 | if role != None: |
| 6913 | self.role = role |
| 6914 | else: |
| 6915 | self.role = 0 |
| 6916 | if reason != None: |
| 6917 | self.reason = reason |
| 6918 | else: |
| 6919 | self.reason = 0 |
| 6920 | if generation_id != None: |
| 6921 | self.generation_id = generation_id |
| 6922 | else: |
| 6923 | self.generation_id = 0 |
| 6924 | return |
| 6925 | |
| 6926 | def pack(self): |
| 6927 | packed = [] |
| 6928 | packed.append(struct.pack("!B", self.version)) |
| 6929 | packed.append(struct.pack("!B", self.type)) |
| 6930 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6931 | packed.append(struct.pack("!L", self.xid)) |
| 6932 | packed.append(struct.pack("!L", self.experimenter)) |
| 6933 | packed.append(struct.pack("!L", self.subtype)) |
| 6934 | packed.append(struct.pack("!L", self.role)) |
| 6935 | packed.append(struct.pack("!B", self.reason)) |
| 6936 | packed.append('\x00' * 3) |
| 6937 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6938 | length = sum([len(x) for x in packed]) |
| 6939 | packed[2] = struct.pack("!H", length) |
| 6940 | return ''.join(packed) |
| 6941 | |
| 6942 | @staticmethod |
| 6943 | def unpack(reader): |
| 6944 | obj = bsn_role_status() |
| 6945 | _version = reader.read("!B")[0] |
| 6946 | assert(_version == 4) |
| 6947 | _type = reader.read("!B")[0] |
| 6948 | assert(_type == 4) |
| 6949 | _length = reader.read("!H")[0] |
| 6950 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6951 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6952 | obj.xid = reader.read("!L")[0] |
| 6953 | _experimenter = reader.read("!L")[0] |
| 6954 | assert(_experimenter == 6035143) |
| 6955 | _subtype = reader.read("!L")[0] |
| 6956 | assert(_subtype == 55) |
| 6957 | obj.role = reader.read("!L")[0] |
| 6958 | obj.reason = reader.read("!B")[0] |
| 6959 | reader.skip(3) |
| 6960 | obj.generation_id = reader.read("!Q")[0] |
| 6961 | return obj |
| 6962 | |
| 6963 | def __eq__(self, other): |
| 6964 | if type(self) != type(other): return False |
| 6965 | if self.xid != other.xid: return False |
| 6966 | if self.role != other.role: return False |
| 6967 | if self.reason != other.reason: return False |
| 6968 | if self.generation_id != other.generation_id: return False |
| 6969 | return True |
| 6970 | |
| 6971 | def pretty_print(self, q): |
| 6972 | q.text("bsn_role_status {") |
| 6973 | with q.group(): |
| 6974 | with q.indent(2): |
| 6975 | q.breakable() |
| 6976 | q.text("xid = "); |
| 6977 | if self.xid != None: |
| 6978 | q.text("%#x" % self.xid) |
| 6979 | else: |
| 6980 | q.text('None') |
| 6981 | q.text(","); q.breakable() |
| 6982 | q.text("role = "); |
| 6983 | q.text("%#x" % self.role) |
| 6984 | q.text(","); q.breakable() |
| 6985 | q.text("reason = "); |
| 6986 | q.text("%#x" % self.reason) |
| 6987 | q.text(","); q.breakable() |
| 6988 | q.text("generation_id = "); |
| 6989 | q.text("%#x" % self.generation_id) |
| 6990 | q.breakable() |
| 6991 | q.text('}') |
| 6992 | |
| 6993 | bsn_header.subtypes[55] = bsn_role_status |
| 6994 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6995 | class bsn_set_aux_cxns_reply(bsn_header): |
| 6996 | version = 4 |
| 6997 | type = 4 |
| 6998 | experimenter = 6035143 |
| 6999 | subtype = 59 |
| 7000 | |
| 7001 | def __init__(self, xid=None, num_aux=None, status=None): |
| 7002 | if xid != None: |
| 7003 | self.xid = xid |
| 7004 | else: |
| 7005 | self.xid = None |
| 7006 | if num_aux != None: |
| 7007 | self.num_aux = num_aux |
| 7008 | else: |
| 7009 | self.num_aux = 0 |
| 7010 | if status != None: |
| 7011 | self.status = status |
| 7012 | else: |
| 7013 | self.status = 0 |
| 7014 | return |
| 7015 | |
| 7016 | def pack(self): |
| 7017 | packed = [] |
| 7018 | packed.append(struct.pack("!B", self.version)) |
| 7019 | packed.append(struct.pack("!B", self.type)) |
| 7020 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7021 | packed.append(struct.pack("!L", self.xid)) |
| 7022 | packed.append(struct.pack("!L", self.experimenter)) |
| 7023 | packed.append(struct.pack("!L", self.subtype)) |
| 7024 | packed.append(struct.pack("!L", self.num_aux)) |
| 7025 | packed.append(struct.pack("!L", self.status)) |
| 7026 | length = sum([len(x) for x in packed]) |
| 7027 | packed[2] = struct.pack("!H", length) |
| 7028 | return ''.join(packed) |
| 7029 | |
| 7030 | @staticmethod |
| 7031 | def unpack(reader): |
| 7032 | obj = bsn_set_aux_cxns_reply() |
| 7033 | _version = reader.read("!B")[0] |
| 7034 | assert(_version == 4) |
| 7035 | _type = reader.read("!B")[0] |
| 7036 | assert(_type == 4) |
| 7037 | _length = reader.read("!H")[0] |
| 7038 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7039 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7040 | obj.xid = reader.read("!L")[0] |
| 7041 | _experimenter = reader.read("!L")[0] |
| 7042 | assert(_experimenter == 6035143) |
| 7043 | _subtype = reader.read("!L")[0] |
| 7044 | assert(_subtype == 59) |
| 7045 | obj.num_aux = reader.read("!L")[0] |
| 7046 | obj.status = reader.read("!L")[0] |
| 7047 | return obj |
| 7048 | |
| 7049 | def __eq__(self, other): |
| 7050 | if type(self) != type(other): return False |
| 7051 | if self.xid != other.xid: return False |
| 7052 | if self.num_aux != other.num_aux: return False |
| 7053 | if self.status != other.status: return False |
| 7054 | return True |
| 7055 | |
| 7056 | def pretty_print(self, q): |
| 7057 | q.text("bsn_set_aux_cxns_reply {") |
| 7058 | with q.group(): |
| 7059 | with q.indent(2): |
| 7060 | q.breakable() |
| 7061 | q.text("xid = "); |
| 7062 | if self.xid != None: |
| 7063 | q.text("%#x" % self.xid) |
| 7064 | else: |
| 7065 | q.text('None') |
| 7066 | q.text(","); q.breakable() |
| 7067 | q.text("num_aux = "); |
| 7068 | q.text("%#x" % self.num_aux) |
| 7069 | q.text(","); q.breakable() |
| 7070 | q.text("status = "); |
| 7071 | q.text("%#x" % self.status) |
| 7072 | q.breakable() |
| 7073 | q.text('}') |
| 7074 | |
| 7075 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 7076 | |
| 7077 | class bsn_set_aux_cxns_request(bsn_header): |
| 7078 | version = 4 |
| 7079 | type = 4 |
| 7080 | experimenter = 6035143 |
| 7081 | subtype = 58 |
| 7082 | |
| 7083 | def __init__(self, xid=None, num_aux=None): |
| 7084 | if xid != None: |
| 7085 | self.xid = xid |
| 7086 | else: |
| 7087 | self.xid = None |
| 7088 | if num_aux != None: |
| 7089 | self.num_aux = num_aux |
| 7090 | else: |
| 7091 | self.num_aux = 0 |
| 7092 | return |
| 7093 | |
| 7094 | def pack(self): |
| 7095 | packed = [] |
| 7096 | packed.append(struct.pack("!B", self.version)) |
| 7097 | packed.append(struct.pack("!B", self.type)) |
| 7098 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7099 | packed.append(struct.pack("!L", self.xid)) |
| 7100 | packed.append(struct.pack("!L", self.experimenter)) |
| 7101 | packed.append(struct.pack("!L", self.subtype)) |
| 7102 | packed.append(struct.pack("!L", self.num_aux)) |
| 7103 | length = sum([len(x) for x in packed]) |
| 7104 | packed[2] = struct.pack("!H", length) |
| 7105 | return ''.join(packed) |
| 7106 | |
| 7107 | @staticmethod |
| 7108 | def unpack(reader): |
| 7109 | obj = bsn_set_aux_cxns_request() |
| 7110 | _version = reader.read("!B")[0] |
| 7111 | assert(_version == 4) |
| 7112 | _type = reader.read("!B")[0] |
| 7113 | assert(_type == 4) |
| 7114 | _length = reader.read("!H")[0] |
| 7115 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7116 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7117 | obj.xid = reader.read("!L")[0] |
| 7118 | _experimenter = reader.read("!L")[0] |
| 7119 | assert(_experimenter == 6035143) |
| 7120 | _subtype = reader.read("!L")[0] |
| 7121 | assert(_subtype == 58) |
| 7122 | obj.num_aux = reader.read("!L")[0] |
| 7123 | return obj |
| 7124 | |
| 7125 | def __eq__(self, other): |
| 7126 | if type(self) != type(other): return False |
| 7127 | if self.xid != other.xid: return False |
| 7128 | if self.num_aux != other.num_aux: return False |
| 7129 | return True |
| 7130 | |
| 7131 | def pretty_print(self, q): |
| 7132 | q.text("bsn_set_aux_cxns_request {") |
| 7133 | with q.group(): |
| 7134 | with q.indent(2): |
| 7135 | q.breakable() |
| 7136 | q.text("xid = "); |
| 7137 | if self.xid != None: |
| 7138 | q.text("%#x" % self.xid) |
| 7139 | else: |
| 7140 | q.text('None') |
| 7141 | q.text(","); q.breakable() |
| 7142 | q.text("num_aux = "); |
| 7143 | q.text("%#x" % self.num_aux) |
| 7144 | q.breakable() |
| 7145 | q.text('}') |
| 7146 | |
| 7147 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 7148 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7149 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7150 | version = 4 |
| 7151 | type = 4 |
| 7152 | experimenter = 6035143 |
| 7153 | subtype = 42 |
| 7154 | |
| 7155 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7156 | if xid != None: |
| 7157 | self.xid = xid |
| 7158 | else: |
| 7159 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7160 | if status != None: |
| 7161 | self.status = status |
| 7162 | else: |
| 7163 | self.status = 0 |
| 7164 | if port_no != None: |
| 7165 | self.port_no = port_no |
| 7166 | else: |
| 7167 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7168 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7169 | |
| 7170 | def pack(self): |
| 7171 | packed = [] |
| 7172 | packed.append(struct.pack("!B", self.version)) |
| 7173 | packed.append(struct.pack("!B", self.type)) |
| 7174 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7175 | packed.append(struct.pack("!L", self.xid)) |
| 7176 | packed.append(struct.pack("!L", self.experimenter)) |
| 7177 | packed.append(struct.pack("!L", self.subtype)) |
| 7178 | packed.append(struct.pack("!L", self.status)) |
| 7179 | packed.append(util.pack_port_no(self.port_no)) |
| 7180 | length = sum([len(x) for x in packed]) |
| 7181 | packed[2] = struct.pack("!H", length) |
| 7182 | return ''.join(packed) |
| 7183 | |
| 7184 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7185 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7186 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7187 | _version = reader.read("!B")[0] |
| 7188 | assert(_version == 4) |
| 7189 | _type = reader.read("!B")[0] |
| 7190 | assert(_type == 4) |
| 7191 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7192 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7193 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7194 | obj.xid = reader.read("!L")[0] |
| 7195 | _experimenter = reader.read("!L")[0] |
| 7196 | assert(_experimenter == 6035143) |
| 7197 | _subtype = reader.read("!L")[0] |
| 7198 | assert(_subtype == 42) |
| 7199 | obj.status = reader.read("!L")[0] |
| 7200 | obj.port_no = util.unpack_port_no(reader) |
| 7201 | return obj |
| 7202 | |
| 7203 | def __eq__(self, other): |
| 7204 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7205 | if self.xid != other.xid: return False |
| 7206 | if self.status != other.status: return False |
| 7207 | if self.port_no != other.port_no: return False |
| 7208 | return True |
| 7209 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7210 | def pretty_print(self, q): |
| 7211 | q.text("bsn_set_lacp_reply {") |
| 7212 | with q.group(): |
| 7213 | with q.indent(2): |
| 7214 | q.breakable() |
| 7215 | q.text("xid = "); |
| 7216 | if self.xid != None: |
| 7217 | q.text("%#x" % self.xid) |
| 7218 | else: |
| 7219 | q.text('None') |
| 7220 | q.text(","); q.breakable() |
| 7221 | q.text("status = "); |
| 7222 | q.text("%#x" % self.status) |
| 7223 | q.text(","); q.breakable() |
| 7224 | q.text("port_no = "); |
| 7225 | q.text(util.pretty_port(self.port_no)) |
| 7226 | q.breakable() |
| 7227 | q.text('}') |
| 7228 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7229 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 7230 | |
| 7231 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7232 | version = 4 |
| 7233 | type = 4 |
| 7234 | experimenter = 6035143 |
| 7235 | subtype = 41 |
| 7236 | |
| 7237 | def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7238 | if xid != None: |
| 7239 | self.xid = xid |
| 7240 | else: |
| 7241 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7242 | if enabled != None: |
| 7243 | self.enabled = enabled |
| 7244 | else: |
| 7245 | self.enabled = 0 |
| 7246 | if port_no != None: |
| 7247 | self.port_no = port_no |
| 7248 | else: |
| 7249 | self.port_no = 0 |
| 7250 | if actor_sys_priority != None: |
| 7251 | self.actor_sys_priority = actor_sys_priority |
| 7252 | else: |
| 7253 | self.actor_sys_priority = 0 |
| 7254 | if actor_sys_mac != None: |
| 7255 | self.actor_sys_mac = actor_sys_mac |
| 7256 | else: |
| 7257 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 7258 | if actor_port_priority != None: |
| 7259 | self.actor_port_priority = actor_port_priority |
| 7260 | else: |
| 7261 | self.actor_port_priority = 0 |
| 7262 | if actor_port_num != None: |
| 7263 | self.actor_port_num = actor_port_num |
| 7264 | else: |
| 7265 | self.actor_port_num = 0 |
| 7266 | if actor_key != None: |
| 7267 | self.actor_key = actor_key |
| 7268 | else: |
| 7269 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7270 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7271 | |
| 7272 | def pack(self): |
| 7273 | packed = [] |
| 7274 | packed.append(struct.pack("!B", self.version)) |
| 7275 | packed.append(struct.pack("!B", self.type)) |
| 7276 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7277 | packed.append(struct.pack("!L", self.xid)) |
| 7278 | packed.append(struct.pack("!L", self.experimenter)) |
| 7279 | packed.append(struct.pack("!L", self.subtype)) |
| 7280 | packed.append(struct.pack("!B", self.enabled)) |
| 7281 | packed.append('\x00' * 3) |
| 7282 | packed.append(util.pack_port_no(self.port_no)) |
| 7283 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 7284 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 7285 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 7286 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 7287 | packed.append(struct.pack("!H", self.actor_key)) |
| 7288 | length = sum([len(x) for x in packed]) |
| 7289 | packed[2] = struct.pack("!H", length) |
| 7290 | return ''.join(packed) |
| 7291 | |
| 7292 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7293 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7294 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7295 | _version = reader.read("!B")[0] |
| 7296 | assert(_version == 4) |
| 7297 | _type = reader.read("!B")[0] |
| 7298 | assert(_type == 4) |
| 7299 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7300 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7301 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7302 | obj.xid = reader.read("!L")[0] |
| 7303 | _experimenter = reader.read("!L")[0] |
| 7304 | assert(_experimenter == 6035143) |
| 7305 | _subtype = reader.read("!L")[0] |
| 7306 | assert(_subtype == 41) |
| 7307 | obj.enabled = reader.read("!B")[0] |
| 7308 | reader.skip(3) |
| 7309 | obj.port_no = util.unpack_port_no(reader) |
| 7310 | obj.actor_sys_priority = reader.read("!H")[0] |
| 7311 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 7312 | obj.actor_port_priority = reader.read("!H")[0] |
| 7313 | obj.actor_port_num = reader.read("!H")[0] |
| 7314 | obj.actor_key = reader.read("!H")[0] |
| 7315 | return obj |
| 7316 | |
| 7317 | def __eq__(self, other): |
| 7318 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7319 | if self.xid != other.xid: return False |
| 7320 | if self.enabled != other.enabled: return False |
| 7321 | if self.port_no != other.port_no: return False |
| 7322 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 7323 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 7324 | if self.actor_port_priority != other.actor_port_priority: return False |
| 7325 | if self.actor_port_num != other.actor_port_num: return False |
| 7326 | if self.actor_key != other.actor_key: return False |
| 7327 | return True |
| 7328 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7329 | def pretty_print(self, q): |
| 7330 | q.text("bsn_set_lacp_request {") |
| 7331 | with q.group(): |
| 7332 | with q.indent(2): |
| 7333 | q.breakable() |
| 7334 | q.text("xid = "); |
| 7335 | if self.xid != None: |
| 7336 | q.text("%#x" % self.xid) |
| 7337 | else: |
| 7338 | q.text('None') |
| 7339 | q.text(","); q.breakable() |
| 7340 | q.text("enabled = "); |
| 7341 | q.text("%#x" % self.enabled) |
| 7342 | q.text(","); q.breakable() |
| 7343 | q.text("port_no = "); |
| 7344 | q.text(util.pretty_port(self.port_no)) |
| 7345 | q.text(","); q.breakable() |
| 7346 | q.text("actor_sys_priority = "); |
| 7347 | q.text("%#x" % self.actor_sys_priority) |
| 7348 | q.text(","); q.breakable() |
| 7349 | q.text("actor_sys_mac = "); |
| 7350 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 7351 | q.text(","); q.breakable() |
| 7352 | q.text("actor_port_priority = "); |
| 7353 | q.text("%#x" % self.actor_port_priority) |
| 7354 | q.text(","); q.breakable() |
| 7355 | q.text("actor_port_num = "); |
| 7356 | q.text("%#x" % self.actor_port_num) |
| 7357 | q.text(","); q.breakable() |
| 7358 | q.text("actor_key = "); |
| 7359 | q.text("%#x" % self.actor_key) |
| 7360 | q.breakable() |
| 7361 | q.text('}') |
| 7362 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7363 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 7364 | |
| 7365 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7366 | version = 4 |
| 7367 | type = 4 |
| 7368 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7369 | subtype = 3 |
| 7370 | |
| 7371 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7372 | if xid != None: |
| 7373 | self.xid = xid |
| 7374 | else: |
| 7375 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7376 | if report_mirror_ports != None: |
| 7377 | self.report_mirror_ports = report_mirror_ports |
| 7378 | else: |
| 7379 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7380 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7381 | |
| 7382 | def pack(self): |
| 7383 | packed = [] |
| 7384 | packed.append(struct.pack("!B", self.version)) |
| 7385 | packed.append(struct.pack("!B", self.type)) |
| 7386 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7387 | packed.append(struct.pack("!L", self.xid)) |
| 7388 | packed.append(struct.pack("!L", self.experimenter)) |
| 7389 | packed.append(struct.pack("!L", self.subtype)) |
| 7390 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 7391 | packed.append('\x00' * 3) |
| 7392 | length = sum([len(x) for x in packed]) |
| 7393 | packed[2] = struct.pack("!H", length) |
| 7394 | return ''.join(packed) |
| 7395 | |
| 7396 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7397 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7398 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7399 | _version = reader.read("!B")[0] |
| 7400 | assert(_version == 4) |
| 7401 | _type = reader.read("!B")[0] |
| 7402 | assert(_type == 4) |
| 7403 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7404 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7405 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7406 | obj.xid = reader.read("!L")[0] |
| 7407 | _experimenter = reader.read("!L")[0] |
| 7408 | assert(_experimenter == 6035143) |
| 7409 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7410 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7411 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7412 | reader.skip(3) |
| 7413 | return obj |
| 7414 | |
| 7415 | def __eq__(self, other): |
| 7416 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7417 | if self.xid != other.xid: return False |
| 7418 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 7419 | return True |
| 7420 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7421 | def pretty_print(self, q): |
| 7422 | q.text("bsn_set_mirroring {") |
| 7423 | with q.group(): |
| 7424 | with q.indent(2): |
| 7425 | q.breakable() |
| 7426 | q.text("xid = "); |
| 7427 | if self.xid != None: |
| 7428 | q.text("%#x" % self.xid) |
| 7429 | else: |
| 7430 | q.text('None') |
| 7431 | q.text(","); q.breakable() |
| 7432 | q.text("report_mirror_ports = "); |
| 7433 | q.text("%#x" % self.report_mirror_ports) |
| 7434 | q.breakable() |
| 7435 | q.text('}') |
| 7436 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7437 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 7438 | |
| 7439 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7440 | version = 4 |
| 7441 | type = 4 |
| 7442 | experimenter = 6035143 |
| 7443 | subtype = 25 |
| 7444 | |
| 7445 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7446 | if xid != None: |
| 7447 | self.xid = xid |
| 7448 | else: |
| 7449 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7450 | if status != None: |
| 7451 | self.status = status |
| 7452 | else: |
| 7453 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7454 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7455 | |
| 7456 | def pack(self): |
| 7457 | packed = [] |
| 7458 | packed.append(struct.pack("!B", self.version)) |
| 7459 | packed.append(struct.pack("!B", self.type)) |
| 7460 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7461 | packed.append(struct.pack("!L", self.xid)) |
| 7462 | packed.append(struct.pack("!L", self.experimenter)) |
| 7463 | packed.append(struct.pack("!L", self.subtype)) |
| 7464 | packed.append(struct.pack("!L", self.status)) |
| 7465 | length = sum([len(x) for x in packed]) |
| 7466 | packed[2] = struct.pack("!H", length) |
| 7467 | return ''.join(packed) |
| 7468 | |
| 7469 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7470 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7471 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7472 | _version = reader.read("!B")[0] |
| 7473 | assert(_version == 4) |
| 7474 | _type = reader.read("!B")[0] |
| 7475 | assert(_type == 4) |
| 7476 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7477 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7478 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7479 | obj.xid = reader.read("!L")[0] |
| 7480 | _experimenter = reader.read("!L")[0] |
| 7481 | assert(_experimenter == 6035143) |
| 7482 | _subtype = reader.read("!L")[0] |
| 7483 | assert(_subtype == 25) |
| 7484 | obj.status = reader.read("!L")[0] |
| 7485 | return obj |
| 7486 | |
| 7487 | def __eq__(self, other): |
| 7488 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7489 | if self.xid != other.xid: return False |
| 7490 | if self.status != other.status: return False |
| 7491 | return True |
| 7492 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7493 | def pretty_print(self, q): |
| 7494 | q.text("bsn_set_pktin_suppression_reply {") |
| 7495 | with q.group(): |
| 7496 | with q.indent(2): |
| 7497 | q.breakable() |
| 7498 | q.text("xid = "); |
| 7499 | if self.xid != None: |
| 7500 | q.text("%#x" % self.xid) |
| 7501 | else: |
| 7502 | q.text('None') |
| 7503 | q.text(","); q.breakable() |
| 7504 | q.text("status = "); |
| 7505 | q.text("%#x" % self.status) |
| 7506 | q.breakable() |
| 7507 | q.text('}') |
| 7508 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7509 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7510 | |
| 7511 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7512 | version = 4 |
| 7513 | type = 4 |
| 7514 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7515 | subtype = 11 |
| 7516 | |
| 7517 | 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] | 7518 | if xid != None: |
| 7519 | self.xid = xid |
| 7520 | else: |
| 7521 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7522 | if enabled != None: |
| 7523 | self.enabled = enabled |
| 7524 | else: |
| 7525 | self.enabled = 0 |
| 7526 | if idle_timeout != None: |
| 7527 | self.idle_timeout = idle_timeout |
| 7528 | else: |
| 7529 | self.idle_timeout = 0 |
| 7530 | if hard_timeout != None: |
| 7531 | self.hard_timeout = hard_timeout |
| 7532 | else: |
| 7533 | self.hard_timeout = 0 |
| 7534 | if priority != None: |
| 7535 | self.priority = priority |
| 7536 | else: |
| 7537 | self.priority = 0 |
| 7538 | if cookie != None: |
| 7539 | self.cookie = cookie |
| 7540 | else: |
| 7541 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7542 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7543 | |
| 7544 | def pack(self): |
| 7545 | packed = [] |
| 7546 | packed.append(struct.pack("!B", self.version)) |
| 7547 | packed.append(struct.pack("!B", self.type)) |
| 7548 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7549 | packed.append(struct.pack("!L", self.xid)) |
| 7550 | packed.append(struct.pack("!L", self.experimenter)) |
| 7551 | packed.append(struct.pack("!L", self.subtype)) |
| 7552 | packed.append(struct.pack("!B", self.enabled)) |
| 7553 | packed.append('\x00' * 1) |
| 7554 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7555 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7556 | packed.append(struct.pack("!H", self.priority)) |
| 7557 | packed.append(struct.pack("!Q", self.cookie)) |
| 7558 | length = sum([len(x) for x in packed]) |
| 7559 | packed[2] = struct.pack("!H", length) |
| 7560 | return ''.join(packed) |
| 7561 | |
| 7562 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7563 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7564 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7565 | _version = reader.read("!B")[0] |
| 7566 | assert(_version == 4) |
| 7567 | _type = reader.read("!B")[0] |
| 7568 | assert(_type == 4) |
| 7569 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7570 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7571 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7572 | obj.xid = reader.read("!L")[0] |
| 7573 | _experimenter = reader.read("!L")[0] |
| 7574 | assert(_experimenter == 6035143) |
| 7575 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7576 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7577 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7578 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7579 | obj.idle_timeout = reader.read("!H")[0] |
| 7580 | obj.hard_timeout = reader.read("!H")[0] |
| 7581 | obj.priority = reader.read("!H")[0] |
| 7582 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7583 | return obj |
| 7584 | |
| 7585 | def __eq__(self, other): |
| 7586 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7587 | if self.xid != other.xid: return False |
| 7588 | if self.enabled != other.enabled: return False |
| 7589 | if self.idle_timeout != other.idle_timeout: return False |
| 7590 | if self.hard_timeout != other.hard_timeout: return False |
| 7591 | if self.priority != other.priority: return False |
| 7592 | if self.cookie != other.cookie: return False |
| 7593 | return True |
| 7594 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7595 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7596 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7597 | with q.group(): |
| 7598 | with q.indent(2): |
| 7599 | q.breakable() |
| 7600 | q.text("xid = "); |
| 7601 | if self.xid != None: |
| 7602 | q.text("%#x" % self.xid) |
| 7603 | else: |
| 7604 | q.text('None') |
| 7605 | q.text(","); q.breakable() |
| 7606 | q.text("enabled = "); |
| 7607 | q.text("%#x" % self.enabled) |
| 7608 | q.text(","); q.breakable() |
| 7609 | q.text("idle_timeout = "); |
| 7610 | q.text("%#x" % self.idle_timeout) |
| 7611 | q.text(","); q.breakable() |
| 7612 | q.text("hard_timeout = "); |
| 7613 | q.text("%#x" % self.hard_timeout) |
| 7614 | q.text(","); q.breakable() |
| 7615 | q.text("priority = "); |
| 7616 | q.text("%#x" % self.priority) |
| 7617 | q.text(","); q.breakable() |
| 7618 | q.text("cookie = "); |
| 7619 | q.text("%#x" % self.cookie) |
| 7620 | q.breakable() |
| 7621 | q.text('}') |
| 7622 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7623 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7624 | |
| 7625 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7626 | version = 4 |
| 7627 | type = 4 |
| 7628 | experimenter = 6035143 |
| 7629 | subtype = 54 |
| 7630 | |
| 7631 | def __init__(self, xid=None, status=None): |
| 7632 | if xid != None: |
| 7633 | self.xid = xid |
| 7634 | else: |
| 7635 | self.xid = None |
| 7636 | if status != None: |
| 7637 | self.status = status |
| 7638 | else: |
| 7639 | self.status = 0 |
| 7640 | return |
| 7641 | |
| 7642 | def pack(self): |
| 7643 | packed = [] |
| 7644 | packed.append(struct.pack("!B", self.version)) |
| 7645 | packed.append(struct.pack("!B", self.type)) |
| 7646 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7647 | packed.append(struct.pack("!L", self.xid)) |
| 7648 | packed.append(struct.pack("!L", self.experimenter)) |
| 7649 | packed.append(struct.pack("!L", self.subtype)) |
| 7650 | packed.append(struct.pack("!L", self.status)) |
| 7651 | length = sum([len(x) for x in packed]) |
| 7652 | packed[2] = struct.pack("!H", length) |
| 7653 | return ''.join(packed) |
| 7654 | |
| 7655 | @staticmethod |
| 7656 | def unpack(reader): |
| 7657 | obj = bsn_set_switch_pipeline_reply() |
| 7658 | _version = reader.read("!B")[0] |
| 7659 | assert(_version == 4) |
| 7660 | _type = reader.read("!B")[0] |
| 7661 | assert(_type == 4) |
| 7662 | _length = reader.read("!H")[0] |
| 7663 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7664 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7665 | obj.xid = reader.read("!L")[0] |
| 7666 | _experimenter = reader.read("!L")[0] |
| 7667 | assert(_experimenter == 6035143) |
| 7668 | _subtype = reader.read("!L")[0] |
| 7669 | assert(_subtype == 54) |
| 7670 | obj.status = reader.read("!L")[0] |
| 7671 | return obj |
| 7672 | |
| 7673 | def __eq__(self, other): |
| 7674 | if type(self) != type(other): return False |
| 7675 | if self.xid != other.xid: return False |
| 7676 | if self.status != other.status: return False |
| 7677 | return True |
| 7678 | |
| 7679 | def pretty_print(self, q): |
| 7680 | q.text("bsn_set_switch_pipeline_reply {") |
| 7681 | with q.group(): |
| 7682 | with q.indent(2): |
| 7683 | q.breakable() |
| 7684 | q.text("xid = "); |
| 7685 | if self.xid != None: |
| 7686 | q.text("%#x" % self.xid) |
| 7687 | else: |
| 7688 | q.text('None') |
| 7689 | q.text(","); q.breakable() |
| 7690 | q.text("status = "); |
| 7691 | q.text("%#x" % self.status) |
| 7692 | q.breakable() |
| 7693 | q.text('}') |
| 7694 | |
| 7695 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7696 | |
| 7697 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7698 | version = 4 |
| 7699 | type = 4 |
| 7700 | experimenter = 6035143 |
| 7701 | subtype = 53 |
| 7702 | |
| 7703 | def __init__(self, xid=None, pipeline=None): |
| 7704 | if xid != None: |
| 7705 | self.xid = xid |
| 7706 | else: |
| 7707 | self.xid = None |
| 7708 | if pipeline != None: |
| 7709 | self.pipeline = pipeline |
| 7710 | else: |
| 7711 | self.pipeline = "" |
| 7712 | return |
| 7713 | |
| 7714 | def pack(self): |
| 7715 | packed = [] |
| 7716 | packed.append(struct.pack("!B", self.version)) |
| 7717 | packed.append(struct.pack("!B", self.type)) |
| 7718 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7719 | packed.append(struct.pack("!L", self.xid)) |
| 7720 | packed.append(struct.pack("!L", self.experimenter)) |
| 7721 | packed.append(struct.pack("!L", self.subtype)) |
| 7722 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7723 | length = sum([len(x) for x in packed]) |
| 7724 | packed[2] = struct.pack("!H", length) |
| 7725 | return ''.join(packed) |
| 7726 | |
| 7727 | @staticmethod |
| 7728 | def unpack(reader): |
| 7729 | obj = bsn_set_switch_pipeline_request() |
| 7730 | _version = reader.read("!B")[0] |
| 7731 | assert(_version == 4) |
| 7732 | _type = reader.read("!B")[0] |
| 7733 | assert(_type == 4) |
| 7734 | _length = reader.read("!H")[0] |
| 7735 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7736 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7737 | obj.xid = reader.read("!L")[0] |
| 7738 | _experimenter = reader.read("!L")[0] |
| 7739 | assert(_experimenter == 6035143) |
| 7740 | _subtype = reader.read("!L")[0] |
| 7741 | assert(_subtype == 53) |
| 7742 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7743 | return obj |
| 7744 | |
| 7745 | def __eq__(self, other): |
| 7746 | if type(self) != type(other): return False |
| 7747 | if self.xid != other.xid: return False |
| 7748 | if self.pipeline != other.pipeline: return False |
| 7749 | return True |
| 7750 | |
| 7751 | def pretty_print(self, q): |
| 7752 | q.text("bsn_set_switch_pipeline_request {") |
| 7753 | with q.group(): |
| 7754 | with q.indent(2): |
| 7755 | q.breakable() |
| 7756 | q.text("xid = "); |
| 7757 | if self.xid != None: |
| 7758 | q.text("%#x" % self.xid) |
| 7759 | else: |
| 7760 | q.text('None') |
| 7761 | q.text(","); q.breakable() |
| 7762 | q.text("pipeline = "); |
| 7763 | q.pp(self.pipeline) |
| 7764 | q.breakable() |
| 7765 | q.text('}') |
| 7766 | |
| 7767 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7768 | |
| 7769 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7770 | version = 4 |
| 7771 | type = 19 |
| 7772 | stats_type = 65535 |
| 7773 | experimenter = 6035143 |
| 7774 | subtype = 6 |
| 7775 | |
| 7776 | def __init__(self, xid=None, flags=None, entries=None): |
| 7777 | if xid != None: |
| 7778 | self.xid = xid |
| 7779 | else: |
| 7780 | self.xid = None |
| 7781 | if flags != None: |
| 7782 | self.flags = flags |
| 7783 | else: |
| 7784 | self.flags = 0 |
| 7785 | if entries != None: |
| 7786 | self.entries = entries |
| 7787 | else: |
| 7788 | self.entries = [] |
| 7789 | return |
| 7790 | |
| 7791 | def pack(self): |
| 7792 | packed = [] |
| 7793 | packed.append(struct.pack("!B", self.version)) |
| 7794 | packed.append(struct.pack("!B", self.type)) |
| 7795 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7796 | packed.append(struct.pack("!L", self.xid)) |
| 7797 | packed.append(struct.pack("!H", self.stats_type)) |
| 7798 | packed.append(struct.pack("!H", self.flags)) |
| 7799 | packed.append('\x00' * 4) |
| 7800 | packed.append(struct.pack("!L", self.experimenter)) |
| 7801 | packed.append(struct.pack("!L", self.subtype)) |
| 7802 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7803 | length = sum([len(x) for x in packed]) |
| 7804 | packed[2] = struct.pack("!H", length) |
| 7805 | return ''.join(packed) |
| 7806 | |
| 7807 | @staticmethod |
| 7808 | def unpack(reader): |
| 7809 | obj = bsn_switch_pipeline_stats_reply() |
| 7810 | _version = reader.read("!B")[0] |
| 7811 | assert(_version == 4) |
| 7812 | _type = reader.read("!B")[0] |
| 7813 | assert(_type == 19) |
| 7814 | _length = reader.read("!H")[0] |
| 7815 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7816 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7817 | obj.xid = reader.read("!L")[0] |
| 7818 | _stats_type = reader.read("!H")[0] |
| 7819 | assert(_stats_type == 65535) |
| 7820 | obj.flags = reader.read("!H")[0] |
| 7821 | reader.skip(4) |
| 7822 | _experimenter = reader.read("!L")[0] |
| 7823 | assert(_experimenter == 6035143) |
| 7824 | _subtype = reader.read("!L")[0] |
| 7825 | assert(_subtype == 6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 7826 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_switch_pipeline_stats_entry.unpack) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7827 | return obj |
| 7828 | |
| 7829 | def __eq__(self, other): |
| 7830 | if type(self) != type(other): return False |
| 7831 | if self.xid != other.xid: return False |
| 7832 | if self.flags != other.flags: return False |
| 7833 | if self.entries != other.entries: return False |
| 7834 | return True |
| 7835 | |
| 7836 | def pretty_print(self, q): |
| 7837 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7838 | with q.group(): |
| 7839 | with q.indent(2): |
| 7840 | q.breakable() |
| 7841 | q.text("xid = "); |
| 7842 | if self.xid != None: |
| 7843 | q.text("%#x" % self.xid) |
| 7844 | else: |
| 7845 | q.text('None') |
| 7846 | q.text(","); q.breakable() |
| 7847 | q.text("flags = "); |
| 7848 | q.text("%#x" % self.flags) |
| 7849 | q.text(","); q.breakable() |
| 7850 | q.text("entries = "); |
| 7851 | q.pp(self.entries) |
| 7852 | q.breakable() |
| 7853 | q.text('}') |
| 7854 | |
| 7855 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7856 | |
| 7857 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7858 | version = 4 |
| 7859 | type = 18 |
| 7860 | stats_type = 65535 |
| 7861 | experimenter = 6035143 |
| 7862 | subtype = 6 |
| 7863 | |
| 7864 | def __init__(self, xid=None, flags=None): |
| 7865 | if xid != None: |
| 7866 | self.xid = xid |
| 7867 | else: |
| 7868 | self.xid = None |
| 7869 | if flags != None: |
| 7870 | self.flags = flags |
| 7871 | else: |
| 7872 | self.flags = 0 |
| 7873 | return |
| 7874 | |
| 7875 | def pack(self): |
| 7876 | packed = [] |
| 7877 | packed.append(struct.pack("!B", self.version)) |
| 7878 | packed.append(struct.pack("!B", self.type)) |
| 7879 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7880 | packed.append(struct.pack("!L", self.xid)) |
| 7881 | packed.append(struct.pack("!H", self.stats_type)) |
| 7882 | packed.append(struct.pack("!H", self.flags)) |
| 7883 | packed.append('\x00' * 4) |
| 7884 | packed.append(struct.pack("!L", self.experimenter)) |
| 7885 | packed.append(struct.pack("!L", self.subtype)) |
| 7886 | length = sum([len(x) for x in packed]) |
| 7887 | packed[2] = struct.pack("!H", length) |
| 7888 | return ''.join(packed) |
| 7889 | |
| 7890 | @staticmethod |
| 7891 | def unpack(reader): |
| 7892 | obj = bsn_switch_pipeline_stats_request() |
| 7893 | _version = reader.read("!B")[0] |
| 7894 | assert(_version == 4) |
| 7895 | _type = reader.read("!B")[0] |
| 7896 | assert(_type == 18) |
| 7897 | _length = reader.read("!H")[0] |
| 7898 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7899 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7900 | obj.xid = reader.read("!L")[0] |
| 7901 | _stats_type = reader.read("!H")[0] |
| 7902 | assert(_stats_type == 65535) |
| 7903 | obj.flags = reader.read("!H")[0] |
| 7904 | reader.skip(4) |
| 7905 | _experimenter = reader.read("!L")[0] |
| 7906 | assert(_experimenter == 6035143) |
| 7907 | _subtype = reader.read("!L")[0] |
| 7908 | assert(_subtype == 6) |
| 7909 | return obj |
| 7910 | |
| 7911 | def __eq__(self, other): |
| 7912 | if type(self) != type(other): return False |
| 7913 | if self.xid != other.xid: return False |
| 7914 | if self.flags != other.flags: return False |
| 7915 | return True |
| 7916 | |
| 7917 | def pretty_print(self, q): |
| 7918 | q.text("bsn_switch_pipeline_stats_request {") |
| 7919 | with q.group(): |
| 7920 | with q.indent(2): |
| 7921 | q.breakable() |
| 7922 | q.text("xid = "); |
| 7923 | if self.xid != None: |
| 7924 | q.text("%#x" % self.xid) |
| 7925 | else: |
| 7926 | q.text('None') |
| 7927 | q.text(","); q.breakable() |
| 7928 | q.text("flags = "); |
| 7929 | q.text("%#x" % self.flags) |
| 7930 | q.breakable() |
| 7931 | q.text('}') |
| 7932 | |
| 7933 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7934 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7935 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7936 | version = 4 |
| 7937 | type = 19 |
| 7938 | stats_type = 65535 |
| 7939 | experimenter = 6035143 |
| 7940 | subtype = 11 |
| 7941 | |
| 7942 | def __init__(self, xid=None, flags=None, entries=None): |
| 7943 | if xid != None: |
| 7944 | self.xid = xid |
| 7945 | else: |
| 7946 | self.xid = None |
| 7947 | if flags != None: |
| 7948 | self.flags = flags |
| 7949 | else: |
| 7950 | self.flags = 0 |
| 7951 | if entries != None: |
| 7952 | self.entries = entries |
| 7953 | else: |
| 7954 | self.entries = [] |
| 7955 | return |
| 7956 | |
| 7957 | def pack(self): |
| 7958 | packed = [] |
| 7959 | packed.append(struct.pack("!B", self.version)) |
| 7960 | packed.append(struct.pack("!B", self.type)) |
| 7961 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7962 | packed.append(struct.pack("!L", self.xid)) |
| 7963 | packed.append(struct.pack("!H", self.stats_type)) |
| 7964 | packed.append(struct.pack("!H", self.flags)) |
| 7965 | packed.append('\x00' * 4) |
| 7966 | packed.append(struct.pack("!L", self.experimenter)) |
| 7967 | packed.append(struct.pack("!L", self.subtype)) |
| 7968 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7969 | length = sum([len(x) for x in packed]) |
| 7970 | packed[2] = struct.pack("!H", length) |
| 7971 | return ''.join(packed) |
| 7972 | |
| 7973 | @staticmethod |
| 7974 | def unpack(reader): |
| 7975 | obj = bsn_table_checksum_stats_reply() |
| 7976 | _version = reader.read("!B")[0] |
| 7977 | assert(_version == 4) |
| 7978 | _type = reader.read("!B")[0] |
| 7979 | assert(_type == 19) |
| 7980 | _length = reader.read("!H")[0] |
| 7981 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7982 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7983 | obj.xid = reader.read("!L")[0] |
| 7984 | _stats_type = reader.read("!H")[0] |
| 7985 | assert(_stats_type == 65535) |
| 7986 | obj.flags = reader.read("!H")[0] |
| 7987 | reader.skip(4) |
| 7988 | _experimenter = reader.read("!L")[0] |
| 7989 | assert(_experimenter == 6035143) |
| 7990 | _subtype = reader.read("!L")[0] |
| 7991 | assert(_subtype == 11) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 7992 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_table_checksum_stats_entry.unpack) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7993 | return obj |
| 7994 | |
| 7995 | def __eq__(self, other): |
| 7996 | if type(self) != type(other): return False |
| 7997 | if self.xid != other.xid: return False |
| 7998 | if self.flags != other.flags: return False |
| 7999 | if self.entries != other.entries: return False |
| 8000 | return True |
| 8001 | |
| 8002 | def pretty_print(self, q): |
| 8003 | q.text("bsn_table_checksum_stats_reply {") |
| 8004 | with q.group(): |
| 8005 | with q.indent(2): |
| 8006 | q.breakable() |
| 8007 | q.text("xid = "); |
| 8008 | if self.xid != None: |
| 8009 | q.text("%#x" % self.xid) |
| 8010 | else: |
| 8011 | q.text('None') |
| 8012 | q.text(","); q.breakable() |
| 8013 | q.text("flags = "); |
| 8014 | q.text("%#x" % self.flags) |
| 8015 | q.text(","); q.breakable() |
| 8016 | q.text("entries = "); |
| 8017 | q.pp(self.entries) |
| 8018 | q.breakable() |
| 8019 | q.text('}') |
| 8020 | |
| 8021 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 8022 | |
| 8023 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 8024 | version = 4 |
| 8025 | type = 18 |
| 8026 | stats_type = 65535 |
| 8027 | experimenter = 6035143 |
| 8028 | subtype = 11 |
| 8029 | |
| 8030 | def __init__(self, xid=None, flags=None): |
| 8031 | if xid != None: |
| 8032 | self.xid = xid |
| 8033 | else: |
| 8034 | self.xid = None |
| 8035 | if flags != None: |
| 8036 | self.flags = flags |
| 8037 | else: |
| 8038 | self.flags = 0 |
| 8039 | return |
| 8040 | |
| 8041 | def pack(self): |
| 8042 | packed = [] |
| 8043 | packed.append(struct.pack("!B", self.version)) |
| 8044 | packed.append(struct.pack("!B", self.type)) |
| 8045 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8046 | packed.append(struct.pack("!L", self.xid)) |
| 8047 | packed.append(struct.pack("!H", self.stats_type)) |
| 8048 | packed.append(struct.pack("!H", self.flags)) |
| 8049 | packed.append('\x00' * 4) |
| 8050 | packed.append(struct.pack("!L", self.experimenter)) |
| 8051 | packed.append(struct.pack("!L", self.subtype)) |
| 8052 | length = sum([len(x) for x in packed]) |
| 8053 | packed[2] = struct.pack("!H", length) |
| 8054 | return ''.join(packed) |
| 8055 | |
| 8056 | @staticmethod |
| 8057 | def unpack(reader): |
| 8058 | obj = bsn_table_checksum_stats_request() |
| 8059 | _version = reader.read("!B")[0] |
| 8060 | assert(_version == 4) |
| 8061 | _type = reader.read("!B")[0] |
| 8062 | assert(_type == 18) |
| 8063 | _length = reader.read("!H")[0] |
| 8064 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8065 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8066 | obj.xid = reader.read("!L")[0] |
| 8067 | _stats_type = reader.read("!H")[0] |
| 8068 | assert(_stats_type == 65535) |
| 8069 | obj.flags = reader.read("!H")[0] |
| 8070 | reader.skip(4) |
| 8071 | _experimenter = reader.read("!L")[0] |
| 8072 | assert(_experimenter == 6035143) |
| 8073 | _subtype = reader.read("!L")[0] |
| 8074 | assert(_subtype == 11) |
| 8075 | return obj |
| 8076 | |
| 8077 | def __eq__(self, other): |
| 8078 | if type(self) != type(other): return False |
| 8079 | if self.xid != other.xid: return False |
| 8080 | if self.flags != other.flags: return False |
| 8081 | return True |
| 8082 | |
| 8083 | def pretty_print(self, q): |
| 8084 | q.text("bsn_table_checksum_stats_request {") |
| 8085 | with q.group(): |
| 8086 | with q.indent(2): |
| 8087 | q.breakable() |
| 8088 | q.text("xid = "); |
| 8089 | if self.xid != None: |
| 8090 | q.text("%#x" % self.xid) |
| 8091 | else: |
| 8092 | q.text('None') |
| 8093 | q.text(","); q.breakable() |
| 8094 | q.text("flags = "); |
| 8095 | q.text("%#x" % self.flags) |
| 8096 | q.breakable() |
| 8097 | q.text('}') |
| 8098 | |
| 8099 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 8100 | |
| 8101 | class bsn_table_set_buckets_size(bsn_header): |
| 8102 | version = 4 |
| 8103 | type = 4 |
| 8104 | experimenter = 6035143 |
| 8105 | subtype = 61 |
| 8106 | |
| 8107 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 8108 | if xid != None: |
| 8109 | self.xid = xid |
| 8110 | else: |
| 8111 | self.xid = None |
| 8112 | if table_id != None: |
| 8113 | self.table_id = table_id |
| 8114 | else: |
| 8115 | self.table_id = 0 |
| 8116 | if buckets_size != None: |
| 8117 | self.buckets_size = buckets_size |
| 8118 | else: |
| 8119 | self.buckets_size = 0 |
| 8120 | return |
| 8121 | |
| 8122 | def pack(self): |
| 8123 | packed = [] |
| 8124 | packed.append(struct.pack("!B", self.version)) |
| 8125 | packed.append(struct.pack("!B", self.type)) |
| 8126 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8127 | packed.append(struct.pack("!L", self.xid)) |
| 8128 | packed.append(struct.pack("!L", self.experimenter)) |
| 8129 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8130 | packed.append('\x00' * 1) |
| 8131 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8132 | packed.append('\x00' * 2) |
| 8133 | packed.append(struct.pack("!L", self.buckets_size)) |
| 8134 | length = sum([len(x) for x in packed]) |
| 8135 | packed[2] = struct.pack("!H", length) |
| 8136 | return ''.join(packed) |
| 8137 | |
| 8138 | @staticmethod |
| 8139 | def unpack(reader): |
| 8140 | obj = bsn_table_set_buckets_size() |
| 8141 | _version = reader.read("!B")[0] |
| 8142 | assert(_version == 4) |
| 8143 | _type = reader.read("!B")[0] |
| 8144 | assert(_type == 4) |
| 8145 | _length = reader.read("!H")[0] |
| 8146 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8147 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8148 | obj.xid = reader.read("!L")[0] |
| 8149 | _experimenter = reader.read("!L")[0] |
| 8150 | assert(_experimenter == 6035143) |
| 8151 | _subtype = reader.read("!L")[0] |
| 8152 | assert(_subtype == 61) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8153 | reader.skip(1) |
| 8154 | obj.table_id = reader.read("!B")[0] |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8155 | reader.skip(2) |
| 8156 | obj.buckets_size = reader.read("!L")[0] |
| 8157 | return obj |
| 8158 | |
| 8159 | def __eq__(self, other): |
| 8160 | if type(self) != type(other): return False |
| 8161 | if self.xid != other.xid: return False |
| 8162 | if self.table_id != other.table_id: return False |
| 8163 | if self.buckets_size != other.buckets_size: return False |
| 8164 | return True |
| 8165 | |
| 8166 | def pretty_print(self, q): |
| 8167 | q.text("bsn_table_set_buckets_size {") |
| 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("buckets_size = "); |
| 8181 | q.text("%#x" % self.buckets_size) |
| 8182 | q.breakable() |
| 8183 | q.text('}') |
| 8184 | |
| 8185 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 8186 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8187 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8188 | version = 4 |
| 8189 | type = 4 |
| 8190 | experimenter = 6035143 |
| 8191 | subtype = 45 |
| 8192 | |
| 8193 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8194 | if xid != None: |
| 8195 | self.xid = xid |
| 8196 | else: |
| 8197 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8198 | if time_ms != None: |
| 8199 | self.time_ms = time_ms |
| 8200 | else: |
| 8201 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8202 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8203 | |
| 8204 | def pack(self): |
| 8205 | packed = [] |
| 8206 | packed.append(struct.pack("!B", self.version)) |
| 8207 | packed.append(struct.pack("!B", self.type)) |
| 8208 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8209 | packed.append(struct.pack("!L", self.xid)) |
| 8210 | packed.append(struct.pack("!L", self.experimenter)) |
| 8211 | packed.append(struct.pack("!L", self.subtype)) |
| 8212 | packed.append(struct.pack("!Q", self.time_ms)) |
| 8213 | length = sum([len(x) for x in packed]) |
| 8214 | packed[2] = struct.pack("!H", length) |
| 8215 | return ''.join(packed) |
| 8216 | |
| 8217 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8218 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8219 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8220 | _version = reader.read("!B")[0] |
| 8221 | assert(_version == 4) |
| 8222 | _type = reader.read("!B")[0] |
| 8223 | assert(_type == 4) |
| 8224 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8225 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8226 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8227 | obj.xid = reader.read("!L")[0] |
| 8228 | _experimenter = reader.read("!L")[0] |
| 8229 | assert(_experimenter == 6035143) |
| 8230 | _subtype = reader.read("!L")[0] |
| 8231 | assert(_subtype == 45) |
| 8232 | obj.time_ms = reader.read("!Q")[0] |
| 8233 | return obj |
| 8234 | |
| 8235 | def __eq__(self, other): |
| 8236 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8237 | if self.xid != other.xid: return False |
| 8238 | if self.time_ms != other.time_ms: return False |
| 8239 | return True |
| 8240 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8241 | def pretty_print(self, q): |
| 8242 | q.text("bsn_time_reply {") |
| 8243 | with q.group(): |
| 8244 | with q.indent(2): |
| 8245 | q.breakable() |
| 8246 | q.text("xid = "); |
| 8247 | if self.xid != None: |
| 8248 | q.text("%#x" % self.xid) |
| 8249 | else: |
| 8250 | q.text('None') |
| 8251 | q.text(","); q.breakable() |
| 8252 | q.text("time_ms = "); |
| 8253 | q.text("%#x" % self.time_ms) |
| 8254 | q.breakable() |
| 8255 | q.text('}') |
| 8256 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8257 | bsn_header.subtypes[45] = bsn_time_reply |
| 8258 | |
| 8259 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8260 | version = 4 |
| 8261 | type = 4 |
| 8262 | experimenter = 6035143 |
| 8263 | subtype = 44 |
| 8264 | |
| 8265 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8266 | if xid != None: |
| 8267 | self.xid = xid |
| 8268 | else: |
| 8269 | self.xid = None |
| 8270 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8271 | |
| 8272 | def pack(self): |
| 8273 | packed = [] |
| 8274 | packed.append(struct.pack("!B", self.version)) |
| 8275 | packed.append(struct.pack("!B", self.type)) |
| 8276 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8277 | packed.append(struct.pack("!L", self.xid)) |
| 8278 | packed.append(struct.pack("!L", self.experimenter)) |
| 8279 | packed.append(struct.pack("!L", self.subtype)) |
| 8280 | length = sum([len(x) for x in packed]) |
| 8281 | packed[2] = struct.pack("!H", length) |
| 8282 | return ''.join(packed) |
| 8283 | |
| 8284 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8285 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8286 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8287 | _version = reader.read("!B")[0] |
| 8288 | assert(_version == 4) |
| 8289 | _type = reader.read("!B")[0] |
| 8290 | assert(_type == 4) |
| 8291 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8292 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8293 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8294 | obj.xid = reader.read("!L")[0] |
| 8295 | _experimenter = reader.read("!L")[0] |
| 8296 | assert(_experimenter == 6035143) |
| 8297 | _subtype = reader.read("!L")[0] |
| 8298 | assert(_subtype == 44) |
| 8299 | return obj |
| 8300 | |
| 8301 | def __eq__(self, other): |
| 8302 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8303 | if self.xid != other.xid: return False |
| 8304 | return True |
| 8305 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8306 | def pretty_print(self, q): |
| 8307 | q.text("bsn_time_request {") |
| 8308 | with q.group(): |
| 8309 | with q.indent(2): |
| 8310 | q.breakable() |
| 8311 | q.text("xid = "); |
| 8312 | if self.xid != None: |
| 8313 | q.text("%#x" % self.xid) |
| 8314 | else: |
| 8315 | q.text('None') |
| 8316 | q.breakable() |
| 8317 | q.text('}') |
| 8318 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8319 | bsn_header.subtypes[44] = bsn_time_request |
| 8320 | |
| 8321 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8322 | version = 4 |
| 8323 | type = 4 |
| 8324 | experimenter = 6035143 |
| 8325 | subtype = 16 |
| 8326 | |
| 8327 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8328 | if xid != None: |
| 8329 | self.xid = xid |
| 8330 | else: |
| 8331 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8332 | if status != None: |
| 8333 | self.status = status |
| 8334 | else: |
| 8335 | self.status = 0 |
| 8336 | if vport_no != None: |
| 8337 | self.vport_no = vport_no |
| 8338 | else: |
| 8339 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8340 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8341 | |
| 8342 | def pack(self): |
| 8343 | packed = [] |
| 8344 | packed.append(struct.pack("!B", self.version)) |
| 8345 | packed.append(struct.pack("!B", self.type)) |
| 8346 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8347 | packed.append(struct.pack("!L", self.xid)) |
| 8348 | packed.append(struct.pack("!L", self.experimenter)) |
| 8349 | packed.append(struct.pack("!L", self.subtype)) |
| 8350 | packed.append(struct.pack("!L", self.status)) |
| 8351 | packed.append(struct.pack("!L", self.vport_no)) |
| 8352 | length = sum([len(x) for x in packed]) |
| 8353 | packed[2] = struct.pack("!H", length) |
| 8354 | return ''.join(packed) |
| 8355 | |
| 8356 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8357 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8358 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8359 | _version = reader.read("!B")[0] |
| 8360 | assert(_version == 4) |
| 8361 | _type = reader.read("!B")[0] |
| 8362 | assert(_type == 4) |
| 8363 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8364 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8365 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8366 | obj.xid = reader.read("!L")[0] |
| 8367 | _experimenter = reader.read("!L")[0] |
| 8368 | assert(_experimenter == 6035143) |
| 8369 | _subtype = reader.read("!L")[0] |
| 8370 | assert(_subtype == 16) |
| 8371 | obj.status = reader.read("!L")[0] |
| 8372 | obj.vport_no = reader.read("!L")[0] |
| 8373 | return obj |
| 8374 | |
| 8375 | def __eq__(self, other): |
| 8376 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8377 | if self.xid != other.xid: return False |
| 8378 | if self.status != other.status: return False |
| 8379 | if self.vport_no != other.vport_no: return False |
| 8380 | return True |
| 8381 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8382 | def pretty_print(self, q): |
| 8383 | q.text("bsn_virtual_port_create_reply {") |
| 8384 | with q.group(): |
| 8385 | with q.indent(2): |
| 8386 | q.breakable() |
| 8387 | q.text("xid = "); |
| 8388 | if self.xid != None: |
| 8389 | q.text("%#x" % self.xid) |
| 8390 | else: |
| 8391 | q.text('None') |
| 8392 | q.text(","); q.breakable() |
| 8393 | q.text("status = "); |
| 8394 | q.text("%#x" % self.status) |
| 8395 | q.text(","); q.breakable() |
| 8396 | q.text("vport_no = "); |
| 8397 | q.text("%#x" % self.vport_no) |
| 8398 | q.breakable() |
| 8399 | q.text('}') |
| 8400 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8401 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 8402 | |
| 8403 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8404 | version = 4 |
| 8405 | type = 4 |
| 8406 | experimenter = 6035143 |
| 8407 | subtype = 15 |
| 8408 | |
| 8409 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8410 | if xid != None: |
| 8411 | self.xid = xid |
| 8412 | else: |
| 8413 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8414 | if vport != None: |
| 8415 | self.vport = vport |
| 8416 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 8417 | self.vport = ofp.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8418 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8419 | |
| 8420 | def pack(self): |
| 8421 | packed = [] |
| 8422 | packed.append(struct.pack("!B", self.version)) |
| 8423 | packed.append(struct.pack("!B", self.type)) |
| 8424 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8425 | packed.append(struct.pack("!L", self.xid)) |
| 8426 | packed.append(struct.pack("!L", self.experimenter)) |
| 8427 | packed.append(struct.pack("!L", self.subtype)) |
| 8428 | packed.append(self.vport.pack()) |
| 8429 | length = sum([len(x) for x in packed]) |
| 8430 | packed[2] = struct.pack("!H", length) |
| 8431 | return ''.join(packed) |
| 8432 | |
| 8433 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8434 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8435 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8436 | _version = reader.read("!B")[0] |
| 8437 | assert(_version == 4) |
| 8438 | _type = reader.read("!B")[0] |
| 8439 | assert(_type == 4) |
| 8440 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8441 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8442 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8443 | obj.xid = reader.read("!L")[0] |
| 8444 | _experimenter = reader.read("!L")[0] |
| 8445 | assert(_experimenter == 6035143) |
| 8446 | _subtype = reader.read("!L")[0] |
| 8447 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 8448 | obj.vport = ofp.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8449 | return obj |
| 8450 | |
| 8451 | def __eq__(self, other): |
| 8452 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8453 | if self.xid != other.xid: return False |
| 8454 | if self.vport != other.vport: return False |
| 8455 | return True |
| 8456 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8457 | def pretty_print(self, q): |
| 8458 | q.text("bsn_virtual_port_create_request {") |
| 8459 | with q.group(): |
| 8460 | with q.indent(2): |
| 8461 | q.breakable() |
| 8462 | q.text("xid = "); |
| 8463 | if self.xid != None: |
| 8464 | q.text("%#x" % self.xid) |
| 8465 | else: |
| 8466 | q.text('None') |
| 8467 | q.text(","); q.breakable() |
| 8468 | q.text("vport = "); |
| 8469 | q.pp(self.vport) |
| 8470 | q.breakable() |
| 8471 | q.text('}') |
| 8472 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8473 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 8474 | |
| 8475 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8476 | version = 4 |
| 8477 | type = 4 |
| 8478 | experimenter = 6035143 |
| 8479 | subtype = 26 |
| 8480 | |
| 8481 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8482 | if xid != None: |
| 8483 | self.xid = xid |
| 8484 | else: |
| 8485 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8486 | if status != None: |
| 8487 | self.status = status |
| 8488 | else: |
| 8489 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8490 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8491 | |
| 8492 | def pack(self): |
| 8493 | packed = [] |
| 8494 | packed.append(struct.pack("!B", self.version)) |
| 8495 | packed.append(struct.pack("!B", self.type)) |
| 8496 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8497 | packed.append(struct.pack("!L", self.xid)) |
| 8498 | packed.append(struct.pack("!L", self.experimenter)) |
| 8499 | packed.append(struct.pack("!L", self.subtype)) |
| 8500 | packed.append(struct.pack("!L", self.status)) |
| 8501 | length = sum([len(x) for x in packed]) |
| 8502 | packed[2] = struct.pack("!H", length) |
| 8503 | return ''.join(packed) |
| 8504 | |
| 8505 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8506 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8507 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8508 | _version = reader.read("!B")[0] |
| 8509 | assert(_version == 4) |
| 8510 | _type = reader.read("!B")[0] |
| 8511 | assert(_type == 4) |
| 8512 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8513 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8514 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8515 | obj.xid = reader.read("!L")[0] |
| 8516 | _experimenter = reader.read("!L")[0] |
| 8517 | assert(_experimenter == 6035143) |
| 8518 | _subtype = reader.read("!L")[0] |
| 8519 | assert(_subtype == 26) |
| 8520 | obj.status = reader.read("!L")[0] |
| 8521 | return obj |
| 8522 | |
| 8523 | def __eq__(self, other): |
| 8524 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8525 | if self.xid != other.xid: return False |
| 8526 | if self.status != other.status: return False |
| 8527 | return True |
| 8528 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8529 | def pretty_print(self, q): |
| 8530 | q.text("bsn_virtual_port_remove_reply {") |
| 8531 | with q.group(): |
| 8532 | with q.indent(2): |
| 8533 | q.breakable() |
| 8534 | q.text("xid = "); |
| 8535 | if self.xid != None: |
| 8536 | q.text("%#x" % self.xid) |
| 8537 | else: |
| 8538 | q.text('None') |
| 8539 | q.text(","); q.breakable() |
| 8540 | q.text("status = "); |
| 8541 | q.text("%#x" % self.status) |
| 8542 | q.breakable() |
| 8543 | q.text('}') |
| 8544 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8545 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8546 | |
| 8547 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8548 | version = 4 |
| 8549 | type = 4 |
| 8550 | experimenter = 6035143 |
| 8551 | subtype = 17 |
| 8552 | |
| 8553 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8554 | if xid != None: |
| 8555 | self.xid = xid |
| 8556 | else: |
| 8557 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8558 | if vport_no != None: |
| 8559 | self.vport_no = vport_no |
| 8560 | else: |
| 8561 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8562 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8563 | |
| 8564 | def pack(self): |
| 8565 | packed = [] |
| 8566 | packed.append(struct.pack("!B", self.version)) |
| 8567 | packed.append(struct.pack("!B", self.type)) |
| 8568 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8569 | packed.append(struct.pack("!L", self.xid)) |
| 8570 | packed.append(struct.pack("!L", self.experimenter)) |
| 8571 | packed.append(struct.pack("!L", self.subtype)) |
| 8572 | packed.append(struct.pack("!L", self.vport_no)) |
| 8573 | length = sum([len(x) for x in packed]) |
| 8574 | packed[2] = struct.pack("!H", length) |
| 8575 | return ''.join(packed) |
| 8576 | |
| 8577 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8578 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8579 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8580 | _version = reader.read("!B")[0] |
| 8581 | assert(_version == 4) |
| 8582 | _type = reader.read("!B")[0] |
| 8583 | assert(_type == 4) |
| 8584 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8585 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8586 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8587 | obj.xid = reader.read("!L")[0] |
| 8588 | _experimenter = reader.read("!L")[0] |
| 8589 | assert(_experimenter == 6035143) |
| 8590 | _subtype = reader.read("!L")[0] |
| 8591 | assert(_subtype == 17) |
| 8592 | obj.vport_no = reader.read("!L")[0] |
| 8593 | return obj |
| 8594 | |
| 8595 | def __eq__(self, other): |
| 8596 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8597 | if self.xid != other.xid: return False |
| 8598 | if self.vport_no != other.vport_no: return False |
| 8599 | return True |
| 8600 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8601 | def pretty_print(self, q): |
| 8602 | q.text("bsn_virtual_port_remove_request {") |
| 8603 | with q.group(): |
| 8604 | with q.indent(2): |
| 8605 | q.breakable() |
| 8606 | q.text("xid = "); |
| 8607 | if self.xid != None: |
| 8608 | q.text("%#x" % self.xid) |
| 8609 | else: |
| 8610 | q.text('None') |
| 8611 | q.text(","); q.breakable() |
| 8612 | q.text("vport_no = "); |
| 8613 | q.text("%#x" % self.vport_no) |
| 8614 | q.breakable() |
| 8615 | q.text('}') |
| 8616 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8617 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8618 | |
| 8619 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8620 | version = 4 |
| 8621 | type = 19 |
| 8622 | stats_type = 65535 |
| 8623 | experimenter = 6035143 |
| 8624 | subtype = 9 |
| 8625 | |
| 8626 | def __init__(self, xid=None, flags=None, entries=None): |
| 8627 | if xid != None: |
| 8628 | self.xid = xid |
| 8629 | else: |
| 8630 | self.xid = None |
| 8631 | if flags != None: |
| 8632 | self.flags = flags |
| 8633 | else: |
| 8634 | self.flags = 0 |
| 8635 | if entries != None: |
| 8636 | self.entries = entries |
| 8637 | else: |
| 8638 | self.entries = [] |
| 8639 | return |
| 8640 | |
| 8641 | def pack(self): |
| 8642 | packed = [] |
| 8643 | packed.append(struct.pack("!B", self.version)) |
| 8644 | packed.append(struct.pack("!B", self.type)) |
| 8645 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8646 | packed.append(struct.pack("!L", self.xid)) |
| 8647 | packed.append(struct.pack("!H", self.stats_type)) |
| 8648 | packed.append(struct.pack("!H", self.flags)) |
| 8649 | packed.append('\x00' * 4) |
| 8650 | packed.append(struct.pack("!L", self.experimenter)) |
| 8651 | packed.append(struct.pack("!L", self.subtype)) |
| 8652 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8653 | length = sum([len(x) for x in packed]) |
| 8654 | packed[2] = struct.pack("!H", length) |
| 8655 | return ''.join(packed) |
| 8656 | |
| 8657 | @staticmethod |
| 8658 | def unpack(reader): |
| 8659 | obj = bsn_vlan_counter_stats_reply() |
| 8660 | _version = reader.read("!B")[0] |
| 8661 | assert(_version == 4) |
| 8662 | _type = reader.read("!B")[0] |
| 8663 | assert(_type == 19) |
| 8664 | _length = reader.read("!H")[0] |
| 8665 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8666 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8667 | obj.xid = reader.read("!L")[0] |
| 8668 | _stats_type = reader.read("!H")[0] |
| 8669 | assert(_stats_type == 65535) |
| 8670 | obj.flags = reader.read("!H")[0] |
| 8671 | reader.skip(4) |
| 8672 | _experimenter = reader.read("!L")[0] |
| 8673 | assert(_experimenter == 6035143) |
| 8674 | _subtype = reader.read("!L")[0] |
| 8675 | assert(_subtype == 9) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 8676 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vlan_counter_stats_entry.unpack) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8677 | return obj |
| 8678 | |
| 8679 | def __eq__(self, other): |
| 8680 | if type(self) != type(other): return False |
| 8681 | if self.xid != other.xid: return False |
| 8682 | if self.flags != other.flags: return False |
| 8683 | if self.entries != other.entries: return False |
| 8684 | return True |
| 8685 | |
| 8686 | def pretty_print(self, q): |
| 8687 | q.text("bsn_vlan_counter_stats_reply {") |
| 8688 | with q.group(): |
| 8689 | with q.indent(2): |
| 8690 | q.breakable() |
| 8691 | q.text("xid = "); |
| 8692 | if self.xid != None: |
| 8693 | q.text("%#x" % self.xid) |
| 8694 | else: |
| 8695 | q.text('None') |
| 8696 | q.text(","); q.breakable() |
| 8697 | q.text("flags = "); |
| 8698 | q.text("%#x" % self.flags) |
| 8699 | q.text(","); q.breakable() |
| 8700 | q.text("entries = "); |
| 8701 | q.pp(self.entries) |
| 8702 | q.breakable() |
| 8703 | q.text('}') |
| 8704 | |
| 8705 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8706 | |
| 8707 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8708 | version = 4 |
| 8709 | type = 18 |
| 8710 | stats_type = 65535 |
| 8711 | experimenter = 6035143 |
| 8712 | subtype = 9 |
| 8713 | |
| 8714 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8715 | if xid != None: |
| 8716 | self.xid = xid |
| 8717 | else: |
| 8718 | self.xid = None |
| 8719 | if flags != None: |
| 8720 | self.flags = flags |
| 8721 | else: |
| 8722 | self.flags = 0 |
| 8723 | if vlan_vid != None: |
| 8724 | self.vlan_vid = vlan_vid |
| 8725 | else: |
| 8726 | self.vlan_vid = 0 |
| 8727 | return |
| 8728 | |
| 8729 | def pack(self): |
| 8730 | packed = [] |
| 8731 | packed.append(struct.pack("!B", self.version)) |
| 8732 | packed.append(struct.pack("!B", self.type)) |
| 8733 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8734 | packed.append(struct.pack("!L", self.xid)) |
| 8735 | packed.append(struct.pack("!H", self.stats_type)) |
| 8736 | packed.append(struct.pack("!H", self.flags)) |
| 8737 | packed.append('\x00' * 4) |
| 8738 | packed.append(struct.pack("!L", self.experimenter)) |
| 8739 | packed.append(struct.pack("!L", self.subtype)) |
| 8740 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8741 | length = sum([len(x) for x in packed]) |
| 8742 | packed[2] = struct.pack("!H", length) |
| 8743 | return ''.join(packed) |
| 8744 | |
| 8745 | @staticmethod |
| 8746 | def unpack(reader): |
| 8747 | obj = bsn_vlan_counter_stats_request() |
| 8748 | _version = reader.read("!B")[0] |
| 8749 | assert(_version == 4) |
| 8750 | _type = reader.read("!B")[0] |
| 8751 | assert(_type == 18) |
| 8752 | _length = reader.read("!H")[0] |
| 8753 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8754 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8755 | obj.xid = reader.read("!L")[0] |
| 8756 | _stats_type = reader.read("!H")[0] |
| 8757 | assert(_stats_type == 65535) |
| 8758 | obj.flags = reader.read("!H")[0] |
| 8759 | reader.skip(4) |
| 8760 | _experimenter = reader.read("!L")[0] |
| 8761 | assert(_experimenter == 6035143) |
| 8762 | _subtype = reader.read("!L")[0] |
| 8763 | assert(_subtype == 9) |
| 8764 | obj.vlan_vid = reader.read("!H")[0] |
| 8765 | return obj |
| 8766 | |
| 8767 | def __eq__(self, other): |
| 8768 | if type(self) != type(other): return False |
| 8769 | if self.xid != other.xid: return False |
| 8770 | if self.flags != other.flags: return False |
| 8771 | if self.vlan_vid != other.vlan_vid: return False |
| 8772 | return True |
| 8773 | |
| 8774 | def pretty_print(self, q): |
| 8775 | q.text("bsn_vlan_counter_stats_request {") |
| 8776 | with q.group(): |
| 8777 | with q.indent(2): |
| 8778 | q.breakable() |
| 8779 | q.text("xid = "); |
| 8780 | if self.xid != None: |
| 8781 | q.text("%#x" % self.xid) |
| 8782 | else: |
| 8783 | q.text('None') |
| 8784 | q.text(","); q.breakable() |
| 8785 | q.text("flags = "); |
| 8786 | q.text("%#x" % self.flags) |
| 8787 | q.text(","); q.breakable() |
| 8788 | q.text("vlan_vid = "); |
| 8789 | q.text("%#x" % self.vlan_vid) |
| 8790 | q.breakable() |
| 8791 | q.text('}') |
| 8792 | |
| 8793 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8794 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8795 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8796 | version = 4 |
| 8797 | type = 19 |
| 8798 | stats_type = 65535 |
| 8799 | experimenter = 6035143 |
| 8800 | subtype = 15 |
| 8801 | |
| 8802 | def __init__(self, xid=None, flags=None, entries=None): |
| 8803 | if xid != None: |
| 8804 | self.xid = xid |
| 8805 | else: |
| 8806 | self.xid = None |
| 8807 | if flags != None: |
| 8808 | self.flags = flags |
| 8809 | else: |
| 8810 | self.flags = 0 |
| 8811 | if entries != None: |
| 8812 | self.entries = entries |
| 8813 | else: |
| 8814 | self.entries = [] |
| 8815 | return |
| 8816 | |
| 8817 | def pack(self): |
| 8818 | packed = [] |
| 8819 | packed.append(struct.pack("!B", self.version)) |
| 8820 | packed.append(struct.pack("!B", self.type)) |
| 8821 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8822 | packed.append(struct.pack("!L", self.xid)) |
| 8823 | packed.append(struct.pack("!H", self.stats_type)) |
| 8824 | packed.append(struct.pack("!H", self.flags)) |
| 8825 | packed.append('\x00' * 4) |
| 8826 | packed.append(struct.pack("!L", self.experimenter)) |
| 8827 | packed.append(struct.pack("!L", self.subtype)) |
| 8828 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8829 | length = sum([len(x) for x in packed]) |
| 8830 | packed[2] = struct.pack("!H", length) |
| 8831 | return ''.join(packed) |
| 8832 | |
| 8833 | @staticmethod |
| 8834 | def unpack(reader): |
| 8835 | obj = bsn_vrf_counter_stats_reply() |
| 8836 | _version = reader.read("!B")[0] |
| 8837 | assert(_version == 4) |
| 8838 | _type = reader.read("!B")[0] |
| 8839 | assert(_type == 19) |
| 8840 | _length = reader.read("!H")[0] |
| 8841 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8842 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8843 | obj.xid = reader.read("!L")[0] |
| 8844 | _stats_type = reader.read("!H")[0] |
| 8845 | assert(_stats_type == 65535) |
| 8846 | obj.flags = reader.read("!H")[0] |
| 8847 | reader.skip(4) |
| 8848 | _experimenter = reader.read("!L")[0] |
| 8849 | assert(_experimenter == 6035143) |
| 8850 | _subtype = reader.read("!L")[0] |
| 8851 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 8852 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.bsn_vrf_counter_stats_entry.unpack) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8853 | return obj |
| 8854 | |
| 8855 | def __eq__(self, other): |
| 8856 | if type(self) != type(other): return False |
| 8857 | if self.xid != other.xid: return False |
| 8858 | if self.flags != other.flags: return False |
| 8859 | if self.entries != other.entries: return False |
| 8860 | return True |
| 8861 | |
| 8862 | def pretty_print(self, q): |
| 8863 | q.text("bsn_vrf_counter_stats_reply {") |
| 8864 | with q.group(): |
| 8865 | with q.indent(2): |
| 8866 | q.breakable() |
| 8867 | q.text("xid = "); |
| 8868 | if self.xid != None: |
| 8869 | q.text("%#x" % self.xid) |
| 8870 | else: |
| 8871 | q.text('None') |
| 8872 | q.text(","); q.breakable() |
| 8873 | q.text("flags = "); |
| 8874 | q.text("%#x" % self.flags) |
| 8875 | q.text(","); q.breakable() |
| 8876 | q.text("entries = "); |
| 8877 | q.pp(self.entries) |
| 8878 | q.breakable() |
| 8879 | q.text('}') |
| 8880 | |
| 8881 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8882 | |
| 8883 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8884 | version = 4 |
| 8885 | type = 18 |
| 8886 | stats_type = 65535 |
| 8887 | experimenter = 6035143 |
| 8888 | subtype = 15 |
| 8889 | |
| 8890 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8891 | if xid != None: |
| 8892 | self.xid = xid |
| 8893 | else: |
| 8894 | self.xid = None |
| 8895 | if flags != None: |
| 8896 | self.flags = flags |
| 8897 | else: |
| 8898 | self.flags = 0 |
| 8899 | if vrf != None: |
| 8900 | self.vrf = vrf |
| 8901 | else: |
| 8902 | self.vrf = 0 |
| 8903 | return |
| 8904 | |
| 8905 | def pack(self): |
| 8906 | packed = [] |
| 8907 | packed.append(struct.pack("!B", self.version)) |
| 8908 | packed.append(struct.pack("!B", self.type)) |
| 8909 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8910 | packed.append(struct.pack("!L", self.xid)) |
| 8911 | packed.append(struct.pack("!H", self.stats_type)) |
| 8912 | packed.append(struct.pack("!H", self.flags)) |
| 8913 | packed.append('\x00' * 4) |
| 8914 | packed.append(struct.pack("!L", self.experimenter)) |
| 8915 | packed.append(struct.pack("!L", self.subtype)) |
| 8916 | packed.append(struct.pack("!L", self.vrf)) |
| 8917 | length = sum([len(x) for x in packed]) |
| 8918 | packed[2] = struct.pack("!H", length) |
| 8919 | return ''.join(packed) |
| 8920 | |
| 8921 | @staticmethod |
| 8922 | def unpack(reader): |
| 8923 | obj = bsn_vrf_counter_stats_request() |
| 8924 | _version = reader.read("!B")[0] |
| 8925 | assert(_version == 4) |
| 8926 | _type = reader.read("!B")[0] |
| 8927 | assert(_type == 18) |
| 8928 | _length = reader.read("!H")[0] |
| 8929 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8930 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8931 | obj.xid = reader.read("!L")[0] |
| 8932 | _stats_type = reader.read("!H")[0] |
| 8933 | assert(_stats_type == 65535) |
| 8934 | obj.flags = reader.read("!H")[0] |
| 8935 | reader.skip(4) |
| 8936 | _experimenter = reader.read("!L")[0] |
| 8937 | assert(_experimenter == 6035143) |
| 8938 | _subtype = reader.read("!L")[0] |
| 8939 | assert(_subtype == 15) |
| 8940 | obj.vrf = reader.read("!L")[0] |
| 8941 | return obj |
| 8942 | |
| 8943 | def __eq__(self, other): |
| 8944 | if type(self) != type(other): return False |
| 8945 | if self.xid != other.xid: return False |
| 8946 | if self.flags != other.flags: return False |
| 8947 | if self.vrf != other.vrf: return False |
| 8948 | return True |
| 8949 | |
| 8950 | def pretty_print(self, q): |
| 8951 | q.text("bsn_vrf_counter_stats_request {") |
| 8952 | with q.group(): |
| 8953 | with q.indent(2): |
| 8954 | q.breakable() |
| 8955 | q.text("xid = "); |
| 8956 | if self.xid != None: |
| 8957 | q.text("%#x" % self.xid) |
| 8958 | else: |
| 8959 | q.text('None') |
| 8960 | q.text(","); q.breakable() |
| 8961 | q.text("flags = "); |
| 8962 | q.text("%#x" % self.flags) |
| 8963 | q.text(","); q.breakable() |
| 8964 | q.text("vrf = "); |
| 8965 | q.text("%#x" % self.vrf) |
| 8966 | q.breakable() |
| 8967 | q.text('}') |
| 8968 | |
| 8969 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 8970 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8971 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8972 | version = 4 |
| 8973 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8974 | stats_type = 0 |
| 8975 | |
| 8976 | 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] | 8977 | if xid != None: |
| 8978 | self.xid = xid |
| 8979 | else: |
| 8980 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8981 | if flags != None: |
| 8982 | self.flags = flags |
| 8983 | else: |
| 8984 | self.flags = 0 |
| 8985 | if mfr_desc != None: |
| 8986 | self.mfr_desc = mfr_desc |
| 8987 | else: |
| 8988 | self.mfr_desc = "" |
| 8989 | if hw_desc != None: |
| 8990 | self.hw_desc = hw_desc |
| 8991 | else: |
| 8992 | self.hw_desc = "" |
| 8993 | if sw_desc != None: |
| 8994 | self.sw_desc = sw_desc |
| 8995 | else: |
| 8996 | self.sw_desc = "" |
| 8997 | if serial_num != None: |
| 8998 | self.serial_num = serial_num |
| 8999 | else: |
| 9000 | self.serial_num = "" |
| 9001 | if dp_desc != None: |
| 9002 | self.dp_desc = dp_desc |
| 9003 | else: |
| 9004 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9005 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9006 | |
| 9007 | def pack(self): |
| 9008 | packed = [] |
| 9009 | packed.append(struct.pack("!B", self.version)) |
| 9010 | packed.append(struct.pack("!B", self.type)) |
| 9011 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9012 | packed.append(struct.pack("!L", self.xid)) |
| 9013 | packed.append(struct.pack("!H", self.stats_type)) |
| 9014 | packed.append(struct.pack("!H", self.flags)) |
| 9015 | packed.append('\x00' * 4) |
| 9016 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 9017 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 9018 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 9019 | packed.append(struct.pack("!32s", self.serial_num)) |
| 9020 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 9021 | length = sum([len(x) for x in packed]) |
| 9022 | packed[2] = struct.pack("!H", length) |
| 9023 | return ''.join(packed) |
| 9024 | |
| 9025 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9026 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9027 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9028 | _version = reader.read("!B")[0] |
| 9029 | assert(_version == 4) |
| 9030 | _type = reader.read("!B")[0] |
| 9031 | assert(_type == 19) |
| 9032 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9033 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9034 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9035 | obj.xid = reader.read("!L")[0] |
| 9036 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9037 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9038 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9039 | reader.skip(4) |
| 9040 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9041 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9042 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9043 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 9044 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9045 | return obj |
| 9046 | |
| 9047 | def __eq__(self, other): |
| 9048 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9049 | if self.xid != other.xid: return False |
| 9050 | if self.flags != other.flags: return False |
| 9051 | if self.mfr_desc != other.mfr_desc: return False |
| 9052 | if self.hw_desc != other.hw_desc: return False |
| 9053 | if self.sw_desc != other.sw_desc: return False |
| 9054 | if self.serial_num != other.serial_num: return False |
| 9055 | if self.dp_desc != other.dp_desc: return False |
| 9056 | return True |
| 9057 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9058 | def pretty_print(self, q): |
| 9059 | q.text("desc_stats_reply {") |
| 9060 | with q.group(): |
| 9061 | with q.indent(2): |
| 9062 | q.breakable() |
| 9063 | q.text("xid = "); |
| 9064 | if self.xid != None: |
| 9065 | q.text("%#x" % self.xid) |
| 9066 | else: |
| 9067 | q.text('None') |
| 9068 | q.text(","); q.breakable() |
| 9069 | q.text("flags = "); |
| 9070 | q.text("%#x" % self.flags) |
| 9071 | q.text(","); q.breakable() |
| 9072 | q.text("mfr_desc = "); |
| 9073 | q.pp(self.mfr_desc) |
| 9074 | q.text(","); q.breakable() |
| 9075 | q.text("hw_desc = "); |
| 9076 | q.pp(self.hw_desc) |
| 9077 | q.text(","); q.breakable() |
| 9078 | q.text("sw_desc = "); |
| 9079 | q.pp(self.sw_desc) |
| 9080 | q.text(","); q.breakable() |
| 9081 | q.text("serial_num = "); |
| 9082 | q.pp(self.serial_num) |
| 9083 | q.text(","); q.breakable() |
| 9084 | q.text("dp_desc = "); |
| 9085 | q.pp(self.dp_desc) |
| 9086 | q.breakable() |
| 9087 | q.text('}') |
| 9088 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9089 | stats_reply.subtypes[0] = desc_stats_reply |
| 9090 | |
| 9091 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9092 | version = 4 |
| 9093 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9094 | stats_type = 0 |
| 9095 | |
| 9096 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9097 | if xid != None: |
| 9098 | self.xid = xid |
| 9099 | else: |
| 9100 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9101 | if flags != None: |
| 9102 | self.flags = flags |
| 9103 | else: |
| 9104 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9105 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9106 | |
| 9107 | def pack(self): |
| 9108 | packed = [] |
| 9109 | packed.append(struct.pack("!B", self.version)) |
| 9110 | packed.append(struct.pack("!B", self.type)) |
| 9111 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9112 | packed.append(struct.pack("!L", self.xid)) |
| 9113 | packed.append(struct.pack("!H", self.stats_type)) |
| 9114 | packed.append(struct.pack("!H", self.flags)) |
| 9115 | packed.append('\x00' * 4) |
| 9116 | length = sum([len(x) for x in packed]) |
| 9117 | packed[2] = struct.pack("!H", length) |
| 9118 | return ''.join(packed) |
| 9119 | |
| 9120 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9121 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9122 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9123 | _version = reader.read("!B")[0] |
| 9124 | assert(_version == 4) |
| 9125 | _type = reader.read("!B")[0] |
| 9126 | assert(_type == 18) |
| 9127 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9128 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9129 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9130 | obj.xid = reader.read("!L")[0] |
| 9131 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9132 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9133 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9134 | reader.skip(4) |
| 9135 | return obj |
| 9136 | |
| 9137 | def __eq__(self, other): |
| 9138 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9139 | if self.xid != other.xid: return False |
| 9140 | if self.flags != other.flags: return False |
| 9141 | return True |
| 9142 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9143 | def pretty_print(self, q): |
| 9144 | q.text("desc_stats_request {") |
| 9145 | with q.group(): |
| 9146 | with q.indent(2): |
| 9147 | q.breakable() |
| 9148 | q.text("xid = "); |
| 9149 | if self.xid != None: |
| 9150 | q.text("%#x" % self.xid) |
| 9151 | else: |
| 9152 | q.text('None') |
| 9153 | q.text(","); q.breakable() |
| 9154 | q.text("flags = "); |
| 9155 | q.text("%#x" % self.flags) |
| 9156 | q.breakable() |
| 9157 | q.text('}') |
| 9158 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9159 | stats_request.subtypes[0] = desc_stats_request |
| 9160 | |
| 9161 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9162 | version = 4 |
| 9163 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9164 | |
| 9165 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9166 | if xid != None: |
| 9167 | self.xid = xid |
| 9168 | else: |
| 9169 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9170 | if data != None: |
| 9171 | self.data = data |
| 9172 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9173 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9174 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9175 | |
| 9176 | def pack(self): |
| 9177 | packed = [] |
| 9178 | packed.append(struct.pack("!B", self.version)) |
| 9179 | packed.append(struct.pack("!B", self.type)) |
| 9180 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9181 | packed.append(struct.pack("!L", self.xid)) |
| 9182 | packed.append(self.data) |
| 9183 | length = sum([len(x) for x in packed]) |
| 9184 | packed[2] = struct.pack("!H", length) |
| 9185 | return ''.join(packed) |
| 9186 | |
| 9187 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9188 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9189 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9190 | _version = reader.read("!B")[0] |
| 9191 | assert(_version == 4) |
| 9192 | _type = reader.read("!B")[0] |
| 9193 | assert(_type == 3) |
| 9194 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9195 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9196 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9197 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9198 | obj.data = str(reader.read_all()) |
| 9199 | return obj |
| 9200 | |
| 9201 | def __eq__(self, other): |
| 9202 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9203 | if self.xid != other.xid: return False |
| 9204 | if self.data != other.data: return False |
| 9205 | return True |
| 9206 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9207 | def pretty_print(self, q): |
| 9208 | q.text("echo_reply {") |
| 9209 | with q.group(): |
| 9210 | with q.indent(2): |
| 9211 | q.breakable() |
| 9212 | q.text("xid = "); |
| 9213 | if self.xid != None: |
| 9214 | q.text("%#x" % self.xid) |
| 9215 | else: |
| 9216 | q.text('None') |
| 9217 | q.text(","); q.breakable() |
| 9218 | q.text("data = "); |
| 9219 | q.pp(self.data) |
| 9220 | q.breakable() |
| 9221 | q.text('}') |
| 9222 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9223 | message.subtypes[3] = echo_reply |
| 9224 | |
| 9225 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9226 | version = 4 |
| 9227 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9228 | |
| 9229 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9230 | if xid != None: |
| 9231 | self.xid = xid |
| 9232 | else: |
| 9233 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9234 | if data != None: |
| 9235 | self.data = data |
| 9236 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9237 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9238 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9239 | |
| 9240 | def pack(self): |
| 9241 | packed = [] |
| 9242 | packed.append(struct.pack("!B", self.version)) |
| 9243 | packed.append(struct.pack("!B", self.type)) |
| 9244 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9245 | packed.append(struct.pack("!L", self.xid)) |
| 9246 | packed.append(self.data) |
| 9247 | length = sum([len(x) for x in packed]) |
| 9248 | packed[2] = struct.pack("!H", length) |
| 9249 | return ''.join(packed) |
| 9250 | |
| 9251 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9252 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9253 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9254 | _version = reader.read("!B")[0] |
| 9255 | assert(_version == 4) |
| 9256 | _type = reader.read("!B")[0] |
| 9257 | assert(_type == 2) |
| 9258 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9259 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9260 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9261 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9262 | obj.data = str(reader.read_all()) |
| 9263 | return obj |
| 9264 | |
| 9265 | def __eq__(self, other): |
| 9266 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9267 | if self.xid != other.xid: return False |
| 9268 | if self.data != other.data: return False |
| 9269 | return True |
| 9270 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9271 | def pretty_print(self, q): |
| 9272 | q.text("echo_request {") |
| 9273 | with q.group(): |
| 9274 | with q.indent(2): |
| 9275 | q.breakable() |
| 9276 | q.text("xid = "); |
| 9277 | if self.xid != None: |
| 9278 | q.text("%#x" % self.xid) |
| 9279 | else: |
| 9280 | q.text('None') |
| 9281 | q.text(","); q.breakable() |
| 9282 | q.text("data = "); |
| 9283 | q.pp(self.data) |
| 9284 | q.breakable() |
| 9285 | q.text('}') |
| 9286 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9287 | message.subtypes[2] = echo_request |
| 9288 | |
| 9289 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9290 | version = 4 |
| 9291 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9292 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9293 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9294 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9295 | if xid != None: |
| 9296 | self.xid = xid |
| 9297 | else: |
| 9298 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9299 | if subtype != None: |
| 9300 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9301 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9302 | self.subtype = 0 |
| 9303 | if experimenter != None: |
| 9304 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9305 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9306 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9307 | if data != None: |
| 9308 | self.data = data |
| 9309 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9310 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9311 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9312 | |
| 9313 | def pack(self): |
| 9314 | packed = [] |
| 9315 | packed.append(struct.pack("!B", self.version)) |
| 9316 | packed.append(struct.pack("!B", self.type)) |
| 9317 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9318 | packed.append(struct.pack("!L", self.xid)) |
| 9319 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9320 | packed.append(struct.pack("!H", self.subtype)) |
| 9321 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9322 | packed.append(self.data) |
| 9323 | length = sum([len(x) for x in packed]) |
| 9324 | packed[2] = struct.pack("!H", length) |
| 9325 | return ''.join(packed) |
| 9326 | |
| 9327 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9328 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9329 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9330 | _version = reader.read("!B")[0] |
| 9331 | assert(_version == 4) |
| 9332 | _type = reader.read("!B")[0] |
| 9333 | assert(_type == 1) |
| 9334 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9335 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9336 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9337 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9338 | _err_type = reader.read("!H")[0] |
| 9339 | assert(_err_type == 65535) |
| 9340 | obj.subtype = reader.read("!H")[0] |
| 9341 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9342 | obj.data = str(reader.read_all()) |
| 9343 | return obj |
| 9344 | |
| 9345 | def __eq__(self, other): |
| 9346 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9347 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9348 | if self.subtype != other.subtype: return False |
| 9349 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9350 | if self.data != other.data: return False |
| 9351 | return True |
| 9352 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9353 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9354 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9355 | with q.group(): |
| 9356 | with q.indent(2): |
| 9357 | q.breakable() |
| 9358 | q.text("xid = "); |
| 9359 | if self.xid != None: |
| 9360 | q.text("%#x" % self.xid) |
| 9361 | else: |
| 9362 | q.text('None') |
| 9363 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9364 | q.text("subtype = "); |
| 9365 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9366 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9367 | q.text("experimenter = "); |
| 9368 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9369 | q.text(","); q.breakable() |
| 9370 | q.text("data = "); |
| 9371 | q.pp(self.data) |
| 9372 | q.breakable() |
| 9373 | q.text('}') |
| 9374 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9375 | error_msg.subtypes[65535] = experimenter_error_msg |
| 9376 | |
| 9377 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9378 | version = 4 |
| 9379 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9380 | |
| 9381 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9382 | if xid != None: |
| 9383 | self.xid = xid |
| 9384 | else: |
| 9385 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9386 | if datapath_id != None: |
| 9387 | self.datapath_id = datapath_id |
| 9388 | else: |
| 9389 | self.datapath_id = 0 |
| 9390 | if n_buffers != None: |
| 9391 | self.n_buffers = n_buffers |
| 9392 | else: |
| 9393 | self.n_buffers = 0 |
| 9394 | if n_tables != None: |
| 9395 | self.n_tables = n_tables |
| 9396 | else: |
| 9397 | self.n_tables = 0 |
| 9398 | if auxiliary_id != None: |
| 9399 | self.auxiliary_id = auxiliary_id |
| 9400 | else: |
| 9401 | self.auxiliary_id = 0 |
| 9402 | if capabilities != None: |
| 9403 | self.capabilities = capabilities |
| 9404 | else: |
| 9405 | self.capabilities = 0 |
| 9406 | if reserved != None: |
| 9407 | self.reserved = reserved |
| 9408 | else: |
| 9409 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9410 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9411 | |
| 9412 | def pack(self): |
| 9413 | packed = [] |
| 9414 | packed.append(struct.pack("!B", self.version)) |
| 9415 | packed.append(struct.pack("!B", self.type)) |
| 9416 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9417 | packed.append(struct.pack("!L", self.xid)) |
| 9418 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 9419 | packed.append(struct.pack("!L", self.n_buffers)) |
| 9420 | packed.append(struct.pack("!B", self.n_tables)) |
| 9421 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 9422 | packed.append('\x00' * 2) |
| 9423 | packed.append(struct.pack("!L", self.capabilities)) |
| 9424 | packed.append(struct.pack("!L", self.reserved)) |
| 9425 | length = sum([len(x) for x in packed]) |
| 9426 | packed[2] = struct.pack("!H", length) |
| 9427 | return ''.join(packed) |
| 9428 | |
| 9429 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9430 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9431 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9432 | _version = reader.read("!B")[0] |
| 9433 | assert(_version == 4) |
| 9434 | _type = reader.read("!B")[0] |
| 9435 | assert(_type == 6) |
| 9436 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9437 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9438 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9439 | obj.xid = reader.read("!L")[0] |
| 9440 | obj.datapath_id = reader.read("!Q")[0] |
| 9441 | obj.n_buffers = reader.read("!L")[0] |
| 9442 | obj.n_tables = reader.read("!B")[0] |
| 9443 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9444 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9445 | obj.capabilities = reader.read("!L")[0] |
| 9446 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9447 | return obj |
| 9448 | |
| 9449 | def __eq__(self, other): |
| 9450 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9451 | if self.xid != other.xid: return False |
| 9452 | if self.datapath_id != other.datapath_id: return False |
| 9453 | if self.n_buffers != other.n_buffers: return False |
| 9454 | if self.n_tables != other.n_tables: return False |
| 9455 | if self.auxiliary_id != other.auxiliary_id: return False |
| 9456 | if self.capabilities != other.capabilities: return False |
| 9457 | if self.reserved != other.reserved: return False |
| 9458 | return True |
| 9459 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9460 | def pretty_print(self, q): |
| 9461 | q.text("features_reply {") |
| 9462 | with q.group(): |
| 9463 | with q.indent(2): |
| 9464 | q.breakable() |
| 9465 | q.text("xid = "); |
| 9466 | if self.xid != None: |
| 9467 | q.text("%#x" % self.xid) |
| 9468 | else: |
| 9469 | q.text('None') |
| 9470 | q.text(","); q.breakable() |
| 9471 | q.text("datapath_id = "); |
| 9472 | q.text("%#x" % self.datapath_id) |
| 9473 | q.text(","); q.breakable() |
| 9474 | q.text("n_buffers = "); |
| 9475 | q.text("%#x" % self.n_buffers) |
| 9476 | q.text(","); q.breakable() |
| 9477 | q.text("n_tables = "); |
| 9478 | q.text("%#x" % self.n_tables) |
| 9479 | q.text(","); q.breakable() |
| 9480 | q.text("auxiliary_id = "); |
| 9481 | q.text("%#x" % self.auxiliary_id) |
| 9482 | q.text(","); q.breakable() |
| 9483 | q.text("capabilities = "); |
| 9484 | q.text("%#x" % self.capabilities) |
| 9485 | q.text(","); q.breakable() |
| 9486 | q.text("reserved = "); |
| 9487 | q.text("%#x" % self.reserved) |
| 9488 | q.breakable() |
| 9489 | q.text('}') |
| 9490 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9491 | message.subtypes[6] = features_reply |
| 9492 | |
| 9493 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9494 | version = 4 |
| 9495 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9496 | |
| 9497 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9498 | if xid != None: |
| 9499 | self.xid = xid |
| 9500 | else: |
| 9501 | self.xid = None |
| 9502 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9503 | |
| 9504 | def pack(self): |
| 9505 | packed = [] |
| 9506 | packed.append(struct.pack("!B", self.version)) |
| 9507 | packed.append(struct.pack("!B", self.type)) |
| 9508 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9509 | packed.append(struct.pack("!L", self.xid)) |
| 9510 | length = sum([len(x) for x in packed]) |
| 9511 | packed[2] = struct.pack("!H", length) |
| 9512 | return ''.join(packed) |
| 9513 | |
| 9514 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9515 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9516 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9517 | _version = reader.read("!B")[0] |
| 9518 | assert(_version == 4) |
| 9519 | _type = reader.read("!B")[0] |
| 9520 | assert(_type == 5) |
| 9521 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9522 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9523 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9524 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9525 | return obj |
| 9526 | |
| 9527 | def __eq__(self, other): |
| 9528 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9529 | if self.xid != other.xid: return False |
| 9530 | return True |
| 9531 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9532 | def pretty_print(self, q): |
| 9533 | q.text("features_request {") |
| 9534 | with q.group(): |
| 9535 | with q.indent(2): |
| 9536 | q.breakable() |
| 9537 | q.text("xid = "); |
| 9538 | if self.xid != None: |
| 9539 | q.text("%#x" % self.xid) |
| 9540 | else: |
| 9541 | q.text('None') |
| 9542 | q.breakable() |
| 9543 | q.text('}') |
| 9544 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9545 | message.subtypes[5] = features_request |
| 9546 | |
| 9547 | class flow_mod(message): |
| 9548 | subtypes = {} |
| 9549 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9550 | version = 4 |
| 9551 | type = 14 |
| 9552 | |
| 9553 | 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): |
| 9554 | if xid != None: |
| 9555 | self.xid = xid |
| 9556 | else: |
| 9557 | self.xid = None |
| 9558 | if cookie != None: |
| 9559 | self.cookie = cookie |
| 9560 | else: |
| 9561 | self.cookie = 0 |
| 9562 | if cookie_mask != None: |
| 9563 | self.cookie_mask = cookie_mask |
| 9564 | else: |
| 9565 | self.cookie_mask = 0 |
| 9566 | if table_id != None: |
| 9567 | self.table_id = table_id |
| 9568 | else: |
| 9569 | self.table_id = 0 |
| 9570 | if _command != None: |
| 9571 | self._command = _command |
| 9572 | else: |
| 9573 | self._command = 0 |
| 9574 | if idle_timeout != None: |
| 9575 | self.idle_timeout = idle_timeout |
| 9576 | else: |
| 9577 | self.idle_timeout = 0 |
| 9578 | if hard_timeout != None: |
| 9579 | self.hard_timeout = hard_timeout |
| 9580 | else: |
| 9581 | self.hard_timeout = 0 |
| 9582 | if priority != None: |
| 9583 | self.priority = priority |
| 9584 | else: |
| 9585 | self.priority = 0 |
| 9586 | if buffer_id != None: |
| 9587 | self.buffer_id = buffer_id |
| 9588 | else: |
| 9589 | self.buffer_id = 0 |
| 9590 | if out_port != None: |
| 9591 | self.out_port = out_port |
| 9592 | else: |
| 9593 | self.out_port = 0 |
| 9594 | if out_group != None: |
| 9595 | self.out_group = out_group |
| 9596 | else: |
| 9597 | self.out_group = 0 |
| 9598 | if flags != None: |
| 9599 | self.flags = flags |
| 9600 | else: |
| 9601 | self.flags = 0 |
| 9602 | if match != None: |
| 9603 | self.match = match |
| 9604 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 9605 | self.match = ofp.match() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9606 | if instructions != None: |
| 9607 | self.instructions = instructions |
| 9608 | else: |
| 9609 | self.instructions = [] |
| 9610 | return |
| 9611 | |
| 9612 | def pack(self): |
| 9613 | packed = [] |
| 9614 | packed.append(struct.pack("!B", self.version)) |
| 9615 | packed.append(struct.pack("!B", self.type)) |
| 9616 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9617 | packed.append(struct.pack("!L", self.xid)) |
| 9618 | packed.append(struct.pack("!Q", self.cookie)) |
| 9619 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9620 | packed.append(struct.pack("!B", self.table_id)) |
| 9621 | packed.append(util.pack_fm_cmd(self._command)) |
| 9622 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9623 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9624 | packed.append(struct.pack("!H", self.priority)) |
| 9625 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9626 | packed.append(util.pack_port_no(self.out_port)) |
| 9627 | packed.append(struct.pack("!L", self.out_group)) |
| 9628 | packed.append(struct.pack("!H", self.flags)) |
| 9629 | packed.append('\x00' * 2) |
| 9630 | packed.append(self.match.pack()) |
| 9631 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9632 | length = sum([len(x) for x in packed]) |
| 9633 | packed[2] = struct.pack("!H", length) |
| 9634 | return ''.join(packed) |
| 9635 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9636 | @staticmethod |
| 9637 | def unpack(reader): |
| 9638 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9639 | subclass = flow_mod.subtypes.get(subtype) |
| 9640 | if subclass: |
| 9641 | return subclass.unpack(reader) |
| 9642 | |
| 9643 | obj = flow_mod() |
| 9644 | _version = reader.read("!B")[0] |
| 9645 | assert(_version == 4) |
| 9646 | _type = reader.read("!B")[0] |
| 9647 | assert(_type == 14) |
| 9648 | _length = reader.read("!H")[0] |
| 9649 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9650 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9651 | obj.xid = reader.read("!L")[0] |
| 9652 | obj.cookie = reader.read("!Q")[0] |
| 9653 | obj.cookie_mask = reader.read("!Q")[0] |
| 9654 | obj.table_id = reader.read("!B")[0] |
| 9655 | obj._command = util.unpack_fm_cmd(reader) |
| 9656 | obj.idle_timeout = reader.read("!H")[0] |
| 9657 | obj.hard_timeout = reader.read("!H")[0] |
| 9658 | obj.priority = reader.read("!H")[0] |
| 9659 | obj.buffer_id = reader.read("!L")[0] |
| 9660 | obj.out_port = util.unpack_port_no(reader) |
| 9661 | obj.out_group = reader.read("!L")[0] |
| 9662 | obj.flags = reader.read("!H")[0] |
| 9663 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 9664 | obj.match = ofp.match.unpack(reader) |
| 9665 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9666 | return obj |
| 9667 | |
| 9668 | def __eq__(self, other): |
| 9669 | if type(self) != type(other): return False |
| 9670 | if self.xid != other.xid: return False |
| 9671 | if self.cookie != other.cookie: return False |
| 9672 | if self.cookie_mask != other.cookie_mask: return False |
| 9673 | if self.table_id != other.table_id: return False |
| 9674 | if self._command != other._command: return False |
| 9675 | if self.idle_timeout != other.idle_timeout: return False |
| 9676 | if self.hard_timeout != other.hard_timeout: return False |
| 9677 | if self.priority != other.priority: return False |
| 9678 | if self.buffer_id != other.buffer_id: return False |
| 9679 | if self.out_port != other.out_port: return False |
| 9680 | if self.out_group != other.out_group: return False |
| 9681 | if self.flags != other.flags: return False |
| 9682 | if self.match != other.match: return False |
| 9683 | if self.instructions != other.instructions: return False |
| 9684 | return True |
| 9685 | |
| 9686 | def pretty_print(self, q): |
| 9687 | q.text("flow_mod {") |
| 9688 | with q.group(): |
| 9689 | with q.indent(2): |
| 9690 | q.breakable() |
| 9691 | q.text("xid = "); |
| 9692 | if self.xid != None: |
| 9693 | q.text("%#x" % self.xid) |
| 9694 | else: |
| 9695 | q.text('None') |
| 9696 | q.text(","); q.breakable() |
| 9697 | q.text("cookie = "); |
| 9698 | q.text("%#x" % self.cookie) |
| 9699 | q.text(","); q.breakable() |
| 9700 | q.text("cookie_mask = "); |
| 9701 | q.text("%#x" % self.cookie_mask) |
| 9702 | q.text(","); q.breakable() |
| 9703 | q.text("table_id = "); |
| 9704 | q.text("%#x" % self.table_id) |
| 9705 | q.text(","); q.breakable() |
| 9706 | q.text("idle_timeout = "); |
| 9707 | q.text("%#x" % self.idle_timeout) |
| 9708 | q.text(","); q.breakable() |
| 9709 | q.text("hard_timeout = "); |
| 9710 | q.text("%#x" % self.hard_timeout) |
| 9711 | q.text(","); q.breakable() |
| 9712 | q.text("priority = "); |
| 9713 | q.text("%#x" % self.priority) |
| 9714 | q.text(","); q.breakable() |
| 9715 | q.text("buffer_id = "); |
| 9716 | q.text("%#x" % self.buffer_id) |
| 9717 | q.text(","); q.breakable() |
| 9718 | q.text("out_port = "); |
| 9719 | q.text(util.pretty_port(self.out_port)) |
| 9720 | q.text(","); q.breakable() |
| 9721 | q.text("out_group = "); |
| 9722 | q.text("%#x" % self.out_group) |
| 9723 | q.text(","); q.breakable() |
| 9724 | q.text("flags = "); |
| 9725 | q.text("%#x" % self.flags) |
| 9726 | q.text(","); q.breakable() |
| 9727 | q.text("match = "); |
| 9728 | q.pp(self.match) |
| 9729 | q.text(","); q.breakable() |
| 9730 | q.text("instructions = "); |
| 9731 | q.pp(self.instructions) |
| 9732 | q.breakable() |
| 9733 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9734 | |
| 9735 | message.subtypes[14] = flow_mod |
| 9736 | |
| 9737 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9738 | version = 4 |
| 9739 | type = 14 |
| 9740 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9741 | |
| 9742 | 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] | 9743 | if xid != None: |
| 9744 | self.xid = xid |
| 9745 | else: |
| 9746 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9747 | if cookie != None: |
| 9748 | self.cookie = cookie |
| 9749 | else: |
| 9750 | self.cookie = 0 |
| 9751 | if cookie_mask != None: |
| 9752 | self.cookie_mask = cookie_mask |
| 9753 | else: |
| 9754 | self.cookie_mask = 0 |
| 9755 | if table_id != None: |
| 9756 | self.table_id = table_id |
| 9757 | else: |
| 9758 | self.table_id = 0 |
| 9759 | if idle_timeout != None: |
| 9760 | self.idle_timeout = idle_timeout |
| 9761 | else: |
| 9762 | self.idle_timeout = 0 |
| 9763 | if hard_timeout != None: |
| 9764 | self.hard_timeout = hard_timeout |
| 9765 | else: |
| 9766 | self.hard_timeout = 0 |
| 9767 | if priority != None: |
| 9768 | self.priority = priority |
| 9769 | else: |
| 9770 | self.priority = 0 |
| 9771 | if buffer_id != None: |
| 9772 | self.buffer_id = buffer_id |
| 9773 | else: |
| 9774 | self.buffer_id = 0 |
| 9775 | if out_port != None: |
| 9776 | self.out_port = out_port |
| 9777 | else: |
| 9778 | self.out_port = 0 |
| 9779 | if out_group != None: |
| 9780 | self.out_group = out_group |
| 9781 | else: |
| 9782 | self.out_group = 0 |
| 9783 | if flags != None: |
| 9784 | self.flags = flags |
| 9785 | else: |
| 9786 | self.flags = 0 |
| 9787 | if match != None: |
| 9788 | self.match = match |
| 9789 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 9790 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9791 | if instructions != None: |
| 9792 | self.instructions = instructions |
| 9793 | else: |
| 9794 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9795 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9796 | |
| 9797 | def pack(self): |
| 9798 | packed = [] |
| 9799 | packed.append(struct.pack("!B", self.version)) |
| 9800 | packed.append(struct.pack("!B", self.type)) |
| 9801 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9802 | packed.append(struct.pack("!L", self.xid)) |
| 9803 | packed.append(struct.pack("!Q", self.cookie)) |
| 9804 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9805 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9806 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9807 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9808 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9809 | packed.append(struct.pack("!H", self.priority)) |
| 9810 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9811 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9812 | packed.append(struct.pack("!L", self.out_group)) |
| 9813 | packed.append(struct.pack("!H", self.flags)) |
| 9814 | packed.append('\x00' * 2) |
| 9815 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9816 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9817 | length = sum([len(x) for x in packed]) |
| 9818 | packed[2] = struct.pack("!H", length) |
| 9819 | return ''.join(packed) |
| 9820 | |
| 9821 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9822 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9823 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9824 | _version = reader.read("!B")[0] |
| 9825 | assert(_version == 4) |
| 9826 | _type = reader.read("!B")[0] |
| 9827 | assert(_type == 14) |
| 9828 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9829 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9830 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9831 | obj.xid = reader.read("!L")[0] |
| 9832 | obj.cookie = reader.read("!Q")[0] |
| 9833 | obj.cookie_mask = reader.read("!Q")[0] |
| 9834 | obj.table_id = reader.read("!B")[0] |
| 9835 | __command = util.unpack_fm_cmd(reader) |
| 9836 | assert(__command == 0) |
| 9837 | obj.idle_timeout = reader.read("!H")[0] |
| 9838 | obj.hard_timeout = reader.read("!H")[0] |
| 9839 | obj.priority = reader.read("!H")[0] |
| 9840 | obj.buffer_id = reader.read("!L")[0] |
| 9841 | obj.out_port = util.unpack_port_no(reader) |
| 9842 | obj.out_group = reader.read("!L")[0] |
| 9843 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9844 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 9845 | obj.match = ofp.match.unpack(reader) |
| 9846 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9847 | return obj |
| 9848 | |
| 9849 | def __eq__(self, other): |
| 9850 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9851 | if self.xid != other.xid: return False |
| 9852 | if self.cookie != other.cookie: return False |
| 9853 | if self.cookie_mask != other.cookie_mask: return False |
| 9854 | if self.table_id != other.table_id: return False |
| 9855 | if self.idle_timeout != other.idle_timeout: return False |
| 9856 | if self.hard_timeout != other.hard_timeout: return False |
| 9857 | if self.priority != other.priority: return False |
| 9858 | if self.buffer_id != other.buffer_id: return False |
| 9859 | if self.out_port != other.out_port: return False |
| 9860 | if self.out_group != other.out_group: return False |
| 9861 | if self.flags != other.flags: return False |
| 9862 | if self.match != other.match: return False |
| 9863 | if self.instructions != other.instructions: return False |
| 9864 | return True |
| 9865 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9866 | def pretty_print(self, q): |
| 9867 | q.text("flow_add {") |
| 9868 | with q.group(): |
| 9869 | with q.indent(2): |
| 9870 | q.breakable() |
| 9871 | q.text("xid = "); |
| 9872 | if self.xid != None: |
| 9873 | q.text("%#x" % self.xid) |
| 9874 | else: |
| 9875 | q.text('None') |
| 9876 | q.text(","); q.breakable() |
| 9877 | q.text("cookie = "); |
| 9878 | q.text("%#x" % self.cookie) |
| 9879 | q.text(","); q.breakable() |
| 9880 | q.text("cookie_mask = "); |
| 9881 | q.text("%#x" % self.cookie_mask) |
| 9882 | q.text(","); q.breakable() |
| 9883 | q.text("table_id = "); |
| 9884 | q.text("%#x" % self.table_id) |
| 9885 | q.text(","); q.breakable() |
| 9886 | q.text("idle_timeout = "); |
| 9887 | q.text("%#x" % self.idle_timeout) |
| 9888 | q.text(","); q.breakable() |
| 9889 | q.text("hard_timeout = "); |
| 9890 | q.text("%#x" % self.hard_timeout) |
| 9891 | q.text(","); q.breakable() |
| 9892 | q.text("priority = "); |
| 9893 | q.text("%#x" % self.priority) |
| 9894 | q.text(","); q.breakable() |
| 9895 | q.text("buffer_id = "); |
| 9896 | q.text("%#x" % self.buffer_id) |
| 9897 | q.text(","); q.breakable() |
| 9898 | q.text("out_port = "); |
| 9899 | q.text(util.pretty_port(self.out_port)) |
| 9900 | q.text(","); q.breakable() |
| 9901 | q.text("out_group = "); |
| 9902 | q.text("%#x" % self.out_group) |
| 9903 | q.text(","); q.breakable() |
| 9904 | q.text("flags = "); |
| 9905 | q.text("%#x" % self.flags) |
| 9906 | q.text(","); q.breakable() |
| 9907 | q.text("match = "); |
| 9908 | q.pp(self.match) |
| 9909 | q.text(","); q.breakable() |
| 9910 | q.text("instructions = "); |
| 9911 | q.pp(self.instructions) |
| 9912 | q.breakable() |
| 9913 | q.text('}') |
| 9914 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9915 | flow_mod.subtypes[0] = flow_add |
| 9916 | |
| 9917 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9918 | version = 4 |
| 9919 | type = 14 |
| 9920 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9921 | |
| 9922 | 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] | 9923 | if xid != None: |
| 9924 | self.xid = xid |
| 9925 | else: |
| 9926 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9927 | if cookie != None: |
| 9928 | self.cookie = cookie |
| 9929 | else: |
| 9930 | self.cookie = 0 |
| 9931 | if cookie_mask != None: |
| 9932 | self.cookie_mask = cookie_mask |
| 9933 | else: |
| 9934 | self.cookie_mask = 0 |
| 9935 | if table_id != None: |
| 9936 | self.table_id = table_id |
| 9937 | else: |
| 9938 | self.table_id = 0 |
| 9939 | if idle_timeout != None: |
| 9940 | self.idle_timeout = idle_timeout |
| 9941 | else: |
| 9942 | self.idle_timeout = 0 |
| 9943 | if hard_timeout != None: |
| 9944 | self.hard_timeout = hard_timeout |
| 9945 | else: |
| 9946 | self.hard_timeout = 0 |
| 9947 | if priority != None: |
| 9948 | self.priority = priority |
| 9949 | else: |
| 9950 | self.priority = 0 |
| 9951 | if buffer_id != None: |
| 9952 | self.buffer_id = buffer_id |
| 9953 | else: |
| 9954 | self.buffer_id = 0 |
| 9955 | if out_port != None: |
| 9956 | self.out_port = out_port |
| 9957 | else: |
| 9958 | self.out_port = 0 |
| 9959 | if out_group != None: |
| 9960 | self.out_group = out_group |
| 9961 | else: |
| 9962 | self.out_group = 0 |
| 9963 | if flags != None: |
| 9964 | self.flags = flags |
| 9965 | else: |
| 9966 | self.flags = 0 |
| 9967 | if match != None: |
| 9968 | self.match = match |
| 9969 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 9970 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9971 | if instructions != None: |
| 9972 | self.instructions = instructions |
| 9973 | else: |
| 9974 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9975 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9976 | |
| 9977 | def pack(self): |
| 9978 | packed = [] |
| 9979 | packed.append(struct.pack("!B", self.version)) |
| 9980 | packed.append(struct.pack("!B", self.type)) |
| 9981 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9982 | packed.append(struct.pack("!L", self.xid)) |
| 9983 | packed.append(struct.pack("!Q", self.cookie)) |
| 9984 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9985 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9986 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9987 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9988 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9989 | packed.append(struct.pack("!H", self.priority)) |
| 9990 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9991 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9992 | packed.append(struct.pack("!L", self.out_group)) |
| 9993 | packed.append(struct.pack("!H", self.flags)) |
| 9994 | packed.append('\x00' * 2) |
| 9995 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9996 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9997 | length = sum([len(x) for x in packed]) |
| 9998 | packed[2] = struct.pack("!H", length) |
| 9999 | return ''.join(packed) |
| 10000 | |
| 10001 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10002 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10003 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10004 | _version = reader.read("!B")[0] |
| 10005 | assert(_version == 4) |
| 10006 | _type = reader.read("!B")[0] |
| 10007 | assert(_type == 14) |
| 10008 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10009 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10010 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10011 | obj.xid = reader.read("!L")[0] |
| 10012 | obj.cookie = reader.read("!Q")[0] |
| 10013 | obj.cookie_mask = reader.read("!Q")[0] |
| 10014 | obj.table_id = reader.read("!B")[0] |
| 10015 | __command = util.unpack_fm_cmd(reader) |
| 10016 | assert(__command == 3) |
| 10017 | obj.idle_timeout = reader.read("!H")[0] |
| 10018 | obj.hard_timeout = reader.read("!H")[0] |
| 10019 | obj.priority = reader.read("!H")[0] |
| 10020 | obj.buffer_id = reader.read("!L")[0] |
| 10021 | obj.out_port = util.unpack_port_no(reader) |
| 10022 | obj.out_group = reader.read("!L")[0] |
| 10023 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10024 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10025 | obj.match = ofp.match.unpack(reader) |
| 10026 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10027 | return obj |
| 10028 | |
| 10029 | def __eq__(self, other): |
| 10030 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10031 | if self.xid != other.xid: return False |
| 10032 | if self.cookie != other.cookie: return False |
| 10033 | if self.cookie_mask != other.cookie_mask: return False |
| 10034 | if self.table_id != other.table_id: return False |
| 10035 | if self.idle_timeout != other.idle_timeout: return False |
| 10036 | if self.hard_timeout != other.hard_timeout: return False |
| 10037 | if self.priority != other.priority: return False |
| 10038 | if self.buffer_id != other.buffer_id: return False |
| 10039 | if self.out_port != other.out_port: return False |
| 10040 | if self.out_group != other.out_group: return False |
| 10041 | if self.flags != other.flags: return False |
| 10042 | if self.match != other.match: return False |
| 10043 | if self.instructions != other.instructions: return False |
| 10044 | return True |
| 10045 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10046 | def pretty_print(self, q): |
| 10047 | q.text("flow_delete {") |
| 10048 | with q.group(): |
| 10049 | with q.indent(2): |
| 10050 | q.breakable() |
| 10051 | q.text("xid = "); |
| 10052 | if self.xid != None: |
| 10053 | q.text("%#x" % self.xid) |
| 10054 | else: |
| 10055 | q.text('None') |
| 10056 | q.text(","); q.breakable() |
| 10057 | q.text("cookie = "); |
| 10058 | q.text("%#x" % self.cookie) |
| 10059 | q.text(","); q.breakable() |
| 10060 | q.text("cookie_mask = "); |
| 10061 | q.text("%#x" % self.cookie_mask) |
| 10062 | q.text(","); q.breakable() |
| 10063 | q.text("table_id = "); |
| 10064 | q.text("%#x" % self.table_id) |
| 10065 | q.text(","); q.breakable() |
| 10066 | q.text("idle_timeout = "); |
| 10067 | q.text("%#x" % self.idle_timeout) |
| 10068 | q.text(","); q.breakable() |
| 10069 | q.text("hard_timeout = "); |
| 10070 | q.text("%#x" % self.hard_timeout) |
| 10071 | q.text(","); q.breakable() |
| 10072 | q.text("priority = "); |
| 10073 | q.text("%#x" % self.priority) |
| 10074 | q.text(","); q.breakable() |
| 10075 | q.text("buffer_id = "); |
| 10076 | q.text("%#x" % self.buffer_id) |
| 10077 | q.text(","); q.breakable() |
| 10078 | q.text("out_port = "); |
| 10079 | q.text(util.pretty_port(self.out_port)) |
| 10080 | q.text(","); q.breakable() |
| 10081 | q.text("out_group = "); |
| 10082 | q.text("%#x" % self.out_group) |
| 10083 | q.text(","); q.breakable() |
| 10084 | q.text("flags = "); |
| 10085 | q.text("%#x" % self.flags) |
| 10086 | q.text(","); q.breakable() |
| 10087 | q.text("match = "); |
| 10088 | q.pp(self.match) |
| 10089 | q.text(","); q.breakable() |
| 10090 | q.text("instructions = "); |
| 10091 | q.pp(self.instructions) |
| 10092 | q.breakable() |
| 10093 | q.text('}') |
| 10094 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10095 | flow_mod.subtypes[3] = flow_delete |
| 10096 | |
| 10097 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10098 | version = 4 |
| 10099 | type = 14 |
| 10100 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10101 | |
| 10102 | 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] | 10103 | if xid != None: |
| 10104 | self.xid = xid |
| 10105 | else: |
| 10106 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10107 | if cookie != None: |
| 10108 | self.cookie = cookie |
| 10109 | else: |
| 10110 | self.cookie = 0 |
| 10111 | if cookie_mask != None: |
| 10112 | self.cookie_mask = cookie_mask |
| 10113 | else: |
| 10114 | self.cookie_mask = 0 |
| 10115 | if table_id != None: |
| 10116 | self.table_id = table_id |
| 10117 | else: |
| 10118 | self.table_id = 0 |
| 10119 | if idle_timeout != None: |
| 10120 | self.idle_timeout = idle_timeout |
| 10121 | else: |
| 10122 | self.idle_timeout = 0 |
| 10123 | if hard_timeout != None: |
| 10124 | self.hard_timeout = hard_timeout |
| 10125 | else: |
| 10126 | self.hard_timeout = 0 |
| 10127 | if priority != None: |
| 10128 | self.priority = priority |
| 10129 | else: |
| 10130 | self.priority = 0 |
| 10131 | if buffer_id != None: |
| 10132 | self.buffer_id = buffer_id |
| 10133 | else: |
| 10134 | self.buffer_id = 0 |
| 10135 | if out_port != None: |
| 10136 | self.out_port = out_port |
| 10137 | else: |
| 10138 | self.out_port = 0 |
| 10139 | if out_group != None: |
| 10140 | self.out_group = out_group |
| 10141 | else: |
| 10142 | self.out_group = 0 |
| 10143 | if flags != None: |
| 10144 | self.flags = flags |
| 10145 | else: |
| 10146 | self.flags = 0 |
| 10147 | if match != None: |
| 10148 | self.match = match |
| 10149 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10150 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10151 | if instructions != None: |
| 10152 | self.instructions = instructions |
| 10153 | else: |
| 10154 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10155 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10156 | |
| 10157 | def pack(self): |
| 10158 | packed = [] |
| 10159 | packed.append(struct.pack("!B", self.version)) |
| 10160 | packed.append(struct.pack("!B", self.type)) |
| 10161 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10162 | packed.append(struct.pack("!L", self.xid)) |
| 10163 | packed.append(struct.pack("!Q", self.cookie)) |
| 10164 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10165 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10166 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10167 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10168 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10169 | packed.append(struct.pack("!H", self.priority)) |
| 10170 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10171 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10172 | packed.append(struct.pack("!L", self.out_group)) |
| 10173 | packed.append(struct.pack("!H", self.flags)) |
| 10174 | packed.append('\x00' * 2) |
| 10175 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10176 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10177 | length = sum([len(x) for x in packed]) |
| 10178 | packed[2] = struct.pack("!H", length) |
| 10179 | return ''.join(packed) |
| 10180 | |
| 10181 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10182 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10183 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10184 | _version = reader.read("!B")[0] |
| 10185 | assert(_version == 4) |
| 10186 | _type = reader.read("!B")[0] |
| 10187 | assert(_type == 14) |
| 10188 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10189 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10190 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10191 | obj.xid = reader.read("!L")[0] |
| 10192 | obj.cookie = reader.read("!Q")[0] |
| 10193 | obj.cookie_mask = reader.read("!Q")[0] |
| 10194 | obj.table_id = reader.read("!B")[0] |
| 10195 | __command = util.unpack_fm_cmd(reader) |
| 10196 | assert(__command == 4) |
| 10197 | obj.idle_timeout = reader.read("!H")[0] |
| 10198 | obj.hard_timeout = reader.read("!H")[0] |
| 10199 | obj.priority = reader.read("!H")[0] |
| 10200 | obj.buffer_id = reader.read("!L")[0] |
| 10201 | obj.out_port = util.unpack_port_no(reader) |
| 10202 | obj.out_group = reader.read("!L")[0] |
| 10203 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10204 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10205 | obj.match = ofp.match.unpack(reader) |
| 10206 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10207 | return obj |
| 10208 | |
| 10209 | def __eq__(self, other): |
| 10210 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10211 | if self.xid != other.xid: return False |
| 10212 | if self.cookie != other.cookie: return False |
| 10213 | if self.cookie_mask != other.cookie_mask: return False |
| 10214 | if self.table_id != other.table_id: return False |
| 10215 | if self.idle_timeout != other.idle_timeout: return False |
| 10216 | if self.hard_timeout != other.hard_timeout: return False |
| 10217 | if self.priority != other.priority: return False |
| 10218 | if self.buffer_id != other.buffer_id: return False |
| 10219 | if self.out_port != other.out_port: return False |
| 10220 | if self.out_group != other.out_group: return False |
| 10221 | if self.flags != other.flags: return False |
| 10222 | if self.match != other.match: return False |
| 10223 | if self.instructions != other.instructions: return False |
| 10224 | return True |
| 10225 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10226 | def pretty_print(self, q): |
| 10227 | q.text("flow_delete_strict {") |
| 10228 | with q.group(): |
| 10229 | with q.indent(2): |
| 10230 | q.breakable() |
| 10231 | q.text("xid = "); |
| 10232 | if self.xid != None: |
| 10233 | q.text("%#x" % self.xid) |
| 10234 | else: |
| 10235 | q.text('None') |
| 10236 | q.text(","); q.breakable() |
| 10237 | q.text("cookie = "); |
| 10238 | q.text("%#x" % self.cookie) |
| 10239 | q.text(","); q.breakable() |
| 10240 | q.text("cookie_mask = "); |
| 10241 | q.text("%#x" % self.cookie_mask) |
| 10242 | q.text(","); q.breakable() |
| 10243 | q.text("table_id = "); |
| 10244 | q.text("%#x" % self.table_id) |
| 10245 | q.text(","); q.breakable() |
| 10246 | q.text("idle_timeout = "); |
| 10247 | q.text("%#x" % self.idle_timeout) |
| 10248 | q.text(","); q.breakable() |
| 10249 | q.text("hard_timeout = "); |
| 10250 | q.text("%#x" % self.hard_timeout) |
| 10251 | q.text(","); q.breakable() |
| 10252 | q.text("priority = "); |
| 10253 | q.text("%#x" % self.priority) |
| 10254 | q.text(","); q.breakable() |
| 10255 | q.text("buffer_id = "); |
| 10256 | q.text("%#x" % self.buffer_id) |
| 10257 | q.text(","); q.breakable() |
| 10258 | q.text("out_port = "); |
| 10259 | q.text(util.pretty_port(self.out_port)) |
| 10260 | q.text(","); q.breakable() |
| 10261 | q.text("out_group = "); |
| 10262 | q.text("%#x" % self.out_group) |
| 10263 | q.text(","); q.breakable() |
| 10264 | q.text("flags = "); |
| 10265 | q.text("%#x" % self.flags) |
| 10266 | q.text(","); q.breakable() |
| 10267 | q.text("match = "); |
| 10268 | q.pp(self.match) |
| 10269 | q.text(","); q.breakable() |
| 10270 | q.text("instructions = "); |
| 10271 | q.pp(self.instructions) |
| 10272 | q.breakable() |
| 10273 | q.text('}') |
| 10274 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10275 | flow_mod.subtypes[4] = flow_delete_strict |
| 10276 | |
| 10277 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10278 | version = 4 |
| 10279 | type = 1 |
| 10280 | err_type = 5 |
| 10281 | |
| 10282 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10283 | if xid != None: |
| 10284 | self.xid = xid |
| 10285 | else: |
| 10286 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10287 | if code != None: |
| 10288 | self.code = code |
| 10289 | else: |
| 10290 | self.code = 0 |
| 10291 | if data != None: |
| 10292 | self.data = data |
| 10293 | else: |
| 10294 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10295 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10296 | |
| 10297 | def pack(self): |
| 10298 | packed = [] |
| 10299 | packed.append(struct.pack("!B", self.version)) |
| 10300 | packed.append(struct.pack("!B", self.type)) |
| 10301 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10302 | packed.append(struct.pack("!L", self.xid)) |
| 10303 | packed.append(struct.pack("!H", self.err_type)) |
| 10304 | packed.append(struct.pack("!H", self.code)) |
| 10305 | packed.append(self.data) |
| 10306 | length = sum([len(x) for x in packed]) |
| 10307 | packed[2] = struct.pack("!H", length) |
| 10308 | return ''.join(packed) |
| 10309 | |
| 10310 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10311 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10312 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10313 | _version = reader.read("!B")[0] |
| 10314 | assert(_version == 4) |
| 10315 | _type = reader.read("!B")[0] |
| 10316 | assert(_type == 1) |
| 10317 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10318 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10319 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10320 | obj.xid = reader.read("!L")[0] |
| 10321 | _err_type = reader.read("!H")[0] |
| 10322 | assert(_err_type == 5) |
| 10323 | obj.code = reader.read("!H")[0] |
| 10324 | obj.data = str(reader.read_all()) |
| 10325 | return obj |
| 10326 | |
| 10327 | def __eq__(self, other): |
| 10328 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10329 | if self.xid != other.xid: return False |
| 10330 | if self.code != other.code: return False |
| 10331 | if self.data != other.data: return False |
| 10332 | return True |
| 10333 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10334 | def pretty_print(self, q): |
| 10335 | q.text("flow_mod_failed_error_msg {") |
| 10336 | with q.group(): |
| 10337 | with q.indent(2): |
| 10338 | q.breakable() |
| 10339 | q.text("xid = "); |
| 10340 | if self.xid != None: |
| 10341 | q.text("%#x" % self.xid) |
| 10342 | else: |
| 10343 | q.text('None') |
| 10344 | q.text(","); q.breakable() |
| 10345 | q.text("code = "); |
| 10346 | q.text("%#x" % self.code) |
| 10347 | q.text(","); q.breakable() |
| 10348 | q.text("data = "); |
| 10349 | q.pp(self.data) |
| 10350 | q.breakable() |
| 10351 | q.text('}') |
| 10352 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10353 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 10354 | |
| 10355 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10356 | version = 4 |
| 10357 | type = 14 |
| 10358 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10359 | |
| 10360 | 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] | 10361 | if xid != None: |
| 10362 | self.xid = xid |
| 10363 | else: |
| 10364 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10365 | if cookie != None: |
| 10366 | self.cookie = cookie |
| 10367 | else: |
| 10368 | self.cookie = 0 |
| 10369 | if cookie_mask != None: |
| 10370 | self.cookie_mask = cookie_mask |
| 10371 | else: |
| 10372 | self.cookie_mask = 0 |
| 10373 | if table_id != None: |
| 10374 | self.table_id = table_id |
| 10375 | else: |
| 10376 | self.table_id = 0 |
| 10377 | if idle_timeout != None: |
| 10378 | self.idle_timeout = idle_timeout |
| 10379 | else: |
| 10380 | self.idle_timeout = 0 |
| 10381 | if hard_timeout != None: |
| 10382 | self.hard_timeout = hard_timeout |
| 10383 | else: |
| 10384 | self.hard_timeout = 0 |
| 10385 | if priority != None: |
| 10386 | self.priority = priority |
| 10387 | else: |
| 10388 | self.priority = 0 |
| 10389 | if buffer_id != None: |
| 10390 | self.buffer_id = buffer_id |
| 10391 | else: |
| 10392 | self.buffer_id = 0 |
| 10393 | if out_port != None: |
| 10394 | self.out_port = out_port |
| 10395 | else: |
| 10396 | self.out_port = 0 |
| 10397 | if out_group != None: |
| 10398 | self.out_group = out_group |
| 10399 | else: |
| 10400 | self.out_group = 0 |
| 10401 | if flags != None: |
| 10402 | self.flags = flags |
| 10403 | else: |
| 10404 | self.flags = 0 |
| 10405 | if match != None: |
| 10406 | self.match = match |
| 10407 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10408 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10409 | if instructions != None: |
| 10410 | self.instructions = instructions |
| 10411 | else: |
| 10412 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10413 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10414 | |
| 10415 | def pack(self): |
| 10416 | packed = [] |
| 10417 | packed.append(struct.pack("!B", self.version)) |
| 10418 | packed.append(struct.pack("!B", self.type)) |
| 10419 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10420 | packed.append(struct.pack("!L", self.xid)) |
| 10421 | packed.append(struct.pack("!Q", self.cookie)) |
| 10422 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10423 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10424 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10425 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10426 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10427 | packed.append(struct.pack("!H", self.priority)) |
| 10428 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10429 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10430 | packed.append(struct.pack("!L", self.out_group)) |
| 10431 | packed.append(struct.pack("!H", self.flags)) |
| 10432 | packed.append('\x00' * 2) |
| 10433 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10434 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10435 | length = sum([len(x) for x in packed]) |
| 10436 | packed[2] = struct.pack("!H", length) |
| 10437 | return ''.join(packed) |
| 10438 | |
| 10439 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10440 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10441 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10442 | _version = reader.read("!B")[0] |
| 10443 | assert(_version == 4) |
| 10444 | _type = reader.read("!B")[0] |
| 10445 | assert(_type == 14) |
| 10446 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10447 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10448 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10449 | obj.xid = reader.read("!L")[0] |
| 10450 | obj.cookie = reader.read("!Q")[0] |
| 10451 | obj.cookie_mask = reader.read("!Q")[0] |
| 10452 | obj.table_id = reader.read("!B")[0] |
| 10453 | __command = util.unpack_fm_cmd(reader) |
| 10454 | assert(__command == 1) |
| 10455 | obj.idle_timeout = reader.read("!H")[0] |
| 10456 | obj.hard_timeout = reader.read("!H")[0] |
| 10457 | obj.priority = reader.read("!H")[0] |
| 10458 | obj.buffer_id = reader.read("!L")[0] |
| 10459 | obj.out_port = util.unpack_port_no(reader) |
| 10460 | obj.out_group = reader.read("!L")[0] |
| 10461 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10462 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10463 | obj.match = ofp.match.unpack(reader) |
| 10464 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10465 | return obj |
| 10466 | |
| 10467 | def __eq__(self, other): |
| 10468 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10469 | if self.xid != other.xid: return False |
| 10470 | if self.cookie != other.cookie: return False |
| 10471 | if self.cookie_mask != other.cookie_mask: return False |
| 10472 | if self.table_id != other.table_id: return False |
| 10473 | if self.idle_timeout != other.idle_timeout: return False |
| 10474 | if self.hard_timeout != other.hard_timeout: return False |
| 10475 | if self.priority != other.priority: return False |
| 10476 | if self.buffer_id != other.buffer_id: return False |
| 10477 | if self.out_port != other.out_port: return False |
| 10478 | if self.out_group != other.out_group: return False |
| 10479 | if self.flags != other.flags: return False |
| 10480 | if self.match != other.match: return False |
| 10481 | if self.instructions != other.instructions: return False |
| 10482 | return True |
| 10483 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10484 | def pretty_print(self, q): |
| 10485 | q.text("flow_modify {") |
| 10486 | with q.group(): |
| 10487 | with q.indent(2): |
| 10488 | q.breakable() |
| 10489 | q.text("xid = "); |
| 10490 | if self.xid != None: |
| 10491 | q.text("%#x" % self.xid) |
| 10492 | else: |
| 10493 | q.text('None') |
| 10494 | q.text(","); q.breakable() |
| 10495 | q.text("cookie = "); |
| 10496 | q.text("%#x" % self.cookie) |
| 10497 | q.text(","); q.breakable() |
| 10498 | q.text("cookie_mask = "); |
| 10499 | q.text("%#x" % self.cookie_mask) |
| 10500 | q.text(","); q.breakable() |
| 10501 | q.text("table_id = "); |
| 10502 | q.text("%#x" % self.table_id) |
| 10503 | q.text(","); q.breakable() |
| 10504 | q.text("idle_timeout = "); |
| 10505 | q.text("%#x" % self.idle_timeout) |
| 10506 | q.text(","); q.breakable() |
| 10507 | q.text("hard_timeout = "); |
| 10508 | q.text("%#x" % self.hard_timeout) |
| 10509 | q.text(","); q.breakable() |
| 10510 | q.text("priority = "); |
| 10511 | q.text("%#x" % self.priority) |
| 10512 | q.text(","); q.breakable() |
| 10513 | q.text("buffer_id = "); |
| 10514 | q.text("%#x" % self.buffer_id) |
| 10515 | q.text(","); q.breakable() |
| 10516 | q.text("out_port = "); |
| 10517 | q.text(util.pretty_port(self.out_port)) |
| 10518 | q.text(","); q.breakable() |
| 10519 | q.text("out_group = "); |
| 10520 | q.text("%#x" % self.out_group) |
| 10521 | q.text(","); q.breakable() |
| 10522 | q.text("flags = "); |
| 10523 | q.text("%#x" % self.flags) |
| 10524 | q.text(","); q.breakable() |
| 10525 | q.text("match = "); |
| 10526 | q.pp(self.match) |
| 10527 | q.text(","); q.breakable() |
| 10528 | q.text("instructions = "); |
| 10529 | q.pp(self.instructions) |
| 10530 | q.breakable() |
| 10531 | q.text('}') |
| 10532 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10533 | flow_mod.subtypes[1] = flow_modify |
| 10534 | |
| 10535 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10536 | version = 4 |
| 10537 | type = 14 |
| 10538 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10539 | |
| 10540 | 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] | 10541 | if xid != None: |
| 10542 | self.xid = xid |
| 10543 | else: |
| 10544 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10545 | if cookie != None: |
| 10546 | self.cookie = cookie |
| 10547 | else: |
| 10548 | self.cookie = 0 |
| 10549 | if cookie_mask != None: |
| 10550 | self.cookie_mask = cookie_mask |
| 10551 | else: |
| 10552 | self.cookie_mask = 0 |
| 10553 | if table_id != None: |
| 10554 | self.table_id = table_id |
| 10555 | else: |
| 10556 | self.table_id = 0 |
| 10557 | if idle_timeout != None: |
| 10558 | self.idle_timeout = idle_timeout |
| 10559 | else: |
| 10560 | self.idle_timeout = 0 |
| 10561 | if hard_timeout != None: |
| 10562 | self.hard_timeout = hard_timeout |
| 10563 | else: |
| 10564 | self.hard_timeout = 0 |
| 10565 | if priority != None: |
| 10566 | self.priority = priority |
| 10567 | else: |
| 10568 | self.priority = 0 |
| 10569 | if buffer_id != None: |
| 10570 | self.buffer_id = buffer_id |
| 10571 | else: |
| 10572 | self.buffer_id = 0 |
| 10573 | if out_port != None: |
| 10574 | self.out_port = out_port |
| 10575 | else: |
| 10576 | self.out_port = 0 |
| 10577 | if out_group != None: |
| 10578 | self.out_group = out_group |
| 10579 | else: |
| 10580 | self.out_group = 0 |
| 10581 | if flags != None: |
| 10582 | self.flags = flags |
| 10583 | else: |
| 10584 | self.flags = 0 |
| 10585 | if match != None: |
| 10586 | self.match = match |
| 10587 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10588 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10589 | if instructions != None: |
| 10590 | self.instructions = instructions |
| 10591 | else: |
| 10592 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10593 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10594 | |
| 10595 | def pack(self): |
| 10596 | packed = [] |
| 10597 | packed.append(struct.pack("!B", self.version)) |
| 10598 | packed.append(struct.pack("!B", self.type)) |
| 10599 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10600 | packed.append(struct.pack("!L", self.xid)) |
| 10601 | packed.append(struct.pack("!Q", self.cookie)) |
| 10602 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10603 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10604 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10605 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10606 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10607 | packed.append(struct.pack("!H", self.priority)) |
| 10608 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10609 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10610 | packed.append(struct.pack("!L", self.out_group)) |
| 10611 | packed.append(struct.pack("!H", self.flags)) |
| 10612 | packed.append('\x00' * 2) |
| 10613 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10614 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10615 | length = sum([len(x) for x in packed]) |
| 10616 | packed[2] = struct.pack("!H", length) |
| 10617 | return ''.join(packed) |
| 10618 | |
| 10619 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10620 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10621 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10622 | _version = reader.read("!B")[0] |
| 10623 | assert(_version == 4) |
| 10624 | _type = reader.read("!B")[0] |
| 10625 | assert(_type == 14) |
| 10626 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10627 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10628 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10629 | obj.xid = reader.read("!L")[0] |
| 10630 | obj.cookie = reader.read("!Q")[0] |
| 10631 | obj.cookie_mask = reader.read("!Q")[0] |
| 10632 | obj.table_id = reader.read("!B")[0] |
| 10633 | __command = util.unpack_fm_cmd(reader) |
| 10634 | assert(__command == 2) |
| 10635 | obj.idle_timeout = reader.read("!H")[0] |
| 10636 | obj.hard_timeout = reader.read("!H")[0] |
| 10637 | obj.priority = reader.read("!H")[0] |
| 10638 | obj.buffer_id = reader.read("!L")[0] |
| 10639 | obj.out_port = util.unpack_port_no(reader) |
| 10640 | obj.out_group = reader.read("!L")[0] |
| 10641 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10642 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10643 | obj.match = ofp.match.unpack(reader) |
| 10644 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10645 | return obj |
| 10646 | |
| 10647 | def __eq__(self, other): |
| 10648 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10649 | if self.xid != other.xid: return False |
| 10650 | if self.cookie != other.cookie: return False |
| 10651 | if self.cookie_mask != other.cookie_mask: return False |
| 10652 | if self.table_id != other.table_id: return False |
| 10653 | if self.idle_timeout != other.idle_timeout: return False |
| 10654 | if self.hard_timeout != other.hard_timeout: return False |
| 10655 | if self.priority != other.priority: return False |
| 10656 | if self.buffer_id != other.buffer_id: return False |
| 10657 | if self.out_port != other.out_port: return False |
| 10658 | if self.out_group != other.out_group: return False |
| 10659 | if self.flags != other.flags: return False |
| 10660 | if self.match != other.match: return False |
| 10661 | if self.instructions != other.instructions: return False |
| 10662 | return True |
| 10663 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10664 | def pretty_print(self, q): |
| 10665 | q.text("flow_modify_strict {") |
| 10666 | with q.group(): |
| 10667 | with q.indent(2): |
| 10668 | q.breakable() |
| 10669 | q.text("xid = "); |
| 10670 | if self.xid != None: |
| 10671 | q.text("%#x" % self.xid) |
| 10672 | else: |
| 10673 | q.text('None') |
| 10674 | q.text(","); q.breakable() |
| 10675 | q.text("cookie = "); |
| 10676 | q.text("%#x" % self.cookie) |
| 10677 | q.text(","); q.breakable() |
| 10678 | q.text("cookie_mask = "); |
| 10679 | q.text("%#x" % self.cookie_mask) |
| 10680 | q.text(","); q.breakable() |
| 10681 | q.text("table_id = "); |
| 10682 | q.text("%#x" % self.table_id) |
| 10683 | q.text(","); q.breakable() |
| 10684 | q.text("idle_timeout = "); |
| 10685 | q.text("%#x" % self.idle_timeout) |
| 10686 | q.text(","); q.breakable() |
| 10687 | q.text("hard_timeout = "); |
| 10688 | q.text("%#x" % self.hard_timeout) |
| 10689 | q.text(","); q.breakable() |
| 10690 | q.text("priority = "); |
| 10691 | q.text("%#x" % self.priority) |
| 10692 | q.text(","); q.breakable() |
| 10693 | q.text("buffer_id = "); |
| 10694 | q.text("%#x" % self.buffer_id) |
| 10695 | q.text(","); q.breakable() |
| 10696 | q.text("out_port = "); |
| 10697 | q.text(util.pretty_port(self.out_port)) |
| 10698 | q.text(","); q.breakable() |
| 10699 | q.text("out_group = "); |
| 10700 | q.text("%#x" % self.out_group) |
| 10701 | q.text(","); q.breakable() |
| 10702 | q.text("flags = "); |
| 10703 | q.text("%#x" % self.flags) |
| 10704 | q.text(","); q.breakable() |
| 10705 | q.text("match = "); |
| 10706 | q.pp(self.match) |
| 10707 | q.text(","); q.breakable() |
| 10708 | q.text("instructions = "); |
| 10709 | q.pp(self.instructions) |
| 10710 | q.breakable() |
| 10711 | q.text('}') |
| 10712 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10713 | flow_mod.subtypes[2] = flow_modify_strict |
| 10714 | |
| 10715 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10716 | version = 4 |
| 10717 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10718 | |
| 10719 | 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] | 10720 | if xid != None: |
| 10721 | self.xid = xid |
| 10722 | else: |
| 10723 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10724 | if cookie != None: |
| 10725 | self.cookie = cookie |
| 10726 | else: |
| 10727 | self.cookie = 0 |
| 10728 | if priority != None: |
| 10729 | self.priority = priority |
| 10730 | else: |
| 10731 | self.priority = 0 |
| 10732 | if reason != None: |
| 10733 | self.reason = reason |
| 10734 | else: |
| 10735 | self.reason = 0 |
| 10736 | if table_id != None: |
| 10737 | self.table_id = table_id |
| 10738 | else: |
| 10739 | self.table_id = 0 |
| 10740 | if duration_sec != None: |
| 10741 | self.duration_sec = duration_sec |
| 10742 | else: |
| 10743 | self.duration_sec = 0 |
| 10744 | if duration_nsec != None: |
| 10745 | self.duration_nsec = duration_nsec |
| 10746 | else: |
| 10747 | self.duration_nsec = 0 |
| 10748 | if idle_timeout != None: |
| 10749 | self.idle_timeout = idle_timeout |
| 10750 | else: |
| 10751 | self.idle_timeout = 0 |
| 10752 | if hard_timeout != None: |
| 10753 | self.hard_timeout = hard_timeout |
| 10754 | else: |
| 10755 | self.hard_timeout = 0 |
| 10756 | if packet_count != None: |
| 10757 | self.packet_count = packet_count |
| 10758 | else: |
| 10759 | self.packet_count = 0 |
| 10760 | if byte_count != None: |
| 10761 | self.byte_count = byte_count |
| 10762 | else: |
| 10763 | self.byte_count = 0 |
| 10764 | if match != None: |
| 10765 | self.match = match |
| 10766 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10767 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10768 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10769 | |
| 10770 | def pack(self): |
| 10771 | packed = [] |
| 10772 | packed.append(struct.pack("!B", self.version)) |
| 10773 | packed.append(struct.pack("!B", self.type)) |
| 10774 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10775 | packed.append(struct.pack("!L", self.xid)) |
| 10776 | packed.append(struct.pack("!Q", self.cookie)) |
| 10777 | packed.append(struct.pack("!H", self.priority)) |
| 10778 | packed.append(struct.pack("!B", self.reason)) |
| 10779 | packed.append(struct.pack("!B", self.table_id)) |
| 10780 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10781 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10782 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10783 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10784 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10785 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10786 | packed.append(self.match.pack()) |
| 10787 | length = sum([len(x) for x in packed]) |
| 10788 | packed[2] = struct.pack("!H", length) |
| 10789 | return ''.join(packed) |
| 10790 | |
| 10791 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10792 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10793 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10794 | _version = reader.read("!B")[0] |
| 10795 | assert(_version == 4) |
| 10796 | _type = reader.read("!B")[0] |
| 10797 | assert(_type == 11) |
| 10798 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10799 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10800 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10801 | obj.xid = reader.read("!L")[0] |
| 10802 | obj.cookie = reader.read("!Q")[0] |
| 10803 | obj.priority = reader.read("!H")[0] |
| 10804 | obj.reason = reader.read("!B")[0] |
| 10805 | obj.table_id = reader.read("!B")[0] |
| 10806 | obj.duration_sec = reader.read("!L")[0] |
| 10807 | obj.duration_nsec = reader.read("!L")[0] |
| 10808 | obj.idle_timeout = reader.read("!H")[0] |
| 10809 | obj.hard_timeout = reader.read("!H")[0] |
| 10810 | obj.packet_count = reader.read("!Q")[0] |
| 10811 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10812 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10813 | return obj |
| 10814 | |
| 10815 | def __eq__(self, other): |
| 10816 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10817 | if self.xid != other.xid: return False |
| 10818 | if self.cookie != other.cookie: return False |
| 10819 | if self.priority != other.priority: return False |
| 10820 | if self.reason != other.reason: return False |
| 10821 | if self.table_id != other.table_id: return False |
| 10822 | if self.duration_sec != other.duration_sec: return False |
| 10823 | if self.duration_nsec != other.duration_nsec: return False |
| 10824 | if self.idle_timeout != other.idle_timeout: return False |
| 10825 | if self.hard_timeout != other.hard_timeout: return False |
| 10826 | if self.packet_count != other.packet_count: return False |
| 10827 | if self.byte_count != other.byte_count: return False |
| 10828 | if self.match != other.match: return False |
| 10829 | return True |
| 10830 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10831 | def pretty_print(self, q): |
| 10832 | q.text("flow_removed {") |
| 10833 | with q.group(): |
| 10834 | with q.indent(2): |
| 10835 | q.breakable() |
| 10836 | q.text("xid = "); |
| 10837 | if self.xid != None: |
| 10838 | q.text("%#x" % self.xid) |
| 10839 | else: |
| 10840 | q.text('None') |
| 10841 | q.text(","); q.breakable() |
| 10842 | q.text("cookie = "); |
| 10843 | q.text("%#x" % self.cookie) |
| 10844 | q.text(","); q.breakable() |
| 10845 | q.text("priority = "); |
| 10846 | q.text("%#x" % self.priority) |
| 10847 | q.text(","); q.breakable() |
| 10848 | q.text("reason = "); |
| 10849 | q.text("%#x" % self.reason) |
| 10850 | q.text(","); q.breakable() |
| 10851 | q.text("table_id = "); |
| 10852 | q.text("%#x" % self.table_id) |
| 10853 | q.text(","); q.breakable() |
| 10854 | q.text("duration_sec = "); |
| 10855 | q.text("%#x" % self.duration_sec) |
| 10856 | q.text(","); q.breakable() |
| 10857 | q.text("duration_nsec = "); |
| 10858 | q.text("%#x" % self.duration_nsec) |
| 10859 | q.text(","); q.breakable() |
| 10860 | q.text("idle_timeout = "); |
| 10861 | q.text("%#x" % self.idle_timeout) |
| 10862 | q.text(","); q.breakable() |
| 10863 | q.text("hard_timeout = "); |
| 10864 | q.text("%#x" % self.hard_timeout) |
| 10865 | q.text(","); q.breakable() |
| 10866 | q.text("packet_count = "); |
| 10867 | q.text("%#x" % self.packet_count) |
| 10868 | q.text(","); q.breakable() |
| 10869 | q.text("byte_count = "); |
| 10870 | q.text("%#x" % self.byte_count) |
| 10871 | q.text(","); q.breakable() |
| 10872 | q.text("match = "); |
| 10873 | q.pp(self.match) |
| 10874 | q.breakable() |
| 10875 | q.text('}') |
| 10876 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10877 | message.subtypes[11] = flow_removed |
| 10878 | |
| 10879 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10880 | version = 4 |
| 10881 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10882 | stats_type = 1 |
| 10883 | |
| 10884 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10885 | if xid != None: |
| 10886 | self.xid = xid |
| 10887 | else: |
| 10888 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10889 | if flags != None: |
| 10890 | self.flags = flags |
| 10891 | else: |
| 10892 | self.flags = 0 |
| 10893 | if entries != None: |
| 10894 | self.entries = entries |
| 10895 | else: |
| 10896 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10897 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10898 | |
| 10899 | def pack(self): |
| 10900 | packed = [] |
| 10901 | packed.append(struct.pack("!B", self.version)) |
| 10902 | packed.append(struct.pack("!B", self.type)) |
| 10903 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10904 | packed.append(struct.pack("!L", self.xid)) |
| 10905 | packed.append(struct.pack("!H", self.stats_type)) |
| 10906 | packed.append(struct.pack("!H", self.flags)) |
| 10907 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10908 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10909 | length = sum([len(x) for x in packed]) |
| 10910 | packed[2] = struct.pack("!H", length) |
| 10911 | return ''.join(packed) |
| 10912 | |
| 10913 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10914 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10915 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10916 | _version = reader.read("!B")[0] |
| 10917 | assert(_version == 4) |
| 10918 | _type = reader.read("!B")[0] |
| 10919 | assert(_type == 19) |
| 10920 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10921 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10922 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10923 | obj.xid = reader.read("!L")[0] |
| 10924 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10925 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10926 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10927 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10928 | 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] | 10929 | return obj |
| 10930 | |
| 10931 | def __eq__(self, other): |
| 10932 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10933 | if self.xid != other.xid: return False |
| 10934 | if self.flags != other.flags: return False |
| 10935 | if self.entries != other.entries: return False |
| 10936 | return True |
| 10937 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10938 | def pretty_print(self, q): |
| 10939 | q.text("flow_stats_reply {") |
| 10940 | with q.group(): |
| 10941 | with q.indent(2): |
| 10942 | q.breakable() |
| 10943 | q.text("xid = "); |
| 10944 | if self.xid != None: |
| 10945 | q.text("%#x" % self.xid) |
| 10946 | else: |
| 10947 | q.text('None') |
| 10948 | q.text(","); q.breakable() |
| 10949 | q.text("flags = "); |
| 10950 | q.text("%#x" % self.flags) |
| 10951 | q.text(","); q.breakable() |
| 10952 | q.text("entries = "); |
| 10953 | q.pp(self.entries) |
| 10954 | q.breakable() |
| 10955 | q.text('}') |
| 10956 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10957 | stats_reply.subtypes[1] = flow_stats_reply |
| 10958 | |
| 10959 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10960 | version = 4 |
| 10961 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10962 | stats_type = 1 |
| 10963 | |
| 10964 | 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] | 10965 | if xid != None: |
| 10966 | self.xid = xid |
| 10967 | else: |
| 10968 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10969 | if flags != None: |
| 10970 | self.flags = flags |
| 10971 | else: |
| 10972 | self.flags = 0 |
| 10973 | if table_id != None: |
| 10974 | self.table_id = table_id |
| 10975 | else: |
| 10976 | self.table_id = 0 |
| 10977 | if out_port != None: |
| 10978 | self.out_port = out_port |
| 10979 | else: |
| 10980 | self.out_port = 0 |
| 10981 | if out_group != None: |
| 10982 | self.out_group = out_group |
| 10983 | else: |
| 10984 | self.out_group = 0 |
| 10985 | if cookie != None: |
| 10986 | self.cookie = cookie |
| 10987 | else: |
| 10988 | self.cookie = 0 |
| 10989 | if cookie_mask != None: |
| 10990 | self.cookie_mask = cookie_mask |
| 10991 | else: |
| 10992 | self.cookie_mask = 0 |
| 10993 | if match != None: |
| 10994 | self.match = match |
| 10995 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 10996 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10997 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10998 | |
| 10999 | def pack(self): |
| 11000 | packed = [] |
| 11001 | packed.append(struct.pack("!B", self.version)) |
| 11002 | packed.append(struct.pack("!B", self.type)) |
| 11003 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11004 | packed.append(struct.pack("!L", self.xid)) |
| 11005 | packed.append(struct.pack("!H", self.stats_type)) |
| 11006 | packed.append(struct.pack("!H", self.flags)) |
| 11007 | packed.append('\x00' * 4) |
| 11008 | packed.append(struct.pack("!B", self.table_id)) |
| 11009 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11010 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11011 | packed.append(struct.pack("!L", self.out_group)) |
| 11012 | packed.append('\x00' * 4) |
| 11013 | packed.append(struct.pack("!Q", self.cookie)) |
| 11014 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 11015 | packed.append(self.match.pack()) |
| 11016 | length = sum([len(x) for x in packed]) |
| 11017 | packed[2] = struct.pack("!H", length) |
| 11018 | return ''.join(packed) |
| 11019 | |
| 11020 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11021 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11022 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11023 | _version = reader.read("!B")[0] |
| 11024 | assert(_version == 4) |
| 11025 | _type = reader.read("!B")[0] |
| 11026 | assert(_type == 18) |
| 11027 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11028 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11029 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11030 | obj.xid = reader.read("!L")[0] |
| 11031 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11032 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11033 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11034 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11035 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11036 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11037 | obj.out_port = util.unpack_port_no(reader) |
| 11038 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11039 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11040 | obj.cookie = reader.read("!Q")[0] |
| 11041 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 11042 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11043 | return obj |
| 11044 | |
| 11045 | def __eq__(self, other): |
| 11046 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11047 | if self.xid != other.xid: return False |
| 11048 | if self.flags != other.flags: return False |
| 11049 | if self.table_id != other.table_id: return False |
| 11050 | if self.out_port != other.out_port: return False |
| 11051 | if self.out_group != other.out_group: return False |
| 11052 | if self.cookie != other.cookie: return False |
| 11053 | if self.cookie_mask != other.cookie_mask: return False |
| 11054 | if self.match != other.match: return False |
| 11055 | return True |
| 11056 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11057 | def pretty_print(self, q): |
| 11058 | q.text("flow_stats_request {") |
| 11059 | with q.group(): |
| 11060 | with q.indent(2): |
| 11061 | q.breakable() |
| 11062 | q.text("xid = "); |
| 11063 | if self.xid != None: |
| 11064 | q.text("%#x" % self.xid) |
| 11065 | else: |
| 11066 | q.text('None') |
| 11067 | q.text(","); q.breakable() |
| 11068 | q.text("flags = "); |
| 11069 | q.text("%#x" % self.flags) |
| 11070 | q.text(","); q.breakable() |
| 11071 | q.text("table_id = "); |
| 11072 | q.text("%#x" % self.table_id) |
| 11073 | q.text(","); q.breakable() |
| 11074 | q.text("out_port = "); |
| 11075 | q.text(util.pretty_port(self.out_port)) |
| 11076 | q.text(","); q.breakable() |
| 11077 | q.text("out_group = "); |
| 11078 | q.text("%#x" % self.out_group) |
| 11079 | q.text(","); q.breakable() |
| 11080 | q.text("cookie = "); |
| 11081 | q.text("%#x" % self.cookie) |
| 11082 | q.text(","); q.breakable() |
| 11083 | q.text("cookie_mask = "); |
| 11084 | q.text("%#x" % self.cookie_mask) |
| 11085 | q.text(","); q.breakable() |
| 11086 | q.text("match = "); |
| 11087 | q.pp(self.match) |
| 11088 | q.breakable() |
| 11089 | q.text('}') |
| 11090 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11091 | stats_request.subtypes[1] = flow_stats_request |
| 11092 | |
| 11093 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11094 | version = 4 |
| 11095 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11096 | |
| 11097 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11098 | if xid != None: |
| 11099 | self.xid = xid |
| 11100 | else: |
| 11101 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11102 | if flags != None: |
| 11103 | self.flags = flags |
| 11104 | else: |
| 11105 | self.flags = 0 |
| 11106 | if miss_send_len != None: |
| 11107 | self.miss_send_len = miss_send_len |
| 11108 | else: |
| 11109 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11110 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11111 | |
| 11112 | def pack(self): |
| 11113 | packed = [] |
| 11114 | packed.append(struct.pack("!B", self.version)) |
| 11115 | packed.append(struct.pack("!B", self.type)) |
| 11116 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11117 | packed.append(struct.pack("!L", self.xid)) |
| 11118 | packed.append(struct.pack("!H", self.flags)) |
| 11119 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 11120 | length = sum([len(x) for x in packed]) |
| 11121 | packed[2] = struct.pack("!H", length) |
| 11122 | return ''.join(packed) |
| 11123 | |
| 11124 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11125 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11126 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11127 | _version = reader.read("!B")[0] |
| 11128 | assert(_version == 4) |
| 11129 | _type = reader.read("!B")[0] |
| 11130 | assert(_type == 8) |
| 11131 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11132 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11133 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11134 | obj.xid = reader.read("!L")[0] |
| 11135 | obj.flags = reader.read("!H")[0] |
| 11136 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11137 | return obj |
| 11138 | |
| 11139 | def __eq__(self, other): |
| 11140 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11141 | if self.xid != other.xid: return False |
| 11142 | if self.flags != other.flags: return False |
| 11143 | if self.miss_send_len != other.miss_send_len: return False |
| 11144 | return True |
| 11145 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11146 | def pretty_print(self, q): |
| 11147 | q.text("get_config_reply {") |
| 11148 | with q.group(): |
| 11149 | with q.indent(2): |
| 11150 | q.breakable() |
| 11151 | q.text("xid = "); |
| 11152 | if self.xid != None: |
| 11153 | q.text("%#x" % self.xid) |
| 11154 | else: |
| 11155 | q.text('None') |
| 11156 | q.text(","); q.breakable() |
| 11157 | q.text("flags = "); |
| 11158 | q.text("%#x" % self.flags) |
| 11159 | q.text(","); q.breakable() |
| 11160 | q.text("miss_send_len = "); |
| 11161 | q.text("%#x" % self.miss_send_len) |
| 11162 | q.breakable() |
| 11163 | q.text('}') |
| 11164 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11165 | message.subtypes[8] = get_config_reply |
| 11166 | |
| 11167 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11168 | version = 4 |
| 11169 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11170 | |
| 11171 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11172 | if xid != None: |
| 11173 | self.xid = xid |
| 11174 | else: |
| 11175 | self.xid = None |
| 11176 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11177 | |
| 11178 | def pack(self): |
| 11179 | packed = [] |
| 11180 | packed.append(struct.pack("!B", self.version)) |
| 11181 | packed.append(struct.pack("!B", self.type)) |
| 11182 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11183 | packed.append(struct.pack("!L", self.xid)) |
| 11184 | length = sum([len(x) for x in packed]) |
| 11185 | packed[2] = struct.pack("!H", length) |
| 11186 | return ''.join(packed) |
| 11187 | |
| 11188 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11189 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11190 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11191 | _version = reader.read("!B")[0] |
| 11192 | assert(_version == 4) |
| 11193 | _type = reader.read("!B")[0] |
| 11194 | assert(_type == 7) |
| 11195 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11196 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11197 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11198 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11199 | return obj |
| 11200 | |
| 11201 | def __eq__(self, other): |
| 11202 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11203 | if self.xid != other.xid: return False |
| 11204 | return True |
| 11205 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11206 | def pretty_print(self, q): |
| 11207 | q.text("get_config_request {") |
| 11208 | with q.group(): |
| 11209 | with q.indent(2): |
| 11210 | q.breakable() |
| 11211 | q.text("xid = "); |
| 11212 | if self.xid != None: |
| 11213 | q.text("%#x" % self.xid) |
| 11214 | else: |
| 11215 | q.text('None') |
| 11216 | q.breakable() |
| 11217 | q.text('}') |
| 11218 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11219 | message.subtypes[7] = get_config_request |
| 11220 | |
| 11221 | class group_mod(message): |
| 11222 | subtypes = {} |
| 11223 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11224 | version = 4 |
| 11225 | type = 15 |
| 11226 | |
| 11227 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 11228 | if xid != None: |
| 11229 | self.xid = xid |
| 11230 | else: |
| 11231 | self.xid = None |
| 11232 | if command != None: |
| 11233 | self.command = command |
| 11234 | else: |
| 11235 | self.command = 0 |
| 11236 | if group_type != None: |
| 11237 | self.group_type = group_type |
| 11238 | else: |
| 11239 | self.group_type = 0 |
| 11240 | if group_id != None: |
| 11241 | self.group_id = group_id |
| 11242 | else: |
| 11243 | self.group_id = 0 |
| 11244 | if buckets != None: |
| 11245 | self.buckets = buckets |
| 11246 | else: |
| 11247 | self.buckets = [] |
| 11248 | return |
| 11249 | |
| 11250 | def pack(self): |
| 11251 | packed = [] |
| 11252 | packed.append(struct.pack("!B", self.version)) |
| 11253 | packed.append(struct.pack("!B", self.type)) |
| 11254 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11255 | packed.append(struct.pack("!L", self.xid)) |
| 11256 | packed.append(struct.pack("!H", self.command)) |
| 11257 | packed.append(struct.pack("!B", self.group_type)) |
| 11258 | packed.append('\x00' * 1) |
| 11259 | packed.append(struct.pack("!L", self.group_id)) |
| 11260 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11261 | length = sum([len(x) for x in packed]) |
| 11262 | packed[2] = struct.pack("!H", length) |
| 11263 | return ''.join(packed) |
| 11264 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11265 | @staticmethod |
| 11266 | def unpack(reader): |
| 11267 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11268 | subclass = group_mod.subtypes.get(subtype) |
| 11269 | if subclass: |
| 11270 | return subclass.unpack(reader) |
| 11271 | |
| 11272 | obj = group_mod() |
| 11273 | _version = reader.read("!B")[0] |
| 11274 | assert(_version == 4) |
| 11275 | _type = reader.read("!B")[0] |
| 11276 | assert(_type == 15) |
| 11277 | _length = reader.read("!H")[0] |
| 11278 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11279 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11280 | obj.xid = reader.read("!L")[0] |
| 11281 | obj.command = reader.read("!H")[0] |
| 11282 | obj.group_type = reader.read("!B")[0] |
| 11283 | reader.skip(1) |
| 11284 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 11285 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11286 | return obj |
| 11287 | |
| 11288 | def __eq__(self, other): |
| 11289 | if type(self) != type(other): return False |
| 11290 | if self.xid != other.xid: return False |
| 11291 | if self.command != other.command: return False |
| 11292 | if self.group_type != other.group_type: return False |
| 11293 | if self.group_id != other.group_id: return False |
| 11294 | if self.buckets != other.buckets: return False |
| 11295 | return True |
| 11296 | |
| 11297 | def pretty_print(self, q): |
| 11298 | q.text("group_mod {") |
| 11299 | with q.group(): |
| 11300 | with q.indent(2): |
| 11301 | q.breakable() |
| 11302 | q.text("xid = "); |
| 11303 | if self.xid != None: |
| 11304 | q.text("%#x" % self.xid) |
| 11305 | else: |
| 11306 | q.text('None') |
| 11307 | q.text(","); q.breakable() |
| 11308 | q.text("group_type = "); |
| 11309 | q.text("%#x" % self.group_type) |
| 11310 | q.text(","); q.breakable() |
| 11311 | q.text("group_id = "); |
| 11312 | q.text("%#x" % self.group_id) |
| 11313 | q.text(","); q.breakable() |
| 11314 | q.text("buckets = "); |
| 11315 | q.pp(self.buckets) |
| 11316 | q.breakable() |
| 11317 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11318 | |
| 11319 | message.subtypes[15] = group_mod |
| 11320 | |
| 11321 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11322 | version = 4 |
| 11323 | type = 15 |
| 11324 | command = 0 |
| 11325 | |
| 11326 | 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] | 11327 | if xid != None: |
| 11328 | self.xid = xid |
| 11329 | else: |
| 11330 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11331 | if group_type != None: |
| 11332 | self.group_type = group_type |
| 11333 | else: |
| 11334 | self.group_type = 0 |
| 11335 | if group_id != None: |
| 11336 | self.group_id = group_id |
| 11337 | else: |
| 11338 | self.group_id = 0 |
| 11339 | if buckets != None: |
| 11340 | self.buckets = buckets |
| 11341 | else: |
| 11342 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11343 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11344 | |
| 11345 | def pack(self): |
| 11346 | packed = [] |
| 11347 | packed.append(struct.pack("!B", self.version)) |
| 11348 | packed.append(struct.pack("!B", self.type)) |
| 11349 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11350 | packed.append(struct.pack("!L", self.xid)) |
| 11351 | packed.append(struct.pack("!H", self.command)) |
| 11352 | packed.append(struct.pack("!B", self.group_type)) |
| 11353 | packed.append('\x00' * 1) |
| 11354 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11355 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11356 | length = sum([len(x) for x in packed]) |
| 11357 | packed[2] = struct.pack("!H", length) |
| 11358 | return ''.join(packed) |
| 11359 | |
| 11360 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11361 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11362 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11363 | _version = reader.read("!B")[0] |
| 11364 | assert(_version == 4) |
| 11365 | _type = reader.read("!B")[0] |
| 11366 | assert(_type == 15) |
| 11367 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11368 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11369 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11370 | obj.xid = reader.read("!L")[0] |
| 11371 | _command = reader.read("!H")[0] |
| 11372 | assert(_command == 0) |
| 11373 | obj.group_type = reader.read("!B")[0] |
| 11374 | reader.skip(1) |
| 11375 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 11376 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11377 | return obj |
| 11378 | |
| 11379 | def __eq__(self, other): |
| 11380 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11381 | if self.xid != other.xid: return False |
| 11382 | if self.group_type != other.group_type: return False |
| 11383 | if self.group_id != other.group_id: return False |
| 11384 | if self.buckets != other.buckets: return False |
| 11385 | return True |
| 11386 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11387 | def pretty_print(self, q): |
| 11388 | q.text("group_add {") |
| 11389 | with q.group(): |
| 11390 | with q.indent(2): |
| 11391 | q.breakable() |
| 11392 | q.text("xid = "); |
| 11393 | if self.xid != None: |
| 11394 | q.text("%#x" % self.xid) |
| 11395 | else: |
| 11396 | q.text('None') |
| 11397 | q.text(","); q.breakable() |
| 11398 | q.text("group_type = "); |
| 11399 | q.text("%#x" % self.group_type) |
| 11400 | q.text(","); q.breakable() |
| 11401 | q.text("group_id = "); |
| 11402 | q.text("%#x" % self.group_id) |
| 11403 | q.text(","); q.breakable() |
| 11404 | q.text("buckets = "); |
| 11405 | q.pp(self.buckets) |
| 11406 | q.breakable() |
| 11407 | q.text('}') |
| 11408 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11409 | group_mod.subtypes[0] = group_add |
| 11410 | |
| 11411 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11412 | version = 4 |
| 11413 | type = 15 |
| 11414 | command = 2 |
| 11415 | |
| 11416 | 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] | 11417 | if xid != None: |
| 11418 | self.xid = xid |
| 11419 | else: |
| 11420 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11421 | if group_type != None: |
| 11422 | self.group_type = group_type |
| 11423 | else: |
| 11424 | self.group_type = 0 |
| 11425 | if group_id != None: |
| 11426 | self.group_id = group_id |
| 11427 | else: |
| 11428 | self.group_id = 0 |
| 11429 | if buckets != None: |
| 11430 | self.buckets = buckets |
| 11431 | else: |
| 11432 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11433 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11434 | |
| 11435 | def pack(self): |
| 11436 | packed = [] |
| 11437 | packed.append(struct.pack("!B", self.version)) |
| 11438 | packed.append(struct.pack("!B", self.type)) |
| 11439 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11440 | packed.append(struct.pack("!L", self.xid)) |
| 11441 | packed.append(struct.pack("!H", self.command)) |
| 11442 | packed.append(struct.pack("!B", self.group_type)) |
| 11443 | packed.append('\x00' * 1) |
| 11444 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11445 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11446 | length = sum([len(x) for x in packed]) |
| 11447 | packed[2] = struct.pack("!H", length) |
| 11448 | return ''.join(packed) |
| 11449 | |
| 11450 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11451 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11452 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11453 | _version = reader.read("!B")[0] |
| 11454 | assert(_version == 4) |
| 11455 | _type = reader.read("!B")[0] |
| 11456 | assert(_type == 15) |
| 11457 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11458 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11459 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11460 | obj.xid = reader.read("!L")[0] |
| 11461 | _command = reader.read("!H")[0] |
| 11462 | assert(_command == 2) |
| 11463 | obj.group_type = reader.read("!B")[0] |
| 11464 | reader.skip(1) |
| 11465 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 11466 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11467 | return obj |
| 11468 | |
| 11469 | def __eq__(self, other): |
| 11470 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11471 | if self.xid != other.xid: return False |
| 11472 | if self.group_type != other.group_type: return False |
| 11473 | if self.group_id != other.group_id: return False |
| 11474 | if self.buckets != other.buckets: return False |
| 11475 | return True |
| 11476 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11477 | def pretty_print(self, q): |
| 11478 | q.text("group_delete {") |
| 11479 | with q.group(): |
| 11480 | with q.indent(2): |
| 11481 | q.breakable() |
| 11482 | q.text("xid = "); |
| 11483 | if self.xid != None: |
| 11484 | q.text("%#x" % self.xid) |
| 11485 | else: |
| 11486 | q.text('None') |
| 11487 | q.text(","); q.breakable() |
| 11488 | q.text("group_type = "); |
| 11489 | q.text("%#x" % self.group_type) |
| 11490 | q.text(","); q.breakable() |
| 11491 | q.text("group_id = "); |
| 11492 | q.text("%#x" % self.group_id) |
| 11493 | q.text(","); q.breakable() |
| 11494 | q.text("buckets = "); |
| 11495 | q.pp(self.buckets) |
| 11496 | q.breakable() |
| 11497 | q.text('}') |
| 11498 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11499 | group_mod.subtypes[2] = group_delete |
| 11500 | |
| 11501 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11502 | version = 4 |
| 11503 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11504 | stats_type = 7 |
| 11505 | |
| 11506 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11507 | if xid != None: |
| 11508 | self.xid = xid |
| 11509 | else: |
| 11510 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11511 | if flags != None: |
| 11512 | self.flags = flags |
| 11513 | else: |
| 11514 | self.flags = 0 |
| 11515 | if entries != None: |
| 11516 | self.entries = entries |
| 11517 | else: |
| 11518 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11519 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11520 | |
| 11521 | def pack(self): |
| 11522 | packed = [] |
| 11523 | packed.append(struct.pack("!B", self.version)) |
| 11524 | packed.append(struct.pack("!B", self.type)) |
| 11525 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11526 | packed.append(struct.pack("!L", self.xid)) |
| 11527 | packed.append(struct.pack("!H", self.stats_type)) |
| 11528 | packed.append(struct.pack("!H", self.flags)) |
| 11529 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11530 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11531 | length = sum([len(x) for x in packed]) |
| 11532 | packed[2] = struct.pack("!H", length) |
| 11533 | return ''.join(packed) |
| 11534 | |
| 11535 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11536 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11537 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11538 | _version = reader.read("!B")[0] |
| 11539 | assert(_version == 4) |
| 11540 | _type = reader.read("!B")[0] |
| 11541 | assert(_type == 19) |
| 11542 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11543 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11544 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11545 | obj.xid = reader.read("!L")[0] |
| 11546 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11547 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11548 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11549 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 11550 | 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] | 11551 | return obj |
| 11552 | |
| 11553 | def __eq__(self, other): |
| 11554 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11555 | if self.xid != other.xid: return False |
| 11556 | if self.flags != other.flags: return False |
| 11557 | if self.entries != other.entries: return False |
| 11558 | return True |
| 11559 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11560 | def pretty_print(self, q): |
| 11561 | q.text("group_desc_stats_reply {") |
| 11562 | with q.group(): |
| 11563 | with q.indent(2): |
| 11564 | q.breakable() |
| 11565 | q.text("xid = "); |
| 11566 | if self.xid != None: |
| 11567 | q.text("%#x" % self.xid) |
| 11568 | else: |
| 11569 | q.text('None') |
| 11570 | q.text(","); q.breakable() |
| 11571 | q.text("flags = "); |
| 11572 | q.text("%#x" % self.flags) |
| 11573 | q.text(","); q.breakable() |
| 11574 | q.text("entries = "); |
| 11575 | q.pp(self.entries) |
| 11576 | q.breakable() |
| 11577 | q.text('}') |
| 11578 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11579 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 11580 | |
| 11581 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11582 | version = 4 |
| 11583 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11584 | stats_type = 7 |
| 11585 | |
| 11586 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11587 | if xid != None: |
| 11588 | self.xid = xid |
| 11589 | else: |
| 11590 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11591 | if flags != None: |
| 11592 | self.flags = flags |
| 11593 | else: |
| 11594 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11595 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11596 | |
| 11597 | def pack(self): |
| 11598 | packed = [] |
| 11599 | packed.append(struct.pack("!B", self.version)) |
| 11600 | packed.append(struct.pack("!B", self.type)) |
| 11601 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11602 | packed.append(struct.pack("!L", self.xid)) |
| 11603 | packed.append(struct.pack("!H", self.stats_type)) |
| 11604 | packed.append(struct.pack("!H", self.flags)) |
| 11605 | packed.append('\x00' * 4) |
| 11606 | length = sum([len(x) for x in packed]) |
| 11607 | packed[2] = struct.pack("!H", length) |
| 11608 | return ''.join(packed) |
| 11609 | |
| 11610 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11611 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11612 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11613 | _version = reader.read("!B")[0] |
| 11614 | assert(_version == 4) |
| 11615 | _type = reader.read("!B")[0] |
| 11616 | assert(_type == 18) |
| 11617 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11618 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11619 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11620 | obj.xid = reader.read("!L")[0] |
| 11621 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11622 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11623 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11624 | reader.skip(4) |
| 11625 | return obj |
| 11626 | |
| 11627 | def __eq__(self, other): |
| 11628 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11629 | if self.xid != other.xid: return False |
| 11630 | if self.flags != other.flags: return False |
| 11631 | return True |
| 11632 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11633 | def pretty_print(self, q): |
| 11634 | q.text("group_desc_stats_request {") |
| 11635 | with q.group(): |
| 11636 | with q.indent(2): |
| 11637 | q.breakable() |
| 11638 | q.text("xid = "); |
| 11639 | if self.xid != None: |
| 11640 | q.text("%#x" % self.xid) |
| 11641 | else: |
| 11642 | q.text('None') |
| 11643 | q.text(","); q.breakable() |
| 11644 | q.text("flags = "); |
| 11645 | q.text("%#x" % self.flags) |
| 11646 | q.breakable() |
| 11647 | q.text('}') |
| 11648 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11649 | stats_request.subtypes[7] = group_desc_stats_request |
| 11650 | |
| 11651 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11652 | version = 4 |
| 11653 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11654 | stats_type = 8 |
| 11655 | |
| 11656 | 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] | 11657 | if xid != None: |
| 11658 | self.xid = xid |
| 11659 | else: |
| 11660 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11661 | if flags != None: |
| 11662 | self.flags = flags |
| 11663 | else: |
| 11664 | self.flags = 0 |
| 11665 | if types != None: |
| 11666 | self.types = types |
| 11667 | else: |
| 11668 | self.types = 0 |
| 11669 | if capabilities != None: |
| 11670 | self.capabilities = capabilities |
| 11671 | else: |
| 11672 | self.capabilities = 0 |
| 11673 | if max_groups_all != None: |
| 11674 | self.max_groups_all = max_groups_all |
| 11675 | else: |
| 11676 | self.max_groups_all = 0 |
| 11677 | if max_groups_select != None: |
| 11678 | self.max_groups_select = max_groups_select |
| 11679 | else: |
| 11680 | self.max_groups_select = 0 |
| 11681 | if max_groups_indirect != None: |
| 11682 | self.max_groups_indirect = max_groups_indirect |
| 11683 | else: |
| 11684 | self.max_groups_indirect = 0 |
| 11685 | if max_groups_ff != None: |
| 11686 | self.max_groups_ff = max_groups_ff |
| 11687 | else: |
| 11688 | self.max_groups_ff = 0 |
| 11689 | if actions_all != None: |
| 11690 | self.actions_all = actions_all |
| 11691 | else: |
| 11692 | self.actions_all = 0 |
| 11693 | if actions_select != None: |
| 11694 | self.actions_select = actions_select |
| 11695 | else: |
| 11696 | self.actions_select = 0 |
| 11697 | if actions_indirect != None: |
| 11698 | self.actions_indirect = actions_indirect |
| 11699 | else: |
| 11700 | self.actions_indirect = 0 |
| 11701 | if actions_ff != None: |
| 11702 | self.actions_ff = actions_ff |
| 11703 | else: |
| 11704 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11705 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11706 | |
| 11707 | def pack(self): |
| 11708 | packed = [] |
| 11709 | packed.append(struct.pack("!B", self.version)) |
| 11710 | packed.append(struct.pack("!B", self.type)) |
| 11711 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11712 | packed.append(struct.pack("!L", self.xid)) |
| 11713 | packed.append(struct.pack("!H", self.stats_type)) |
| 11714 | packed.append(struct.pack("!H", self.flags)) |
| 11715 | packed.append('\x00' * 4) |
| 11716 | packed.append(struct.pack("!L", self.types)) |
| 11717 | packed.append(struct.pack("!L", self.capabilities)) |
| 11718 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 11719 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 11720 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 11721 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 11722 | packed.append(struct.pack("!L", self.actions_all)) |
| 11723 | packed.append(struct.pack("!L", self.actions_select)) |
| 11724 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 11725 | packed.append(struct.pack("!L", self.actions_ff)) |
| 11726 | length = sum([len(x) for x in packed]) |
| 11727 | packed[2] = struct.pack("!H", length) |
| 11728 | return ''.join(packed) |
| 11729 | |
| 11730 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11731 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11732 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11733 | _version = reader.read("!B")[0] |
| 11734 | assert(_version == 4) |
| 11735 | _type = reader.read("!B")[0] |
| 11736 | assert(_type == 19) |
| 11737 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11738 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11739 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11740 | obj.xid = reader.read("!L")[0] |
| 11741 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11742 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11743 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11744 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11745 | obj.types = reader.read("!L")[0] |
| 11746 | obj.capabilities = reader.read("!L")[0] |
| 11747 | obj.max_groups_all = reader.read("!L")[0] |
| 11748 | obj.max_groups_select = reader.read("!L")[0] |
| 11749 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11750 | obj.max_groups_ff = reader.read("!L")[0] |
| 11751 | obj.actions_all = reader.read("!L")[0] |
| 11752 | obj.actions_select = reader.read("!L")[0] |
| 11753 | obj.actions_indirect = reader.read("!L")[0] |
| 11754 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11755 | return obj |
| 11756 | |
| 11757 | def __eq__(self, other): |
| 11758 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11759 | if self.xid != other.xid: return False |
| 11760 | if self.flags != other.flags: return False |
| 11761 | if self.types != other.types: return False |
| 11762 | if self.capabilities != other.capabilities: return False |
| 11763 | if self.max_groups_all != other.max_groups_all: return False |
| 11764 | if self.max_groups_select != other.max_groups_select: return False |
| 11765 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11766 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11767 | if self.actions_all != other.actions_all: return False |
| 11768 | if self.actions_select != other.actions_select: return False |
| 11769 | if self.actions_indirect != other.actions_indirect: return False |
| 11770 | if self.actions_ff != other.actions_ff: return False |
| 11771 | return True |
| 11772 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11773 | def pretty_print(self, q): |
| 11774 | q.text("group_features_stats_reply {") |
| 11775 | with q.group(): |
| 11776 | with q.indent(2): |
| 11777 | q.breakable() |
| 11778 | q.text("xid = "); |
| 11779 | if self.xid != None: |
| 11780 | q.text("%#x" % self.xid) |
| 11781 | else: |
| 11782 | q.text('None') |
| 11783 | q.text(","); q.breakable() |
| 11784 | q.text("flags = "); |
| 11785 | q.text("%#x" % self.flags) |
| 11786 | q.text(","); q.breakable() |
| 11787 | q.text("types = "); |
| 11788 | q.text("%#x" % self.types) |
| 11789 | q.text(","); q.breakable() |
| 11790 | q.text("capabilities = "); |
| 11791 | q.text("%#x" % self.capabilities) |
| 11792 | q.text(","); q.breakable() |
| 11793 | q.text("max_groups_all = "); |
| 11794 | q.text("%#x" % self.max_groups_all) |
| 11795 | q.text(","); q.breakable() |
| 11796 | q.text("max_groups_select = "); |
| 11797 | q.text("%#x" % self.max_groups_select) |
| 11798 | q.text(","); q.breakable() |
| 11799 | q.text("max_groups_indirect = "); |
| 11800 | q.text("%#x" % self.max_groups_indirect) |
| 11801 | q.text(","); q.breakable() |
| 11802 | q.text("max_groups_ff = "); |
| 11803 | q.text("%#x" % self.max_groups_ff) |
| 11804 | q.text(","); q.breakable() |
| 11805 | q.text("actions_all = "); |
| 11806 | q.text("%#x" % self.actions_all) |
| 11807 | q.text(","); q.breakable() |
| 11808 | q.text("actions_select = "); |
| 11809 | q.text("%#x" % self.actions_select) |
| 11810 | q.text(","); q.breakable() |
| 11811 | q.text("actions_indirect = "); |
| 11812 | q.text("%#x" % self.actions_indirect) |
| 11813 | q.text(","); q.breakable() |
| 11814 | q.text("actions_ff = "); |
| 11815 | q.text("%#x" % self.actions_ff) |
| 11816 | q.breakable() |
| 11817 | q.text('}') |
| 11818 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11819 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11820 | |
| 11821 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11822 | version = 4 |
| 11823 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11824 | stats_type = 8 |
| 11825 | |
| 11826 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11827 | if xid != None: |
| 11828 | self.xid = xid |
| 11829 | else: |
| 11830 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11831 | if flags != None: |
| 11832 | self.flags = flags |
| 11833 | else: |
| 11834 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11835 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11836 | |
| 11837 | def pack(self): |
| 11838 | packed = [] |
| 11839 | packed.append(struct.pack("!B", self.version)) |
| 11840 | packed.append(struct.pack("!B", self.type)) |
| 11841 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11842 | packed.append(struct.pack("!L", self.xid)) |
| 11843 | packed.append(struct.pack("!H", self.stats_type)) |
| 11844 | packed.append(struct.pack("!H", self.flags)) |
| 11845 | packed.append('\x00' * 4) |
| 11846 | length = sum([len(x) for x in packed]) |
| 11847 | packed[2] = struct.pack("!H", length) |
| 11848 | return ''.join(packed) |
| 11849 | |
| 11850 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11851 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11852 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11853 | _version = reader.read("!B")[0] |
| 11854 | assert(_version == 4) |
| 11855 | _type = reader.read("!B")[0] |
| 11856 | assert(_type == 18) |
| 11857 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11858 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11859 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11860 | obj.xid = reader.read("!L")[0] |
| 11861 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11862 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11863 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11864 | reader.skip(4) |
| 11865 | return obj |
| 11866 | |
| 11867 | def __eq__(self, other): |
| 11868 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11869 | if self.xid != other.xid: return False |
| 11870 | if self.flags != other.flags: return False |
| 11871 | return True |
| 11872 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11873 | def pretty_print(self, q): |
| 11874 | q.text("group_features_stats_request {") |
| 11875 | with q.group(): |
| 11876 | with q.indent(2): |
| 11877 | q.breakable() |
| 11878 | q.text("xid = "); |
| 11879 | if self.xid != None: |
| 11880 | q.text("%#x" % self.xid) |
| 11881 | else: |
| 11882 | q.text('None') |
| 11883 | q.text(","); q.breakable() |
| 11884 | q.text("flags = "); |
| 11885 | q.text("%#x" % self.flags) |
| 11886 | q.breakable() |
| 11887 | q.text('}') |
| 11888 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11889 | stats_request.subtypes[8] = group_features_stats_request |
| 11890 | |
| 11891 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11892 | version = 4 |
| 11893 | type = 1 |
| 11894 | err_type = 6 |
| 11895 | |
| 11896 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11897 | if xid != None: |
| 11898 | self.xid = xid |
| 11899 | else: |
| 11900 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11901 | if code != None: |
| 11902 | self.code = code |
| 11903 | else: |
| 11904 | self.code = 0 |
| 11905 | if data != None: |
| 11906 | self.data = data |
| 11907 | else: |
| 11908 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11909 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11910 | |
| 11911 | def pack(self): |
| 11912 | packed = [] |
| 11913 | packed.append(struct.pack("!B", self.version)) |
| 11914 | packed.append(struct.pack("!B", self.type)) |
| 11915 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11916 | packed.append(struct.pack("!L", self.xid)) |
| 11917 | packed.append(struct.pack("!H", self.err_type)) |
| 11918 | packed.append(struct.pack("!H", self.code)) |
| 11919 | packed.append(self.data) |
| 11920 | length = sum([len(x) for x in packed]) |
| 11921 | packed[2] = struct.pack("!H", length) |
| 11922 | return ''.join(packed) |
| 11923 | |
| 11924 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11926 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11927 | _version = reader.read("!B")[0] |
| 11928 | assert(_version == 4) |
| 11929 | _type = reader.read("!B")[0] |
| 11930 | assert(_type == 1) |
| 11931 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11932 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11933 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11934 | obj.xid = reader.read("!L")[0] |
| 11935 | _err_type = reader.read("!H")[0] |
| 11936 | assert(_err_type == 6) |
| 11937 | obj.code = reader.read("!H")[0] |
| 11938 | obj.data = str(reader.read_all()) |
| 11939 | return obj |
| 11940 | |
| 11941 | def __eq__(self, other): |
| 11942 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11943 | if self.xid != other.xid: return False |
| 11944 | if self.code != other.code: return False |
| 11945 | if self.data != other.data: return False |
| 11946 | return True |
| 11947 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11948 | def pretty_print(self, q): |
| 11949 | q.text("group_mod_failed_error_msg {") |
| 11950 | with q.group(): |
| 11951 | with q.indent(2): |
| 11952 | q.breakable() |
| 11953 | q.text("xid = "); |
| 11954 | if self.xid != None: |
| 11955 | q.text("%#x" % self.xid) |
| 11956 | else: |
| 11957 | q.text('None') |
| 11958 | q.text(","); q.breakable() |
| 11959 | q.text("code = "); |
| 11960 | q.text("%#x" % self.code) |
| 11961 | q.text(","); q.breakable() |
| 11962 | q.text("data = "); |
| 11963 | q.pp(self.data) |
| 11964 | q.breakable() |
| 11965 | q.text('}') |
| 11966 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11967 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11968 | |
| 11969 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11970 | version = 4 |
| 11971 | type = 15 |
| 11972 | command = 1 |
| 11973 | |
| 11974 | 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] | 11975 | if xid != None: |
| 11976 | self.xid = xid |
| 11977 | else: |
| 11978 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11979 | if group_type != None: |
| 11980 | self.group_type = group_type |
| 11981 | else: |
| 11982 | self.group_type = 0 |
| 11983 | if group_id != None: |
| 11984 | self.group_id = group_id |
| 11985 | else: |
| 11986 | self.group_id = 0 |
| 11987 | if buckets != None: |
| 11988 | self.buckets = buckets |
| 11989 | else: |
| 11990 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11991 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11992 | |
| 11993 | def pack(self): |
| 11994 | packed = [] |
| 11995 | packed.append(struct.pack("!B", self.version)) |
| 11996 | packed.append(struct.pack("!B", self.type)) |
| 11997 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11998 | packed.append(struct.pack("!L", self.xid)) |
| 11999 | packed.append(struct.pack("!H", self.command)) |
| 12000 | packed.append(struct.pack("!B", self.group_type)) |
| 12001 | packed.append('\x00' * 1) |
| 12002 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12003 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12004 | length = sum([len(x) for x in packed]) |
| 12005 | packed[2] = struct.pack("!H", length) |
| 12006 | return ''.join(packed) |
| 12007 | |
| 12008 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12009 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12010 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12011 | _version = reader.read("!B")[0] |
| 12012 | assert(_version == 4) |
| 12013 | _type = reader.read("!B")[0] |
| 12014 | assert(_type == 15) |
| 12015 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12016 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12017 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12018 | obj.xid = reader.read("!L")[0] |
| 12019 | _command = reader.read("!H")[0] |
| 12020 | assert(_command == 1) |
| 12021 | obj.group_type = reader.read("!B")[0] |
| 12022 | reader.skip(1) |
| 12023 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12024 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12025 | return obj |
| 12026 | |
| 12027 | def __eq__(self, other): |
| 12028 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12029 | if self.xid != other.xid: return False |
| 12030 | if self.group_type != other.group_type: return False |
| 12031 | if self.group_id != other.group_id: return False |
| 12032 | if self.buckets != other.buckets: return False |
| 12033 | return True |
| 12034 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12035 | def pretty_print(self, q): |
| 12036 | q.text("group_modify {") |
| 12037 | with q.group(): |
| 12038 | with q.indent(2): |
| 12039 | q.breakable() |
| 12040 | q.text("xid = "); |
| 12041 | if self.xid != None: |
| 12042 | q.text("%#x" % self.xid) |
| 12043 | else: |
| 12044 | q.text('None') |
| 12045 | q.text(","); q.breakable() |
| 12046 | q.text("group_type = "); |
| 12047 | q.text("%#x" % self.group_type) |
| 12048 | q.text(","); q.breakable() |
| 12049 | q.text("group_id = "); |
| 12050 | q.text("%#x" % self.group_id) |
| 12051 | q.text(","); q.breakable() |
| 12052 | q.text("buckets = "); |
| 12053 | q.pp(self.buckets) |
| 12054 | q.breakable() |
| 12055 | q.text('}') |
| 12056 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12057 | group_mod.subtypes[1] = group_modify |
| 12058 | |
| 12059 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12060 | version = 4 |
| 12061 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12062 | stats_type = 6 |
| 12063 | |
| 12064 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12065 | if xid != None: |
| 12066 | self.xid = xid |
| 12067 | else: |
| 12068 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12069 | if flags != None: |
| 12070 | self.flags = flags |
| 12071 | else: |
| 12072 | self.flags = 0 |
| 12073 | if entries != None: |
| 12074 | self.entries = entries |
| 12075 | else: |
| 12076 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12077 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12078 | |
| 12079 | def pack(self): |
| 12080 | packed = [] |
| 12081 | packed.append(struct.pack("!B", self.version)) |
| 12082 | packed.append(struct.pack("!B", self.type)) |
| 12083 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12084 | packed.append(struct.pack("!L", self.xid)) |
| 12085 | packed.append(struct.pack("!H", self.stats_type)) |
| 12086 | packed.append(struct.pack("!H", self.flags)) |
| 12087 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12088 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12089 | length = sum([len(x) for x in packed]) |
| 12090 | packed[2] = struct.pack("!H", length) |
| 12091 | return ''.join(packed) |
| 12092 | |
| 12093 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12094 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12095 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12096 | _version = reader.read("!B")[0] |
| 12097 | assert(_version == 4) |
| 12098 | _type = reader.read("!B")[0] |
| 12099 | assert(_type == 19) |
| 12100 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12101 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12102 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12103 | obj.xid = reader.read("!L")[0] |
| 12104 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12105 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12106 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12107 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12108 | 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] | 12109 | return obj |
| 12110 | |
| 12111 | def __eq__(self, other): |
| 12112 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12113 | if self.xid != other.xid: return False |
| 12114 | if self.flags != other.flags: return False |
| 12115 | if self.entries != other.entries: return False |
| 12116 | return True |
| 12117 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12118 | def pretty_print(self, q): |
| 12119 | q.text("group_stats_reply {") |
| 12120 | with q.group(): |
| 12121 | with q.indent(2): |
| 12122 | q.breakable() |
| 12123 | q.text("xid = "); |
| 12124 | if self.xid != None: |
| 12125 | q.text("%#x" % self.xid) |
| 12126 | else: |
| 12127 | q.text('None') |
| 12128 | q.text(","); q.breakable() |
| 12129 | q.text("flags = "); |
| 12130 | q.text("%#x" % self.flags) |
| 12131 | q.text(","); q.breakable() |
| 12132 | q.text("entries = "); |
| 12133 | q.pp(self.entries) |
| 12134 | q.breakable() |
| 12135 | q.text('}') |
| 12136 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12137 | stats_reply.subtypes[6] = group_stats_reply |
| 12138 | |
| 12139 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12140 | version = 4 |
| 12141 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12142 | stats_type = 6 |
| 12143 | |
| 12144 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12145 | if xid != None: |
| 12146 | self.xid = xid |
| 12147 | else: |
| 12148 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12149 | if flags != None: |
| 12150 | self.flags = flags |
| 12151 | else: |
| 12152 | self.flags = 0 |
| 12153 | if group_id != None: |
| 12154 | self.group_id = group_id |
| 12155 | else: |
| 12156 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12157 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12158 | |
| 12159 | def pack(self): |
| 12160 | packed = [] |
| 12161 | packed.append(struct.pack("!B", self.version)) |
| 12162 | packed.append(struct.pack("!B", self.type)) |
| 12163 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12164 | packed.append(struct.pack("!L", self.xid)) |
| 12165 | packed.append(struct.pack("!H", self.stats_type)) |
| 12166 | packed.append(struct.pack("!H", self.flags)) |
| 12167 | packed.append('\x00' * 4) |
| 12168 | packed.append(struct.pack("!L", self.group_id)) |
| 12169 | packed.append('\x00' * 4) |
| 12170 | length = sum([len(x) for x in packed]) |
| 12171 | packed[2] = struct.pack("!H", length) |
| 12172 | return ''.join(packed) |
| 12173 | |
| 12174 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12175 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12176 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12177 | _version = reader.read("!B")[0] |
| 12178 | assert(_version == 4) |
| 12179 | _type = reader.read("!B")[0] |
| 12180 | assert(_type == 18) |
| 12181 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12182 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12183 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12184 | obj.xid = reader.read("!L")[0] |
| 12185 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12186 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12187 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12188 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12189 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12190 | reader.skip(4) |
| 12191 | return obj |
| 12192 | |
| 12193 | def __eq__(self, other): |
| 12194 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12195 | if self.xid != other.xid: return False |
| 12196 | if self.flags != other.flags: return False |
| 12197 | if self.group_id != other.group_id: return False |
| 12198 | return True |
| 12199 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12200 | def pretty_print(self, q): |
| 12201 | q.text("group_stats_request {") |
| 12202 | with q.group(): |
| 12203 | with q.indent(2): |
| 12204 | q.breakable() |
| 12205 | q.text("xid = "); |
| 12206 | if self.xid != None: |
| 12207 | q.text("%#x" % self.xid) |
| 12208 | else: |
| 12209 | q.text('None') |
| 12210 | q.text(","); q.breakable() |
| 12211 | q.text("flags = "); |
| 12212 | q.text("%#x" % self.flags) |
| 12213 | q.text(","); q.breakable() |
| 12214 | q.text("group_id = "); |
| 12215 | q.text("%#x" % self.group_id) |
| 12216 | q.breakable() |
| 12217 | q.text('}') |
| 12218 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12219 | stats_request.subtypes[6] = group_stats_request |
| 12220 | |
| 12221 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12222 | version = 4 |
| 12223 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12224 | |
| 12225 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12226 | if xid != None: |
| 12227 | self.xid = xid |
| 12228 | else: |
| 12229 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12230 | if elements != None: |
| 12231 | self.elements = elements |
| 12232 | else: |
| 12233 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12234 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12235 | |
| 12236 | def pack(self): |
| 12237 | packed = [] |
| 12238 | packed.append(struct.pack("!B", self.version)) |
| 12239 | packed.append(struct.pack("!B", self.type)) |
| 12240 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12241 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12242 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12243 | length = sum([len(x) for x in packed]) |
| 12244 | packed[2] = struct.pack("!H", length) |
| 12245 | return ''.join(packed) |
| 12246 | |
| 12247 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12248 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12249 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12250 | _version = reader.read("!B")[0] |
| 12251 | assert(_version == 4) |
| 12252 | _type = reader.read("!B")[0] |
| 12253 | assert(_type == 0) |
| 12254 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12255 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12256 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12257 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12258 | obj.elements = loxi.generic_util.unpack_list(reader, ofp.common.hello_elem.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12259 | return obj |
| 12260 | |
| 12261 | def __eq__(self, other): |
| 12262 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12263 | if self.xid != other.xid: return False |
| 12264 | if self.elements != other.elements: return False |
| 12265 | return True |
| 12266 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12267 | def pretty_print(self, q): |
| 12268 | q.text("hello {") |
| 12269 | with q.group(): |
| 12270 | with q.indent(2): |
| 12271 | q.breakable() |
| 12272 | q.text("xid = "); |
| 12273 | if self.xid != None: |
| 12274 | q.text("%#x" % self.xid) |
| 12275 | else: |
| 12276 | q.text('None') |
| 12277 | q.text(","); q.breakable() |
| 12278 | q.text("elements = "); |
| 12279 | q.pp(self.elements) |
| 12280 | q.breakable() |
| 12281 | q.text('}') |
| 12282 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12283 | message.subtypes[0] = hello |
| 12284 | |
| 12285 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12286 | version = 4 |
| 12287 | type = 1 |
| 12288 | err_type = 0 |
| 12289 | |
| 12290 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12291 | if xid != None: |
| 12292 | self.xid = xid |
| 12293 | else: |
| 12294 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12295 | if code != None: |
| 12296 | self.code = code |
| 12297 | else: |
| 12298 | self.code = 0 |
| 12299 | if data != None: |
| 12300 | self.data = data |
| 12301 | else: |
| 12302 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12303 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12304 | |
| 12305 | def pack(self): |
| 12306 | packed = [] |
| 12307 | packed.append(struct.pack("!B", self.version)) |
| 12308 | packed.append(struct.pack("!B", self.type)) |
| 12309 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12310 | packed.append(struct.pack("!L", self.xid)) |
| 12311 | packed.append(struct.pack("!H", self.err_type)) |
| 12312 | packed.append(struct.pack("!H", self.code)) |
| 12313 | packed.append(self.data) |
| 12314 | length = sum([len(x) for x in packed]) |
| 12315 | packed[2] = struct.pack("!H", length) |
| 12316 | return ''.join(packed) |
| 12317 | |
| 12318 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12319 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12320 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12321 | _version = reader.read("!B")[0] |
| 12322 | assert(_version == 4) |
| 12323 | _type = reader.read("!B")[0] |
| 12324 | assert(_type == 1) |
| 12325 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12326 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12327 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12328 | obj.xid = reader.read("!L")[0] |
| 12329 | _err_type = reader.read("!H")[0] |
| 12330 | assert(_err_type == 0) |
| 12331 | obj.code = reader.read("!H")[0] |
| 12332 | obj.data = str(reader.read_all()) |
| 12333 | return obj |
| 12334 | |
| 12335 | def __eq__(self, other): |
| 12336 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12337 | if self.xid != other.xid: return False |
| 12338 | if self.code != other.code: return False |
| 12339 | if self.data != other.data: return False |
| 12340 | return True |
| 12341 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12342 | def pretty_print(self, q): |
| 12343 | q.text("hello_failed_error_msg {") |
| 12344 | with q.group(): |
| 12345 | with q.indent(2): |
| 12346 | q.breakable() |
| 12347 | q.text("xid = "); |
| 12348 | if self.xid != None: |
| 12349 | q.text("%#x" % self.xid) |
| 12350 | else: |
| 12351 | q.text('None') |
| 12352 | q.text(","); q.breakable() |
| 12353 | q.text("code = "); |
| 12354 | q.text("%#x" % self.code) |
| 12355 | q.text(","); q.breakable() |
| 12356 | q.text("data = "); |
| 12357 | q.pp(self.data) |
| 12358 | q.breakable() |
| 12359 | q.text('}') |
| 12360 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12361 | error_msg.subtypes[0] = hello_failed_error_msg |
| 12362 | |
| 12363 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12364 | version = 4 |
| 12365 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12366 | stats_type = 10 |
| 12367 | |
| 12368 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12369 | if xid != None: |
| 12370 | self.xid = xid |
| 12371 | else: |
| 12372 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12373 | if flags != None: |
| 12374 | self.flags = flags |
| 12375 | else: |
| 12376 | self.flags = 0 |
| 12377 | if entries != None: |
| 12378 | self.entries = entries |
| 12379 | else: |
| 12380 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12381 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12382 | |
| 12383 | def pack(self): |
| 12384 | packed = [] |
| 12385 | packed.append(struct.pack("!B", self.version)) |
| 12386 | packed.append(struct.pack("!B", self.type)) |
| 12387 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12388 | packed.append(struct.pack("!L", self.xid)) |
| 12389 | packed.append(struct.pack("!H", self.stats_type)) |
| 12390 | packed.append(struct.pack("!H", self.flags)) |
| 12391 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12392 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12393 | length = sum([len(x) for x in packed]) |
| 12394 | packed[2] = struct.pack("!H", length) |
| 12395 | return ''.join(packed) |
| 12396 | |
| 12397 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12398 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12399 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12400 | _version = reader.read("!B")[0] |
| 12401 | assert(_version == 4) |
| 12402 | _type = reader.read("!B")[0] |
| 12403 | assert(_type == 19) |
| 12404 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12405 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12406 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12407 | obj.xid = reader.read("!L")[0] |
| 12408 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12409 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12410 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12411 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12412 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12413 | return obj |
| 12414 | |
| 12415 | def __eq__(self, other): |
| 12416 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12417 | if self.xid != other.xid: return False |
| 12418 | if self.flags != other.flags: return False |
| 12419 | if self.entries != other.entries: return False |
| 12420 | return True |
| 12421 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12422 | def pretty_print(self, q): |
| 12423 | q.text("meter_config_stats_reply {") |
| 12424 | with q.group(): |
| 12425 | with q.indent(2): |
| 12426 | q.breakable() |
| 12427 | q.text("xid = "); |
| 12428 | if self.xid != None: |
| 12429 | q.text("%#x" % self.xid) |
| 12430 | else: |
| 12431 | q.text('None') |
| 12432 | q.text(","); q.breakable() |
| 12433 | q.text("flags = "); |
| 12434 | q.text("%#x" % self.flags) |
| 12435 | q.text(","); q.breakable() |
| 12436 | q.text("entries = "); |
| 12437 | q.pp(self.entries) |
| 12438 | q.breakable() |
| 12439 | q.text('}') |
| 12440 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12441 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 12442 | |
| 12443 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12444 | version = 4 |
| 12445 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12446 | stats_type = 10 |
| 12447 | |
| 12448 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12449 | if xid != None: |
| 12450 | self.xid = xid |
| 12451 | else: |
| 12452 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12453 | if flags != None: |
| 12454 | self.flags = flags |
| 12455 | else: |
| 12456 | self.flags = 0 |
| 12457 | if meter_id != None: |
| 12458 | self.meter_id = meter_id |
| 12459 | else: |
| 12460 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12461 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12462 | |
| 12463 | def pack(self): |
| 12464 | packed = [] |
| 12465 | packed.append(struct.pack("!B", self.version)) |
| 12466 | packed.append(struct.pack("!B", self.type)) |
| 12467 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12468 | packed.append(struct.pack("!L", self.xid)) |
| 12469 | packed.append(struct.pack("!H", self.stats_type)) |
| 12470 | packed.append(struct.pack("!H", self.flags)) |
| 12471 | packed.append('\x00' * 4) |
| 12472 | packed.append(struct.pack("!L", self.meter_id)) |
| 12473 | packed.append('\x00' * 4) |
| 12474 | length = sum([len(x) for x in packed]) |
| 12475 | packed[2] = struct.pack("!H", length) |
| 12476 | return ''.join(packed) |
| 12477 | |
| 12478 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12479 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12480 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12481 | _version = reader.read("!B")[0] |
| 12482 | assert(_version == 4) |
| 12483 | _type = reader.read("!B")[0] |
| 12484 | assert(_type == 18) |
| 12485 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12486 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12487 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12488 | obj.xid = reader.read("!L")[0] |
| 12489 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12490 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12491 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12492 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12493 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12494 | reader.skip(4) |
| 12495 | return obj |
| 12496 | |
| 12497 | def __eq__(self, other): |
| 12498 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12499 | if self.xid != other.xid: return False |
| 12500 | if self.flags != other.flags: return False |
| 12501 | if self.meter_id != other.meter_id: return False |
| 12502 | return True |
| 12503 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12504 | def pretty_print(self, q): |
| 12505 | q.text("meter_config_stats_request {") |
| 12506 | with q.group(): |
| 12507 | with q.indent(2): |
| 12508 | q.breakable() |
| 12509 | q.text("xid = "); |
| 12510 | if self.xid != None: |
| 12511 | q.text("%#x" % self.xid) |
| 12512 | else: |
| 12513 | q.text('None') |
| 12514 | q.text(","); q.breakable() |
| 12515 | q.text("flags = "); |
| 12516 | q.text("%#x" % self.flags) |
| 12517 | q.text(","); q.breakable() |
| 12518 | q.text("meter_id = "); |
| 12519 | q.text("%#x" % self.meter_id) |
| 12520 | q.breakable() |
| 12521 | q.text('}') |
| 12522 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12523 | stats_request.subtypes[10] = meter_config_stats_request |
| 12524 | |
| 12525 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12526 | version = 4 |
| 12527 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12528 | stats_type = 11 |
| 12529 | |
| 12530 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12531 | if xid != None: |
| 12532 | self.xid = xid |
| 12533 | else: |
| 12534 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12535 | if flags != None: |
| 12536 | self.flags = flags |
| 12537 | else: |
| 12538 | self.flags = 0 |
| 12539 | if features != None: |
| 12540 | self.features = features |
| 12541 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12542 | self.features = ofp.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12543 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12544 | |
| 12545 | def pack(self): |
| 12546 | packed = [] |
| 12547 | packed.append(struct.pack("!B", self.version)) |
| 12548 | packed.append(struct.pack("!B", self.type)) |
| 12549 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12550 | packed.append(struct.pack("!L", self.xid)) |
| 12551 | packed.append(struct.pack("!H", self.stats_type)) |
| 12552 | packed.append(struct.pack("!H", self.flags)) |
| 12553 | packed.append('\x00' * 4) |
| 12554 | packed.append(self.features.pack()) |
| 12555 | length = sum([len(x) for x in packed]) |
| 12556 | packed[2] = struct.pack("!H", length) |
| 12557 | return ''.join(packed) |
| 12558 | |
| 12559 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12560 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12561 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12562 | _version = reader.read("!B")[0] |
| 12563 | assert(_version == 4) |
| 12564 | _type = reader.read("!B")[0] |
| 12565 | assert(_type == 19) |
| 12566 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12567 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12568 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12569 | obj.xid = reader.read("!L")[0] |
| 12570 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12571 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12572 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12573 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12574 | obj.features = ofp.meter_features.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12575 | return obj |
| 12576 | |
| 12577 | def __eq__(self, other): |
| 12578 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12579 | if self.xid != other.xid: return False |
| 12580 | if self.flags != other.flags: return False |
| 12581 | if self.features != other.features: return False |
| 12582 | return True |
| 12583 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12584 | def pretty_print(self, q): |
| 12585 | q.text("meter_features_stats_reply {") |
| 12586 | with q.group(): |
| 12587 | with q.indent(2): |
| 12588 | q.breakable() |
| 12589 | q.text("xid = "); |
| 12590 | if self.xid != None: |
| 12591 | q.text("%#x" % self.xid) |
| 12592 | else: |
| 12593 | q.text('None') |
| 12594 | q.text(","); q.breakable() |
| 12595 | q.text("flags = "); |
| 12596 | q.text("%#x" % self.flags) |
| 12597 | q.text(","); q.breakable() |
| 12598 | q.text("features = "); |
| 12599 | q.pp(self.features) |
| 12600 | q.breakable() |
| 12601 | q.text('}') |
| 12602 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12603 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 12604 | |
| 12605 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12606 | version = 4 |
| 12607 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12608 | stats_type = 11 |
| 12609 | |
| 12610 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12611 | if xid != None: |
| 12612 | self.xid = xid |
| 12613 | else: |
| 12614 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12615 | if flags != None: |
| 12616 | self.flags = flags |
| 12617 | else: |
| 12618 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12619 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12620 | |
| 12621 | def pack(self): |
| 12622 | packed = [] |
| 12623 | packed.append(struct.pack("!B", self.version)) |
| 12624 | packed.append(struct.pack("!B", self.type)) |
| 12625 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12626 | packed.append(struct.pack("!L", self.xid)) |
| 12627 | packed.append(struct.pack("!H", self.stats_type)) |
| 12628 | packed.append(struct.pack("!H", self.flags)) |
| 12629 | packed.append('\x00' * 4) |
| 12630 | length = sum([len(x) for x in packed]) |
| 12631 | packed[2] = struct.pack("!H", length) |
| 12632 | return ''.join(packed) |
| 12633 | |
| 12634 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12635 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12636 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12637 | _version = reader.read("!B")[0] |
| 12638 | assert(_version == 4) |
| 12639 | _type = reader.read("!B")[0] |
| 12640 | assert(_type == 18) |
| 12641 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12642 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12643 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12644 | obj.xid = reader.read("!L")[0] |
| 12645 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12646 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12647 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12648 | reader.skip(4) |
| 12649 | return obj |
| 12650 | |
| 12651 | def __eq__(self, other): |
| 12652 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12653 | if self.xid != other.xid: return False |
| 12654 | if self.flags != other.flags: return False |
| 12655 | return True |
| 12656 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12657 | def pretty_print(self, q): |
| 12658 | q.text("meter_features_stats_request {") |
| 12659 | with q.group(): |
| 12660 | with q.indent(2): |
| 12661 | q.breakable() |
| 12662 | q.text("xid = "); |
| 12663 | if self.xid != None: |
| 12664 | q.text("%#x" % self.xid) |
| 12665 | else: |
| 12666 | q.text('None') |
| 12667 | q.text(","); q.breakable() |
| 12668 | q.text("flags = "); |
| 12669 | q.text("%#x" % self.flags) |
| 12670 | q.breakable() |
| 12671 | q.text('}') |
| 12672 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12673 | stats_request.subtypes[11] = meter_features_stats_request |
| 12674 | |
| 12675 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12676 | version = 4 |
| 12677 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12678 | |
| 12679 | def __init__(self, xid=None, command=None, flags=None, meter_id=None, meters=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12680 | if xid != None: |
| 12681 | self.xid = xid |
| 12682 | else: |
| 12683 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12684 | if command != None: |
| 12685 | self.command = command |
| 12686 | else: |
| 12687 | self.command = 0 |
| 12688 | if flags != None: |
| 12689 | self.flags = flags |
| 12690 | else: |
| 12691 | self.flags = 0 |
| 12692 | if meter_id != None: |
| 12693 | self.meter_id = meter_id |
| 12694 | else: |
| 12695 | self.meter_id = 0 |
| 12696 | if meters != None: |
| 12697 | self.meters = meters |
| 12698 | else: |
| 12699 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12700 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12701 | |
| 12702 | def pack(self): |
| 12703 | packed = [] |
| 12704 | packed.append(struct.pack("!B", self.version)) |
| 12705 | packed.append(struct.pack("!B", self.type)) |
| 12706 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12707 | packed.append(struct.pack("!L", self.xid)) |
| 12708 | packed.append(struct.pack("!H", self.command)) |
| 12709 | packed.append(struct.pack("!H", self.flags)) |
| 12710 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12711 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12712 | length = sum([len(x) for x in packed]) |
| 12713 | packed[2] = struct.pack("!H", length) |
| 12714 | return ''.join(packed) |
| 12715 | |
| 12716 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12717 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12718 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12719 | _version = reader.read("!B")[0] |
| 12720 | assert(_version == 4) |
| 12721 | _type = reader.read("!B")[0] |
| 12722 | assert(_type == 29) |
| 12723 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12724 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12725 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12726 | obj.xid = reader.read("!L")[0] |
| 12727 | obj.command = reader.read("!H")[0] |
| 12728 | obj.flags = reader.read("!H")[0] |
| 12729 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12730 | obj.meters = loxi.generic_util.unpack_list(reader, ofp.meter_band.meter_band.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12731 | return obj |
| 12732 | |
| 12733 | def __eq__(self, other): |
| 12734 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12735 | if self.xid != other.xid: return False |
| 12736 | if self.command != other.command: return False |
| 12737 | if self.flags != other.flags: return False |
| 12738 | if self.meter_id != other.meter_id: return False |
| 12739 | if self.meters != other.meters: return False |
| 12740 | return True |
| 12741 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12742 | def pretty_print(self, q): |
| 12743 | q.text("meter_mod {") |
| 12744 | with q.group(): |
| 12745 | with q.indent(2): |
| 12746 | q.breakable() |
| 12747 | q.text("xid = "); |
| 12748 | if self.xid != None: |
| 12749 | q.text("%#x" % self.xid) |
| 12750 | else: |
| 12751 | q.text('None') |
| 12752 | q.text(","); q.breakable() |
| 12753 | q.text("command = "); |
| 12754 | q.text("%#x" % self.command) |
| 12755 | q.text(","); q.breakable() |
| 12756 | q.text("flags = "); |
| 12757 | q.text("%#x" % self.flags) |
| 12758 | q.text(","); q.breakable() |
| 12759 | q.text("meter_id = "); |
| 12760 | q.text("%#x" % self.meter_id) |
| 12761 | q.text(","); q.breakable() |
| 12762 | q.text("meters = "); |
| 12763 | q.pp(self.meters) |
| 12764 | q.breakable() |
| 12765 | q.text('}') |
| 12766 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12767 | message.subtypes[29] = meter_mod |
| 12768 | |
| 12769 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12770 | version = 4 |
| 12771 | type = 1 |
| 12772 | err_type = 12 |
| 12773 | |
| 12774 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12775 | if xid != None: |
| 12776 | self.xid = xid |
| 12777 | else: |
| 12778 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12779 | if code != None: |
| 12780 | self.code = code |
| 12781 | else: |
| 12782 | self.code = 0 |
| 12783 | if data != None: |
| 12784 | self.data = data |
| 12785 | else: |
| 12786 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12787 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12788 | |
| 12789 | def pack(self): |
| 12790 | packed = [] |
| 12791 | packed.append(struct.pack("!B", self.version)) |
| 12792 | packed.append(struct.pack("!B", self.type)) |
| 12793 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12794 | packed.append(struct.pack("!L", self.xid)) |
| 12795 | packed.append(struct.pack("!H", self.err_type)) |
| 12796 | packed.append(struct.pack("!H", self.code)) |
| 12797 | packed.append(self.data) |
| 12798 | length = sum([len(x) for x in packed]) |
| 12799 | packed[2] = struct.pack("!H", length) |
| 12800 | return ''.join(packed) |
| 12801 | |
| 12802 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12803 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12804 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12805 | _version = reader.read("!B")[0] |
| 12806 | assert(_version == 4) |
| 12807 | _type = reader.read("!B")[0] |
| 12808 | assert(_type == 1) |
| 12809 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12810 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12811 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12812 | obj.xid = reader.read("!L")[0] |
| 12813 | _err_type = reader.read("!H")[0] |
| 12814 | assert(_err_type == 12) |
| 12815 | obj.code = reader.read("!H")[0] |
| 12816 | obj.data = str(reader.read_all()) |
| 12817 | return obj |
| 12818 | |
| 12819 | def __eq__(self, other): |
| 12820 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12821 | if self.xid != other.xid: return False |
| 12822 | if self.code != other.code: return False |
| 12823 | if self.data != other.data: return False |
| 12824 | return True |
| 12825 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12826 | def pretty_print(self, q): |
| 12827 | q.text("meter_mod_failed_error_msg {") |
| 12828 | with q.group(): |
| 12829 | with q.indent(2): |
| 12830 | q.breakable() |
| 12831 | q.text("xid = "); |
| 12832 | if self.xid != None: |
| 12833 | q.text("%#x" % self.xid) |
| 12834 | else: |
| 12835 | q.text('None') |
| 12836 | q.text(","); q.breakable() |
| 12837 | q.text("code = "); |
| 12838 | q.text("%#x" % self.code) |
| 12839 | q.text(","); q.breakable() |
| 12840 | q.text("data = "); |
| 12841 | q.pp(self.data) |
| 12842 | q.breakable() |
| 12843 | q.text('}') |
| 12844 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12845 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12846 | |
| 12847 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12848 | version = 4 |
| 12849 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12850 | stats_type = 9 |
| 12851 | |
| 12852 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12853 | if xid != None: |
| 12854 | self.xid = xid |
| 12855 | else: |
| 12856 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12857 | if flags != None: |
| 12858 | self.flags = flags |
| 12859 | else: |
| 12860 | self.flags = 0 |
| 12861 | if entries != None: |
| 12862 | self.entries = entries |
| 12863 | else: |
| 12864 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12865 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12866 | |
| 12867 | def pack(self): |
| 12868 | packed = [] |
| 12869 | packed.append(struct.pack("!B", self.version)) |
| 12870 | packed.append(struct.pack("!B", self.type)) |
| 12871 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12872 | packed.append(struct.pack("!L", self.xid)) |
| 12873 | packed.append(struct.pack("!H", self.stats_type)) |
| 12874 | packed.append(struct.pack("!H", self.flags)) |
| 12875 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12876 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12877 | length = sum([len(x) for x in packed]) |
| 12878 | packed[2] = struct.pack("!H", length) |
| 12879 | return ''.join(packed) |
| 12880 | |
| 12881 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12882 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12883 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12884 | _version = reader.read("!B")[0] |
| 12885 | assert(_version == 4) |
| 12886 | _type = reader.read("!B")[0] |
| 12887 | assert(_type == 19) |
| 12888 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12889 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12890 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12891 | obj.xid = reader.read("!L")[0] |
| 12892 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12893 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12894 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12895 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 12896 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.meter_stats.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12897 | return obj |
| 12898 | |
| 12899 | def __eq__(self, other): |
| 12900 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12901 | if self.xid != other.xid: return False |
| 12902 | if self.flags != other.flags: return False |
| 12903 | if self.entries != other.entries: return False |
| 12904 | return True |
| 12905 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12906 | def pretty_print(self, q): |
| 12907 | q.text("meter_stats_reply {") |
| 12908 | with q.group(): |
| 12909 | with q.indent(2): |
| 12910 | q.breakable() |
| 12911 | q.text("xid = "); |
| 12912 | if self.xid != None: |
| 12913 | q.text("%#x" % self.xid) |
| 12914 | else: |
| 12915 | q.text('None') |
| 12916 | q.text(","); q.breakable() |
| 12917 | q.text("flags = "); |
| 12918 | q.text("%#x" % self.flags) |
| 12919 | q.text(","); q.breakable() |
| 12920 | q.text("entries = "); |
| 12921 | q.pp(self.entries) |
| 12922 | q.breakable() |
| 12923 | q.text('}') |
| 12924 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12925 | stats_reply.subtypes[9] = meter_stats_reply |
| 12926 | |
| 12927 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12928 | version = 4 |
| 12929 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12930 | stats_type = 9 |
| 12931 | |
| 12932 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12933 | if xid != None: |
| 12934 | self.xid = xid |
| 12935 | else: |
| 12936 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12937 | if flags != None: |
| 12938 | self.flags = flags |
| 12939 | else: |
| 12940 | self.flags = 0 |
| 12941 | if meter_id != None: |
| 12942 | self.meter_id = meter_id |
| 12943 | else: |
| 12944 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12945 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12946 | |
| 12947 | def pack(self): |
| 12948 | packed = [] |
| 12949 | packed.append(struct.pack("!B", self.version)) |
| 12950 | packed.append(struct.pack("!B", self.type)) |
| 12951 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12952 | packed.append(struct.pack("!L", self.xid)) |
| 12953 | packed.append(struct.pack("!H", self.stats_type)) |
| 12954 | packed.append(struct.pack("!H", self.flags)) |
| 12955 | packed.append('\x00' * 4) |
| 12956 | packed.append(struct.pack("!L", self.meter_id)) |
| 12957 | packed.append('\x00' * 4) |
| 12958 | length = sum([len(x) for x in packed]) |
| 12959 | packed[2] = struct.pack("!H", length) |
| 12960 | return ''.join(packed) |
| 12961 | |
| 12962 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12963 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12964 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12965 | _version = reader.read("!B")[0] |
| 12966 | assert(_version == 4) |
| 12967 | _type = reader.read("!B")[0] |
| 12968 | assert(_type == 18) |
| 12969 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12970 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12971 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12972 | obj.xid = reader.read("!L")[0] |
| 12973 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12974 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12975 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12976 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12977 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12978 | reader.skip(4) |
| 12979 | return obj |
| 12980 | |
| 12981 | def __eq__(self, other): |
| 12982 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12983 | if self.xid != other.xid: return False |
| 12984 | if self.flags != other.flags: return False |
| 12985 | if self.meter_id != other.meter_id: return False |
| 12986 | return True |
| 12987 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12988 | def pretty_print(self, q): |
| 12989 | q.text("meter_stats_request {") |
| 12990 | with q.group(): |
| 12991 | with q.indent(2): |
| 12992 | q.breakable() |
| 12993 | q.text("xid = "); |
| 12994 | if self.xid != None: |
| 12995 | q.text("%#x" % self.xid) |
| 12996 | else: |
| 12997 | q.text('None') |
| 12998 | q.text(","); q.breakable() |
| 12999 | q.text("flags = "); |
| 13000 | q.text("%#x" % self.flags) |
| 13001 | q.text(","); q.breakable() |
| 13002 | q.text("meter_id = "); |
| 13003 | q.text("%#x" % self.meter_id) |
| 13004 | q.breakable() |
| 13005 | q.text('}') |
| 13006 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13007 | stats_request.subtypes[9] = meter_stats_request |
| 13008 | |
| 13009 | class nicira_header(experimenter): |
| 13010 | subtypes = {} |
| 13011 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13012 | version = 4 |
| 13013 | type = 4 |
| 13014 | experimenter = 8992 |
| 13015 | |
| 13016 | def __init__(self, xid=None, subtype=None): |
| 13017 | if xid != None: |
| 13018 | self.xid = xid |
| 13019 | else: |
| 13020 | self.xid = None |
| 13021 | if subtype != None: |
| 13022 | self.subtype = subtype |
| 13023 | else: |
| 13024 | self.subtype = 0 |
| 13025 | return |
| 13026 | |
| 13027 | def pack(self): |
| 13028 | packed = [] |
| 13029 | packed.append(struct.pack("!B", self.version)) |
| 13030 | packed.append(struct.pack("!B", self.type)) |
| 13031 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13032 | packed.append(struct.pack("!L", self.xid)) |
| 13033 | packed.append(struct.pack("!L", self.experimenter)) |
| 13034 | packed.append(struct.pack("!L", self.subtype)) |
| 13035 | length = sum([len(x) for x in packed]) |
| 13036 | packed[2] = struct.pack("!H", length) |
| 13037 | return ''.join(packed) |
| 13038 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13039 | @staticmethod |
| 13040 | def unpack(reader): |
| 13041 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13042 | subclass = nicira_header.subtypes.get(subtype) |
| 13043 | if subclass: |
| 13044 | return subclass.unpack(reader) |
| 13045 | |
| 13046 | obj = nicira_header() |
| 13047 | _version = reader.read("!B")[0] |
| 13048 | assert(_version == 4) |
| 13049 | _type = reader.read("!B")[0] |
| 13050 | assert(_type == 4) |
| 13051 | _length = reader.read("!H")[0] |
| 13052 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13053 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13054 | obj.xid = reader.read("!L")[0] |
| 13055 | _experimenter = reader.read("!L")[0] |
| 13056 | assert(_experimenter == 8992) |
| 13057 | obj.subtype = reader.read("!L")[0] |
| 13058 | return obj |
| 13059 | |
| 13060 | def __eq__(self, other): |
| 13061 | if type(self) != type(other): return False |
| 13062 | if self.xid != other.xid: return False |
| 13063 | if self.subtype != other.subtype: return False |
| 13064 | return True |
| 13065 | |
| 13066 | def pretty_print(self, q): |
| 13067 | q.text("nicira_header {") |
| 13068 | with q.group(): |
| 13069 | with q.indent(2): |
| 13070 | q.breakable() |
| 13071 | q.text("xid = "); |
| 13072 | if self.xid != None: |
| 13073 | q.text("%#x" % self.xid) |
| 13074 | else: |
| 13075 | q.text('None') |
| 13076 | q.breakable() |
| 13077 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13078 | |
| 13079 | experimenter.subtypes[8992] = nicira_header |
| 13080 | |
| 13081 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13082 | version = 4 |
| 13083 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13084 | |
| 13085 | def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13086 | if xid != None: |
| 13087 | self.xid = xid |
| 13088 | else: |
| 13089 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13090 | if buffer_id != None: |
| 13091 | self.buffer_id = buffer_id |
| 13092 | else: |
| 13093 | self.buffer_id = 0 |
| 13094 | if total_len != None: |
| 13095 | self.total_len = total_len |
| 13096 | else: |
| 13097 | self.total_len = 0 |
| 13098 | if reason != None: |
| 13099 | self.reason = reason |
| 13100 | else: |
| 13101 | self.reason = 0 |
| 13102 | if table_id != None: |
| 13103 | self.table_id = table_id |
| 13104 | else: |
| 13105 | self.table_id = 0 |
| 13106 | if cookie != None: |
| 13107 | self.cookie = cookie |
| 13108 | else: |
| 13109 | self.cookie = 0 |
| 13110 | if match != None: |
| 13111 | self.match = match |
| 13112 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13113 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13114 | if data != None: |
| 13115 | self.data = data |
| 13116 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13117 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13118 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13119 | |
| 13120 | def pack(self): |
| 13121 | packed = [] |
| 13122 | packed.append(struct.pack("!B", self.version)) |
| 13123 | packed.append(struct.pack("!B", self.type)) |
| 13124 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13125 | packed.append(struct.pack("!L", self.xid)) |
| 13126 | packed.append(struct.pack("!L", self.buffer_id)) |
| 13127 | packed.append(struct.pack("!H", self.total_len)) |
| 13128 | packed.append(struct.pack("!B", self.reason)) |
| 13129 | packed.append(struct.pack("!B", self.table_id)) |
| 13130 | packed.append(struct.pack("!Q", self.cookie)) |
| 13131 | packed.append(self.match.pack()) |
| 13132 | packed.append('\x00' * 2) |
| 13133 | packed.append(self.data) |
| 13134 | length = sum([len(x) for x in packed]) |
| 13135 | packed[2] = struct.pack("!H", length) |
| 13136 | return ''.join(packed) |
| 13137 | |
| 13138 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13139 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13140 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13141 | _version = reader.read("!B")[0] |
| 13142 | assert(_version == 4) |
| 13143 | _type = reader.read("!B")[0] |
| 13144 | assert(_type == 10) |
| 13145 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13146 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13147 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13148 | obj.xid = reader.read("!L")[0] |
| 13149 | obj.buffer_id = reader.read("!L")[0] |
| 13150 | obj.total_len = reader.read("!H")[0] |
| 13151 | obj.reason = reader.read("!B")[0] |
| 13152 | obj.table_id = reader.read("!B")[0] |
| 13153 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13154 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13155 | reader.skip(2) |
| 13156 | obj.data = str(reader.read_all()) |
| 13157 | return obj |
| 13158 | |
| 13159 | def __eq__(self, other): |
| 13160 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13161 | if self.xid != other.xid: return False |
| 13162 | if self.buffer_id != other.buffer_id: return False |
| 13163 | if self.total_len != other.total_len: return False |
| 13164 | if self.reason != other.reason: return False |
| 13165 | if self.table_id != other.table_id: return False |
| 13166 | if self.cookie != other.cookie: return False |
| 13167 | if self.match != other.match: return False |
| 13168 | if self.data != other.data: return False |
| 13169 | return True |
| 13170 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13171 | def pretty_print(self, q): |
| 13172 | q.text("packet_in {") |
| 13173 | with q.group(): |
| 13174 | with q.indent(2): |
| 13175 | q.breakable() |
| 13176 | q.text("xid = "); |
| 13177 | if self.xid != None: |
| 13178 | q.text("%#x" % self.xid) |
| 13179 | else: |
| 13180 | q.text('None') |
| 13181 | q.text(","); q.breakable() |
| 13182 | q.text("buffer_id = "); |
| 13183 | q.text("%#x" % self.buffer_id) |
| 13184 | q.text(","); q.breakable() |
| 13185 | q.text("total_len = "); |
| 13186 | q.text("%#x" % self.total_len) |
| 13187 | q.text(","); q.breakable() |
| 13188 | q.text("reason = "); |
| 13189 | q.text("%#x" % self.reason) |
| 13190 | q.text(","); q.breakable() |
| 13191 | q.text("table_id = "); |
| 13192 | q.text("%#x" % self.table_id) |
| 13193 | q.text(","); q.breakable() |
| 13194 | q.text("cookie = "); |
| 13195 | q.text("%#x" % self.cookie) |
| 13196 | q.text(","); q.breakable() |
| 13197 | q.text("match = "); |
| 13198 | q.pp(self.match) |
| 13199 | q.text(","); q.breakable() |
| 13200 | q.text("data = "); |
| 13201 | q.pp(self.data) |
| 13202 | q.breakable() |
| 13203 | q.text('}') |
| 13204 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13205 | message.subtypes[10] = packet_in |
| 13206 | |
| 13207 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13208 | version = 4 |
| 13209 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13210 | |
| 13211 | 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] | 13212 | if xid != None: |
| 13213 | self.xid = xid |
| 13214 | else: |
| 13215 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13216 | if buffer_id != None: |
| 13217 | self.buffer_id = buffer_id |
| 13218 | else: |
| 13219 | self.buffer_id = 0 |
| 13220 | if in_port != None: |
| 13221 | self.in_port = in_port |
| 13222 | else: |
| 13223 | self.in_port = 0 |
| 13224 | if actions != None: |
| 13225 | self.actions = actions |
| 13226 | else: |
| 13227 | self.actions = [] |
| 13228 | if data != None: |
| 13229 | self.data = data |
| 13230 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13231 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13232 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13233 | |
| 13234 | def pack(self): |
| 13235 | packed = [] |
| 13236 | packed.append(struct.pack("!B", self.version)) |
| 13237 | packed.append(struct.pack("!B", self.type)) |
| 13238 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13239 | packed.append(struct.pack("!L", self.xid)) |
| 13240 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13241 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13242 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 13243 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13244 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13245 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 13246 | packed.append(self.data) |
| 13247 | length = sum([len(x) for x in packed]) |
| 13248 | packed[2] = struct.pack("!H", length) |
| 13249 | return ''.join(packed) |
| 13250 | |
| 13251 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13252 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13253 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13254 | _version = reader.read("!B")[0] |
| 13255 | assert(_version == 4) |
| 13256 | _type = reader.read("!B")[0] |
| 13257 | assert(_type == 13) |
| 13258 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13259 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13260 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13261 | obj.xid = reader.read("!L")[0] |
| 13262 | obj.buffer_id = reader.read("!L")[0] |
| 13263 | obj.in_port = util.unpack_port_no(reader) |
| 13264 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13265 | reader.skip(6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13266 | 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] | 13267 | obj.data = str(reader.read_all()) |
| 13268 | return obj |
| 13269 | |
| 13270 | def __eq__(self, other): |
| 13271 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13272 | if self.xid != other.xid: return False |
| 13273 | if self.buffer_id != other.buffer_id: return False |
| 13274 | if self.in_port != other.in_port: return False |
| 13275 | if self.actions != other.actions: return False |
| 13276 | if self.data != other.data: return False |
| 13277 | return True |
| 13278 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13279 | def pretty_print(self, q): |
| 13280 | q.text("packet_out {") |
| 13281 | with q.group(): |
| 13282 | with q.indent(2): |
| 13283 | q.breakable() |
| 13284 | q.text("xid = "); |
| 13285 | if self.xid != None: |
| 13286 | q.text("%#x" % self.xid) |
| 13287 | else: |
| 13288 | q.text('None') |
| 13289 | q.text(","); q.breakable() |
| 13290 | q.text("buffer_id = "); |
| 13291 | q.text("%#x" % self.buffer_id) |
| 13292 | q.text(","); q.breakable() |
| 13293 | q.text("in_port = "); |
| 13294 | q.text(util.pretty_port(self.in_port)) |
| 13295 | q.text(","); q.breakable() |
| 13296 | q.text("actions = "); |
| 13297 | q.pp(self.actions) |
| 13298 | q.text(","); q.breakable() |
| 13299 | q.text("data = "); |
| 13300 | q.pp(self.data) |
| 13301 | q.breakable() |
| 13302 | q.text('}') |
| 13303 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13304 | message.subtypes[13] = packet_out |
| 13305 | |
| 13306 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13307 | version = 4 |
| 13308 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13309 | stats_type = 13 |
| 13310 | |
| 13311 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13312 | if xid != None: |
| 13313 | self.xid = xid |
| 13314 | else: |
| 13315 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13316 | if flags != None: |
| 13317 | self.flags = flags |
| 13318 | else: |
| 13319 | self.flags = 0 |
| 13320 | if entries != None: |
| 13321 | self.entries = entries |
| 13322 | else: |
| 13323 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13324 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13325 | |
| 13326 | def pack(self): |
| 13327 | packed = [] |
| 13328 | packed.append(struct.pack("!B", self.version)) |
| 13329 | packed.append(struct.pack("!B", self.type)) |
| 13330 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13331 | packed.append(struct.pack("!L", self.xid)) |
| 13332 | packed.append(struct.pack("!H", self.stats_type)) |
| 13333 | packed.append(struct.pack("!H", self.flags)) |
| 13334 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13335 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13336 | length = sum([len(x) for x in packed]) |
| 13337 | packed[2] = struct.pack("!H", length) |
| 13338 | return ''.join(packed) |
| 13339 | |
| 13340 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13341 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13342 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13343 | _version = reader.read("!B")[0] |
| 13344 | assert(_version == 4) |
| 13345 | _type = reader.read("!B")[0] |
| 13346 | assert(_type == 19) |
| 13347 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13348 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13349 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13350 | obj.xid = reader.read("!L")[0] |
| 13351 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13352 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13353 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13354 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13355 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13356 | return obj |
| 13357 | |
| 13358 | def __eq__(self, other): |
| 13359 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13360 | if self.xid != other.xid: return False |
| 13361 | if self.flags != other.flags: return False |
| 13362 | if self.entries != other.entries: return False |
| 13363 | return True |
| 13364 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13365 | def pretty_print(self, q): |
| 13366 | q.text("port_desc_stats_reply {") |
| 13367 | with q.group(): |
| 13368 | with q.indent(2): |
| 13369 | q.breakable() |
| 13370 | q.text("xid = "); |
| 13371 | if self.xid != None: |
| 13372 | q.text("%#x" % self.xid) |
| 13373 | else: |
| 13374 | q.text('None') |
| 13375 | q.text(","); q.breakable() |
| 13376 | q.text("flags = "); |
| 13377 | q.text("%#x" % self.flags) |
| 13378 | q.text(","); q.breakable() |
| 13379 | q.text("entries = "); |
| 13380 | q.pp(self.entries) |
| 13381 | q.breakable() |
| 13382 | q.text('}') |
| 13383 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13384 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 13385 | |
| 13386 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13387 | version = 4 |
| 13388 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13389 | stats_type = 13 |
| 13390 | |
| 13391 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13392 | if xid != None: |
| 13393 | self.xid = xid |
| 13394 | else: |
| 13395 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13396 | if flags != None: |
| 13397 | self.flags = flags |
| 13398 | else: |
| 13399 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13400 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13401 | |
| 13402 | def pack(self): |
| 13403 | packed = [] |
| 13404 | packed.append(struct.pack("!B", self.version)) |
| 13405 | packed.append(struct.pack("!B", self.type)) |
| 13406 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13407 | packed.append(struct.pack("!L", self.xid)) |
| 13408 | packed.append(struct.pack("!H", self.stats_type)) |
| 13409 | packed.append(struct.pack("!H", self.flags)) |
| 13410 | packed.append('\x00' * 4) |
| 13411 | length = sum([len(x) for x in packed]) |
| 13412 | packed[2] = struct.pack("!H", length) |
| 13413 | return ''.join(packed) |
| 13414 | |
| 13415 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13416 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13417 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13418 | _version = reader.read("!B")[0] |
| 13419 | assert(_version == 4) |
| 13420 | _type = reader.read("!B")[0] |
| 13421 | assert(_type == 18) |
| 13422 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13423 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13424 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13425 | obj.xid = reader.read("!L")[0] |
| 13426 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13427 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13428 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13429 | reader.skip(4) |
| 13430 | return obj |
| 13431 | |
| 13432 | def __eq__(self, other): |
| 13433 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13434 | if self.xid != other.xid: return False |
| 13435 | if self.flags != other.flags: return False |
| 13436 | return True |
| 13437 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13438 | def pretty_print(self, q): |
| 13439 | q.text("port_desc_stats_request {") |
| 13440 | with q.group(): |
| 13441 | with q.indent(2): |
| 13442 | q.breakable() |
| 13443 | q.text("xid = "); |
| 13444 | if self.xid != None: |
| 13445 | q.text("%#x" % self.xid) |
| 13446 | else: |
| 13447 | q.text('None') |
| 13448 | q.text(","); q.breakable() |
| 13449 | q.text("flags = "); |
| 13450 | q.text("%#x" % self.flags) |
| 13451 | q.breakable() |
| 13452 | q.text('}') |
| 13453 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13454 | stats_request.subtypes[13] = port_desc_stats_request |
| 13455 | |
| 13456 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13457 | version = 4 |
| 13458 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13459 | |
| 13460 | 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] | 13461 | if xid != None: |
| 13462 | self.xid = xid |
| 13463 | else: |
| 13464 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13465 | if port_no != None: |
| 13466 | self.port_no = port_no |
| 13467 | else: |
| 13468 | self.port_no = 0 |
| 13469 | if hw_addr != None: |
| 13470 | self.hw_addr = hw_addr |
| 13471 | else: |
| 13472 | self.hw_addr = [0,0,0,0,0,0] |
| 13473 | if config != None: |
| 13474 | self.config = config |
| 13475 | else: |
| 13476 | self.config = 0 |
| 13477 | if mask != None: |
| 13478 | self.mask = mask |
| 13479 | else: |
| 13480 | self.mask = 0 |
| 13481 | if advertise != None: |
| 13482 | self.advertise = advertise |
| 13483 | else: |
| 13484 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13485 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13486 | |
| 13487 | def pack(self): |
| 13488 | packed = [] |
| 13489 | packed.append(struct.pack("!B", self.version)) |
| 13490 | packed.append(struct.pack("!B", self.type)) |
| 13491 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13492 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13493 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13494 | packed.append('\x00' * 4) |
| 13495 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13496 | packed.append('\x00' * 2) |
| 13497 | packed.append(struct.pack("!L", self.config)) |
| 13498 | packed.append(struct.pack("!L", self.mask)) |
| 13499 | packed.append(struct.pack("!L", self.advertise)) |
| 13500 | packed.append('\x00' * 4) |
| 13501 | length = sum([len(x) for x in packed]) |
| 13502 | packed[2] = struct.pack("!H", length) |
| 13503 | return ''.join(packed) |
| 13504 | |
| 13505 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13506 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13507 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13508 | _version = reader.read("!B")[0] |
| 13509 | assert(_version == 4) |
| 13510 | _type = reader.read("!B")[0] |
| 13511 | assert(_type == 16) |
| 13512 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13513 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13514 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13515 | obj.xid = reader.read("!L")[0] |
| 13516 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13517 | reader.skip(4) |
| 13518 | obj.hw_addr = list(reader.read('!6B')) |
| 13519 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13520 | obj.config = reader.read("!L")[0] |
| 13521 | obj.mask = reader.read("!L")[0] |
| 13522 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13523 | reader.skip(4) |
| 13524 | return obj |
| 13525 | |
| 13526 | def __eq__(self, other): |
| 13527 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13528 | if self.xid != other.xid: return False |
| 13529 | if self.port_no != other.port_no: return False |
| 13530 | if self.hw_addr != other.hw_addr: return False |
| 13531 | if self.config != other.config: return False |
| 13532 | if self.mask != other.mask: return False |
| 13533 | if self.advertise != other.advertise: return False |
| 13534 | return True |
| 13535 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13536 | def pretty_print(self, q): |
| 13537 | q.text("port_mod {") |
| 13538 | with q.group(): |
| 13539 | with q.indent(2): |
| 13540 | q.breakable() |
| 13541 | q.text("xid = "); |
| 13542 | if self.xid != None: |
| 13543 | q.text("%#x" % self.xid) |
| 13544 | else: |
| 13545 | q.text('None') |
| 13546 | q.text(","); q.breakable() |
| 13547 | q.text("port_no = "); |
| 13548 | q.text(util.pretty_port(self.port_no)) |
| 13549 | q.text(","); q.breakable() |
| 13550 | q.text("hw_addr = "); |
| 13551 | q.text(util.pretty_mac(self.hw_addr)) |
| 13552 | q.text(","); q.breakable() |
| 13553 | q.text("config = "); |
| 13554 | q.text("%#x" % self.config) |
| 13555 | q.text(","); q.breakable() |
| 13556 | q.text("mask = "); |
| 13557 | q.text("%#x" % self.mask) |
| 13558 | q.text(","); q.breakable() |
| 13559 | q.text("advertise = "); |
| 13560 | q.text("%#x" % self.advertise) |
| 13561 | q.breakable() |
| 13562 | q.text('}') |
| 13563 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13564 | message.subtypes[16] = port_mod |
| 13565 | |
| 13566 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13567 | version = 4 |
| 13568 | type = 1 |
| 13569 | err_type = 7 |
| 13570 | |
| 13571 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13572 | if xid != None: |
| 13573 | self.xid = xid |
| 13574 | else: |
| 13575 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13576 | if code != None: |
| 13577 | self.code = code |
| 13578 | else: |
| 13579 | self.code = 0 |
| 13580 | if data != None: |
| 13581 | self.data = data |
| 13582 | else: |
| 13583 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13584 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13585 | |
| 13586 | def pack(self): |
| 13587 | packed = [] |
| 13588 | packed.append(struct.pack("!B", self.version)) |
| 13589 | packed.append(struct.pack("!B", self.type)) |
| 13590 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13591 | packed.append(struct.pack("!L", self.xid)) |
| 13592 | packed.append(struct.pack("!H", self.err_type)) |
| 13593 | packed.append(struct.pack("!H", self.code)) |
| 13594 | packed.append(self.data) |
| 13595 | length = sum([len(x) for x in packed]) |
| 13596 | packed[2] = struct.pack("!H", length) |
| 13597 | return ''.join(packed) |
| 13598 | |
| 13599 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13600 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13601 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13602 | _version = reader.read("!B")[0] |
| 13603 | assert(_version == 4) |
| 13604 | _type = reader.read("!B")[0] |
| 13605 | assert(_type == 1) |
| 13606 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13607 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13608 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13609 | obj.xid = reader.read("!L")[0] |
| 13610 | _err_type = reader.read("!H")[0] |
| 13611 | assert(_err_type == 7) |
| 13612 | obj.code = reader.read("!H")[0] |
| 13613 | obj.data = str(reader.read_all()) |
| 13614 | return obj |
| 13615 | |
| 13616 | def __eq__(self, other): |
| 13617 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13618 | if self.xid != other.xid: return False |
| 13619 | if self.code != other.code: return False |
| 13620 | if self.data != other.data: return False |
| 13621 | return True |
| 13622 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13623 | def pretty_print(self, q): |
| 13624 | q.text("port_mod_failed_error_msg {") |
| 13625 | with q.group(): |
| 13626 | with q.indent(2): |
| 13627 | q.breakable() |
| 13628 | q.text("xid = "); |
| 13629 | if self.xid != None: |
| 13630 | q.text("%#x" % self.xid) |
| 13631 | else: |
| 13632 | q.text('None') |
| 13633 | q.text(","); q.breakable() |
| 13634 | q.text("code = "); |
| 13635 | q.text("%#x" % self.code) |
| 13636 | q.text(","); q.breakable() |
| 13637 | q.text("data = "); |
| 13638 | q.pp(self.data) |
| 13639 | q.breakable() |
| 13640 | q.text('}') |
| 13641 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13642 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 13643 | |
| 13644 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13645 | version = 4 |
| 13646 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13647 | stats_type = 4 |
| 13648 | |
| 13649 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13650 | if xid != None: |
| 13651 | self.xid = xid |
| 13652 | else: |
| 13653 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13654 | if flags != None: |
| 13655 | self.flags = flags |
| 13656 | else: |
| 13657 | self.flags = 0 |
| 13658 | if entries != None: |
| 13659 | self.entries = entries |
| 13660 | else: |
| 13661 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13662 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13663 | |
| 13664 | def pack(self): |
| 13665 | packed = [] |
| 13666 | packed.append(struct.pack("!B", self.version)) |
| 13667 | packed.append(struct.pack("!B", self.type)) |
| 13668 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13669 | packed.append(struct.pack("!L", self.xid)) |
| 13670 | packed.append(struct.pack("!H", self.stats_type)) |
| 13671 | packed.append(struct.pack("!H", self.flags)) |
| 13672 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13673 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13674 | length = sum([len(x) for x in packed]) |
| 13675 | packed[2] = struct.pack("!H", length) |
| 13676 | return ''.join(packed) |
| 13677 | |
| 13678 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13679 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13680 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13681 | _version = reader.read("!B")[0] |
| 13682 | assert(_version == 4) |
| 13683 | _type = reader.read("!B")[0] |
| 13684 | assert(_type == 19) |
| 13685 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13686 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13687 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13688 | obj.xid = reader.read("!L")[0] |
| 13689 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13690 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13691 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13692 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13693 | 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] | 13694 | return obj |
| 13695 | |
| 13696 | def __eq__(self, other): |
| 13697 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13698 | if self.xid != other.xid: return False |
| 13699 | if self.flags != other.flags: return False |
| 13700 | if self.entries != other.entries: return False |
| 13701 | return True |
| 13702 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13703 | def pretty_print(self, q): |
| 13704 | q.text("port_stats_reply {") |
| 13705 | with q.group(): |
| 13706 | with q.indent(2): |
| 13707 | q.breakable() |
| 13708 | q.text("xid = "); |
| 13709 | if self.xid != None: |
| 13710 | q.text("%#x" % self.xid) |
| 13711 | else: |
| 13712 | q.text('None') |
| 13713 | q.text(","); q.breakable() |
| 13714 | q.text("flags = "); |
| 13715 | q.text("%#x" % self.flags) |
| 13716 | q.text(","); q.breakable() |
| 13717 | q.text("entries = "); |
| 13718 | q.pp(self.entries) |
| 13719 | q.breakable() |
| 13720 | q.text('}') |
| 13721 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13722 | stats_reply.subtypes[4] = port_stats_reply |
| 13723 | |
| 13724 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13725 | version = 4 |
| 13726 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13727 | stats_type = 4 |
| 13728 | |
| 13729 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13730 | if xid != None: |
| 13731 | self.xid = xid |
| 13732 | else: |
| 13733 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13734 | if flags != None: |
| 13735 | self.flags = flags |
| 13736 | else: |
| 13737 | self.flags = 0 |
| 13738 | if port_no != None: |
| 13739 | self.port_no = port_no |
| 13740 | else: |
| 13741 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13742 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13743 | |
| 13744 | def pack(self): |
| 13745 | packed = [] |
| 13746 | packed.append(struct.pack("!B", self.version)) |
| 13747 | packed.append(struct.pack("!B", self.type)) |
| 13748 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13749 | packed.append(struct.pack("!L", self.xid)) |
| 13750 | packed.append(struct.pack("!H", self.stats_type)) |
| 13751 | packed.append(struct.pack("!H", self.flags)) |
| 13752 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13753 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13754 | packed.append('\x00' * 4) |
| 13755 | length = sum([len(x) for x in packed]) |
| 13756 | packed[2] = struct.pack("!H", length) |
| 13757 | return ''.join(packed) |
| 13758 | |
| 13759 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13760 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13761 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13762 | _version = reader.read("!B")[0] |
| 13763 | assert(_version == 4) |
| 13764 | _type = reader.read("!B")[0] |
| 13765 | assert(_type == 18) |
| 13766 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13767 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13768 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13769 | obj.xid = reader.read("!L")[0] |
| 13770 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13771 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13772 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13773 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13774 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13775 | reader.skip(4) |
| 13776 | return obj |
| 13777 | |
| 13778 | def __eq__(self, other): |
| 13779 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13780 | if self.xid != other.xid: return False |
| 13781 | if self.flags != other.flags: return False |
| 13782 | if self.port_no != other.port_no: return False |
| 13783 | return True |
| 13784 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13785 | def pretty_print(self, q): |
| 13786 | q.text("port_stats_request {") |
| 13787 | with q.group(): |
| 13788 | with q.indent(2): |
| 13789 | q.breakable() |
| 13790 | q.text("xid = "); |
| 13791 | if self.xid != None: |
| 13792 | q.text("%#x" % self.xid) |
| 13793 | else: |
| 13794 | q.text('None') |
| 13795 | q.text(","); q.breakable() |
| 13796 | q.text("flags = "); |
| 13797 | q.text("%#x" % self.flags) |
| 13798 | q.text(","); q.breakable() |
| 13799 | q.text("port_no = "); |
| 13800 | q.text(util.pretty_port(self.port_no)) |
| 13801 | q.breakable() |
| 13802 | q.text('}') |
| 13803 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13804 | stats_request.subtypes[4] = port_stats_request |
| 13805 | |
| 13806 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13807 | version = 4 |
| 13808 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13809 | |
| 13810 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13811 | if xid != None: |
| 13812 | self.xid = xid |
| 13813 | else: |
| 13814 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13815 | if reason != None: |
| 13816 | self.reason = reason |
| 13817 | else: |
| 13818 | self.reason = 0 |
| 13819 | if desc != None: |
| 13820 | self.desc = desc |
| 13821 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13822 | self.desc = ofp.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13823 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13824 | |
| 13825 | def pack(self): |
| 13826 | packed = [] |
| 13827 | packed.append(struct.pack("!B", self.version)) |
| 13828 | packed.append(struct.pack("!B", self.type)) |
| 13829 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13830 | packed.append(struct.pack("!L", self.xid)) |
| 13831 | packed.append(struct.pack("!B", self.reason)) |
| 13832 | packed.append('\x00' * 7) |
| 13833 | packed.append(self.desc.pack()) |
| 13834 | length = sum([len(x) for x in packed]) |
| 13835 | packed[2] = struct.pack("!H", length) |
| 13836 | return ''.join(packed) |
| 13837 | |
| 13838 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13839 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13840 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13841 | _version = reader.read("!B")[0] |
| 13842 | assert(_version == 4) |
| 13843 | _type = reader.read("!B")[0] |
| 13844 | assert(_type == 12) |
| 13845 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13846 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13847 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13848 | obj.xid = reader.read("!L")[0] |
| 13849 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13850 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13851 | obj.desc = ofp.port_desc.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13852 | return obj |
| 13853 | |
| 13854 | def __eq__(self, other): |
| 13855 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13856 | if self.xid != other.xid: return False |
| 13857 | if self.reason != other.reason: return False |
| 13858 | if self.desc != other.desc: return False |
| 13859 | return True |
| 13860 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13861 | def pretty_print(self, q): |
| 13862 | q.text("port_status {") |
| 13863 | with q.group(): |
| 13864 | with q.indent(2): |
| 13865 | q.breakable() |
| 13866 | q.text("xid = "); |
| 13867 | if self.xid != None: |
| 13868 | q.text("%#x" % self.xid) |
| 13869 | else: |
| 13870 | q.text('None') |
| 13871 | q.text(","); q.breakable() |
| 13872 | q.text("reason = "); |
| 13873 | q.text("%#x" % self.reason) |
| 13874 | q.text(","); q.breakable() |
| 13875 | q.text("desc = "); |
| 13876 | q.pp(self.desc) |
| 13877 | q.breakable() |
| 13878 | q.text('}') |
| 13879 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13880 | message.subtypes[12] = port_status |
| 13881 | |
| 13882 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13883 | version = 4 |
| 13884 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13885 | |
| 13886 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13887 | if xid != None: |
| 13888 | self.xid = xid |
| 13889 | else: |
| 13890 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13891 | if port != None: |
| 13892 | self.port = port |
| 13893 | else: |
| 13894 | self.port = 0 |
| 13895 | if queues != None: |
| 13896 | self.queues = queues |
| 13897 | else: |
| 13898 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13899 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13900 | |
| 13901 | def pack(self): |
| 13902 | packed = [] |
| 13903 | packed.append(struct.pack("!B", self.version)) |
| 13904 | packed.append(struct.pack("!B", self.type)) |
| 13905 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13906 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13907 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13908 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13909 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13910 | length = sum([len(x) for x in packed]) |
| 13911 | packed[2] = struct.pack("!H", length) |
| 13912 | return ''.join(packed) |
| 13913 | |
| 13914 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13915 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13916 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13917 | _version = reader.read("!B")[0] |
| 13918 | assert(_version == 4) |
| 13919 | _type = reader.read("!B")[0] |
| 13920 | assert(_type == 23) |
| 13921 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13922 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13923 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13924 | obj.xid = reader.read("!L")[0] |
| 13925 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13926 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 13927 | 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] | 13928 | return obj |
| 13929 | |
| 13930 | def __eq__(self, other): |
| 13931 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13932 | if self.xid != other.xid: return False |
| 13933 | if self.port != other.port: return False |
| 13934 | if self.queues != other.queues: return False |
| 13935 | return True |
| 13936 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13937 | def pretty_print(self, q): |
| 13938 | q.text("queue_get_config_reply {") |
| 13939 | with q.group(): |
| 13940 | with q.indent(2): |
| 13941 | q.breakable() |
| 13942 | q.text("xid = "); |
| 13943 | if self.xid != None: |
| 13944 | q.text("%#x" % self.xid) |
| 13945 | else: |
| 13946 | q.text('None') |
| 13947 | q.text(","); q.breakable() |
| 13948 | q.text("port = "); |
| 13949 | q.text(util.pretty_port(self.port)) |
| 13950 | q.text(","); q.breakable() |
| 13951 | q.text("queues = "); |
| 13952 | q.pp(self.queues) |
| 13953 | q.breakable() |
| 13954 | q.text('}') |
| 13955 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13956 | message.subtypes[23] = queue_get_config_reply |
| 13957 | |
| 13958 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13959 | version = 4 |
| 13960 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13961 | |
| 13962 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13963 | if xid != None: |
| 13964 | self.xid = xid |
| 13965 | else: |
| 13966 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13967 | if port != None: |
| 13968 | self.port = port |
| 13969 | else: |
| 13970 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13971 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13972 | |
| 13973 | def pack(self): |
| 13974 | packed = [] |
| 13975 | packed.append(struct.pack("!B", self.version)) |
| 13976 | packed.append(struct.pack("!B", self.type)) |
| 13977 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13978 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13979 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13980 | packed.append('\x00' * 4) |
| 13981 | length = sum([len(x) for x in packed]) |
| 13982 | packed[2] = struct.pack("!H", length) |
| 13983 | return ''.join(packed) |
| 13984 | |
| 13985 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13986 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13987 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13988 | _version = reader.read("!B")[0] |
| 13989 | assert(_version == 4) |
| 13990 | _type = reader.read("!B")[0] |
| 13991 | assert(_type == 22) |
| 13992 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13993 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13994 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13995 | obj.xid = reader.read("!L")[0] |
| 13996 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13997 | reader.skip(4) |
| 13998 | return obj |
| 13999 | |
| 14000 | def __eq__(self, other): |
| 14001 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14002 | if self.xid != other.xid: return False |
| 14003 | if self.port != other.port: return False |
| 14004 | return True |
| 14005 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14006 | def pretty_print(self, q): |
| 14007 | q.text("queue_get_config_request {") |
| 14008 | with q.group(): |
| 14009 | with q.indent(2): |
| 14010 | q.breakable() |
| 14011 | q.text("xid = "); |
| 14012 | if self.xid != None: |
| 14013 | q.text("%#x" % self.xid) |
| 14014 | else: |
| 14015 | q.text('None') |
| 14016 | q.text(","); q.breakable() |
| 14017 | q.text("port = "); |
| 14018 | q.text(util.pretty_port(self.port)) |
| 14019 | q.breakable() |
| 14020 | q.text('}') |
| 14021 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14022 | message.subtypes[22] = queue_get_config_request |
| 14023 | |
| 14024 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14025 | version = 4 |
| 14026 | type = 1 |
| 14027 | err_type = 9 |
| 14028 | |
| 14029 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14030 | if xid != None: |
| 14031 | self.xid = xid |
| 14032 | else: |
| 14033 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14034 | if code != None: |
| 14035 | self.code = code |
| 14036 | else: |
| 14037 | self.code = 0 |
| 14038 | if data != None: |
| 14039 | self.data = data |
| 14040 | else: |
| 14041 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14042 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14043 | |
| 14044 | def pack(self): |
| 14045 | packed = [] |
| 14046 | packed.append(struct.pack("!B", self.version)) |
| 14047 | packed.append(struct.pack("!B", self.type)) |
| 14048 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14049 | packed.append(struct.pack("!L", self.xid)) |
| 14050 | packed.append(struct.pack("!H", self.err_type)) |
| 14051 | packed.append(struct.pack("!H", self.code)) |
| 14052 | packed.append(self.data) |
| 14053 | length = sum([len(x) for x in packed]) |
| 14054 | packed[2] = struct.pack("!H", length) |
| 14055 | return ''.join(packed) |
| 14056 | |
| 14057 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14058 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14059 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14060 | _version = reader.read("!B")[0] |
| 14061 | assert(_version == 4) |
| 14062 | _type = reader.read("!B")[0] |
| 14063 | assert(_type == 1) |
| 14064 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14065 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14066 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14067 | obj.xid = reader.read("!L")[0] |
| 14068 | _err_type = reader.read("!H")[0] |
| 14069 | assert(_err_type == 9) |
| 14070 | obj.code = reader.read("!H")[0] |
| 14071 | obj.data = str(reader.read_all()) |
| 14072 | return obj |
| 14073 | |
| 14074 | def __eq__(self, other): |
| 14075 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14076 | if self.xid != other.xid: return False |
| 14077 | if self.code != other.code: return False |
| 14078 | if self.data != other.data: return False |
| 14079 | return True |
| 14080 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14081 | def pretty_print(self, q): |
| 14082 | q.text("queue_op_failed_error_msg {") |
| 14083 | with q.group(): |
| 14084 | with q.indent(2): |
| 14085 | q.breakable() |
| 14086 | q.text("xid = "); |
| 14087 | if self.xid != None: |
| 14088 | q.text("%#x" % self.xid) |
| 14089 | else: |
| 14090 | q.text('None') |
| 14091 | q.text(","); q.breakable() |
| 14092 | q.text("code = "); |
| 14093 | q.text("%#x" % self.code) |
| 14094 | q.text(","); q.breakable() |
| 14095 | q.text("data = "); |
| 14096 | q.pp(self.data) |
| 14097 | q.breakable() |
| 14098 | q.text('}') |
| 14099 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14100 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 14101 | |
| 14102 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14103 | version = 4 |
| 14104 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14105 | stats_type = 5 |
| 14106 | |
| 14107 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14108 | if xid != None: |
| 14109 | self.xid = xid |
| 14110 | else: |
| 14111 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14112 | if flags != None: |
| 14113 | self.flags = flags |
| 14114 | else: |
| 14115 | self.flags = 0 |
| 14116 | if entries != None: |
| 14117 | self.entries = entries |
| 14118 | else: |
| 14119 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14120 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14121 | |
| 14122 | def pack(self): |
| 14123 | packed = [] |
| 14124 | packed.append(struct.pack("!B", self.version)) |
| 14125 | packed.append(struct.pack("!B", self.type)) |
| 14126 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14127 | packed.append(struct.pack("!L", self.xid)) |
| 14128 | packed.append(struct.pack("!H", self.stats_type)) |
| 14129 | packed.append(struct.pack("!H", self.flags)) |
| 14130 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14131 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14132 | length = sum([len(x) for x in packed]) |
| 14133 | packed[2] = struct.pack("!H", length) |
| 14134 | return ''.join(packed) |
| 14135 | |
| 14136 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14137 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14138 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14139 | _version = reader.read("!B")[0] |
| 14140 | assert(_version == 4) |
| 14141 | _type = reader.read("!B")[0] |
| 14142 | assert(_type == 19) |
| 14143 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14144 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14145 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14146 | obj.xid = reader.read("!L")[0] |
| 14147 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14148 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14149 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14150 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 14151 | 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] | 14152 | return obj |
| 14153 | |
| 14154 | def __eq__(self, other): |
| 14155 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14156 | if self.xid != other.xid: return False |
| 14157 | if self.flags != other.flags: return False |
| 14158 | if self.entries != other.entries: return False |
| 14159 | return True |
| 14160 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14161 | def pretty_print(self, q): |
| 14162 | q.text("queue_stats_reply {") |
| 14163 | with q.group(): |
| 14164 | with q.indent(2): |
| 14165 | q.breakable() |
| 14166 | q.text("xid = "); |
| 14167 | if self.xid != None: |
| 14168 | q.text("%#x" % self.xid) |
| 14169 | else: |
| 14170 | q.text('None') |
| 14171 | q.text(","); q.breakable() |
| 14172 | q.text("flags = "); |
| 14173 | q.text("%#x" % self.flags) |
| 14174 | q.text(","); q.breakable() |
| 14175 | q.text("entries = "); |
| 14176 | q.pp(self.entries) |
| 14177 | q.breakable() |
| 14178 | q.text('}') |
| 14179 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14180 | stats_reply.subtypes[5] = queue_stats_reply |
| 14181 | |
| 14182 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14183 | version = 4 |
| 14184 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14185 | stats_type = 5 |
| 14186 | |
| 14187 | 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] | 14188 | if xid != None: |
| 14189 | self.xid = xid |
| 14190 | else: |
| 14191 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14192 | if flags != None: |
| 14193 | self.flags = flags |
| 14194 | else: |
| 14195 | self.flags = 0 |
| 14196 | if port_no != None: |
| 14197 | self.port_no = port_no |
| 14198 | else: |
| 14199 | self.port_no = 0 |
| 14200 | if queue_id != None: |
| 14201 | self.queue_id = queue_id |
| 14202 | else: |
| 14203 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14204 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14205 | |
| 14206 | def pack(self): |
| 14207 | packed = [] |
| 14208 | packed.append(struct.pack("!B", self.version)) |
| 14209 | packed.append(struct.pack("!B", self.type)) |
| 14210 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14211 | packed.append(struct.pack("!L", self.xid)) |
| 14212 | packed.append(struct.pack("!H", self.stats_type)) |
| 14213 | packed.append(struct.pack("!H", self.flags)) |
| 14214 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14215 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14216 | packed.append(struct.pack("!L", self.queue_id)) |
| 14217 | length = sum([len(x) for x in packed]) |
| 14218 | packed[2] = struct.pack("!H", length) |
| 14219 | return ''.join(packed) |
| 14220 | |
| 14221 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14222 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14223 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14224 | _version = reader.read("!B")[0] |
| 14225 | assert(_version == 4) |
| 14226 | _type = reader.read("!B")[0] |
| 14227 | assert(_type == 18) |
| 14228 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14229 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14230 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14231 | obj.xid = reader.read("!L")[0] |
| 14232 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14233 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14234 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14235 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14236 | obj.port_no = util.unpack_port_no(reader) |
| 14237 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14238 | return obj |
| 14239 | |
| 14240 | def __eq__(self, other): |
| 14241 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14242 | if self.xid != other.xid: return False |
| 14243 | if self.flags != other.flags: return False |
| 14244 | if self.port_no != other.port_no: return False |
| 14245 | if self.queue_id != other.queue_id: return False |
| 14246 | return True |
| 14247 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14248 | def pretty_print(self, q): |
| 14249 | q.text("queue_stats_request {") |
| 14250 | with q.group(): |
| 14251 | with q.indent(2): |
| 14252 | q.breakable() |
| 14253 | q.text("xid = "); |
| 14254 | if self.xid != None: |
| 14255 | q.text("%#x" % self.xid) |
| 14256 | else: |
| 14257 | q.text('None') |
| 14258 | q.text(","); q.breakable() |
| 14259 | q.text("flags = "); |
| 14260 | q.text("%#x" % self.flags) |
| 14261 | q.text(","); q.breakable() |
| 14262 | q.text("port_no = "); |
| 14263 | q.text(util.pretty_port(self.port_no)) |
| 14264 | q.text(","); q.breakable() |
| 14265 | q.text("queue_id = "); |
| 14266 | q.text("%#x" % self.queue_id) |
| 14267 | q.breakable() |
| 14268 | q.text('}') |
| 14269 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14270 | stats_request.subtypes[5] = queue_stats_request |
| 14271 | |
| 14272 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14273 | version = 4 |
| 14274 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14275 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14276 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14277 | if xid != None: |
| 14278 | self.xid = xid |
| 14279 | else: |
| 14280 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14281 | if role != None: |
| 14282 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14283 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14284 | self.role = 0 |
| 14285 | if generation_id != None: |
| 14286 | self.generation_id = generation_id |
| 14287 | else: |
| 14288 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14289 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14290 | |
| 14291 | def pack(self): |
| 14292 | packed = [] |
| 14293 | packed.append(struct.pack("!B", self.version)) |
| 14294 | packed.append(struct.pack("!B", self.type)) |
| 14295 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14296 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14297 | packed.append(struct.pack("!L", self.role)) |
| 14298 | packed.append('\x00' * 4) |
| 14299 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14300 | length = sum([len(x) for x in packed]) |
| 14301 | packed[2] = struct.pack("!H", length) |
| 14302 | return ''.join(packed) |
| 14303 | |
| 14304 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14305 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14306 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14307 | _version = reader.read("!B")[0] |
| 14308 | assert(_version == 4) |
| 14309 | _type = reader.read("!B")[0] |
| 14310 | assert(_type == 25) |
| 14311 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14312 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14313 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14314 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14315 | obj.role = reader.read("!L")[0] |
| 14316 | reader.skip(4) |
| 14317 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14318 | return obj |
| 14319 | |
| 14320 | def __eq__(self, other): |
| 14321 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14322 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14323 | if self.role != other.role: return False |
| 14324 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14325 | return True |
| 14326 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14327 | def pretty_print(self, q): |
| 14328 | q.text("role_reply {") |
| 14329 | with q.group(): |
| 14330 | with q.indent(2): |
| 14331 | q.breakable() |
| 14332 | q.text("xid = "); |
| 14333 | if self.xid != None: |
| 14334 | q.text("%#x" % self.xid) |
| 14335 | else: |
| 14336 | q.text('None') |
| 14337 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14338 | q.text("role = "); |
| 14339 | q.text("%#x" % self.role) |
| 14340 | q.text(","); q.breakable() |
| 14341 | q.text("generation_id = "); |
| 14342 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14343 | q.breakable() |
| 14344 | q.text('}') |
| 14345 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14346 | message.subtypes[25] = role_reply |
| 14347 | |
| 14348 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14349 | version = 4 |
| 14350 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14351 | |
| 14352 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14353 | if xid != None: |
| 14354 | self.xid = xid |
| 14355 | else: |
| 14356 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14357 | if role != None: |
| 14358 | self.role = role |
| 14359 | else: |
| 14360 | self.role = 0 |
| 14361 | if generation_id != None: |
| 14362 | self.generation_id = generation_id |
| 14363 | else: |
| 14364 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14365 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14366 | |
| 14367 | def pack(self): |
| 14368 | packed = [] |
| 14369 | packed.append(struct.pack("!B", self.version)) |
| 14370 | packed.append(struct.pack("!B", self.type)) |
| 14371 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14372 | packed.append(struct.pack("!L", self.xid)) |
| 14373 | packed.append(struct.pack("!L", self.role)) |
| 14374 | packed.append('\x00' * 4) |
| 14375 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14376 | length = sum([len(x) for x in packed]) |
| 14377 | packed[2] = struct.pack("!H", length) |
| 14378 | return ''.join(packed) |
| 14379 | |
| 14380 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14381 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14382 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14383 | _version = reader.read("!B")[0] |
| 14384 | assert(_version == 4) |
| 14385 | _type = reader.read("!B")[0] |
| 14386 | assert(_type == 24) |
| 14387 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14388 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14389 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14390 | obj.xid = reader.read("!L")[0] |
| 14391 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14392 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14393 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14394 | return obj |
| 14395 | |
| 14396 | def __eq__(self, other): |
| 14397 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14398 | if self.xid != other.xid: return False |
| 14399 | if self.role != other.role: return False |
| 14400 | if self.generation_id != other.generation_id: return False |
| 14401 | return True |
| 14402 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14403 | def pretty_print(self, q): |
| 14404 | q.text("role_request {") |
| 14405 | with q.group(): |
| 14406 | with q.indent(2): |
| 14407 | q.breakable() |
| 14408 | q.text("xid = "); |
| 14409 | if self.xid != None: |
| 14410 | q.text("%#x" % self.xid) |
| 14411 | else: |
| 14412 | q.text('None') |
| 14413 | q.text(","); q.breakable() |
| 14414 | q.text("role = "); |
| 14415 | q.text("%#x" % self.role) |
| 14416 | q.text(","); q.breakable() |
| 14417 | q.text("generation_id = "); |
| 14418 | q.text("%#x" % self.generation_id) |
| 14419 | q.breakable() |
| 14420 | q.text('}') |
| 14421 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14422 | message.subtypes[24] = role_request |
| 14423 | |
| 14424 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14425 | version = 4 |
| 14426 | type = 1 |
| 14427 | err_type = 11 |
| 14428 | |
| 14429 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14430 | if xid != None: |
| 14431 | self.xid = xid |
| 14432 | else: |
| 14433 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14434 | if code != None: |
| 14435 | self.code = code |
| 14436 | else: |
| 14437 | self.code = 0 |
| 14438 | if data != None: |
| 14439 | self.data = data |
| 14440 | else: |
| 14441 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14442 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14443 | |
| 14444 | def pack(self): |
| 14445 | packed = [] |
| 14446 | packed.append(struct.pack("!B", self.version)) |
| 14447 | packed.append(struct.pack("!B", self.type)) |
| 14448 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14449 | packed.append(struct.pack("!L", self.xid)) |
| 14450 | packed.append(struct.pack("!H", self.err_type)) |
| 14451 | packed.append(struct.pack("!H", self.code)) |
| 14452 | packed.append(self.data) |
| 14453 | length = sum([len(x) for x in packed]) |
| 14454 | packed[2] = struct.pack("!H", length) |
| 14455 | return ''.join(packed) |
| 14456 | |
| 14457 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14458 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14459 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14460 | _version = reader.read("!B")[0] |
| 14461 | assert(_version == 4) |
| 14462 | _type = reader.read("!B")[0] |
| 14463 | assert(_type == 1) |
| 14464 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14465 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14466 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14467 | obj.xid = reader.read("!L")[0] |
| 14468 | _err_type = reader.read("!H")[0] |
| 14469 | assert(_err_type == 11) |
| 14470 | obj.code = reader.read("!H")[0] |
| 14471 | obj.data = str(reader.read_all()) |
| 14472 | return obj |
| 14473 | |
| 14474 | def __eq__(self, other): |
| 14475 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14476 | if self.xid != other.xid: return False |
| 14477 | if self.code != other.code: return False |
| 14478 | if self.data != other.data: return False |
| 14479 | return True |
| 14480 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14481 | def pretty_print(self, q): |
| 14482 | q.text("role_request_failed_error_msg {") |
| 14483 | with q.group(): |
| 14484 | with q.indent(2): |
| 14485 | q.breakable() |
| 14486 | q.text("xid = "); |
| 14487 | if self.xid != None: |
| 14488 | q.text("%#x" % self.xid) |
| 14489 | else: |
| 14490 | q.text('None') |
| 14491 | q.text(","); q.breakable() |
| 14492 | q.text("code = "); |
| 14493 | q.text("%#x" % self.code) |
| 14494 | q.text(","); q.breakable() |
| 14495 | q.text("data = "); |
| 14496 | q.pp(self.data) |
| 14497 | q.breakable() |
| 14498 | q.text('}') |
| 14499 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14500 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 14501 | |
| 14502 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14503 | version = 4 |
| 14504 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14505 | |
| 14506 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14507 | if xid != None: |
| 14508 | self.xid = xid |
| 14509 | else: |
| 14510 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14511 | if flags != None: |
| 14512 | self.flags = flags |
| 14513 | else: |
| 14514 | self.flags = 0 |
| 14515 | if miss_send_len != None: |
| 14516 | self.miss_send_len = miss_send_len |
| 14517 | else: |
| 14518 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14519 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14520 | |
| 14521 | def pack(self): |
| 14522 | packed = [] |
| 14523 | packed.append(struct.pack("!B", self.version)) |
| 14524 | packed.append(struct.pack("!B", self.type)) |
| 14525 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14526 | packed.append(struct.pack("!L", self.xid)) |
| 14527 | packed.append(struct.pack("!H", self.flags)) |
| 14528 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 14529 | length = sum([len(x) for x in packed]) |
| 14530 | packed[2] = struct.pack("!H", length) |
| 14531 | return ''.join(packed) |
| 14532 | |
| 14533 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14534 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14535 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14536 | _version = reader.read("!B")[0] |
| 14537 | assert(_version == 4) |
| 14538 | _type = reader.read("!B")[0] |
| 14539 | assert(_type == 9) |
| 14540 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14541 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14542 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14543 | obj.xid = reader.read("!L")[0] |
| 14544 | obj.flags = reader.read("!H")[0] |
| 14545 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14546 | return obj |
| 14547 | |
| 14548 | def __eq__(self, other): |
| 14549 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14550 | if self.xid != other.xid: return False |
| 14551 | if self.flags != other.flags: return False |
| 14552 | if self.miss_send_len != other.miss_send_len: return False |
| 14553 | return True |
| 14554 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14555 | def pretty_print(self, q): |
| 14556 | q.text("set_config {") |
| 14557 | with q.group(): |
| 14558 | with q.indent(2): |
| 14559 | q.breakable() |
| 14560 | q.text("xid = "); |
| 14561 | if self.xid != None: |
| 14562 | q.text("%#x" % self.xid) |
| 14563 | else: |
| 14564 | q.text('None') |
| 14565 | q.text(","); q.breakable() |
| 14566 | q.text("flags = "); |
| 14567 | q.text("%#x" % self.flags) |
| 14568 | q.text(","); q.breakable() |
| 14569 | q.text("miss_send_len = "); |
| 14570 | q.text("%#x" % self.miss_send_len) |
| 14571 | q.breakable() |
| 14572 | q.text('}') |
| 14573 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14574 | message.subtypes[9] = set_config |
| 14575 | |
| 14576 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14577 | version = 4 |
| 14578 | type = 1 |
| 14579 | err_type = 10 |
| 14580 | |
| 14581 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14582 | if xid != None: |
| 14583 | self.xid = xid |
| 14584 | else: |
| 14585 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14586 | if code != None: |
| 14587 | self.code = code |
| 14588 | else: |
| 14589 | self.code = 0 |
| 14590 | if data != None: |
| 14591 | self.data = data |
| 14592 | else: |
| 14593 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14594 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14595 | |
| 14596 | def pack(self): |
| 14597 | packed = [] |
| 14598 | packed.append(struct.pack("!B", self.version)) |
| 14599 | packed.append(struct.pack("!B", self.type)) |
| 14600 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14601 | packed.append(struct.pack("!L", self.xid)) |
| 14602 | packed.append(struct.pack("!H", self.err_type)) |
| 14603 | packed.append(struct.pack("!H", self.code)) |
| 14604 | packed.append(self.data) |
| 14605 | length = sum([len(x) for x in packed]) |
| 14606 | packed[2] = struct.pack("!H", length) |
| 14607 | return ''.join(packed) |
| 14608 | |
| 14609 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14610 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14611 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14612 | _version = reader.read("!B")[0] |
| 14613 | assert(_version == 4) |
| 14614 | _type = reader.read("!B")[0] |
| 14615 | assert(_type == 1) |
| 14616 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14617 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14618 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14619 | obj.xid = reader.read("!L")[0] |
| 14620 | _err_type = reader.read("!H")[0] |
| 14621 | assert(_err_type == 10) |
| 14622 | obj.code = reader.read("!H")[0] |
| 14623 | obj.data = str(reader.read_all()) |
| 14624 | return obj |
| 14625 | |
| 14626 | def __eq__(self, other): |
| 14627 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14628 | if self.xid != other.xid: return False |
| 14629 | if self.code != other.code: return False |
| 14630 | if self.data != other.data: return False |
| 14631 | return True |
| 14632 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14633 | def pretty_print(self, q): |
| 14634 | q.text("switch_config_failed_error_msg {") |
| 14635 | with q.group(): |
| 14636 | with q.indent(2): |
| 14637 | q.breakable() |
| 14638 | q.text("xid = "); |
| 14639 | if self.xid != None: |
| 14640 | q.text("%#x" % self.xid) |
| 14641 | else: |
| 14642 | q.text('None') |
| 14643 | q.text(","); q.breakable() |
| 14644 | q.text("code = "); |
| 14645 | q.text("%#x" % self.code) |
| 14646 | q.text(","); q.breakable() |
| 14647 | q.text("data = "); |
| 14648 | q.pp(self.data) |
| 14649 | q.breakable() |
| 14650 | q.text('}') |
| 14651 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14652 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 14653 | |
| 14654 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14655 | version = 4 |
| 14656 | type = 1 |
| 14657 | err_type = 13 |
| 14658 | |
| 14659 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14660 | if xid != None: |
| 14661 | self.xid = xid |
| 14662 | else: |
| 14663 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14664 | if code != None: |
| 14665 | self.code = code |
| 14666 | else: |
| 14667 | self.code = 0 |
| 14668 | if data != None: |
| 14669 | self.data = data |
| 14670 | else: |
| 14671 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14672 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14673 | |
| 14674 | def pack(self): |
| 14675 | packed = [] |
| 14676 | packed.append(struct.pack("!B", self.version)) |
| 14677 | packed.append(struct.pack("!B", self.type)) |
| 14678 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14679 | packed.append(struct.pack("!L", self.xid)) |
| 14680 | packed.append(struct.pack("!H", self.err_type)) |
| 14681 | packed.append(struct.pack("!H", self.code)) |
| 14682 | packed.append(self.data) |
| 14683 | length = sum([len(x) for x in packed]) |
| 14684 | packed[2] = struct.pack("!H", length) |
| 14685 | return ''.join(packed) |
| 14686 | |
| 14687 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14688 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14689 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14690 | _version = reader.read("!B")[0] |
| 14691 | assert(_version == 4) |
| 14692 | _type = reader.read("!B")[0] |
| 14693 | assert(_type == 1) |
| 14694 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14695 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14696 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14697 | obj.xid = reader.read("!L")[0] |
| 14698 | _err_type = reader.read("!H")[0] |
| 14699 | assert(_err_type == 13) |
| 14700 | obj.code = reader.read("!H")[0] |
| 14701 | obj.data = str(reader.read_all()) |
| 14702 | return obj |
| 14703 | |
| 14704 | def __eq__(self, other): |
| 14705 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14706 | if self.xid != other.xid: return False |
| 14707 | if self.code != other.code: return False |
| 14708 | if self.data != other.data: return False |
| 14709 | return True |
| 14710 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14711 | def pretty_print(self, q): |
| 14712 | q.text("table_features_failed_error_msg {") |
| 14713 | with q.group(): |
| 14714 | with q.indent(2): |
| 14715 | q.breakable() |
| 14716 | q.text("xid = "); |
| 14717 | if self.xid != None: |
| 14718 | q.text("%#x" % self.xid) |
| 14719 | else: |
| 14720 | q.text('None') |
| 14721 | q.text(","); q.breakable() |
| 14722 | q.text("code = "); |
| 14723 | q.text("%#x" % self.code) |
| 14724 | q.text(","); q.breakable() |
| 14725 | q.text("data = "); |
| 14726 | q.pp(self.data) |
| 14727 | q.breakable() |
| 14728 | q.text('}') |
| 14729 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14730 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 14731 | |
| 14732 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14733 | version = 4 |
| 14734 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14735 | stats_type = 12 |
| 14736 | |
| 14737 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14738 | if xid != None: |
| 14739 | self.xid = xid |
| 14740 | else: |
| 14741 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14742 | if flags != None: |
| 14743 | self.flags = flags |
| 14744 | else: |
| 14745 | self.flags = 0 |
| 14746 | if entries != None: |
| 14747 | self.entries = entries |
| 14748 | else: |
| 14749 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14750 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14751 | |
| 14752 | def pack(self): |
| 14753 | packed = [] |
| 14754 | packed.append(struct.pack("!B", self.version)) |
| 14755 | packed.append(struct.pack("!B", self.type)) |
| 14756 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14757 | packed.append(struct.pack("!L", self.xid)) |
| 14758 | packed.append(struct.pack("!H", self.stats_type)) |
| 14759 | packed.append(struct.pack("!H", self.flags)) |
| 14760 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14761 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14762 | length = sum([len(x) for x in packed]) |
| 14763 | packed[2] = struct.pack("!H", length) |
| 14764 | return ''.join(packed) |
| 14765 | |
| 14766 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14767 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14768 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14769 | _version = reader.read("!B")[0] |
| 14770 | assert(_version == 4) |
| 14771 | _type = reader.read("!B")[0] |
| 14772 | assert(_type == 19) |
| 14773 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14774 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14775 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14776 | obj.xid = reader.read("!L")[0] |
| 14777 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14778 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14779 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14780 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 14781 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14782 | return obj |
| 14783 | |
| 14784 | def __eq__(self, other): |
| 14785 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14786 | if self.xid != other.xid: return False |
| 14787 | if self.flags != other.flags: return False |
| 14788 | if self.entries != other.entries: return False |
| 14789 | return True |
| 14790 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14791 | def pretty_print(self, q): |
| 14792 | q.text("table_features_stats_reply {") |
| 14793 | with q.group(): |
| 14794 | with q.indent(2): |
| 14795 | q.breakable() |
| 14796 | q.text("xid = "); |
| 14797 | if self.xid != None: |
| 14798 | q.text("%#x" % self.xid) |
| 14799 | else: |
| 14800 | q.text('None') |
| 14801 | q.text(","); q.breakable() |
| 14802 | q.text("flags = "); |
| 14803 | q.text("%#x" % self.flags) |
| 14804 | q.text(","); q.breakable() |
| 14805 | q.text("entries = "); |
| 14806 | q.pp(self.entries) |
| 14807 | q.breakable() |
| 14808 | q.text('}') |
| 14809 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14810 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14811 | |
| 14812 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14813 | version = 4 |
| 14814 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14815 | stats_type = 12 |
| 14816 | |
| 14817 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14818 | if xid != None: |
| 14819 | self.xid = xid |
| 14820 | else: |
| 14821 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14822 | if flags != None: |
| 14823 | self.flags = flags |
| 14824 | else: |
| 14825 | self.flags = 0 |
| 14826 | if entries != None: |
| 14827 | self.entries = entries |
| 14828 | else: |
| 14829 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14830 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14831 | |
| 14832 | def pack(self): |
| 14833 | packed = [] |
| 14834 | packed.append(struct.pack("!B", self.version)) |
| 14835 | packed.append(struct.pack("!B", self.type)) |
| 14836 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14837 | packed.append(struct.pack("!L", self.xid)) |
| 14838 | packed.append(struct.pack("!H", self.stats_type)) |
| 14839 | packed.append(struct.pack("!H", self.flags)) |
| 14840 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14841 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14842 | length = sum([len(x) for x in packed]) |
| 14843 | packed[2] = struct.pack("!H", length) |
| 14844 | return ''.join(packed) |
| 14845 | |
| 14846 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14847 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14848 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14849 | _version = reader.read("!B")[0] |
| 14850 | assert(_version == 4) |
| 14851 | _type = reader.read("!B")[0] |
| 14852 | assert(_type == 18) |
| 14853 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14854 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14855 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14856 | obj.xid = reader.read("!L")[0] |
| 14857 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14858 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14859 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14860 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 14861 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_features.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14862 | return obj |
| 14863 | |
| 14864 | def __eq__(self, other): |
| 14865 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14866 | if self.xid != other.xid: return False |
| 14867 | if self.flags != other.flags: return False |
| 14868 | if self.entries != other.entries: return False |
| 14869 | return True |
| 14870 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14871 | def pretty_print(self, q): |
| 14872 | q.text("table_features_stats_request {") |
| 14873 | with q.group(): |
| 14874 | with q.indent(2): |
| 14875 | q.breakable() |
| 14876 | q.text("xid = "); |
| 14877 | if self.xid != None: |
| 14878 | q.text("%#x" % self.xid) |
| 14879 | else: |
| 14880 | q.text('None') |
| 14881 | q.text(","); q.breakable() |
| 14882 | q.text("flags = "); |
| 14883 | q.text("%#x" % self.flags) |
| 14884 | q.text(","); q.breakable() |
| 14885 | q.text("entries = "); |
| 14886 | q.pp(self.entries) |
| 14887 | q.breakable() |
| 14888 | q.text('}') |
| 14889 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14890 | stats_request.subtypes[12] = table_features_stats_request |
| 14891 | |
| 14892 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14893 | version = 4 |
| 14894 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14895 | |
| 14896 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14897 | if xid != None: |
| 14898 | self.xid = xid |
| 14899 | else: |
| 14900 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14901 | if table_id != None: |
| 14902 | self.table_id = table_id |
| 14903 | else: |
| 14904 | self.table_id = 0 |
| 14905 | if config != None: |
| 14906 | self.config = config |
| 14907 | else: |
| 14908 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14909 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14910 | |
| 14911 | def pack(self): |
| 14912 | packed = [] |
| 14913 | packed.append(struct.pack("!B", self.version)) |
| 14914 | packed.append(struct.pack("!B", self.type)) |
| 14915 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14916 | packed.append(struct.pack("!L", self.xid)) |
| 14917 | packed.append(struct.pack("!B", self.table_id)) |
| 14918 | packed.append('\x00' * 3) |
| 14919 | packed.append(struct.pack("!L", self.config)) |
| 14920 | length = sum([len(x) for x in packed]) |
| 14921 | packed[2] = struct.pack("!H", length) |
| 14922 | return ''.join(packed) |
| 14923 | |
| 14924 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14925 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14926 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14927 | _version = reader.read("!B")[0] |
| 14928 | assert(_version == 4) |
| 14929 | _type = reader.read("!B")[0] |
| 14930 | assert(_type == 17) |
| 14931 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14932 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14933 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14934 | obj.xid = reader.read("!L")[0] |
| 14935 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14936 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14937 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14938 | return obj |
| 14939 | |
| 14940 | def __eq__(self, other): |
| 14941 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14942 | if self.xid != other.xid: return False |
| 14943 | if self.table_id != other.table_id: return False |
| 14944 | if self.config != other.config: return False |
| 14945 | return True |
| 14946 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14947 | def pretty_print(self, q): |
| 14948 | q.text("table_mod {") |
| 14949 | with q.group(): |
| 14950 | with q.indent(2): |
| 14951 | q.breakable() |
| 14952 | q.text("xid = "); |
| 14953 | if self.xid != None: |
| 14954 | q.text("%#x" % self.xid) |
| 14955 | else: |
| 14956 | q.text('None') |
| 14957 | q.text(","); q.breakable() |
| 14958 | q.text("table_id = "); |
| 14959 | q.text("%#x" % self.table_id) |
| 14960 | q.text(","); q.breakable() |
| 14961 | q.text("config = "); |
| 14962 | q.text("%#x" % self.config) |
| 14963 | q.breakable() |
| 14964 | q.text('}') |
| 14965 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14966 | message.subtypes[17] = table_mod |
| 14967 | |
| 14968 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14969 | version = 4 |
| 14970 | type = 1 |
| 14971 | err_type = 8 |
| 14972 | |
| 14973 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14974 | if xid != None: |
| 14975 | self.xid = xid |
| 14976 | else: |
| 14977 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14978 | if code != None: |
| 14979 | self.code = code |
| 14980 | else: |
| 14981 | self.code = 0 |
| 14982 | if data != None: |
| 14983 | self.data = data |
| 14984 | else: |
| 14985 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14986 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14987 | |
| 14988 | def pack(self): |
| 14989 | packed = [] |
| 14990 | packed.append(struct.pack("!B", self.version)) |
| 14991 | packed.append(struct.pack("!B", self.type)) |
| 14992 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14993 | packed.append(struct.pack("!L", self.xid)) |
| 14994 | packed.append(struct.pack("!H", self.err_type)) |
| 14995 | packed.append(struct.pack("!H", self.code)) |
| 14996 | packed.append(self.data) |
| 14997 | length = sum([len(x) for x in packed]) |
| 14998 | packed[2] = struct.pack("!H", length) |
| 14999 | return ''.join(packed) |
| 15000 | |
| 15001 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15002 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15003 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15004 | _version = reader.read("!B")[0] |
| 15005 | assert(_version == 4) |
| 15006 | _type = reader.read("!B")[0] |
| 15007 | assert(_type == 1) |
| 15008 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15009 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15010 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15011 | obj.xid = reader.read("!L")[0] |
| 15012 | _err_type = reader.read("!H")[0] |
| 15013 | assert(_err_type == 8) |
| 15014 | obj.code = reader.read("!H")[0] |
| 15015 | obj.data = str(reader.read_all()) |
| 15016 | return obj |
| 15017 | |
| 15018 | def __eq__(self, other): |
| 15019 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15020 | if self.xid != other.xid: return False |
| 15021 | if self.code != other.code: return False |
| 15022 | if self.data != other.data: return False |
| 15023 | return True |
| 15024 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15025 | def pretty_print(self, q): |
| 15026 | q.text("table_mod_failed_error_msg {") |
| 15027 | with q.group(): |
| 15028 | with q.indent(2): |
| 15029 | q.breakable() |
| 15030 | q.text("xid = "); |
| 15031 | if self.xid != None: |
| 15032 | q.text("%#x" % self.xid) |
| 15033 | else: |
| 15034 | q.text('None') |
| 15035 | q.text(","); q.breakable() |
| 15036 | q.text("code = "); |
| 15037 | q.text("%#x" % self.code) |
| 15038 | q.text(","); q.breakable() |
| 15039 | q.text("data = "); |
| 15040 | q.pp(self.data) |
| 15041 | q.breakable() |
| 15042 | q.text('}') |
| 15043 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15044 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 15045 | |
| 15046 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15047 | version = 4 |
| 15048 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15049 | stats_type = 3 |
| 15050 | |
| 15051 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15052 | if xid != None: |
| 15053 | self.xid = xid |
| 15054 | else: |
| 15055 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15056 | if flags != None: |
| 15057 | self.flags = flags |
| 15058 | else: |
| 15059 | self.flags = 0 |
| 15060 | if entries != None: |
| 15061 | self.entries = entries |
| 15062 | else: |
| 15063 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15064 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15065 | |
| 15066 | def pack(self): |
| 15067 | packed = [] |
| 15068 | packed.append(struct.pack("!B", self.version)) |
| 15069 | packed.append(struct.pack("!B", self.type)) |
| 15070 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15071 | packed.append(struct.pack("!L", self.xid)) |
| 15072 | packed.append(struct.pack("!H", self.stats_type)) |
| 15073 | packed.append(struct.pack("!H", self.flags)) |
| 15074 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15075 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15076 | length = sum([len(x) for x in packed]) |
| 15077 | packed[2] = struct.pack("!H", length) |
| 15078 | return ''.join(packed) |
| 15079 | |
| 15080 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15081 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15082 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15083 | _version = reader.read("!B")[0] |
| 15084 | assert(_version == 4) |
| 15085 | _type = reader.read("!B")[0] |
| 15086 | assert(_type == 19) |
| 15087 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15088 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15089 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15090 | obj.xid = reader.read("!L")[0] |
| 15091 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15092 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15093 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15094 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 15095 | 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] | 15096 | return obj |
| 15097 | |
| 15098 | def __eq__(self, other): |
| 15099 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15100 | if self.xid != other.xid: return False |
| 15101 | if self.flags != other.flags: return False |
| 15102 | if self.entries != other.entries: return False |
| 15103 | return True |
| 15104 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15105 | def pretty_print(self, q): |
| 15106 | q.text("table_stats_reply {") |
| 15107 | with q.group(): |
| 15108 | with q.indent(2): |
| 15109 | q.breakable() |
| 15110 | q.text("xid = "); |
| 15111 | if self.xid != None: |
| 15112 | q.text("%#x" % self.xid) |
| 15113 | else: |
| 15114 | q.text('None') |
| 15115 | q.text(","); q.breakable() |
| 15116 | q.text("flags = "); |
| 15117 | q.text("%#x" % self.flags) |
| 15118 | q.text(","); q.breakable() |
| 15119 | q.text("entries = "); |
| 15120 | q.pp(self.entries) |
| 15121 | q.breakable() |
| 15122 | q.text('}') |
| 15123 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15124 | stats_reply.subtypes[3] = table_stats_reply |
| 15125 | |
| 15126 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15127 | version = 4 |
| 15128 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15129 | stats_type = 3 |
| 15130 | |
| 15131 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15132 | if xid != None: |
| 15133 | self.xid = xid |
| 15134 | else: |
| 15135 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15136 | if flags != None: |
| 15137 | self.flags = flags |
| 15138 | else: |
| 15139 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15140 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15141 | |
| 15142 | def pack(self): |
| 15143 | packed = [] |
| 15144 | packed.append(struct.pack("!B", self.version)) |
| 15145 | packed.append(struct.pack("!B", self.type)) |
| 15146 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15147 | packed.append(struct.pack("!L", self.xid)) |
| 15148 | packed.append(struct.pack("!H", self.stats_type)) |
| 15149 | packed.append(struct.pack("!H", self.flags)) |
| 15150 | packed.append('\x00' * 4) |
| 15151 | length = sum([len(x) for x in packed]) |
| 15152 | packed[2] = struct.pack("!H", length) |
| 15153 | return ''.join(packed) |
| 15154 | |
| 15155 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15156 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15157 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15158 | _version = reader.read("!B")[0] |
| 15159 | assert(_version == 4) |
| 15160 | _type = reader.read("!B")[0] |
| 15161 | assert(_type == 18) |
| 15162 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15163 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15164 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15165 | obj.xid = reader.read("!L")[0] |
| 15166 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15167 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15168 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15169 | reader.skip(4) |
| 15170 | return obj |
| 15171 | |
| 15172 | def __eq__(self, other): |
| 15173 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15174 | if self.xid != other.xid: return False |
| 15175 | if self.flags != other.flags: return False |
| 15176 | return True |
| 15177 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15178 | def pretty_print(self, q): |
| 15179 | q.text("table_stats_request {") |
| 15180 | with q.group(): |
| 15181 | with q.indent(2): |
| 15182 | q.breakable() |
| 15183 | q.text("xid = "); |
| 15184 | if self.xid != None: |
| 15185 | q.text("%#x" % self.xid) |
| 15186 | else: |
| 15187 | q.text('None') |
| 15188 | q.text(","); q.breakable() |
| 15189 | q.text("flags = "); |
| 15190 | q.text("%#x" % self.flags) |
| 15191 | q.breakable() |
| 15192 | q.text('}') |
| 15193 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15194 | stats_request.subtypes[3] = table_stats_request |
| 15195 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15196 | |
| 15197 | def parse_header(buf): |
| 15198 | if len(buf) < 8: |
| 15199 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 15200 | return struct.unpack_from("!BBHL", buf) |
| 15201 | |
| 15202 | def parse_message(buf): |
| 15203 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame^] | 15204 | if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO: |
| 15205 | 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] | 15206 | if len(buf) != msg_len: |
| 15207 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15208 | return message.unpack(loxi.generic_util.OFReader(buf)) |