Matteo Scandolo | a229eca | 2017-08-08 13:05:28 -0700 | [diff] [blame] | 1 | |
| 2 | # Copyright 2017-present Open Networking Foundation |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
| 16 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 17 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 18 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 19 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 20 | # 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] | 21 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 22 | # Automatically generated by LOXI from template module.py |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 23 | # Do not modify |
| 24 | |
| 25 | import struct |
| 26 | import loxi |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 27 | import util |
| 28 | import loxi.generic_util |
| 29 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 30 | import sys |
| 31 | ofp = sys.modules['loxi.of13'] |
| 32 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 33 | class message(loxi.OFObject): |
| 34 | subtypes = {} |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 35 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 36 | version = 4 |
| 37 | |
| 38 | def __init__(self, type=None, xid=None): |
| 39 | if type != None: |
| 40 | self.type = type |
| 41 | else: |
| 42 | self.type = 0 |
| 43 | if xid != None: |
| 44 | self.xid = xid |
| 45 | else: |
| 46 | self.xid = None |
| 47 | return |
| 48 | |
| 49 | def pack(self): |
| 50 | packed = [] |
| 51 | packed.append(struct.pack("!B", self.version)) |
| 52 | packed.append(struct.pack("!B", self.type)) |
| 53 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 54 | packed.append(struct.pack("!L", self.xid)) |
| 55 | length = sum([len(x) for x in packed]) |
| 56 | packed[2] = struct.pack("!H", length) |
| 57 | return ''.join(packed) |
| 58 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 59 | @staticmethod |
| 60 | def unpack(reader): |
| 61 | subtype, = reader.peek('B', 1) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 62 | subclass = message.subtypes.get(subtype) |
| 63 | if subclass: |
| 64 | return subclass.unpack(reader) |
| 65 | |
| 66 | obj = message() |
| 67 | _version = reader.read("!B")[0] |
| 68 | assert(_version == 4) |
| 69 | obj.type = reader.read("!B")[0] |
| 70 | _length = reader.read("!H")[0] |
| 71 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 72 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 73 | obj.xid = reader.read("!L")[0] |
| 74 | return obj |
| 75 | |
| 76 | def __eq__(self, other): |
| 77 | if type(self) != type(other): return False |
| 78 | if self.type != other.type: return False |
| 79 | if self.xid != other.xid: return False |
| 80 | return True |
| 81 | |
| 82 | def pretty_print(self, q): |
| 83 | q.text("message {") |
| 84 | with q.group(): |
| 85 | with q.indent(2): |
| 86 | q.breakable() |
| 87 | q.text("xid = "); |
| 88 | if self.xid != None: |
| 89 | q.text("%#x" % self.xid) |
| 90 | else: |
| 91 | q.text('None') |
| 92 | q.breakable() |
| 93 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 94 | |
| 95 | |
| 96 | class stats_reply(message): |
| 97 | subtypes = {} |
| 98 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 99 | version = 4 |
| 100 | type = 19 |
| 101 | |
| 102 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 103 | if xid != None: |
| 104 | self.xid = xid |
| 105 | else: |
| 106 | self.xid = None |
| 107 | if stats_type != None: |
| 108 | self.stats_type = stats_type |
| 109 | else: |
| 110 | self.stats_type = 0 |
| 111 | if flags != None: |
| 112 | self.flags = flags |
| 113 | else: |
| 114 | self.flags = 0 |
| 115 | return |
| 116 | |
| 117 | def pack(self): |
| 118 | packed = [] |
| 119 | packed.append(struct.pack("!B", self.version)) |
| 120 | packed.append(struct.pack("!B", self.type)) |
| 121 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 122 | packed.append(struct.pack("!L", self.xid)) |
| 123 | packed.append(struct.pack("!H", self.stats_type)) |
| 124 | packed.append(struct.pack("!H", self.flags)) |
| 125 | packed.append('\x00' * 4) |
| 126 | length = sum([len(x) for x in packed]) |
| 127 | packed[2] = struct.pack("!H", length) |
| 128 | return ''.join(packed) |
| 129 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 130 | @staticmethod |
| 131 | def unpack(reader): |
| 132 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 133 | subclass = stats_reply.subtypes.get(subtype) |
| 134 | if subclass: |
| 135 | return subclass.unpack(reader) |
| 136 | |
| 137 | obj = stats_reply() |
| 138 | _version = reader.read("!B")[0] |
| 139 | assert(_version == 4) |
| 140 | _type = reader.read("!B")[0] |
| 141 | assert(_type == 19) |
| 142 | _length = reader.read("!H")[0] |
| 143 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 144 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 145 | obj.xid = reader.read("!L")[0] |
| 146 | obj.stats_type = reader.read("!H")[0] |
| 147 | obj.flags = reader.read("!H")[0] |
| 148 | reader.skip(4) |
| 149 | return obj |
| 150 | |
| 151 | def __eq__(self, other): |
| 152 | if type(self) != type(other): return False |
| 153 | if self.xid != other.xid: return False |
| 154 | if self.stats_type != other.stats_type: return False |
| 155 | if self.flags != other.flags: return False |
| 156 | return True |
| 157 | |
| 158 | def pretty_print(self, q): |
| 159 | q.text("stats_reply {") |
| 160 | with q.group(): |
| 161 | with q.indent(2): |
| 162 | q.breakable() |
| 163 | q.text("xid = "); |
| 164 | if self.xid != None: |
| 165 | q.text("%#x" % self.xid) |
| 166 | else: |
| 167 | q.text('None') |
| 168 | q.text(","); q.breakable() |
| 169 | q.text("flags = "); |
| 170 | q.text("%#x" % self.flags) |
| 171 | q.breakable() |
| 172 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 173 | |
| 174 | message.subtypes[19] = stats_reply |
| 175 | |
| 176 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 177 | version = 4 |
| 178 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 179 | stats_type = 2 |
| 180 | |
| 181 | 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] | 182 | if xid != None: |
| 183 | self.xid = xid |
| 184 | else: |
| 185 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 186 | if flags != None: |
| 187 | self.flags = flags |
| 188 | else: |
| 189 | self.flags = 0 |
| 190 | if packet_count != None: |
| 191 | self.packet_count = packet_count |
| 192 | else: |
| 193 | self.packet_count = 0 |
| 194 | if byte_count != None: |
| 195 | self.byte_count = byte_count |
| 196 | else: |
| 197 | self.byte_count = 0 |
| 198 | if flow_count != None: |
| 199 | self.flow_count = flow_count |
| 200 | else: |
| 201 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 202 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 203 | |
| 204 | def pack(self): |
| 205 | packed = [] |
| 206 | packed.append(struct.pack("!B", self.version)) |
| 207 | packed.append(struct.pack("!B", self.type)) |
| 208 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 209 | packed.append(struct.pack("!L", self.xid)) |
| 210 | packed.append(struct.pack("!H", self.stats_type)) |
| 211 | packed.append(struct.pack("!H", self.flags)) |
| 212 | packed.append('\x00' * 4) |
| 213 | packed.append(struct.pack("!Q", self.packet_count)) |
| 214 | packed.append(struct.pack("!Q", self.byte_count)) |
| 215 | packed.append(struct.pack("!L", self.flow_count)) |
| 216 | packed.append('\x00' * 4) |
| 217 | length = sum([len(x) for x in packed]) |
| 218 | packed[2] = struct.pack("!H", length) |
| 219 | return ''.join(packed) |
| 220 | |
| 221 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 222 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 223 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 224 | _version = reader.read("!B")[0] |
| 225 | assert(_version == 4) |
| 226 | _type = reader.read("!B")[0] |
| 227 | assert(_type == 19) |
| 228 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 229 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 230 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 231 | obj.xid = reader.read("!L")[0] |
| 232 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 233 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 234 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 235 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 236 | obj.packet_count = reader.read("!Q")[0] |
| 237 | obj.byte_count = reader.read("!Q")[0] |
| 238 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 239 | reader.skip(4) |
| 240 | return obj |
| 241 | |
| 242 | def __eq__(self, other): |
| 243 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 244 | if self.xid != other.xid: return False |
| 245 | if self.flags != other.flags: return False |
| 246 | if self.packet_count != other.packet_count: return False |
| 247 | if self.byte_count != other.byte_count: return False |
| 248 | if self.flow_count != other.flow_count: return False |
| 249 | return True |
| 250 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 251 | def pretty_print(self, q): |
| 252 | q.text("aggregate_stats_reply {") |
| 253 | with q.group(): |
| 254 | with q.indent(2): |
| 255 | q.breakable() |
| 256 | q.text("xid = "); |
| 257 | if self.xid != None: |
| 258 | q.text("%#x" % self.xid) |
| 259 | else: |
| 260 | q.text('None') |
| 261 | q.text(","); q.breakable() |
| 262 | q.text("flags = "); |
| 263 | q.text("%#x" % self.flags) |
| 264 | q.text(","); q.breakable() |
| 265 | q.text("packet_count = "); |
| 266 | q.text("%#x" % self.packet_count) |
| 267 | q.text(","); q.breakable() |
| 268 | q.text("byte_count = "); |
| 269 | q.text("%#x" % self.byte_count) |
| 270 | q.text(","); q.breakable() |
| 271 | q.text("flow_count = "); |
| 272 | q.text("%#x" % self.flow_count) |
| 273 | q.breakable() |
| 274 | q.text('}') |
| 275 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 276 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 277 | |
| 278 | class stats_request(message): |
| 279 | subtypes = {} |
| 280 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 281 | version = 4 |
| 282 | type = 18 |
| 283 | |
| 284 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 285 | if xid != None: |
| 286 | self.xid = xid |
| 287 | else: |
| 288 | self.xid = None |
| 289 | if stats_type != None: |
| 290 | self.stats_type = stats_type |
| 291 | else: |
| 292 | self.stats_type = 0 |
| 293 | if flags != None: |
| 294 | self.flags = flags |
| 295 | else: |
| 296 | self.flags = 0 |
| 297 | return |
| 298 | |
| 299 | def pack(self): |
| 300 | packed = [] |
| 301 | packed.append(struct.pack("!B", self.version)) |
| 302 | packed.append(struct.pack("!B", self.type)) |
| 303 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 304 | packed.append(struct.pack("!L", self.xid)) |
| 305 | packed.append(struct.pack("!H", self.stats_type)) |
| 306 | packed.append(struct.pack("!H", self.flags)) |
| 307 | packed.append('\x00' * 4) |
| 308 | length = sum([len(x) for x in packed]) |
| 309 | packed[2] = struct.pack("!H", length) |
| 310 | return ''.join(packed) |
| 311 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 312 | @staticmethod |
| 313 | def unpack(reader): |
| 314 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 315 | subclass = stats_request.subtypes.get(subtype) |
| 316 | if subclass: |
| 317 | return subclass.unpack(reader) |
| 318 | |
| 319 | obj = stats_request() |
| 320 | _version = reader.read("!B")[0] |
| 321 | assert(_version == 4) |
| 322 | _type = reader.read("!B")[0] |
| 323 | assert(_type == 18) |
| 324 | _length = reader.read("!H")[0] |
| 325 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 326 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 327 | obj.xid = reader.read("!L")[0] |
| 328 | obj.stats_type = reader.read("!H")[0] |
| 329 | obj.flags = reader.read("!H")[0] |
| 330 | reader.skip(4) |
| 331 | return obj |
| 332 | |
| 333 | def __eq__(self, other): |
| 334 | if type(self) != type(other): return False |
| 335 | if self.xid != other.xid: return False |
| 336 | if self.stats_type != other.stats_type: return False |
| 337 | if self.flags != other.flags: return False |
| 338 | return True |
| 339 | |
| 340 | def pretty_print(self, q): |
| 341 | q.text("stats_request {") |
| 342 | with q.group(): |
| 343 | with q.indent(2): |
| 344 | q.breakable() |
| 345 | q.text("xid = "); |
| 346 | if self.xid != None: |
| 347 | q.text("%#x" % self.xid) |
| 348 | else: |
| 349 | q.text('None') |
| 350 | q.text(","); q.breakable() |
| 351 | q.text("flags = "); |
| 352 | q.text("%#x" % self.flags) |
| 353 | q.breakable() |
| 354 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 355 | |
| 356 | message.subtypes[18] = stats_request |
| 357 | |
| 358 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 359 | version = 4 |
| 360 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 361 | stats_type = 2 |
| 362 | |
| 363 | 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] | 364 | if xid != None: |
| 365 | self.xid = xid |
| 366 | else: |
| 367 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 368 | if flags != None: |
| 369 | self.flags = flags |
| 370 | else: |
| 371 | self.flags = 0 |
| 372 | if table_id != None: |
| 373 | self.table_id = table_id |
| 374 | else: |
| 375 | self.table_id = 0 |
| 376 | if out_port != None: |
| 377 | self.out_port = out_port |
| 378 | else: |
| 379 | self.out_port = 0 |
| 380 | if out_group != None: |
| 381 | self.out_group = out_group |
| 382 | else: |
| 383 | self.out_group = 0 |
| 384 | if cookie != None: |
| 385 | self.cookie = cookie |
| 386 | else: |
| 387 | self.cookie = 0 |
| 388 | if cookie_mask != None: |
| 389 | self.cookie_mask = cookie_mask |
| 390 | else: |
| 391 | self.cookie_mask = 0 |
| 392 | if match != None: |
| 393 | self.match = match |
| 394 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 395 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 396 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 397 | |
| 398 | def pack(self): |
| 399 | packed = [] |
| 400 | packed.append(struct.pack("!B", self.version)) |
| 401 | packed.append(struct.pack("!B", self.type)) |
| 402 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 403 | packed.append(struct.pack("!L", self.xid)) |
| 404 | packed.append(struct.pack("!H", self.stats_type)) |
| 405 | packed.append(struct.pack("!H", self.flags)) |
| 406 | packed.append('\x00' * 4) |
| 407 | packed.append(struct.pack("!B", self.table_id)) |
| 408 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 409 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 410 | packed.append(struct.pack("!L", self.out_group)) |
| 411 | packed.append('\x00' * 4) |
| 412 | packed.append(struct.pack("!Q", self.cookie)) |
| 413 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 414 | packed.append(self.match.pack()) |
| 415 | length = sum([len(x) for x in packed]) |
| 416 | packed[2] = struct.pack("!H", length) |
| 417 | return ''.join(packed) |
| 418 | |
| 419 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 420 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 421 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 422 | _version = reader.read("!B")[0] |
| 423 | assert(_version == 4) |
| 424 | _type = reader.read("!B")[0] |
| 425 | assert(_type == 18) |
| 426 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 427 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 428 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 429 | obj.xid = reader.read("!L")[0] |
| 430 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 431 | assert(_stats_type == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 432 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 433 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 434 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 435 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 436 | obj.out_port = util.unpack_port_no(reader) |
| 437 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 438 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 439 | obj.cookie = reader.read("!Q")[0] |
| 440 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 441 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 442 | return obj |
| 443 | |
| 444 | def __eq__(self, other): |
| 445 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 446 | if self.xid != other.xid: return False |
| 447 | if self.flags != other.flags: return False |
| 448 | if self.table_id != other.table_id: return False |
| 449 | if self.out_port != other.out_port: return False |
| 450 | if self.out_group != other.out_group: return False |
| 451 | if self.cookie != other.cookie: return False |
| 452 | if self.cookie_mask != other.cookie_mask: return False |
| 453 | if self.match != other.match: return False |
| 454 | return True |
| 455 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 456 | def pretty_print(self, q): |
| 457 | q.text("aggregate_stats_request {") |
| 458 | with q.group(): |
| 459 | with q.indent(2): |
| 460 | q.breakable() |
| 461 | q.text("xid = "); |
| 462 | if self.xid != None: |
| 463 | q.text("%#x" % self.xid) |
| 464 | else: |
| 465 | q.text('None') |
| 466 | q.text(","); q.breakable() |
| 467 | q.text("flags = "); |
| 468 | q.text("%#x" % self.flags) |
| 469 | q.text(","); q.breakable() |
| 470 | q.text("table_id = "); |
| 471 | q.text("%#x" % self.table_id) |
| 472 | q.text(","); q.breakable() |
| 473 | q.text("out_port = "); |
| 474 | q.text(util.pretty_port(self.out_port)) |
| 475 | q.text(","); q.breakable() |
| 476 | q.text("out_group = "); |
| 477 | q.text("%#x" % self.out_group) |
| 478 | q.text(","); q.breakable() |
| 479 | q.text("cookie = "); |
| 480 | q.text("%#x" % self.cookie) |
| 481 | q.text(","); q.breakable() |
| 482 | q.text("cookie_mask = "); |
| 483 | q.text("%#x" % self.cookie_mask) |
| 484 | q.text(","); q.breakable() |
| 485 | q.text("match = "); |
| 486 | q.pp(self.match) |
| 487 | q.breakable() |
| 488 | q.text('}') |
| 489 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 490 | stats_request.subtypes[2] = aggregate_stats_request |
| 491 | |
| 492 | class async_get_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 493 | version = 4 |
| 494 | type = 27 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 495 | |
| 496 | 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] | 497 | if xid != None: |
| 498 | self.xid = xid |
| 499 | else: |
| 500 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 501 | if packet_in_mask_equal_master != None: |
| 502 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 503 | else: |
| 504 | self.packet_in_mask_equal_master = 0 |
| 505 | if packet_in_mask_slave != None: |
| 506 | self.packet_in_mask_slave = packet_in_mask_slave |
| 507 | else: |
| 508 | self.packet_in_mask_slave = 0 |
| 509 | if port_status_mask_equal_master != None: |
| 510 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 511 | else: |
| 512 | self.port_status_mask_equal_master = 0 |
| 513 | if port_status_mask_slave != None: |
| 514 | self.port_status_mask_slave = port_status_mask_slave |
| 515 | else: |
| 516 | self.port_status_mask_slave = 0 |
| 517 | if flow_removed_mask_equal_master != None: |
| 518 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 519 | else: |
| 520 | self.flow_removed_mask_equal_master = 0 |
| 521 | if flow_removed_mask_slave != None: |
| 522 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 523 | else: |
| 524 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 525 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 526 | |
| 527 | def pack(self): |
| 528 | packed = [] |
| 529 | packed.append(struct.pack("!B", self.version)) |
| 530 | packed.append(struct.pack("!B", self.type)) |
| 531 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 532 | packed.append(struct.pack("!L", self.xid)) |
| 533 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 534 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 535 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 536 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 537 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 538 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 539 | length = sum([len(x) for x in packed]) |
| 540 | packed[2] = struct.pack("!H", length) |
| 541 | return ''.join(packed) |
| 542 | |
| 543 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 544 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 545 | obj = async_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 546 | _version = reader.read("!B")[0] |
| 547 | assert(_version == 4) |
| 548 | _type = reader.read("!B")[0] |
| 549 | assert(_type == 27) |
| 550 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 551 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 552 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 553 | obj.xid = reader.read("!L")[0] |
| 554 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 555 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 556 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 557 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 558 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 559 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 560 | return obj |
| 561 | |
| 562 | def __eq__(self, other): |
| 563 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 564 | if self.xid != other.xid: return False |
| 565 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 566 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 567 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 568 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 569 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 570 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 571 | return True |
| 572 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 573 | def pretty_print(self, q): |
| 574 | q.text("async_get_reply {") |
| 575 | with q.group(): |
| 576 | with q.indent(2): |
| 577 | q.breakable() |
| 578 | q.text("xid = "); |
| 579 | if self.xid != None: |
| 580 | q.text("%#x" % self.xid) |
| 581 | else: |
| 582 | q.text('None') |
| 583 | q.text(","); q.breakable() |
| 584 | q.text("packet_in_mask_equal_master = "); |
| 585 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 586 | q.text(","); q.breakable() |
| 587 | q.text("packet_in_mask_slave = "); |
| 588 | q.text("%#x" % self.packet_in_mask_slave) |
| 589 | q.text(","); q.breakable() |
| 590 | q.text("port_status_mask_equal_master = "); |
| 591 | q.text("%#x" % self.port_status_mask_equal_master) |
| 592 | q.text(","); q.breakable() |
| 593 | q.text("port_status_mask_slave = "); |
| 594 | q.text("%#x" % self.port_status_mask_slave) |
| 595 | q.text(","); q.breakable() |
| 596 | q.text("flow_removed_mask_equal_master = "); |
| 597 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 598 | q.text(","); q.breakable() |
| 599 | q.text("flow_removed_mask_slave = "); |
| 600 | q.text("%#x" % self.flow_removed_mask_slave) |
| 601 | q.breakable() |
| 602 | q.text('}') |
| 603 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 604 | message.subtypes[27] = async_get_reply |
| 605 | |
| 606 | class async_get_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 607 | version = 4 |
| 608 | type = 26 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 609 | |
| 610 | 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] | 611 | if xid != None: |
| 612 | self.xid = xid |
| 613 | else: |
| 614 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 615 | if packet_in_mask_equal_master != None: |
| 616 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 617 | else: |
| 618 | self.packet_in_mask_equal_master = 0 |
| 619 | if packet_in_mask_slave != None: |
| 620 | self.packet_in_mask_slave = packet_in_mask_slave |
| 621 | else: |
| 622 | self.packet_in_mask_slave = 0 |
| 623 | if port_status_mask_equal_master != None: |
| 624 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 625 | else: |
| 626 | self.port_status_mask_equal_master = 0 |
| 627 | if port_status_mask_slave != None: |
| 628 | self.port_status_mask_slave = port_status_mask_slave |
| 629 | else: |
| 630 | self.port_status_mask_slave = 0 |
| 631 | if flow_removed_mask_equal_master != None: |
| 632 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 633 | else: |
| 634 | self.flow_removed_mask_equal_master = 0 |
| 635 | if flow_removed_mask_slave != None: |
| 636 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 637 | else: |
| 638 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 639 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 640 | |
| 641 | def pack(self): |
| 642 | packed = [] |
| 643 | packed.append(struct.pack("!B", self.version)) |
| 644 | packed.append(struct.pack("!B", self.type)) |
| 645 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 646 | packed.append(struct.pack("!L", self.xid)) |
| 647 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 648 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 649 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 650 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 651 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 652 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 653 | length = sum([len(x) for x in packed]) |
| 654 | packed[2] = struct.pack("!H", length) |
| 655 | return ''.join(packed) |
| 656 | |
| 657 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 658 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 659 | obj = async_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 660 | _version = reader.read("!B")[0] |
| 661 | assert(_version == 4) |
| 662 | _type = reader.read("!B")[0] |
| 663 | assert(_type == 26) |
| 664 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 665 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 666 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 667 | obj.xid = reader.read("!L")[0] |
| 668 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 669 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 670 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 671 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 672 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 673 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 674 | return obj |
| 675 | |
| 676 | def __eq__(self, other): |
| 677 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 678 | if self.xid != other.xid: return False |
| 679 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 680 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 681 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 682 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 683 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 684 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 685 | return True |
| 686 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 687 | def pretty_print(self, q): |
| 688 | q.text("async_get_request {") |
| 689 | with q.group(): |
| 690 | with q.indent(2): |
| 691 | q.breakable() |
| 692 | q.text("xid = "); |
| 693 | if self.xid != None: |
| 694 | q.text("%#x" % self.xid) |
| 695 | else: |
| 696 | q.text('None') |
| 697 | q.text(","); q.breakable() |
| 698 | q.text("packet_in_mask_equal_master = "); |
| 699 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 700 | q.text(","); q.breakable() |
| 701 | q.text("packet_in_mask_slave = "); |
| 702 | q.text("%#x" % self.packet_in_mask_slave) |
| 703 | q.text(","); q.breakable() |
| 704 | q.text("port_status_mask_equal_master = "); |
| 705 | q.text("%#x" % self.port_status_mask_equal_master) |
| 706 | q.text(","); q.breakable() |
| 707 | q.text("port_status_mask_slave = "); |
| 708 | q.text("%#x" % self.port_status_mask_slave) |
| 709 | q.text(","); q.breakable() |
| 710 | q.text("flow_removed_mask_equal_master = "); |
| 711 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 712 | q.text(","); q.breakable() |
| 713 | q.text("flow_removed_mask_slave = "); |
| 714 | q.text("%#x" % self.flow_removed_mask_slave) |
| 715 | q.breakable() |
| 716 | q.text('}') |
| 717 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 718 | message.subtypes[26] = async_get_request |
| 719 | |
| 720 | class async_set(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 721 | version = 4 |
| 722 | type = 28 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 723 | |
| 724 | 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] | 725 | if xid != None: |
| 726 | self.xid = xid |
| 727 | else: |
| 728 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 729 | if packet_in_mask_equal_master != None: |
| 730 | self.packet_in_mask_equal_master = packet_in_mask_equal_master |
| 731 | else: |
| 732 | self.packet_in_mask_equal_master = 0 |
| 733 | if packet_in_mask_slave != None: |
| 734 | self.packet_in_mask_slave = packet_in_mask_slave |
| 735 | else: |
| 736 | self.packet_in_mask_slave = 0 |
| 737 | if port_status_mask_equal_master != None: |
| 738 | self.port_status_mask_equal_master = port_status_mask_equal_master |
| 739 | else: |
| 740 | self.port_status_mask_equal_master = 0 |
| 741 | if port_status_mask_slave != None: |
| 742 | self.port_status_mask_slave = port_status_mask_slave |
| 743 | else: |
| 744 | self.port_status_mask_slave = 0 |
| 745 | if flow_removed_mask_equal_master != None: |
| 746 | self.flow_removed_mask_equal_master = flow_removed_mask_equal_master |
| 747 | else: |
| 748 | self.flow_removed_mask_equal_master = 0 |
| 749 | if flow_removed_mask_slave != None: |
| 750 | self.flow_removed_mask_slave = flow_removed_mask_slave |
| 751 | else: |
| 752 | self.flow_removed_mask_slave = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 753 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 754 | |
| 755 | def pack(self): |
| 756 | packed = [] |
| 757 | packed.append(struct.pack("!B", self.version)) |
| 758 | packed.append(struct.pack("!B", self.type)) |
| 759 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 760 | packed.append(struct.pack("!L", self.xid)) |
| 761 | packed.append(struct.pack("!L", self.packet_in_mask_equal_master)) |
| 762 | packed.append(struct.pack("!L", self.packet_in_mask_slave)) |
| 763 | packed.append(struct.pack("!L", self.port_status_mask_equal_master)) |
| 764 | packed.append(struct.pack("!L", self.port_status_mask_slave)) |
| 765 | packed.append(struct.pack("!L", self.flow_removed_mask_equal_master)) |
| 766 | packed.append(struct.pack("!L", self.flow_removed_mask_slave)) |
| 767 | length = sum([len(x) for x in packed]) |
| 768 | packed[2] = struct.pack("!H", length) |
| 769 | return ''.join(packed) |
| 770 | |
| 771 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 772 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 773 | obj = async_set() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 774 | _version = reader.read("!B")[0] |
| 775 | assert(_version == 4) |
| 776 | _type = reader.read("!B")[0] |
| 777 | assert(_type == 28) |
| 778 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 779 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 780 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 781 | obj.xid = reader.read("!L")[0] |
| 782 | obj.packet_in_mask_equal_master = reader.read("!L")[0] |
| 783 | obj.packet_in_mask_slave = reader.read("!L")[0] |
| 784 | obj.port_status_mask_equal_master = reader.read("!L")[0] |
| 785 | obj.port_status_mask_slave = reader.read("!L")[0] |
| 786 | obj.flow_removed_mask_equal_master = reader.read("!L")[0] |
| 787 | obj.flow_removed_mask_slave = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 788 | return obj |
| 789 | |
| 790 | def __eq__(self, other): |
| 791 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 792 | if self.xid != other.xid: return False |
| 793 | if self.packet_in_mask_equal_master != other.packet_in_mask_equal_master: return False |
| 794 | if self.packet_in_mask_slave != other.packet_in_mask_slave: return False |
| 795 | if self.port_status_mask_equal_master != other.port_status_mask_equal_master: return False |
| 796 | if self.port_status_mask_slave != other.port_status_mask_slave: return False |
| 797 | if self.flow_removed_mask_equal_master != other.flow_removed_mask_equal_master: return False |
| 798 | if self.flow_removed_mask_slave != other.flow_removed_mask_slave: return False |
| 799 | return True |
| 800 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 801 | def pretty_print(self, q): |
| 802 | q.text("async_set {") |
| 803 | with q.group(): |
| 804 | with q.indent(2): |
| 805 | q.breakable() |
| 806 | q.text("xid = "); |
| 807 | if self.xid != None: |
| 808 | q.text("%#x" % self.xid) |
| 809 | else: |
| 810 | q.text('None') |
| 811 | q.text(","); q.breakable() |
| 812 | q.text("packet_in_mask_equal_master = "); |
| 813 | q.text("%#x" % self.packet_in_mask_equal_master) |
| 814 | q.text(","); q.breakable() |
| 815 | q.text("packet_in_mask_slave = "); |
| 816 | q.text("%#x" % self.packet_in_mask_slave) |
| 817 | q.text(","); q.breakable() |
| 818 | q.text("port_status_mask_equal_master = "); |
| 819 | q.text("%#x" % self.port_status_mask_equal_master) |
| 820 | q.text(","); q.breakable() |
| 821 | q.text("port_status_mask_slave = "); |
| 822 | q.text("%#x" % self.port_status_mask_slave) |
| 823 | q.text(","); q.breakable() |
| 824 | q.text("flow_removed_mask_equal_master = "); |
| 825 | q.text("%#x" % self.flow_removed_mask_equal_master) |
| 826 | q.text(","); q.breakable() |
| 827 | q.text("flow_removed_mask_slave = "); |
| 828 | q.text("%#x" % self.flow_removed_mask_slave) |
| 829 | q.breakable() |
| 830 | q.text('}') |
| 831 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 832 | message.subtypes[28] = async_set |
| 833 | |
| 834 | class error_msg(message): |
| 835 | subtypes = {} |
| 836 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 837 | version = 4 |
| 838 | type = 1 |
| 839 | |
| 840 | def __init__(self, xid=None, err_type=None): |
| 841 | if xid != None: |
| 842 | self.xid = xid |
| 843 | else: |
| 844 | self.xid = None |
| 845 | if err_type != None: |
| 846 | self.err_type = err_type |
| 847 | else: |
| 848 | self.err_type = 0 |
| 849 | return |
| 850 | |
| 851 | def pack(self): |
| 852 | packed = [] |
| 853 | packed.append(struct.pack("!B", self.version)) |
| 854 | packed.append(struct.pack("!B", self.type)) |
| 855 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 856 | packed.append(struct.pack("!L", self.xid)) |
| 857 | packed.append(struct.pack("!H", self.err_type)) |
| 858 | length = sum([len(x) for x in packed]) |
| 859 | packed[2] = struct.pack("!H", length) |
| 860 | return ''.join(packed) |
| 861 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 862 | @staticmethod |
| 863 | def unpack(reader): |
| 864 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 865 | subclass = error_msg.subtypes.get(subtype) |
| 866 | if subclass: |
| 867 | return subclass.unpack(reader) |
| 868 | |
| 869 | obj = error_msg() |
| 870 | _version = reader.read("!B")[0] |
| 871 | assert(_version == 4) |
| 872 | _type = reader.read("!B")[0] |
| 873 | assert(_type == 1) |
| 874 | _length = reader.read("!H")[0] |
| 875 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 876 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 877 | obj.xid = reader.read("!L")[0] |
| 878 | obj.err_type = reader.read("!H")[0] |
| 879 | return obj |
| 880 | |
| 881 | def __eq__(self, other): |
| 882 | if type(self) != type(other): return False |
| 883 | if self.xid != other.xid: return False |
| 884 | if self.err_type != other.err_type: return False |
| 885 | return True |
| 886 | |
| 887 | def pretty_print(self, q): |
| 888 | q.text("error_msg {") |
| 889 | with q.group(): |
| 890 | with q.indent(2): |
| 891 | q.breakable() |
| 892 | q.text("xid = "); |
| 893 | if self.xid != None: |
| 894 | q.text("%#x" % self.xid) |
| 895 | else: |
| 896 | q.text('None') |
| 897 | q.breakable() |
| 898 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 899 | |
| 900 | message.subtypes[1] = error_msg |
| 901 | |
| 902 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 903 | version = 4 |
| 904 | type = 1 |
| 905 | err_type = 2 |
| 906 | |
| 907 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 908 | if xid != None: |
| 909 | self.xid = xid |
| 910 | else: |
| 911 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 912 | if code != None: |
| 913 | self.code = code |
| 914 | else: |
| 915 | self.code = 0 |
| 916 | if data != None: |
| 917 | self.data = data |
| 918 | else: |
| 919 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 920 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 921 | |
| 922 | def pack(self): |
| 923 | packed = [] |
| 924 | packed.append(struct.pack("!B", self.version)) |
| 925 | packed.append(struct.pack("!B", self.type)) |
| 926 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 927 | packed.append(struct.pack("!L", self.xid)) |
| 928 | packed.append(struct.pack("!H", self.err_type)) |
| 929 | packed.append(struct.pack("!H", self.code)) |
| 930 | packed.append(self.data) |
| 931 | length = sum([len(x) for x in packed]) |
| 932 | packed[2] = struct.pack("!H", length) |
| 933 | return ''.join(packed) |
| 934 | |
| 935 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 936 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 937 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 938 | _version = reader.read("!B")[0] |
| 939 | assert(_version == 4) |
| 940 | _type = reader.read("!B")[0] |
| 941 | assert(_type == 1) |
| 942 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 943 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 944 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 945 | obj.xid = reader.read("!L")[0] |
| 946 | _err_type = reader.read("!H")[0] |
| 947 | assert(_err_type == 2) |
| 948 | obj.code = reader.read("!H")[0] |
| 949 | obj.data = str(reader.read_all()) |
| 950 | return obj |
| 951 | |
| 952 | def __eq__(self, other): |
| 953 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 954 | if self.xid != other.xid: return False |
| 955 | if self.code != other.code: return False |
| 956 | if self.data != other.data: return False |
| 957 | return True |
| 958 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 959 | def pretty_print(self, q): |
| 960 | q.text("bad_action_error_msg {") |
| 961 | with q.group(): |
| 962 | with q.indent(2): |
| 963 | q.breakable() |
| 964 | q.text("xid = "); |
| 965 | if self.xid != None: |
| 966 | q.text("%#x" % self.xid) |
| 967 | else: |
| 968 | q.text('None') |
| 969 | q.text(","); q.breakable() |
| 970 | q.text("code = "); |
| 971 | q.text("%#x" % self.code) |
| 972 | q.text(","); q.breakable() |
| 973 | q.text("data = "); |
| 974 | q.pp(self.data) |
| 975 | q.breakable() |
| 976 | q.text('}') |
| 977 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 978 | error_msg.subtypes[2] = bad_action_error_msg |
| 979 | |
| 980 | class bad_instruction_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 981 | version = 4 |
| 982 | type = 1 |
| 983 | err_type = 3 |
| 984 | |
| 985 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 986 | if xid != None: |
| 987 | self.xid = xid |
| 988 | else: |
| 989 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 990 | if code != None: |
| 991 | self.code = code |
| 992 | else: |
| 993 | self.code = 0 |
| 994 | if data != None: |
| 995 | self.data = data |
| 996 | else: |
| 997 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 998 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 999 | |
| 1000 | def pack(self): |
| 1001 | packed = [] |
| 1002 | packed.append(struct.pack("!B", self.version)) |
| 1003 | packed.append(struct.pack("!B", self.type)) |
| 1004 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1005 | packed.append(struct.pack("!L", self.xid)) |
| 1006 | packed.append(struct.pack("!H", self.err_type)) |
| 1007 | packed.append(struct.pack("!H", self.code)) |
| 1008 | packed.append(self.data) |
| 1009 | length = sum([len(x) for x in packed]) |
| 1010 | packed[2] = struct.pack("!H", length) |
| 1011 | return ''.join(packed) |
| 1012 | |
| 1013 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1014 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1015 | obj = bad_instruction_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1016 | _version = reader.read("!B")[0] |
| 1017 | assert(_version == 4) |
| 1018 | _type = reader.read("!B")[0] |
| 1019 | assert(_type == 1) |
| 1020 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1021 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1022 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1023 | obj.xid = reader.read("!L")[0] |
| 1024 | _err_type = reader.read("!H")[0] |
| 1025 | assert(_err_type == 3) |
| 1026 | obj.code = reader.read("!H")[0] |
| 1027 | obj.data = str(reader.read_all()) |
| 1028 | return obj |
| 1029 | |
| 1030 | def __eq__(self, other): |
| 1031 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1032 | if self.xid != other.xid: return False |
| 1033 | if self.code != other.code: return False |
| 1034 | if self.data != other.data: return False |
| 1035 | return True |
| 1036 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1037 | def pretty_print(self, q): |
| 1038 | q.text("bad_instruction_error_msg {") |
| 1039 | with q.group(): |
| 1040 | with q.indent(2): |
| 1041 | q.breakable() |
| 1042 | q.text("xid = "); |
| 1043 | if self.xid != None: |
| 1044 | q.text("%#x" % self.xid) |
| 1045 | else: |
| 1046 | q.text('None') |
| 1047 | q.text(","); q.breakable() |
| 1048 | q.text("code = "); |
| 1049 | q.text("%#x" % self.code) |
| 1050 | q.text(","); q.breakable() |
| 1051 | q.text("data = "); |
| 1052 | q.pp(self.data) |
| 1053 | q.breakable() |
| 1054 | q.text('}') |
| 1055 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1056 | error_msg.subtypes[3] = bad_instruction_error_msg |
| 1057 | |
| 1058 | class bad_match_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1059 | version = 4 |
| 1060 | type = 1 |
| 1061 | err_type = 4 |
| 1062 | |
| 1063 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1064 | if xid != None: |
| 1065 | self.xid = xid |
| 1066 | else: |
| 1067 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1068 | if code != None: |
| 1069 | self.code = code |
| 1070 | else: |
| 1071 | self.code = 0 |
| 1072 | if data != None: |
| 1073 | self.data = data |
| 1074 | else: |
| 1075 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1076 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1077 | |
| 1078 | def pack(self): |
| 1079 | packed = [] |
| 1080 | packed.append(struct.pack("!B", self.version)) |
| 1081 | packed.append(struct.pack("!B", self.type)) |
| 1082 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1083 | packed.append(struct.pack("!L", self.xid)) |
| 1084 | packed.append(struct.pack("!H", self.err_type)) |
| 1085 | packed.append(struct.pack("!H", self.code)) |
| 1086 | packed.append(self.data) |
| 1087 | length = sum([len(x) for x in packed]) |
| 1088 | packed[2] = struct.pack("!H", length) |
| 1089 | return ''.join(packed) |
| 1090 | |
| 1091 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1092 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1093 | obj = bad_match_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1094 | _version = reader.read("!B")[0] |
| 1095 | assert(_version == 4) |
| 1096 | _type = reader.read("!B")[0] |
| 1097 | assert(_type == 1) |
| 1098 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1099 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1100 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1101 | obj.xid = reader.read("!L")[0] |
| 1102 | _err_type = reader.read("!H")[0] |
| 1103 | assert(_err_type == 4) |
| 1104 | obj.code = reader.read("!H")[0] |
| 1105 | obj.data = str(reader.read_all()) |
| 1106 | return obj |
| 1107 | |
| 1108 | def __eq__(self, other): |
| 1109 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1110 | if self.xid != other.xid: return False |
| 1111 | if self.code != other.code: return False |
| 1112 | if self.data != other.data: return False |
| 1113 | return True |
| 1114 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1115 | def pretty_print(self, q): |
| 1116 | q.text("bad_match_error_msg {") |
| 1117 | with q.group(): |
| 1118 | with q.indent(2): |
| 1119 | q.breakable() |
| 1120 | q.text("xid = "); |
| 1121 | if self.xid != None: |
| 1122 | q.text("%#x" % self.xid) |
| 1123 | else: |
| 1124 | q.text('None') |
| 1125 | q.text(","); q.breakable() |
| 1126 | q.text("code = "); |
| 1127 | q.text("%#x" % self.code) |
| 1128 | q.text(","); q.breakable() |
| 1129 | q.text("data = "); |
| 1130 | q.pp(self.data) |
| 1131 | q.breakable() |
| 1132 | q.text('}') |
| 1133 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1134 | error_msg.subtypes[4] = bad_match_error_msg |
| 1135 | |
| 1136 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1137 | version = 4 |
| 1138 | type = 1 |
| 1139 | err_type = 1 |
| 1140 | |
| 1141 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1142 | if xid != None: |
| 1143 | self.xid = xid |
| 1144 | else: |
| 1145 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1146 | if code != None: |
| 1147 | self.code = code |
| 1148 | else: |
| 1149 | self.code = 0 |
| 1150 | if data != None: |
| 1151 | self.data = data |
| 1152 | else: |
| 1153 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1154 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1155 | |
| 1156 | def pack(self): |
| 1157 | packed = [] |
| 1158 | packed.append(struct.pack("!B", self.version)) |
| 1159 | packed.append(struct.pack("!B", self.type)) |
| 1160 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1161 | packed.append(struct.pack("!L", self.xid)) |
| 1162 | packed.append(struct.pack("!H", self.err_type)) |
| 1163 | packed.append(struct.pack("!H", self.code)) |
| 1164 | packed.append(self.data) |
| 1165 | length = sum([len(x) for x in packed]) |
| 1166 | packed[2] = struct.pack("!H", length) |
| 1167 | return ''.join(packed) |
| 1168 | |
| 1169 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1170 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1171 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1172 | _version = reader.read("!B")[0] |
| 1173 | assert(_version == 4) |
| 1174 | _type = reader.read("!B")[0] |
| 1175 | assert(_type == 1) |
| 1176 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1177 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1178 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1179 | obj.xid = reader.read("!L")[0] |
| 1180 | _err_type = reader.read("!H")[0] |
| 1181 | assert(_err_type == 1) |
| 1182 | obj.code = reader.read("!H")[0] |
| 1183 | obj.data = str(reader.read_all()) |
| 1184 | return obj |
| 1185 | |
| 1186 | def __eq__(self, other): |
| 1187 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1188 | if self.xid != other.xid: return False |
| 1189 | if self.code != other.code: return False |
| 1190 | if self.data != other.data: return False |
| 1191 | return True |
| 1192 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1193 | def pretty_print(self, q): |
| 1194 | q.text("bad_request_error_msg {") |
| 1195 | with q.group(): |
| 1196 | with q.indent(2): |
| 1197 | q.breakable() |
| 1198 | q.text("xid = "); |
| 1199 | if self.xid != None: |
| 1200 | q.text("%#x" % self.xid) |
| 1201 | else: |
| 1202 | q.text('None') |
| 1203 | q.text(","); q.breakable() |
| 1204 | q.text("code = "); |
| 1205 | q.text("%#x" % self.code) |
| 1206 | q.text(","); q.breakable() |
| 1207 | q.text("data = "); |
| 1208 | q.pp(self.data) |
| 1209 | q.breakable() |
| 1210 | q.text('}') |
| 1211 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1212 | error_msg.subtypes[1] = bad_request_error_msg |
| 1213 | |
| 1214 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1215 | version = 4 |
| 1216 | type = 21 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1217 | |
| 1218 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1219 | if xid != None: |
| 1220 | self.xid = xid |
| 1221 | else: |
| 1222 | self.xid = None |
| 1223 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1224 | |
| 1225 | def pack(self): |
| 1226 | packed = [] |
| 1227 | packed.append(struct.pack("!B", self.version)) |
| 1228 | packed.append(struct.pack("!B", self.type)) |
| 1229 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1230 | packed.append(struct.pack("!L", self.xid)) |
| 1231 | length = sum([len(x) for x in packed]) |
| 1232 | packed[2] = struct.pack("!H", length) |
| 1233 | return ''.join(packed) |
| 1234 | |
| 1235 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1236 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1237 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1238 | _version = reader.read("!B")[0] |
| 1239 | assert(_version == 4) |
| 1240 | _type = reader.read("!B")[0] |
| 1241 | assert(_type == 21) |
| 1242 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1243 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1244 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1245 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1246 | return obj |
| 1247 | |
| 1248 | def __eq__(self, other): |
| 1249 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1250 | if self.xid != other.xid: return False |
| 1251 | return True |
| 1252 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1253 | def pretty_print(self, q): |
| 1254 | q.text("barrier_reply {") |
| 1255 | with q.group(): |
| 1256 | with q.indent(2): |
| 1257 | q.breakable() |
| 1258 | q.text("xid = "); |
| 1259 | if self.xid != None: |
| 1260 | q.text("%#x" % self.xid) |
| 1261 | else: |
| 1262 | q.text('None') |
| 1263 | q.breakable() |
| 1264 | q.text('}') |
| 1265 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1266 | message.subtypes[21] = barrier_reply |
| 1267 | |
| 1268 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1269 | version = 4 |
| 1270 | type = 20 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1271 | |
| 1272 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1273 | if xid != None: |
| 1274 | self.xid = xid |
| 1275 | else: |
| 1276 | self.xid = None |
| 1277 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1278 | |
| 1279 | def pack(self): |
| 1280 | packed = [] |
| 1281 | packed.append(struct.pack("!B", self.version)) |
| 1282 | packed.append(struct.pack("!B", self.type)) |
| 1283 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1284 | packed.append(struct.pack("!L", self.xid)) |
| 1285 | length = sum([len(x) for x in packed]) |
| 1286 | packed[2] = struct.pack("!H", length) |
| 1287 | return ''.join(packed) |
| 1288 | |
| 1289 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1290 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1291 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1292 | _version = reader.read("!B")[0] |
| 1293 | assert(_version == 4) |
| 1294 | _type = reader.read("!B")[0] |
| 1295 | assert(_type == 20) |
| 1296 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1297 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1298 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1299 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1300 | return obj |
| 1301 | |
| 1302 | def __eq__(self, other): |
| 1303 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1304 | if self.xid != other.xid: return False |
| 1305 | return True |
| 1306 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1307 | def pretty_print(self, q): |
| 1308 | q.text("barrier_request {") |
| 1309 | with q.group(): |
| 1310 | with q.indent(2): |
| 1311 | q.breakable() |
| 1312 | q.text("xid = "); |
| 1313 | if self.xid != None: |
| 1314 | q.text("%#x" % self.xid) |
| 1315 | else: |
| 1316 | q.text('None') |
| 1317 | q.breakable() |
| 1318 | q.text('}') |
| 1319 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1320 | message.subtypes[20] = barrier_request |
| 1321 | |
| 1322 | class experimenter(message): |
| 1323 | subtypes = {} |
| 1324 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1325 | version = 4 |
| 1326 | type = 4 |
| 1327 | |
| 1328 | def __init__(self, xid=None, experimenter=None, subtype=None, data=None): |
| 1329 | if xid != None: |
| 1330 | self.xid = xid |
| 1331 | else: |
| 1332 | self.xid = None |
| 1333 | if experimenter != None: |
| 1334 | self.experimenter = experimenter |
| 1335 | else: |
| 1336 | self.experimenter = 0 |
| 1337 | if subtype != None: |
| 1338 | self.subtype = subtype |
| 1339 | else: |
| 1340 | self.subtype = 0 |
| 1341 | if data != None: |
| 1342 | self.data = data |
| 1343 | else: |
| 1344 | self.data = '' |
| 1345 | return |
| 1346 | |
| 1347 | def pack(self): |
| 1348 | packed = [] |
| 1349 | packed.append(struct.pack("!B", self.version)) |
| 1350 | packed.append(struct.pack("!B", self.type)) |
| 1351 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1352 | packed.append(struct.pack("!L", self.xid)) |
| 1353 | packed.append(struct.pack("!L", self.experimenter)) |
| 1354 | packed.append(struct.pack("!L", self.subtype)) |
| 1355 | packed.append(self.data) |
| 1356 | length = sum([len(x) for x in packed]) |
| 1357 | packed[2] = struct.pack("!H", length) |
| 1358 | return ''.join(packed) |
| 1359 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1360 | @staticmethod |
| 1361 | def unpack(reader): |
| 1362 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1363 | subclass = experimenter.subtypes.get(subtype) |
| 1364 | if subclass: |
| 1365 | return subclass.unpack(reader) |
| 1366 | |
| 1367 | obj = experimenter() |
| 1368 | _version = reader.read("!B")[0] |
| 1369 | assert(_version == 4) |
| 1370 | _type = reader.read("!B")[0] |
| 1371 | assert(_type == 4) |
| 1372 | _length = reader.read("!H")[0] |
| 1373 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1374 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1375 | obj.xid = reader.read("!L")[0] |
| 1376 | obj.experimenter = reader.read("!L")[0] |
| 1377 | obj.subtype = reader.read("!L")[0] |
| 1378 | obj.data = str(reader.read_all()) |
| 1379 | return obj |
| 1380 | |
| 1381 | def __eq__(self, other): |
| 1382 | if type(self) != type(other): return False |
| 1383 | if self.xid != other.xid: return False |
| 1384 | if self.experimenter != other.experimenter: return False |
| 1385 | if self.subtype != other.subtype: return False |
| 1386 | if self.data != other.data: return False |
| 1387 | return True |
| 1388 | |
| 1389 | def pretty_print(self, q): |
| 1390 | q.text("experimenter {") |
| 1391 | with q.group(): |
| 1392 | with q.indent(2): |
| 1393 | q.breakable() |
| 1394 | q.text("xid = "); |
| 1395 | if self.xid != None: |
| 1396 | q.text("%#x" % self.xid) |
| 1397 | else: |
| 1398 | q.text('None') |
| 1399 | q.text(","); q.breakable() |
| 1400 | q.text("subtype = "); |
| 1401 | q.text("%#x" % self.subtype) |
| 1402 | q.text(","); q.breakable() |
| 1403 | q.text("data = "); |
| 1404 | q.pp(self.data) |
| 1405 | q.breakable() |
| 1406 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1407 | |
| 1408 | message.subtypes[4] = experimenter |
| 1409 | |
| 1410 | class bsn_header(experimenter): |
| 1411 | subtypes = {} |
| 1412 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1413 | version = 4 |
| 1414 | type = 4 |
| 1415 | experimenter = 6035143 |
| 1416 | |
| 1417 | def __init__(self, xid=None, subtype=None): |
| 1418 | if xid != None: |
| 1419 | self.xid = xid |
| 1420 | else: |
| 1421 | self.xid = None |
| 1422 | if subtype != None: |
| 1423 | self.subtype = subtype |
| 1424 | else: |
| 1425 | self.subtype = 0 |
| 1426 | return |
| 1427 | |
| 1428 | def pack(self): |
| 1429 | packed = [] |
| 1430 | packed.append(struct.pack("!B", self.version)) |
| 1431 | packed.append(struct.pack("!B", self.type)) |
| 1432 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1433 | packed.append(struct.pack("!L", self.xid)) |
| 1434 | packed.append(struct.pack("!L", self.experimenter)) |
| 1435 | packed.append(struct.pack("!L", self.subtype)) |
| 1436 | length = sum([len(x) for x in packed]) |
| 1437 | packed[2] = struct.pack("!H", length) |
| 1438 | return ''.join(packed) |
| 1439 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1440 | @staticmethod |
| 1441 | def unpack(reader): |
| 1442 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1443 | subclass = bsn_header.subtypes.get(subtype) |
| 1444 | if subclass: |
| 1445 | return subclass.unpack(reader) |
| 1446 | |
| 1447 | obj = bsn_header() |
| 1448 | _version = reader.read("!B")[0] |
| 1449 | assert(_version == 4) |
| 1450 | _type = reader.read("!B")[0] |
| 1451 | assert(_type == 4) |
| 1452 | _length = reader.read("!H")[0] |
| 1453 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1454 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 1455 | obj.xid = reader.read("!L")[0] |
| 1456 | _experimenter = reader.read("!L")[0] |
| 1457 | assert(_experimenter == 6035143) |
| 1458 | obj.subtype = reader.read("!L")[0] |
| 1459 | return obj |
| 1460 | |
| 1461 | def __eq__(self, other): |
| 1462 | if type(self) != type(other): return False |
| 1463 | if self.xid != other.xid: return False |
| 1464 | if self.subtype != other.subtype: return False |
| 1465 | return True |
| 1466 | |
| 1467 | def pretty_print(self, q): |
| 1468 | q.text("bsn_header {") |
| 1469 | with q.group(): |
| 1470 | with q.indent(2): |
| 1471 | q.breakable() |
| 1472 | q.text("xid = "); |
| 1473 | if self.xid != None: |
| 1474 | q.text("%#x" % self.xid) |
| 1475 | else: |
| 1476 | q.text('None') |
| 1477 | q.breakable() |
| 1478 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1479 | |
| 1480 | experimenter.subtypes[6035143] = bsn_header |
| 1481 | |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1482 | class bsn_arp_idle(bsn_header): |
| 1483 | version = 4 |
| 1484 | type = 4 |
| 1485 | experimenter = 6035143 |
| 1486 | subtype = 60 |
| 1487 | |
| 1488 | def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None): |
| 1489 | if xid != None: |
| 1490 | self.xid = xid |
| 1491 | else: |
| 1492 | self.xid = None |
| 1493 | if vlan_vid != None: |
| 1494 | self.vlan_vid = vlan_vid |
| 1495 | else: |
| 1496 | self.vlan_vid = 0 |
| 1497 | if ipv4_addr != None: |
| 1498 | self.ipv4_addr = ipv4_addr |
| 1499 | else: |
| 1500 | self.ipv4_addr = 0 |
| 1501 | return |
| 1502 | |
| 1503 | def pack(self): |
| 1504 | packed = [] |
| 1505 | packed.append(struct.pack("!B", self.version)) |
| 1506 | packed.append(struct.pack("!B", self.type)) |
| 1507 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1508 | packed.append(struct.pack("!L", self.xid)) |
| 1509 | packed.append(struct.pack("!L", self.experimenter)) |
| 1510 | packed.append(struct.pack("!L", self.subtype)) |
| 1511 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 1512 | packed.append('\x00' * 2) |
| 1513 | packed.append(struct.pack("!L", self.ipv4_addr)) |
| 1514 | length = sum([len(x) for x in packed]) |
| 1515 | packed[2] = struct.pack("!H", length) |
| 1516 | return ''.join(packed) |
| 1517 | |
| 1518 | @staticmethod |
| 1519 | def unpack(reader): |
| 1520 | obj = bsn_arp_idle() |
| 1521 | _version = reader.read("!B")[0] |
| 1522 | assert(_version == 4) |
| 1523 | _type = reader.read("!B")[0] |
| 1524 | assert(_type == 4) |
| 1525 | _length = reader.read("!H")[0] |
| 1526 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1527 | reader = orig_reader.slice(_length, 4) |
Rich Lane | a61048f | 2014-01-30 16:14:00 -0800 | [diff] [blame] | 1528 | obj.xid = reader.read("!L")[0] |
| 1529 | _experimenter = reader.read("!L")[0] |
| 1530 | assert(_experimenter == 6035143) |
| 1531 | _subtype = reader.read("!L")[0] |
| 1532 | assert(_subtype == 60) |
| 1533 | obj.vlan_vid = reader.read("!H")[0] |
| 1534 | reader.skip(2) |
| 1535 | obj.ipv4_addr = reader.read("!L")[0] |
| 1536 | return obj |
| 1537 | |
| 1538 | def __eq__(self, other): |
| 1539 | if type(self) != type(other): return False |
| 1540 | if self.xid != other.xid: return False |
| 1541 | if self.vlan_vid != other.vlan_vid: return False |
| 1542 | if self.ipv4_addr != other.ipv4_addr: return False |
| 1543 | return True |
| 1544 | |
| 1545 | def pretty_print(self, q): |
| 1546 | q.text("bsn_arp_idle {") |
| 1547 | with q.group(): |
| 1548 | with q.indent(2): |
| 1549 | q.breakable() |
| 1550 | q.text("xid = "); |
| 1551 | if self.xid != None: |
| 1552 | q.text("%#x" % self.xid) |
| 1553 | else: |
| 1554 | q.text('None') |
| 1555 | q.text(","); q.breakable() |
| 1556 | q.text("vlan_vid = "); |
| 1557 | q.text("%#x" % self.vlan_vid) |
| 1558 | q.text(","); q.breakable() |
| 1559 | q.text("ipv4_addr = "); |
| 1560 | q.text(util.pretty_ipv4(self.ipv4_addr)) |
| 1561 | q.breakable() |
| 1562 | q.text('}') |
| 1563 | |
| 1564 | bsn_header.subtypes[60] = bsn_arp_idle |
| 1565 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1566 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1567 | version = 4 |
| 1568 | type = 4 |
| 1569 | experimenter = 6035143 |
| 1570 | subtype = 22 |
| 1571 | |
| 1572 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1573 | if xid != None: |
| 1574 | self.xid = xid |
| 1575 | else: |
| 1576 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1577 | if status != None: |
| 1578 | self.status = status |
| 1579 | else: |
| 1580 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1581 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1582 | |
| 1583 | def pack(self): |
| 1584 | packed = [] |
| 1585 | packed.append(struct.pack("!B", self.version)) |
| 1586 | packed.append(struct.pack("!B", self.type)) |
| 1587 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1588 | packed.append(struct.pack("!L", self.xid)) |
| 1589 | packed.append(struct.pack("!L", self.experimenter)) |
| 1590 | packed.append(struct.pack("!L", self.subtype)) |
| 1591 | packed.append(struct.pack("!L", self.status)) |
| 1592 | length = sum([len(x) for x in packed]) |
| 1593 | packed[2] = struct.pack("!H", length) |
| 1594 | return ''.join(packed) |
| 1595 | |
| 1596 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1597 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1598 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1599 | _version = reader.read("!B")[0] |
| 1600 | assert(_version == 4) |
| 1601 | _type = reader.read("!B")[0] |
| 1602 | assert(_type == 4) |
| 1603 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1604 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1605 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1606 | obj.xid = reader.read("!L")[0] |
| 1607 | _experimenter = reader.read("!L")[0] |
| 1608 | assert(_experimenter == 6035143) |
| 1609 | _subtype = reader.read("!L")[0] |
| 1610 | assert(_subtype == 22) |
| 1611 | obj.status = reader.read("!L")[0] |
| 1612 | return obj |
| 1613 | |
| 1614 | def __eq__(self, other): |
| 1615 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1616 | if self.xid != other.xid: return False |
| 1617 | if self.status != other.status: return False |
| 1618 | return True |
| 1619 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1620 | def pretty_print(self, q): |
| 1621 | q.text("bsn_bw_clear_data_reply {") |
| 1622 | with q.group(): |
| 1623 | with q.indent(2): |
| 1624 | q.breakable() |
| 1625 | q.text("xid = "); |
| 1626 | if self.xid != None: |
| 1627 | q.text("%#x" % self.xid) |
| 1628 | else: |
| 1629 | q.text('None') |
| 1630 | q.text(","); q.breakable() |
| 1631 | q.text("status = "); |
| 1632 | q.text("%#x" % self.status) |
| 1633 | q.breakable() |
| 1634 | q.text('}') |
| 1635 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1636 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1637 | |
| 1638 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1639 | version = 4 |
| 1640 | type = 4 |
| 1641 | experimenter = 6035143 |
| 1642 | subtype = 21 |
| 1643 | |
| 1644 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1645 | if xid != None: |
| 1646 | self.xid = xid |
| 1647 | else: |
| 1648 | self.xid = None |
| 1649 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1650 | |
| 1651 | def pack(self): |
| 1652 | packed = [] |
| 1653 | packed.append(struct.pack("!B", self.version)) |
| 1654 | packed.append(struct.pack("!B", self.type)) |
| 1655 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1656 | packed.append(struct.pack("!L", self.xid)) |
| 1657 | packed.append(struct.pack("!L", self.experimenter)) |
| 1658 | packed.append(struct.pack("!L", self.subtype)) |
| 1659 | length = sum([len(x) for x in packed]) |
| 1660 | packed[2] = struct.pack("!H", length) |
| 1661 | return ''.join(packed) |
| 1662 | |
| 1663 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1664 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1665 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1666 | _version = reader.read("!B")[0] |
| 1667 | assert(_version == 4) |
| 1668 | _type = reader.read("!B")[0] |
| 1669 | assert(_type == 4) |
| 1670 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1671 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1672 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1673 | obj.xid = reader.read("!L")[0] |
| 1674 | _experimenter = reader.read("!L")[0] |
| 1675 | assert(_experimenter == 6035143) |
| 1676 | _subtype = reader.read("!L")[0] |
| 1677 | assert(_subtype == 21) |
| 1678 | return obj |
| 1679 | |
| 1680 | def __eq__(self, other): |
| 1681 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1682 | if self.xid != other.xid: return False |
| 1683 | return True |
| 1684 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1685 | def pretty_print(self, q): |
| 1686 | q.text("bsn_bw_clear_data_request {") |
| 1687 | with q.group(): |
| 1688 | with q.indent(2): |
| 1689 | q.breakable() |
| 1690 | q.text("xid = "); |
| 1691 | if self.xid != None: |
| 1692 | q.text("%#x" % self.xid) |
| 1693 | else: |
| 1694 | q.text('None') |
| 1695 | q.breakable() |
| 1696 | q.text('}') |
| 1697 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1698 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1699 | |
| 1700 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1701 | version = 4 |
| 1702 | type = 4 |
| 1703 | experimenter = 6035143 |
| 1704 | subtype = 20 |
| 1705 | |
| 1706 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1707 | if xid != None: |
| 1708 | self.xid = xid |
| 1709 | else: |
| 1710 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1711 | if enabled != None: |
| 1712 | self.enabled = enabled |
| 1713 | else: |
| 1714 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1715 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1716 | |
| 1717 | def pack(self): |
| 1718 | packed = [] |
| 1719 | packed.append(struct.pack("!B", self.version)) |
| 1720 | packed.append(struct.pack("!B", self.type)) |
| 1721 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1722 | packed.append(struct.pack("!L", self.xid)) |
| 1723 | packed.append(struct.pack("!L", self.experimenter)) |
| 1724 | packed.append(struct.pack("!L", self.subtype)) |
| 1725 | packed.append(struct.pack("!L", self.enabled)) |
| 1726 | length = sum([len(x) for x in packed]) |
| 1727 | packed[2] = struct.pack("!H", length) |
| 1728 | return ''.join(packed) |
| 1729 | |
| 1730 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1731 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1732 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1733 | _version = reader.read("!B")[0] |
| 1734 | assert(_version == 4) |
| 1735 | _type = reader.read("!B")[0] |
| 1736 | assert(_type == 4) |
| 1737 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1738 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1739 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1740 | obj.xid = reader.read("!L")[0] |
| 1741 | _experimenter = reader.read("!L")[0] |
| 1742 | assert(_experimenter == 6035143) |
| 1743 | _subtype = reader.read("!L")[0] |
| 1744 | assert(_subtype == 20) |
| 1745 | obj.enabled = reader.read("!L")[0] |
| 1746 | return obj |
| 1747 | |
| 1748 | def __eq__(self, other): |
| 1749 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1750 | if self.xid != other.xid: return False |
| 1751 | if self.enabled != other.enabled: return False |
| 1752 | return True |
| 1753 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1754 | def pretty_print(self, q): |
| 1755 | q.text("bsn_bw_enable_get_reply {") |
| 1756 | with q.group(): |
| 1757 | with q.indent(2): |
| 1758 | q.breakable() |
| 1759 | q.text("xid = "); |
| 1760 | if self.xid != None: |
| 1761 | q.text("%#x" % self.xid) |
| 1762 | else: |
| 1763 | q.text('None') |
| 1764 | q.text(","); q.breakable() |
| 1765 | q.text("enabled = "); |
| 1766 | q.text("%#x" % self.enabled) |
| 1767 | q.breakable() |
| 1768 | q.text('}') |
| 1769 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1770 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1771 | |
| 1772 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1773 | version = 4 |
| 1774 | type = 4 |
| 1775 | experimenter = 6035143 |
| 1776 | subtype = 19 |
| 1777 | |
| 1778 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1779 | if xid != None: |
| 1780 | self.xid = xid |
| 1781 | else: |
| 1782 | self.xid = None |
| 1783 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1784 | |
| 1785 | def pack(self): |
| 1786 | packed = [] |
| 1787 | packed.append(struct.pack("!B", self.version)) |
| 1788 | packed.append(struct.pack("!B", self.type)) |
| 1789 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1790 | packed.append(struct.pack("!L", self.xid)) |
| 1791 | packed.append(struct.pack("!L", self.experimenter)) |
| 1792 | packed.append(struct.pack("!L", self.subtype)) |
| 1793 | length = sum([len(x) for x in packed]) |
| 1794 | packed[2] = struct.pack("!H", length) |
| 1795 | return ''.join(packed) |
| 1796 | |
| 1797 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1798 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1799 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1800 | _version = reader.read("!B")[0] |
| 1801 | assert(_version == 4) |
| 1802 | _type = reader.read("!B")[0] |
| 1803 | assert(_type == 4) |
| 1804 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1805 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1806 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1807 | obj.xid = reader.read("!L")[0] |
| 1808 | _experimenter = reader.read("!L")[0] |
| 1809 | assert(_experimenter == 6035143) |
| 1810 | _subtype = reader.read("!L")[0] |
| 1811 | assert(_subtype == 19) |
| 1812 | return obj |
| 1813 | |
| 1814 | def __eq__(self, other): |
| 1815 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1816 | if self.xid != other.xid: return False |
| 1817 | return True |
| 1818 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1819 | def pretty_print(self, q): |
| 1820 | q.text("bsn_bw_enable_get_request {") |
| 1821 | with q.group(): |
| 1822 | with q.indent(2): |
| 1823 | q.breakable() |
| 1824 | q.text("xid = "); |
| 1825 | if self.xid != None: |
| 1826 | q.text("%#x" % self.xid) |
| 1827 | else: |
| 1828 | q.text('None') |
| 1829 | q.breakable() |
| 1830 | q.text('}') |
| 1831 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1832 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1833 | |
| 1834 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1835 | version = 4 |
| 1836 | type = 4 |
| 1837 | experimenter = 6035143 |
| 1838 | subtype = 23 |
| 1839 | |
| 1840 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1841 | if xid != None: |
| 1842 | self.xid = xid |
| 1843 | else: |
| 1844 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1845 | if enable != None: |
| 1846 | self.enable = enable |
| 1847 | else: |
| 1848 | self.enable = 0 |
| 1849 | if status != None: |
| 1850 | self.status = status |
| 1851 | else: |
| 1852 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1853 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1854 | |
| 1855 | def pack(self): |
| 1856 | packed = [] |
| 1857 | packed.append(struct.pack("!B", self.version)) |
| 1858 | packed.append(struct.pack("!B", self.type)) |
| 1859 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1860 | packed.append(struct.pack("!L", self.xid)) |
| 1861 | packed.append(struct.pack("!L", self.experimenter)) |
| 1862 | packed.append(struct.pack("!L", self.subtype)) |
| 1863 | packed.append(struct.pack("!L", self.enable)) |
| 1864 | packed.append(struct.pack("!L", self.status)) |
| 1865 | length = sum([len(x) for x in packed]) |
| 1866 | packed[2] = struct.pack("!H", length) |
| 1867 | return ''.join(packed) |
| 1868 | |
| 1869 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1870 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1871 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1872 | _version = reader.read("!B")[0] |
| 1873 | assert(_version == 4) |
| 1874 | _type = reader.read("!B")[0] |
| 1875 | assert(_type == 4) |
| 1876 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1877 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1878 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1879 | obj.xid = reader.read("!L")[0] |
| 1880 | _experimenter = reader.read("!L")[0] |
| 1881 | assert(_experimenter == 6035143) |
| 1882 | _subtype = reader.read("!L")[0] |
| 1883 | assert(_subtype == 23) |
| 1884 | obj.enable = reader.read("!L")[0] |
| 1885 | obj.status = reader.read("!L")[0] |
| 1886 | return obj |
| 1887 | |
| 1888 | def __eq__(self, other): |
| 1889 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1890 | if self.xid != other.xid: return False |
| 1891 | if self.enable != other.enable: return False |
| 1892 | if self.status != other.status: return False |
| 1893 | return True |
| 1894 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1895 | def pretty_print(self, q): |
| 1896 | q.text("bsn_bw_enable_set_reply {") |
| 1897 | with q.group(): |
| 1898 | with q.indent(2): |
| 1899 | q.breakable() |
| 1900 | q.text("xid = "); |
| 1901 | if self.xid != None: |
| 1902 | q.text("%#x" % self.xid) |
| 1903 | else: |
| 1904 | q.text('None') |
| 1905 | q.text(","); q.breakable() |
| 1906 | q.text("enable = "); |
| 1907 | q.text("%#x" % self.enable) |
| 1908 | q.text(","); q.breakable() |
| 1909 | q.text("status = "); |
| 1910 | q.text("%#x" % self.status) |
| 1911 | q.breakable() |
| 1912 | q.text('}') |
| 1913 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1914 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1915 | |
| 1916 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1917 | version = 4 |
| 1918 | type = 4 |
| 1919 | experimenter = 6035143 |
| 1920 | subtype = 18 |
| 1921 | |
| 1922 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1923 | if xid != None: |
| 1924 | self.xid = xid |
| 1925 | else: |
| 1926 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1927 | if enable != None: |
| 1928 | self.enable = enable |
| 1929 | else: |
| 1930 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1931 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1932 | |
| 1933 | def pack(self): |
| 1934 | packed = [] |
| 1935 | packed.append(struct.pack("!B", self.version)) |
| 1936 | packed.append(struct.pack("!B", self.type)) |
| 1937 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1938 | packed.append(struct.pack("!L", self.xid)) |
| 1939 | packed.append(struct.pack("!L", self.experimenter)) |
| 1940 | packed.append(struct.pack("!L", self.subtype)) |
| 1941 | packed.append(struct.pack("!L", self.enable)) |
| 1942 | length = sum([len(x) for x in packed]) |
| 1943 | packed[2] = struct.pack("!H", length) |
| 1944 | return ''.join(packed) |
| 1945 | |
| 1946 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1947 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1948 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1949 | _version = reader.read("!B")[0] |
| 1950 | assert(_version == 4) |
| 1951 | _type = reader.read("!B")[0] |
| 1952 | assert(_type == 4) |
| 1953 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1954 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1955 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1956 | obj.xid = reader.read("!L")[0] |
| 1957 | _experimenter = reader.read("!L")[0] |
| 1958 | assert(_experimenter == 6035143) |
| 1959 | _subtype = reader.read("!L")[0] |
| 1960 | assert(_subtype == 18) |
| 1961 | obj.enable = reader.read("!L")[0] |
| 1962 | return obj |
| 1963 | |
| 1964 | def __eq__(self, other): |
| 1965 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1966 | if self.xid != other.xid: return False |
| 1967 | if self.enable != other.enable: return False |
| 1968 | return True |
| 1969 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1970 | def pretty_print(self, q): |
| 1971 | q.text("bsn_bw_enable_set_request {") |
| 1972 | with q.group(): |
| 1973 | with q.indent(2): |
| 1974 | q.breakable() |
| 1975 | q.text("xid = "); |
| 1976 | if self.xid != None: |
| 1977 | q.text("%#x" % self.xid) |
| 1978 | else: |
| 1979 | q.text('None') |
| 1980 | q.text(","); q.breakable() |
| 1981 | q.text("enable = "); |
| 1982 | q.text("%#x" % self.enable) |
| 1983 | q.breakable() |
| 1984 | q.text('}') |
| 1985 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1986 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1987 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 1988 | class bsn_controller_connections_reply(bsn_header): |
| 1989 | version = 4 |
| 1990 | type = 4 |
| 1991 | experimenter = 6035143 |
| 1992 | subtype = 57 |
| 1993 | |
| 1994 | def __init__(self, xid=None, connections=None): |
| 1995 | if xid != None: |
| 1996 | self.xid = xid |
| 1997 | else: |
| 1998 | self.xid = None |
| 1999 | if connections != None: |
| 2000 | self.connections = connections |
| 2001 | else: |
| 2002 | self.connections = [] |
| 2003 | return |
| 2004 | |
| 2005 | def pack(self): |
| 2006 | packed = [] |
| 2007 | packed.append(struct.pack("!B", self.version)) |
| 2008 | packed.append(struct.pack("!B", self.type)) |
| 2009 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2010 | packed.append(struct.pack("!L", self.xid)) |
| 2011 | packed.append(struct.pack("!L", self.experimenter)) |
| 2012 | packed.append(struct.pack("!L", self.subtype)) |
| 2013 | packed.append(loxi.generic_util.pack_list(self.connections)) |
| 2014 | length = sum([len(x) for x in packed]) |
| 2015 | packed[2] = struct.pack("!H", length) |
| 2016 | return ''.join(packed) |
| 2017 | |
| 2018 | @staticmethod |
| 2019 | def unpack(reader): |
| 2020 | obj = bsn_controller_connections_reply() |
| 2021 | _version = reader.read("!B")[0] |
| 2022 | assert(_version == 4) |
| 2023 | _type = reader.read("!B")[0] |
| 2024 | assert(_type == 4) |
| 2025 | _length = reader.read("!H")[0] |
| 2026 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2027 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2028 | obj.xid = reader.read("!L")[0] |
| 2029 | _experimenter = reader.read("!L")[0] |
| 2030 | assert(_experimenter == 6035143) |
| 2031 | _subtype = reader.read("!L")[0] |
| 2032 | assert(_subtype == 57) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2033 | 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] | 2034 | return obj |
| 2035 | |
| 2036 | def __eq__(self, other): |
| 2037 | if type(self) != type(other): return False |
| 2038 | if self.xid != other.xid: return False |
| 2039 | if self.connections != other.connections: return False |
| 2040 | return True |
| 2041 | |
| 2042 | def pretty_print(self, q): |
| 2043 | q.text("bsn_controller_connections_reply {") |
| 2044 | with q.group(): |
| 2045 | with q.indent(2): |
| 2046 | q.breakable() |
| 2047 | q.text("xid = "); |
| 2048 | if self.xid != None: |
| 2049 | q.text("%#x" % self.xid) |
| 2050 | else: |
| 2051 | q.text('None') |
| 2052 | q.text(","); q.breakable() |
| 2053 | q.text("connections = "); |
| 2054 | q.pp(self.connections) |
| 2055 | q.breakable() |
| 2056 | q.text('}') |
| 2057 | |
| 2058 | bsn_header.subtypes[57] = bsn_controller_connections_reply |
| 2059 | |
| 2060 | class bsn_controller_connections_request(bsn_header): |
| 2061 | version = 4 |
| 2062 | type = 4 |
| 2063 | experimenter = 6035143 |
| 2064 | subtype = 56 |
| 2065 | |
| 2066 | def __init__(self, xid=None): |
| 2067 | if xid != None: |
| 2068 | self.xid = xid |
| 2069 | else: |
| 2070 | self.xid = None |
| 2071 | return |
| 2072 | |
| 2073 | def pack(self): |
| 2074 | packed = [] |
| 2075 | packed.append(struct.pack("!B", self.version)) |
| 2076 | packed.append(struct.pack("!B", self.type)) |
| 2077 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2078 | packed.append(struct.pack("!L", self.xid)) |
| 2079 | packed.append(struct.pack("!L", self.experimenter)) |
| 2080 | packed.append(struct.pack("!L", self.subtype)) |
| 2081 | length = sum([len(x) for x in packed]) |
| 2082 | packed[2] = struct.pack("!H", length) |
| 2083 | return ''.join(packed) |
| 2084 | |
| 2085 | @staticmethod |
| 2086 | def unpack(reader): |
| 2087 | obj = bsn_controller_connections_request() |
| 2088 | _version = reader.read("!B")[0] |
| 2089 | assert(_version == 4) |
| 2090 | _type = reader.read("!B")[0] |
| 2091 | assert(_type == 4) |
| 2092 | _length = reader.read("!H")[0] |
| 2093 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2094 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 2095 | obj.xid = reader.read("!L")[0] |
| 2096 | _experimenter = reader.read("!L")[0] |
| 2097 | assert(_experimenter == 6035143) |
| 2098 | _subtype = reader.read("!L")[0] |
| 2099 | assert(_subtype == 56) |
| 2100 | return obj |
| 2101 | |
| 2102 | def __eq__(self, other): |
| 2103 | if type(self) != type(other): return False |
| 2104 | if self.xid != other.xid: return False |
| 2105 | return True |
| 2106 | |
| 2107 | def pretty_print(self, q): |
| 2108 | q.text("bsn_controller_connections_request {") |
| 2109 | with q.group(): |
| 2110 | with q.indent(2): |
| 2111 | q.breakable() |
| 2112 | q.text("xid = "); |
| 2113 | if self.xid != None: |
| 2114 | q.text("%#x" % self.xid) |
| 2115 | else: |
| 2116 | q.text('None') |
| 2117 | q.breakable() |
| 2118 | q.text('}') |
| 2119 | |
| 2120 | bsn_header.subtypes[56] = bsn_controller_connections_request |
| 2121 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2122 | class experimenter_stats_reply(stats_reply): |
| 2123 | subtypes = {} |
| 2124 | |
| 2125 | version = 4 |
| 2126 | type = 19 |
| 2127 | stats_type = 65535 |
| 2128 | |
| 2129 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2130 | if xid != None: |
| 2131 | self.xid = xid |
| 2132 | else: |
| 2133 | self.xid = None |
| 2134 | if flags != None: |
| 2135 | self.flags = flags |
| 2136 | else: |
| 2137 | self.flags = 0 |
| 2138 | if experimenter != None: |
| 2139 | self.experimenter = experimenter |
| 2140 | else: |
| 2141 | self.experimenter = 0 |
| 2142 | if subtype != None: |
| 2143 | self.subtype = subtype |
| 2144 | else: |
| 2145 | self.subtype = 0 |
| 2146 | return |
| 2147 | |
| 2148 | def pack(self): |
| 2149 | packed = [] |
| 2150 | packed.append(struct.pack("!B", self.version)) |
| 2151 | packed.append(struct.pack("!B", self.type)) |
| 2152 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2153 | packed.append(struct.pack("!L", self.xid)) |
| 2154 | packed.append(struct.pack("!H", self.stats_type)) |
| 2155 | packed.append(struct.pack("!H", self.flags)) |
| 2156 | packed.append('\x00' * 4) |
| 2157 | packed.append(struct.pack("!L", self.experimenter)) |
| 2158 | packed.append(struct.pack("!L", self.subtype)) |
| 2159 | length = sum([len(x) for x in packed]) |
| 2160 | packed[2] = struct.pack("!H", length) |
| 2161 | return ''.join(packed) |
| 2162 | |
| 2163 | @staticmethod |
| 2164 | def unpack(reader): |
| 2165 | subtype, = reader.peek('!L', 16) |
| 2166 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 2167 | if subclass: |
| 2168 | return subclass.unpack(reader) |
| 2169 | |
| 2170 | obj = experimenter_stats_reply() |
| 2171 | _version = reader.read("!B")[0] |
| 2172 | assert(_version == 4) |
| 2173 | _type = reader.read("!B")[0] |
| 2174 | assert(_type == 19) |
| 2175 | _length = reader.read("!H")[0] |
| 2176 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2177 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2178 | obj.xid = reader.read("!L")[0] |
| 2179 | _stats_type = reader.read("!H")[0] |
| 2180 | assert(_stats_type == 65535) |
| 2181 | obj.flags = reader.read("!H")[0] |
| 2182 | reader.skip(4) |
| 2183 | obj.experimenter = reader.read("!L")[0] |
| 2184 | obj.subtype = reader.read("!L")[0] |
| 2185 | return obj |
| 2186 | |
| 2187 | def __eq__(self, other): |
| 2188 | if type(self) != type(other): return False |
| 2189 | if self.xid != other.xid: return False |
| 2190 | if self.flags != other.flags: return False |
| 2191 | if self.experimenter != other.experimenter: return False |
| 2192 | if self.subtype != other.subtype: return False |
| 2193 | return True |
| 2194 | |
| 2195 | def pretty_print(self, q): |
| 2196 | q.text("experimenter_stats_reply {") |
| 2197 | with q.group(): |
| 2198 | with q.indent(2): |
| 2199 | q.breakable() |
| 2200 | q.text("xid = "); |
| 2201 | if self.xid != None: |
| 2202 | q.text("%#x" % self.xid) |
| 2203 | else: |
| 2204 | q.text('None') |
| 2205 | q.text(","); q.breakable() |
| 2206 | q.text("flags = "); |
| 2207 | q.text("%#x" % self.flags) |
| 2208 | q.text(","); q.breakable() |
| 2209 | q.text("subtype = "); |
| 2210 | q.text("%#x" % self.subtype) |
| 2211 | q.breakable() |
| 2212 | q.text('}') |
| 2213 | |
| 2214 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 2215 | |
| 2216 | class bsn_stats_reply(experimenter_stats_reply): |
| 2217 | subtypes = {} |
| 2218 | |
| 2219 | version = 4 |
| 2220 | type = 19 |
| 2221 | stats_type = 65535 |
| 2222 | experimenter = 6035143 |
| 2223 | |
| 2224 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2225 | if xid != None: |
| 2226 | self.xid = xid |
| 2227 | else: |
| 2228 | self.xid = None |
| 2229 | if flags != None: |
| 2230 | self.flags = flags |
| 2231 | else: |
| 2232 | self.flags = 0 |
| 2233 | if subtype != None: |
| 2234 | self.subtype = subtype |
| 2235 | else: |
| 2236 | self.subtype = 0 |
| 2237 | return |
| 2238 | |
| 2239 | def pack(self): |
| 2240 | packed = [] |
| 2241 | packed.append(struct.pack("!B", self.version)) |
| 2242 | packed.append(struct.pack("!B", self.type)) |
| 2243 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2244 | packed.append(struct.pack("!L", self.xid)) |
| 2245 | packed.append(struct.pack("!H", self.stats_type)) |
| 2246 | packed.append(struct.pack("!H", self.flags)) |
| 2247 | packed.append('\x00' * 4) |
| 2248 | packed.append(struct.pack("!L", self.experimenter)) |
| 2249 | packed.append(struct.pack("!L", self.subtype)) |
| 2250 | length = sum([len(x) for x in packed]) |
| 2251 | packed[2] = struct.pack("!H", length) |
| 2252 | return ''.join(packed) |
| 2253 | |
| 2254 | @staticmethod |
| 2255 | def unpack(reader): |
| 2256 | subtype, = reader.peek('!L', 20) |
| 2257 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 2258 | if subclass: |
| 2259 | return subclass.unpack(reader) |
| 2260 | |
| 2261 | obj = bsn_stats_reply() |
| 2262 | _version = reader.read("!B")[0] |
| 2263 | assert(_version == 4) |
| 2264 | _type = reader.read("!B")[0] |
| 2265 | assert(_type == 19) |
| 2266 | _length = reader.read("!H")[0] |
| 2267 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2268 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2269 | obj.xid = reader.read("!L")[0] |
| 2270 | _stats_type = reader.read("!H")[0] |
| 2271 | assert(_stats_type == 65535) |
| 2272 | obj.flags = reader.read("!H")[0] |
| 2273 | reader.skip(4) |
| 2274 | _experimenter = reader.read("!L")[0] |
| 2275 | assert(_experimenter == 6035143) |
| 2276 | obj.subtype = reader.read("!L")[0] |
| 2277 | return obj |
| 2278 | |
| 2279 | def __eq__(self, other): |
| 2280 | if type(self) != type(other): return False |
| 2281 | if self.xid != other.xid: return False |
| 2282 | if self.flags != other.flags: return False |
| 2283 | if self.subtype != other.subtype: return False |
| 2284 | return True |
| 2285 | |
| 2286 | def pretty_print(self, q): |
| 2287 | q.text("bsn_stats_reply {") |
| 2288 | with q.group(): |
| 2289 | with q.indent(2): |
| 2290 | q.breakable() |
| 2291 | q.text("xid = "); |
| 2292 | if self.xid != None: |
| 2293 | q.text("%#x" % self.xid) |
| 2294 | else: |
| 2295 | q.text('None') |
| 2296 | q.text(","); q.breakable() |
| 2297 | q.text("flags = "); |
| 2298 | q.text("%#x" % self.flags) |
| 2299 | q.breakable() |
| 2300 | q.text('}') |
| 2301 | |
| 2302 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 2303 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2304 | class bsn_debug_counter_desc_stats_reply(bsn_stats_reply): |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2305 | version = 4 |
| 2306 | type = 19 |
| 2307 | stats_type = 65535 |
| 2308 | experimenter = 6035143 |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2309 | subtype = 13 |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2310 | |
| 2311 | def __init__(self, xid=None, flags=None, entries=None): |
| 2312 | if xid != None: |
| 2313 | self.xid = xid |
| 2314 | else: |
| 2315 | self.xid = None |
| 2316 | if flags != None: |
| 2317 | self.flags = flags |
| 2318 | else: |
| 2319 | self.flags = 0 |
| 2320 | if entries != None: |
| 2321 | self.entries = entries |
| 2322 | else: |
| 2323 | self.entries = [] |
| 2324 | return |
| 2325 | |
| 2326 | def pack(self): |
| 2327 | packed = [] |
| 2328 | packed.append(struct.pack("!B", self.version)) |
| 2329 | packed.append(struct.pack("!B", self.type)) |
| 2330 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2331 | packed.append(struct.pack("!L", self.xid)) |
| 2332 | packed.append(struct.pack("!H", self.stats_type)) |
| 2333 | packed.append(struct.pack("!H", self.flags)) |
| 2334 | packed.append('\x00' * 4) |
| 2335 | packed.append(struct.pack("!L", self.experimenter)) |
| 2336 | packed.append(struct.pack("!L", self.subtype)) |
| 2337 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2338 | length = sum([len(x) for x in packed]) |
| 2339 | packed[2] = struct.pack("!H", length) |
| 2340 | return ''.join(packed) |
| 2341 | |
| 2342 | @staticmethod |
| 2343 | def unpack(reader): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2344 | obj = bsn_debug_counter_desc_stats_reply() |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2345 | _version = reader.read("!B")[0] |
| 2346 | assert(_version == 4) |
| 2347 | _type = reader.read("!B")[0] |
| 2348 | assert(_type == 19) |
| 2349 | _length = reader.read("!H")[0] |
| 2350 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2351 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2352 | obj.xid = reader.read("!L")[0] |
| 2353 | _stats_type = reader.read("!H")[0] |
| 2354 | assert(_stats_type == 65535) |
| 2355 | obj.flags = reader.read("!H")[0] |
| 2356 | reader.skip(4) |
| 2357 | _experimenter = reader.read("!L")[0] |
| 2358 | assert(_experimenter == 6035143) |
| 2359 | _subtype = reader.read("!L")[0] |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2360 | assert(_subtype == 13) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2361 | 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] | 2362 | return obj |
| 2363 | |
| 2364 | def __eq__(self, other): |
| 2365 | if type(self) != type(other): return False |
| 2366 | if self.xid != other.xid: return False |
| 2367 | if self.flags != other.flags: return False |
| 2368 | if self.entries != other.entries: return False |
| 2369 | return True |
| 2370 | |
| 2371 | def pretty_print(self, q): |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2372 | q.text("bsn_debug_counter_desc_stats_reply {") |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2373 | with q.group(): |
| 2374 | with q.indent(2): |
| 2375 | q.breakable() |
| 2376 | q.text("xid = "); |
| 2377 | if self.xid != None: |
| 2378 | q.text("%#x" % self.xid) |
| 2379 | else: |
| 2380 | q.text('None') |
| 2381 | q.text(","); q.breakable() |
| 2382 | q.text("flags = "); |
| 2383 | q.text("%#x" % self.flags) |
| 2384 | q.text(","); q.breakable() |
| 2385 | q.text("entries = "); |
| 2386 | q.pp(self.entries) |
| 2387 | q.breakable() |
| 2388 | q.text('}') |
| 2389 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2390 | bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2391 | |
| 2392 | class experimenter_stats_request(stats_request): |
| 2393 | subtypes = {} |
| 2394 | |
| 2395 | version = 4 |
| 2396 | type = 18 |
| 2397 | stats_type = 65535 |
| 2398 | |
| 2399 | def __init__(self, xid=None, flags=None, experimenter=None, subtype=None): |
| 2400 | if xid != None: |
| 2401 | self.xid = xid |
| 2402 | else: |
| 2403 | self.xid = None |
| 2404 | if flags != None: |
| 2405 | self.flags = flags |
| 2406 | else: |
| 2407 | self.flags = 0 |
| 2408 | if experimenter != None: |
| 2409 | self.experimenter = experimenter |
| 2410 | else: |
| 2411 | self.experimenter = 0 |
| 2412 | if subtype != None: |
| 2413 | self.subtype = subtype |
| 2414 | else: |
| 2415 | self.subtype = 0 |
| 2416 | return |
| 2417 | |
| 2418 | def pack(self): |
| 2419 | packed = [] |
| 2420 | packed.append(struct.pack("!B", self.version)) |
| 2421 | packed.append(struct.pack("!B", self.type)) |
| 2422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2423 | packed.append(struct.pack("!L", self.xid)) |
| 2424 | packed.append(struct.pack("!H", self.stats_type)) |
| 2425 | packed.append(struct.pack("!H", self.flags)) |
| 2426 | packed.append('\x00' * 4) |
| 2427 | packed.append(struct.pack("!L", self.experimenter)) |
| 2428 | packed.append(struct.pack("!L", self.subtype)) |
| 2429 | length = sum([len(x) for x in packed]) |
| 2430 | packed[2] = struct.pack("!H", length) |
| 2431 | return ''.join(packed) |
| 2432 | |
| 2433 | @staticmethod |
| 2434 | def unpack(reader): |
| 2435 | subtype, = reader.peek('!L', 16) |
| 2436 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 2437 | if subclass: |
| 2438 | return subclass.unpack(reader) |
| 2439 | |
| 2440 | obj = experimenter_stats_request() |
| 2441 | _version = reader.read("!B")[0] |
| 2442 | assert(_version == 4) |
| 2443 | _type = reader.read("!B")[0] |
| 2444 | assert(_type == 18) |
| 2445 | _length = reader.read("!H")[0] |
| 2446 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2447 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2448 | obj.xid = reader.read("!L")[0] |
| 2449 | _stats_type = reader.read("!H")[0] |
| 2450 | assert(_stats_type == 65535) |
| 2451 | obj.flags = reader.read("!H")[0] |
| 2452 | reader.skip(4) |
| 2453 | obj.experimenter = reader.read("!L")[0] |
| 2454 | obj.subtype = reader.read("!L")[0] |
| 2455 | return obj |
| 2456 | |
| 2457 | def __eq__(self, other): |
| 2458 | if type(self) != type(other): return False |
| 2459 | if self.xid != other.xid: return False |
| 2460 | if self.flags != other.flags: return False |
| 2461 | if self.experimenter != other.experimenter: return False |
| 2462 | if self.subtype != other.subtype: return False |
| 2463 | return True |
| 2464 | |
| 2465 | def pretty_print(self, q): |
| 2466 | q.text("experimenter_stats_request {") |
| 2467 | with q.group(): |
| 2468 | with q.indent(2): |
| 2469 | q.breakable() |
| 2470 | q.text("xid = "); |
| 2471 | if self.xid != None: |
| 2472 | q.text("%#x" % self.xid) |
| 2473 | else: |
| 2474 | q.text('None') |
| 2475 | q.text(","); q.breakable() |
| 2476 | q.text("flags = "); |
| 2477 | q.text("%#x" % self.flags) |
| 2478 | q.text(","); q.breakable() |
| 2479 | q.text("subtype = "); |
| 2480 | q.text("%#x" % self.subtype) |
| 2481 | q.breakable() |
| 2482 | q.text('}') |
| 2483 | |
| 2484 | stats_request.subtypes[65535] = experimenter_stats_request |
| 2485 | |
| 2486 | class bsn_stats_request(experimenter_stats_request): |
| 2487 | subtypes = {} |
| 2488 | |
| 2489 | version = 4 |
| 2490 | type = 18 |
| 2491 | stats_type = 65535 |
| 2492 | experimenter = 6035143 |
| 2493 | |
| 2494 | def __init__(self, xid=None, flags=None, subtype=None): |
| 2495 | if xid != None: |
| 2496 | self.xid = xid |
| 2497 | else: |
| 2498 | self.xid = None |
| 2499 | if flags != None: |
| 2500 | self.flags = flags |
| 2501 | else: |
| 2502 | self.flags = 0 |
| 2503 | if subtype != None: |
| 2504 | self.subtype = subtype |
| 2505 | else: |
| 2506 | self.subtype = 0 |
| 2507 | return |
| 2508 | |
| 2509 | def pack(self): |
| 2510 | packed = [] |
| 2511 | packed.append(struct.pack("!B", self.version)) |
| 2512 | packed.append(struct.pack("!B", self.type)) |
| 2513 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2514 | packed.append(struct.pack("!L", self.xid)) |
| 2515 | packed.append(struct.pack("!H", self.stats_type)) |
| 2516 | packed.append(struct.pack("!H", self.flags)) |
| 2517 | packed.append('\x00' * 4) |
| 2518 | packed.append(struct.pack("!L", self.experimenter)) |
| 2519 | packed.append(struct.pack("!L", self.subtype)) |
| 2520 | length = sum([len(x) for x in packed]) |
| 2521 | packed[2] = struct.pack("!H", length) |
| 2522 | return ''.join(packed) |
| 2523 | |
| 2524 | @staticmethod |
| 2525 | def unpack(reader): |
| 2526 | subtype, = reader.peek('!L', 20) |
| 2527 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 2528 | if subclass: |
| 2529 | return subclass.unpack(reader) |
| 2530 | |
| 2531 | obj = bsn_stats_request() |
| 2532 | _version = reader.read("!B")[0] |
| 2533 | assert(_version == 4) |
| 2534 | _type = reader.read("!B")[0] |
| 2535 | assert(_type == 18) |
| 2536 | _length = reader.read("!H")[0] |
| 2537 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2538 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2539 | obj.xid = reader.read("!L")[0] |
| 2540 | _stats_type = reader.read("!H")[0] |
| 2541 | assert(_stats_type == 65535) |
| 2542 | obj.flags = reader.read("!H")[0] |
| 2543 | reader.skip(4) |
| 2544 | _experimenter = reader.read("!L")[0] |
| 2545 | assert(_experimenter == 6035143) |
| 2546 | obj.subtype = reader.read("!L")[0] |
| 2547 | return obj |
| 2548 | |
| 2549 | def __eq__(self, other): |
| 2550 | if type(self) != type(other): return False |
| 2551 | if self.xid != other.xid: return False |
| 2552 | if self.flags != other.flags: return False |
| 2553 | if self.subtype != other.subtype: return False |
| 2554 | return True |
| 2555 | |
| 2556 | def pretty_print(self, q): |
| 2557 | q.text("bsn_stats_request {") |
| 2558 | with q.group(): |
| 2559 | with q.indent(2): |
| 2560 | q.breakable() |
| 2561 | q.text("xid = "); |
| 2562 | if self.xid != None: |
| 2563 | q.text("%#x" % self.xid) |
| 2564 | else: |
| 2565 | q.text('None') |
| 2566 | q.text(","); q.breakable() |
| 2567 | q.text("flags = "); |
| 2568 | q.text("%#x" % self.flags) |
| 2569 | q.breakable() |
| 2570 | q.text('}') |
| 2571 | |
| 2572 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 2573 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2574 | class bsn_debug_counter_desc_stats_request(bsn_stats_request): |
| 2575 | version = 4 |
| 2576 | type = 18 |
| 2577 | stats_type = 65535 |
| 2578 | experimenter = 6035143 |
| 2579 | subtype = 13 |
| 2580 | |
| 2581 | def __init__(self, xid=None, flags=None): |
| 2582 | if xid != None: |
| 2583 | self.xid = xid |
| 2584 | else: |
| 2585 | self.xid = None |
| 2586 | if flags != None: |
| 2587 | self.flags = flags |
| 2588 | else: |
| 2589 | self.flags = 0 |
| 2590 | return |
| 2591 | |
| 2592 | def pack(self): |
| 2593 | packed = [] |
| 2594 | packed.append(struct.pack("!B", self.version)) |
| 2595 | packed.append(struct.pack("!B", self.type)) |
| 2596 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2597 | packed.append(struct.pack("!L", self.xid)) |
| 2598 | packed.append(struct.pack("!H", self.stats_type)) |
| 2599 | packed.append(struct.pack("!H", self.flags)) |
| 2600 | packed.append('\x00' * 4) |
| 2601 | packed.append(struct.pack("!L", self.experimenter)) |
| 2602 | packed.append(struct.pack("!L", self.subtype)) |
| 2603 | length = sum([len(x) for x in packed]) |
| 2604 | packed[2] = struct.pack("!H", length) |
| 2605 | return ''.join(packed) |
| 2606 | |
| 2607 | @staticmethod |
| 2608 | def unpack(reader): |
| 2609 | obj = bsn_debug_counter_desc_stats_request() |
| 2610 | _version = reader.read("!B")[0] |
| 2611 | assert(_version == 4) |
| 2612 | _type = reader.read("!B")[0] |
| 2613 | assert(_type == 18) |
| 2614 | _length = reader.read("!H")[0] |
| 2615 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2616 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2617 | obj.xid = reader.read("!L")[0] |
| 2618 | _stats_type = reader.read("!H")[0] |
| 2619 | assert(_stats_type == 65535) |
| 2620 | obj.flags = reader.read("!H")[0] |
| 2621 | reader.skip(4) |
| 2622 | _experimenter = reader.read("!L")[0] |
| 2623 | assert(_experimenter == 6035143) |
| 2624 | _subtype = reader.read("!L")[0] |
| 2625 | assert(_subtype == 13) |
| 2626 | return obj |
| 2627 | |
| 2628 | def __eq__(self, other): |
| 2629 | if type(self) != type(other): return False |
| 2630 | if self.xid != other.xid: return False |
| 2631 | if self.flags != other.flags: return False |
| 2632 | return True |
| 2633 | |
| 2634 | def pretty_print(self, q): |
| 2635 | q.text("bsn_debug_counter_desc_stats_request {") |
| 2636 | with q.group(): |
| 2637 | with q.indent(2): |
| 2638 | q.breakable() |
| 2639 | q.text("xid = "); |
| 2640 | if self.xid != None: |
| 2641 | q.text("%#x" % self.xid) |
| 2642 | else: |
| 2643 | q.text('None') |
| 2644 | q.text(","); q.breakable() |
| 2645 | q.text("flags = "); |
| 2646 | q.text("%#x" % self.flags) |
| 2647 | q.breakable() |
| 2648 | q.text('}') |
| 2649 | |
| 2650 | bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request |
| 2651 | |
| 2652 | class bsn_debug_counter_stats_reply(bsn_stats_reply): |
| 2653 | version = 4 |
| 2654 | type = 19 |
| 2655 | stats_type = 65535 |
| 2656 | experimenter = 6035143 |
| 2657 | subtype = 12 |
| 2658 | |
| 2659 | def __init__(self, xid=None, flags=None, entries=None): |
| 2660 | if xid != None: |
| 2661 | self.xid = xid |
| 2662 | else: |
| 2663 | self.xid = None |
| 2664 | if flags != None: |
| 2665 | self.flags = flags |
| 2666 | else: |
| 2667 | self.flags = 0 |
| 2668 | if entries != None: |
| 2669 | self.entries = entries |
| 2670 | else: |
| 2671 | self.entries = [] |
| 2672 | return |
| 2673 | |
| 2674 | def pack(self): |
| 2675 | packed = [] |
| 2676 | packed.append(struct.pack("!B", self.version)) |
| 2677 | packed.append(struct.pack("!B", self.type)) |
| 2678 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2679 | packed.append(struct.pack("!L", self.xid)) |
| 2680 | packed.append(struct.pack("!H", self.stats_type)) |
| 2681 | packed.append(struct.pack("!H", self.flags)) |
| 2682 | packed.append('\x00' * 4) |
| 2683 | packed.append(struct.pack("!L", self.experimenter)) |
| 2684 | packed.append(struct.pack("!L", self.subtype)) |
| 2685 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2686 | length = sum([len(x) for x in packed]) |
| 2687 | packed[2] = struct.pack("!H", length) |
| 2688 | return ''.join(packed) |
| 2689 | |
| 2690 | @staticmethod |
| 2691 | def unpack(reader): |
| 2692 | obj = bsn_debug_counter_stats_reply() |
| 2693 | _version = reader.read("!B")[0] |
| 2694 | assert(_version == 4) |
| 2695 | _type = reader.read("!B")[0] |
| 2696 | assert(_type == 19) |
| 2697 | _length = reader.read("!H")[0] |
| 2698 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2699 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2700 | obj.xid = reader.read("!L")[0] |
| 2701 | _stats_type = reader.read("!H")[0] |
| 2702 | assert(_stats_type == 65535) |
| 2703 | obj.flags = reader.read("!H")[0] |
| 2704 | reader.skip(4) |
| 2705 | _experimenter = reader.read("!L")[0] |
| 2706 | assert(_experimenter == 6035143) |
| 2707 | _subtype = reader.read("!L")[0] |
| 2708 | assert(_subtype == 12) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2709 | 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] | 2710 | return obj |
| 2711 | |
| 2712 | def __eq__(self, other): |
| 2713 | if type(self) != type(other): return False |
| 2714 | if self.xid != other.xid: return False |
| 2715 | if self.flags != other.flags: return False |
| 2716 | if self.entries != other.entries: return False |
| 2717 | return True |
| 2718 | |
| 2719 | def pretty_print(self, q): |
| 2720 | q.text("bsn_debug_counter_stats_reply {") |
| 2721 | with q.group(): |
| 2722 | with q.indent(2): |
| 2723 | q.breakable() |
| 2724 | q.text("xid = "); |
| 2725 | if self.xid != None: |
| 2726 | q.text("%#x" % self.xid) |
| 2727 | else: |
| 2728 | q.text('None') |
| 2729 | q.text(","); q.breakable() |
| 2730 | q.text("flags = "); |
| 2731 | q.text("%#x" % self.flags) |
| 2732 | q.text(","); q.breakable() |
| 2733 | q.text("entries = "); |
| 2734 | q.pp(self.entries) |
| 2735 | q.breakable() |
| 2736 | q.text('}') |
| 2737 | |
| 2738 | bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply |
| 2739 | |
| 2740 | class bsn_debug_counter_stats_request(bsn_stats_request): |
| 2741 | version = 4 |
| 2742 | type = 18 |
| 2743 | stats_type = 65535 |
| 2744 | experimenter = 6035143 |
| 2745 | subtype = 12 |
| 2746 | |
| 2747 | def __init__(self, xid=None, flags=None): |
| 2748 | if xid != None: |
| 2749 | self.xid = xid |
| 2750 | else: |
| 2751 | self.xid = None |
| 2752 | if flags != None: |
| 2753 | self.flags = flags |
| 2754 | else: |
| 2755 | self.flags = 0 |
| 2756 | return |
| 2757 | |
| 2758 | def pack(self): |
| 2759 | packed = [] |
| 2760 | packed.append(struct.pack("!B", self.version)) |
| 2761 | packed.append(struct.pack("!B", self.type)) |
| 2762 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2763 | packed.append(struct.pack("!L", self.xid)) |
| 2764 | packed.append(struct.pack("!H", self.stats_type)) |
| 2765 | packed.append(struct.pack("!H", self.flags)) |
| 2766 | packed.append('\x00' * 4) |
| 2767 | packed.append(struct.pack("!L", self.experimenter)) |
| 2768 | packed.append(struct.pack("!L", self.subtype)) |
| 2769 | length = sum([len(x) for x in packed]) |
| 2770 | packed[2] = struct.pack("!H", length) |
| 2771 | return ''.join(packed) |
| 2772 | |
| 2773 | @staticmethod |
| 2774 | def unpack(reader): |
| 2775 | obj = bsn_debug_counter_stats_request() |
| 2776 | _version = reader.read("!B")[0] |
| 2777 | assert(_version == 4) |
| 2778 | _type = reader.read("!B")[0] |
| 2779 | assert(_type == 18) |
| 2780 | _length = reader.read("!H")[0] |
| 2781 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2782 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2783 | obj.xid = reader.read("!L")[0] |
| 2784 | _stats_type = reader.read("!H")[0] |
| 2785 | assert(_stats_type == 65535) |
| 2786 | obj.flags = reader.read("!H")[0] |
| 2787 | reader.skip(4) |
| 2788 | _experimenter = reader.read("!L")[0] |
| 2789 | assert(_experimenter == 6035143) |
| 2790 | _subtype = reader.read("!L")[0] |
| 2791 | assert(_subtype == 12) |
| 2792 | return obj |
| 2793 | |
| 2794 | def __eq__(self, other): |
| 2795 | if type(self) != type(other): return False |
| 2796 | if self.xid != other.xid: return False |
| 2797 | if self.flags != other.flags: return False |
| 2798 | return True |
| 2799 | |
| 2800 | def pretty_print(self, q): |
| 2801 | q.text("bsn_debug_counter_stats_request {") |
| 2802 | with q.group(): |
| 2803 | with q.indent(2): |
| 2804 | q.breakable() |
| 2805 | q.text("xid = "); |
| 2806 | if self.xid != None: |
| 2807 | q.text("%#x" % self.xid) |
| 2808 | else: |
| 2809 | q.text('None') |
| 2810 | q.text(","); q.breakable() |
| 2811 | q.text("flags = "); |
| 2812 | q.text("%#x" % self.flags) |
| 2813 | q.breakable() |
| 2814 | q.text('}') |
| 2815 | |
| 2816 | bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request |
| 2817 | |
| 2818 | class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply): |
| 2819 | version = 4 |
| 2820 | type = 19 |
| 2821 | stats_type = 65535 |
| 2822 | experimenter = 6035143 |
| 2823 | subtype = 10 |
| 2824 | |
| 2825 | def __init__(self, xid=None, flags=None, entries=None): |
| 2826 | if xid != None: |
| 2827 | self.xid = xid |
| 2828 | else: |
| 2829 | self.xid = None |
| 2830 | if flags != None: |
| 2831 | self.flags = flags |
| 2832 | else: |
| 2833 | self.flags = 0 |
| 2834 | if entries != None: |
| 2835 | self.entries = entries |
| 2836 | else: |
| 2837 | self.entries = [] |
| 2838 | return |
| 2839 | |
| 2840 | def pack(self): |
| 2841 | packed = [] |
| 2842 | packed.append(struct.pack("!B", self.version)) |
| 2843 | packed.append(struct.pack("!B", self.type)) |
| 2844 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2845 | packed.append(struct.pack("!L", self.xid)) |
| 2846 | packed.append(struct.pack("!H", self.stats_type)) |
| 2847 | packed.append(struct.pack("!H", self.flags)) |
| 2848 | packed.append('\x00' * 4) |
| 2849 | packed.append(struct.pack("!L", self.experimenter)) |
| 2850 | packed.append(struct.pack("!L", self.subtype)) |
| 2851 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 2852 | length = sum([len(x) for x in packed]) |
| 2853 | packed[2] = struct.pack("!H", length) |
| 2854 | return ''.join(packed) |
| 2855 | |
| 2856 | @staticmethod |
| 2857 | def unpack(reader): |
| 2858 | obj = bsn_flow_checksum_bucket_stats_reply() |
| 2859 | _version = reader.read("!B")[0] |
| 2860 | assert(_version == 4) |
| 2861 | _type = reader.read("!B")[0] |
| 2862 | assert(_type == 19) |
| 2863 | _length = reader.read("!H")[0] |
| 2864 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2865 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 2866 | obj.xid = reader.read("!L")[0] |
| 2867 | _stats_type = reader.read("!H")[0] |
| 2868 | assert(_stats_type == 65535) |
| 2869 | obj.flags = reader.read("!H")[0] |
| 2870 | reader.skip(4) |
| 2871 | _experimenter = reader.read("!L")[0] |
| 2872 | assert(_experimenter == 6035143) |
| 2873 | _subtype = reader.read("!L")[0] |
| 2874 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 2875 | 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] | 2876 | return obj |
| 2877 | |
| 2878 | def __eq__(self, other): |
| 2879 | if type(self) != type(other): return False |
| 2880 | if self.xid != other.xid: return False |
| 2881 | if self.flags != other.flags: return False |
| 2882 | if self.entries != other.entries: return False |
| 2883 | return True |
| 2884 | |
| 2885 | def pretty_print(self, q): |
| 2886 | q.text("bsn_flow_checksum_bucket_stats_reply {") |
| 2887 | with q.group(): |
| 2888 | with q.indent(2): |
| 2889 | q.breakable() |
| 2890 | q.text("xid = "); |
| 2891 | if self.xid != None: |
| 2892 | q.text("%#x" % self.xid) |
| 2893 | else: |
| 2894 | q.text('None') |
| 2895 | q.text(","); q.breakable() |
| 2896 | q.text("flags = "); |
| 2897 | q.text("%#x" % self.flags) |
| 2898 | q.text(","); q.breakable() |
| 2899 | q.text("entries = "); |
| 2900 | q.pp(self.entries) |
| 2901 | q.breakable() |
| 2902 | q.text('}') |
| 2903 | |
| 2904 | bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply |
| 2905 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2906 | class bsn_flow_checksum_bucket_stats_request(bsn_stats_request): |
| 2907 | version = 4 |
| 2908 | type = 18 |
| 2909 | stats_type = 65535 |
| 2910 | experimenter = 6035143 |
| 2911 | subtype = 10 |
| 2912 | |
| 2913 | def __init__(self, xid=None, flags=None, table_id=None): |
| 2914 | if xid != None: |
| 2915 | self.xid = xid |
| 2916 | else: |
| 2917 | self.xid = None |
| 2918 | if flags != None: |
| 2919 | self.flags = flags |
| 2920 | else: |
| 2921 | self.flags = 0 |
| 2922 | if table_id != None: |
| 2923 | self.table_id = table_id |
| 2924 | else: |
| 2925 | self.table_id = 0 |
| 2926 | return |
| 2927 | |
| 2928 | def pack(self): |
| 2929 | packed = [] |
| 2930 | packed.append(struct.pack("!B", self.version)) |
| 2931 | packed.append(struct.pack("!B", self.type)) |
| 2932 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2933 | packed.append(struct.pack("!L", self.xid)) |
| 2934 | packed.append(struct.pack("!H", self.stats_type)) |
| 2935 | packed.append(struct.pack("!H", self.flags)) |
| 2936 | packed.append('\x00' * 4) |
| 2937 | packed.append(struct.pack("!L", self.experimenter)) |
| 2938 | packed.append(struct.pack("!L", self.subtype)) |
| 2939 | packed.append(struct.pack("!B", self.table_id)) |
| 2940 | length = sum([len(x) for x in packed]) |
| 2941 | packed[2] = struct.pack("!H", length) |
| 2942 | return ''.join(packed) |
| 2943 | |
| 2944 | @staticmethod |
| 2945 | def unpack(reader): |
| 2946 | obj = bsn_flow_checksum_bucket_stats_request() |
| 2947 | _version = reader.read("!B")[0] |
| 2948 | assert(_version == 4) |
| 2949 | _type = reader.read("!B")[0] |
| 2950 | assert(_type == 18) |
| 2951 | _length = reader.read("!H")[0] |
| 2952 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2953 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 2954 | obj.xid = reader.read("!L")[0] |
| 2955 | _stats_type = reader.read("!H")[0] |
| 2956 | assert(_stats_type == 65535) |
| 2957 | obj.flags = reader.read("!H")[0] |
| 2958 | reader.skip(4) |
| 2959 | _experimenter = reader.read("!L")[0] |
| 2960 | assert(_experimenter == 6035143) |
| 2961 | _subtype = reader.read("!L")[0] |
| 2962 | assert(_subtype == 10) |
| 2963 | obj.table_id = reader.read("!B")[0] |
| 2964 | return obj |
| 2965 | |
| 2966 | def __eq__(self, other): |
| 2967 | if type(self) != type(other): return False |
| 2968 | if self.xid != other.xid: return False |
| 2969 | if self.flags != other.flags: return False |
| 2970 | if self.table_id != other.table_id: return False |
| 2971 | return True |
| 2972 | |
| 2973 | def pretty_print(self, q): |
| 2974 | q.text("bsn_flow_checksum_bucket_stats_request {") |
| 2975 | with q.group(): |
| 2976 | with q.indent(2): |
| 2977 | q.breakable() |
| 2978 | q.text("xid = "); |
| 2979 | if self.xid != None: |
| 2980 | q.text("%#x" % self.xid) |
| 2981 | else: |
| 2982 | q.text('None') |
| 2983 | q.text(","); q.breakable() |
| 2984 | q.text("flags = "); |
| 2985 | q.text("%#x" % self.flags) |
| 2986 | q.text(","); q.breakable() |
| 2987 | q.text("table_id = "); |
| 2988 | q.text("%#x" % self.table_id) |
| 2989 | q.breakable() |
| 2990 | q.text('}') |
| 2991 | |
| 2992 | bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request |
| 2993 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2994 | class bsn_flow_idle(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2995 | version = 4 |
| 2996 | type = 4 |
| 2997 | experimenter = 6035143 |
| 2998 | subtype = 40 |
| 2999 | |
| 3000 | 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] | 3001 | if xid != None: |
| 3002 | self.xid = xid |
| 3003 | else: |
| 3004 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3005 | if cookie != None: |
| 3006 | self.cookie = cookie |
| 3007 | else: |
| 3008 | self.cookie = 0 |
| 3009 | if priority != None: |
| 3010 | self.priority = priority |
| 3011 | else: |
| 3012 | self.priority = 0 |
| 3013 | if table_id != None: |
| 3014 | self.table_id = table_id |
| 3015 | else: |
| 3016 | self.table_id = 0 |
| 3017 | if match != None: |
| 3018 | self.match = match |
| 3019 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3020 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3021 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3022 | |
| 3023 | def pack(self): |
| 3024 | packed = [] |
| 3025 | packed.append(struct.pack("!B", self.version)) |
| 3026 | packed.append(struct.pack("!B", self.type)) |
| 3027 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3028 | packed.append(struct.pack("!L", self.xid)) |
| 3029 | packed.append(struct.pack("!L", self.experimenter)) |
| 3030 | packed.append(struct.pack("!L", self.subtype)) |
| 3031 | packed.append(struct.pack("!Q", self.cookie)) |
| 3032 | packed.append(struct.pack("!H", self.priority)) |
| 3033 | packed.append(struct.pack("!B", self.table_id)) |
| 3034 | packed.append('\x00' * 5) |
| 3035 | packed.append(self.match.pack()) |
| 3036 | length = sum([len(x) for x in packed]) |
| 3037 | packed[2] = struct.pack("!H", length) |
| 3038 | return ''.join(packed) |
| 3039 | |
| 3040 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3041 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3042 | obj = bsn_flow_idle() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3043 | _version = reader.read("!B")[0] |
| 3044 | assert(_version == 4) |
| 3045 | _type = reader.read("!B")[0] |
| 3046 | assert(_type == 4) |
| 3047 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3048 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3049 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3050 | obj.xid = reader.read("!L")[0] |
| 3051 | _experimenter = reader.read("!L")[0] |
| 3052 | assert(_experimenter == 6035143) |
| 3053 | _subtype = reader.read("!L")[0] |
| 3054 | assert(_subtype == 40) |
| 3055 | obj.cookie = reader.read("!Q")[0] |
| 3056 | obj.priority = reader.read("!H")[0] |
| 3057 | obj.table_id = reader.read("!B")[0] |
| 3058 | reader.skip(5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3059 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3060 | return obj |
| 3061 | |
| 3062 | def __eq__(self, other): |
| 3063 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3064 | if self.xid != other.xid: return False |
| 3065 | if self.cookie != other.cookie: return False |
| 3066 | if self.priority != other.priority: return False |
| 3067 | if self.table_id != other.table_id: return False |
| 3068 | if self.match != other.match: return False |
| 3069 | return True |
| 3070 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3071 | def pretty_print(self, q): |
| 3072 | q.text("bsn_flow_idle {") |
| 3073 | with q.group(): |
| 3074 | with q.indent(2): |
| 3075 | q.breakable() |
| 3076 | q.text("xid = "); |
| 3077 | if self.xid != None: |
| 3078 | q.text("%#x" % self.xid) |
| 3079 | else: |
| 3080 | q.text('None') |
| 3081 | q.text(","); q.breakable() |
| 3082 | q.text("cookie = "); |
| 3083 | q.text("%#x" % self.cookie) |
| 3084 | q.text(","); q.breakable() |
| 3085 | q.text("priority = "); |
| 3086 | q.text("%#x" % self.priority) |
| 3087 | q.text(","); q.breakable() |
| 3088 | q.text("table_id = "); |
| 3089 | q.text("%#x" % self.table_id) |
| 3090 | q.text(","); q.breakable() |
| 3091 | q.text("match = "); |
| 3092 | q.pp(self.match) |
| 3093 | q.breakable() |
| 3094 | q.text('}') |
| 3095 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3096 | bsn_header.subtypes[40] = bsn_flow_idle |
| 3097 | |
| 3098 | class bsn_flow_idle_enable_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3099 | version = 4 |
| 3100 | type = 4 |
| 3101 | experimenter = 6035143 |
| 3102 | subtype = 39 |
| 3103 | |
| 3104 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3105 | if xid != None: |
| 3106 | self.xid = xid |
| 3107 | else: |
| 3108 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3109 | if enabled != None: |
| 3110 | self.enabled = enabled |
| 3111 | else: |
| 3112 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3113 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3114 | |
| 3115 | def pack(self): |
| 3116 | packed = [] |
| 3117 | packed.append(struct.pack("!B", self.version)) |
| 3118 | packed.append(struct.pack("!B", self.type)) |
| 3119 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3120 | packed.append(struct.pack("!L", self.xid)) |
| 3121 | packed.append(struct.pack("!L", self.experimenter)) |
| 3122 | packed.append(struct.pack("!L", self.subtype)) |
| 3123 | packed.append(struct.pack("!L", self.enabled)) |
| 3124 | length = sum([len(x) for x in packed]) |
| 3125 | packed[2] = struct.pack("!H", length) |
| 3126 | return ''.join(packed) |
| 3127 | |
| 3128 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3129 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3130 | obj = bsn_flow_idle_enable_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3131 | _version = reader.read("!B")[0] |
| 3132 | assert(_version == 4) |
| 3133 | _type = reader.read("!B")[0] |
| 3134 | assert(_type == 4) |
| 3135 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3136 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3137 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3138 | obj.xid = reader.read("!L")[0] |
| 3139 | _experimenter = reader.read("!L")[0] |
| 3140 | assert(_experimenter == 6035143) |
| 3141 | _subtype = reader.read("!L")[0] |
| 3142 | assert(_subtype == 39) |
| 3143 | obj.enabled = reader.read("!L")[0] |
| 3144 | return obj |
| 3145 | |
| 3146 | def __eq__(self, other): |
| 3147 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3148 | if self.xid != other.xid: return False |
| 3149 | if self.enabled != other.enabled: return False |
| 3150 | return True |
| 3151 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3152 | def pretty_print(self, q): |
| 3153 | q.text("bsn_flow_idle_enable_get_reply {") |
| 3154 | with q.group(): |
| 3155 | with q.indent(2): |
| 3156 | q.breakable() |
| 3157 | q.text("xid = "); |
| 3158 | if self.xid != None: |
| 3159 | q.text("%#x" % self.xid) |
| 3160 | else: |
| 3161 | q.text('None') |
| 3162 | q.text(","); q.breakable() |
| 3163 | q.text("enabled = "); |
| 3164 | q.text("%#x" % self.enabled) |
| 3165 | q.breakable() |
| 3166 | q.text('}') |
| 3167 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3168 | bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply |
| 3169 | |
| 3170 | class bsn_flow_idle_enable_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3171 | version = 4 |
| 3172 | type = 4 |
| 3173 | experimenter = 6035143 |
| 3174 | subtype = 38 |
| 3175 | |
| 3176 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3177 | if xid != None: |
| 3178 | self.xid = xid |
| 3179 | else: |
| 3180 | self.xid = None |
| 3181 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3182 | |
| 3183 | def pack(self): |
| 3184 | packed = [] |
| 3185 | packed.append(struct.pack("!B", self.version)) |
| 3186 | packed.append(struct.pack("!B", self.type)) |
| 3187 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3188 | packed.append(struct.pack("!L", self.xid)) |
| 3189 | packed.append(struct.pack("!L", self.experimenter)) |
| 3190 | packed.append(struct.pack("!L", self.subtype)) |
| 3191 | length = sum([len(x) for x in packed]) |
| 3192 | packed[2] = struct.pack("!H", length) |
| 3193 | return ''.join(packed) |
| 3194 | |
| 3195 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3196 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3197 | obj = bsn_flow_idle_enable_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3198 | _version = reader.read("!B")[0] |
| 3199 | assert(_version == 4) |
| 3200 | _type = reader.read("!B")[0] |
| 3201 | assert(_type == 4) |
| 3202 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3203 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3204 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3205 | obj.xid = reader.read("!L")[0] |
| 3206 | _experimenter = reader.read("!L")[0] |
| 3207 | assert(_experimenter == 6035143) |
| 3208 | _subtype = reader.read("!L")[0] |
| 3209 | assert(_subtype == 38) |
| 3210 | return obj |
| 3211 | |
| 3212 | def __eq__(self, other): |
| 3213 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3214 | if self.xid != other.xid: return False |
| 3215 | return True |
| 3216 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3217 | def pretty_print(self, q): |
| 3218 | q.text("bsn_flow_idle_enable_get_request {") |
| 3219 | with q.group(): |
| 3220 | with q.indent(2): |
| 3221 | q.breakable() |
| 3222 | q.text("xid = "); |
| 3223 | if self.xid != None: |
| 3224 | q.text("%#x" % self.xid) |
| 3225 | else: |
| 3226 | q.text('None') |
| 3227 | q.breakable() |
| 3228 | q.text('}') |
| 3229 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3230 | bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request |
| 3231 | |
| 3232 | class bsn_flow_idle_enable_set_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3233 | version = 4 |
| 3234 | type = 4 |
| 3235 | experimenter = 6035143 |
| 3236 | subtype = 37 |
| 3237 | |
| 3238 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3239 | if xid != None: |
| 3240 | self.xid = xid |
| 3241 | else: |
| 3242 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3243 | if enable != None: |
| 3244 | self.enable = enable |
| 3245 | else: |
| 3246 | self.enable = 0 |
| 3247 | if status != None: |
| 3248 | self.status = status |
| 3249 | else: |
| 3250 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3251 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3252 | |
| 3253 | def pack(self): |
| 3254 | packed = [] |
| 3255 | packed.append(struct.pack("!B", self.version)) |
| 3256 | packed.append(struct.pack("!B", self.type)) |
| 3257 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3258 | packed.append(struct.pack("!L", self.xid)) |
| 3259 | packed.append(struct.pack("!L", self.experimenter)) |
| 3260 | packed.append(struct.pack("!L", self.subtype)) |
| 3261 | packed.append(struct.pack("!L", self.enable)) |
| 3262 | packed.append(struct.pack("!L", self.status)) |
| 3263 | length = sum([len(x) for x in packed]) |
| 3264 | packed[2] = struct.pack("!H", length) |
| 3265 | return ''.join(packed) |
| 3266 | |
| 3267 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3268 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3269 | obj = bsn_flow_idle_enable_set_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3270 | _version = reader.read("!B")[0] |
| 3271 | assert(_version == 4) |
| 3272 | _type = reader.read("!B")[0] |
| 3273 | assert(_type == 4) |
| 3274 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3275 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3276 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3277 | obj.xid = reader.read("!L")[0] |
| 3278 | _experimenter = reader.read("!L")[0] |
| 3279 | assert(_experimenter == 6035143) |
| 3280 | _subtype = reader.read("!L")[0] |
| 3281 | assert(_subtype == 37) |
| 3282 | obj.enable = reader.read("!L")[0] |
| 3283 | obj.status = reader.read("!L")[0] |
| 3284 | return obj |
| 3285 | |
| 3286 | def __eq__(self, other): |
| 3287 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3288 | if self.xid != other.xid: return False |
| 3289 | if self.enable != other.enable: return False |
| 3290 | if self.status != other.status: return False |
| 3291 | return True |
| 3292 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3293 | def pretty_print(self, q): |
| 3294 | q.text("bsn_flow_idle_enable_set_reply {") |
| 3295 | with q.group(): |
| 3296 | with q.indent(2): |
| 3297 | q.breakable() |
| 3298 | q.text("xid = "); |
| 3299 | if self.xid != None: |
| 3300 | q.text("%#x" % self.xid) |
| 3301 | else: |
| 3302 | q.text('None') |
| 3303 | q.text(","); q.breakable() |
| 3304 | q.text("enable = "); |
| 3305 | q.text("%#x" % self.enable) |
| 3306 | q.text(","); q.breakable() |
| 3307 | q.text("status = "); |
| 3308 | q.text("%#x" % self.status) |
| 3309 | q.breakable() |
| 3310 | q.text('}') |
| 3311 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3312 | bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply |
| 3313 | |
| 3314 | class bsn_flow_idle_enable_set_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3315 | version = 4 |
| 3316 | type = 4 |
| 3317 | experimenter = 6035143 |
| 3318 | subtype = 36 |
| 3319 | |
| 3320 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3321 | if xid != None: |
| 3322 | self.xid = xid |
| 3323 | else: |
| 3324 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3325 | if enable != None: |
| 3326 | self.enable = enable |
| 3327 | else: |
| 3328 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3329 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3330 | |
| 3331 | def pack(self): |
| 3332 | packed = [] |
| 3333 | packed.append(struct.pack("!B", self.version)) |
| 3334 | packed.append(struct.pack("!B", self.type)) |
| 3335 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3336 | packed.append(struct.pack("!L", self.xid)) |
| 3337 | packed.append(struct.pack("!L", self.experimenter)) |
| 3338 | packed.append(struct.pack("!L", self.subtype)) |
| 3339 | packed.append(struct.pack("!L", self.enable)) |
| 3340 | length = sum([len(x) for x in packed]) |
| 3341 | packed[2] = struct.pack("!H", length) |
| 3342 | return ''.join(packed) |
| 3343 | |
| 3344 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3345 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3346 | obj = bsn_flow_idle_enable_set_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3347 | _version = reader.read("!B")[0] |
| 3348 | assert(_version == 4) |
| 3349 | _type = reader.read("!B")[0] |
| 3350 | assert(_type == 4) |
| 3351 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3352 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3353 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3354 | obj.xid = reader.read("!L")[0] |
| 3355 | _experimenter = reader.read("!L")[0] |
| 3356 | assert(_experimenter == 6035143) |
| 3357 | _subtype = reader.read("!L")[0] |
| 3358 | assert(_subtype == 36) |
| 3359 | obj.enable = reader.read("!L")[0] |
| 3360 | return obj |
| 3361 | |
| 3362 | def __eq__(self, other): |
| 3363 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3364 | if self.xid != other.xid: return False |
| 3365 | if self.enable != other.enable: return False |
| 3366 | return True |
| 3367 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 3368 | def pretty_print(self, q): |
| 3369 | q.text("bsn_flow_idle_enable_set_request {") |
| 3370 | with q.group(): |
| 3371 | with q.indent(2): |
| 3372 | q.breakable() |
| 3373 | q.text("xid = "); |
| 3374 | if self.xid != None: |
| 3375 | q.text("%#x" % self.xid) |
| 3376 | else: |
| 3377 | q.text('None') |
| 3378 | q.text(","); q.breakable() |
| 3379 | q.text("enable = "); |
| 3380 | q.text("%#x" % self.enable) |
| 3381 | q.breakable() |
| 3382 | q.text('}') |
| 3383 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3384 | bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request |
| 3385 | |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3386 | class bsn_generic_stats_reply(bsn_stats_reply): |
| 3387 | version = 4 |
| 3388 | type = 19 |
| 3389 | stats_type = 65535 |
| 3390 | experimenter = 6035143 |
| 3391 | subtype = 16 |
| 3392 | |
| 3393 | def __init__(self, xid=None, flags=None, entries=None): |
| 3394 | if xid != None: |
| 3395 | self.xid = xid |
| 3396 | else: |
| 3397 | self.xid = None |
| 3398 | if flags != None: |
| 3399 | self.flags = flags |
| 3400 | else: |
| 3401 | self.flags = 0 |
| 3402 | if entries != None: |
| 3403 | self.entries = entries |
| 3404 | else: |
| 3405 | self.entries = [] |
| 3406 | return |
| 3407 | |
| 3408 | def pack(self): |
| 3409 | packed = [] |
| 3410 | packed.append(struct.pack("!B", self.version)) |
| 3411 | packed.append(struct.pack("!B", self.type)) |
| 3412 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3413 | packed.append(struct.pack("!L", self.xid)) |
| 3414 | packed.append(struct.pack("!H", self.stats_type)) |
| 3415 | packed.append(struct.pack("!H", self.flags)) |
| 3416 | packed.append('\x00' * 4) |
| 3417 | packed.append(struct.pack("!L", self.experimenter)) |
| 3418 | packed.append(struct.pack("!L", self.subtype)) |
| 3419 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3420 | length = sum([len(x) for x in packed]) |
| 3421 | packed[2] = struct.pack("!H", length) |
| 3422 | return ''.join(packed) |
| 3423 | |
| 3424 | @staticmethod |
| 3425 | def unpack(reader): |
| 3426 | obj = bsn_generic_stats_reply() |
| 3427 | _version = reader.read("!B")[0] |
| 3428 | assert(_version == 4) |
| 3429 | _type = reader.read("!B")[0] |
| 3430 | assert(_type == 19) |
| 3431 | _length = reader.read("!H")[0] |
| 3432 | orig_reader = reader |
| 3433 | reader = orig_reader.slice(_length, 4) |
| 3434 | obj.xid = reader.read("!L")[0] |
| 3435 | _stats_type = reader.read("!H")[0] |
| 3436 | assert(_stats_type == 65535) |
| 3437 | obj.flags = reader.read("!H")[0] |
| 3438 | reader.skip(4) |
| 3439 | _experimenter = reader.read("!L")[0] |
| 3440 | assert(_experimenter == 6035143) |
| 3441 | _subtype = reader.read("!L")[0] |
| 3442 | assert(_subtype == 16) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3443 | 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] | 3444 | return obj |
| 3445 | |
| 3446 | def __eq__(self, other): |
| 3447 | if type(self) != type(other): return False |
| 3448 | if self.xid != other.xid: return False |
| 3449 | if self.flags != other.flags: return False |
| 3450 | if self.entries != other.entries: return False |
| 3451 | return True |
| 3452 | |
| 3453 | def pretty_print(self, q): |
| 3454 | q.text("bsn_generic_stats_reply {") |
| 3455 | with q.group(): |
| 3456 | with q.indent(2): |
| 3457 | q.breakable() |
| 3458 | q.text("xid = "); |
| 3459 | if self.xid != None: |
| 3460 | q.text("%#x" % self.xid) |
| 3461 | else: |
| 3462 | q.text('None') |
| 3463 | q.text(","); q.breakable() |
| 3464 | q.text("flags = "); |
| 3465 | q.text("%#x" % self.flags) |
| 3466 | q.text(","); q.breakable() |
| 3467 | q.text("entries = "); |
| 3468 | q.pp(self.entries) |
| 3469 | q.breakable() |
| 3470 | q.text('}') |
| 3471 | |
| 3472 | bsn_stats_reply.subtypes[16] = bsn_generic_stats_reply |
| 3473 | |
| 3474 | class bsn_generic_stats_request(bsn_stats_request): |
| 3475 | version = 4 |
| 3476 | type = 18 |
| 3477 | stats_type = 65535 |
| 3478 | experimenter = 6035143 |
| 3479 | subtype = 16 |
| 3480 | |
| 3481 | def __init__(self, xid=None, flags=None, name=None, tlvs=None): |
| 3482 | if xid != None: |
| 3483 | self.xid = xid |
| 3484 | else: |
| 3485 | self.xid = None |
| 3486 | if flags != None: |
| 3487 | self.flags = flags |
| 3488 | else: |
| 3489 | self.flags = 0 |
| 3490 | if name != None: |
| 3491 | self.name = name |
| 3492 | else: |
| 3493 | self.name = "" |
| 3494 | if tlvs != None: |
| 3495 | self.tlvs = tlvs |
| 3496 | else: |
| 3497 | self.tlvs = [] |
| 3498 | return |
| 3499 | |
| 3500 | def pack(self): |
| 3501 | packed = [] |
| 3502 | packed.append(struct.pack("!B", self.version)) |
| 3503 | packed.append(struct.pack("!B", self.type)) |
| 3504 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3505 | packed.append(struct.pack("!L", self.xid)) |
| 3506 | packed.append(struct.pack("!H", self.stats_type)) |
| 3507 | packed.append(struct.pack("!H", self.flags)) |
| 3508 | packed.append('\x00' * 4) |
| 3509 | packed.append(struct.pack("!L", self.experimenter)) |
| 3510 | packed.append(struct.pack("!L", self.subtype)) |
| 3511 | packed.append(struct.pack("!64s", self.name)) |
| 3512 | packed.append(loxi.generic_util.pack_list(self.tlvs)) |
| 3513 | length = sum([len(x) for x in packed]) |
| 3514 | packed[2] = struct.pack("!H", length) |
| 3515 | return ''.join(packed) |
| 3516 | |
| 3517 | @staticmethod |
| 3518 | def unpack(reader): |
| 3519 | obj = bsn_generic_stats_request() |
| 3520 | _version = reader.read("!B")[0] |
| 3521 | assert(_version == 4) |
| 3522 | _type = reader.read("!B")[0] |
| 3523 | assert(_type == 18) |
| 3524 | _length = reader.read("!H")[0] |
| 3525 | orig_reader = reader |
| 3526 | reader = orig_reader.slice(_length, 4) |
| 3527 | obj.xid = reader.read("!L")[0] |
| 3528 | _stats_type = reader.read("!H")[0] |
| 3529 | assert(_stats_type == 65535) |
| 3530 | obj.flags = reader.read("!H")[0] |
| 3531 | reader.skip(4) |
| 3532 | _experimenter = reader.read("!L")[0] |
| 3533 | assert(_experimenter == 6035143) |
| 3534 | _subtype = reader.read("!L")[0] |
| 3535 | assert(_subtype == 16) |
| 3536 | obj.name = reader.read("!64s")[0].rstrip("\x00") |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3537 | 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] | 3538 | return obj |
| 3539 | |
| 3540 | def __eq__(self, other): |
| 3541 | if type(self) != type(other): return False |
| 3542 | if self.xid != other.xid: return False |
| 3543 | if self.flags != other.flags: return False |
| 3544 | if self.name != other.name: return False |
| 3545 | if self.tlvs != other.tlvs: return False |
| 3546 | return True |
| 3547 | |
| 3548 | def pretty_print(self, q): |
| 3549 | q.text("bsn_generic_stats_request {") |
| 3550 | with q.group(): |
| 3551 | with q.indent(2): |
| 3552 | q.breakable() |
| 3553 | q.text("xid = "); |
| 3554 | if self.xid != None: |
| 3555 | q.text("%#x" % self.xid) |
| 3556 | else: |
| 3557 | q.text('None') |
| 3558 | q.text(","); q.breakable() |
| 3559 | q.text("flags = "); |
| 3560 | q.text("%#x" % self.flags) |
| 3561 | q.text(","); q.breakable() |
| 3562 | q.text("name = "); |
| 3563 | q.pp(self.name) |
| 3564 | q.text(","); q.breakable() |
| 3565 | q.text("tlvs = "); |
| 3566 | q.pp(self.tlvs) |
| 3567 | q.breakable() |
| 3568 | q.text('}') |
| 3569 | |
| 3570 | bsn_stats_request.subtypes[16] = bsn_generic_stats_request |
| 3571 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3572 | class bsn_gentable_bucket_stats_reply(bsn_stats_reply): |
| 3573 | version = 4 |
| 3574 | type = 19 |
| 3575 | stats_type = 65535 |
| 3576 | experimenter = 6035143 |
| 3577 | subtype = 5 |
| 3578 | |
| 3579 | def __init__(self, xid=None, flags=None, entries=None): |
| 3580 | if xid != None: |
| 3581 | self.xid = xid |
| 3582 | else: |
| 3583 | self.xid = None |
| 3584 | if flags != None: |
| 3585 | self.flags = flags |
| 3586 | else: |
| 3587 | self.flags = 0 |
| 3588 | if entries != None: |
| 3589 | self.entries = entries |
| 3590 | else: |
| 3591 | self.entries = [] |
| 3592 | return |
| 3593 | |
| 3594 | def pack(self): |
| 3595 | packed = [] |
| 3596 | packed.append(struct.pack("!B", self.version)) |
| 3597 | packed.append(struct.pack("!B", self.type)) |
| 3598 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3599 | packed.append(struct.pack("!L", self.xid)) |
| 3600 | packed.append(struct.pack("!H", self.stats_type)) |
| 3601 | packed.append(struct.pack("!H", self.flags)) |
| 3602 | packed.append('\x00' * 4) |
| 3603 | packed.append(struct.pack("!L", self.experimenter)) |
| 3604 | packed.append(struct.pack("!L", self.subtype)) |
| 3605 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3606 | length = sum([len(x) for x in packed]) |
| 3607 | packed[2] = struct.pack("!H", length) |
| 3608 | return ''.join(packed) |
| 3609 | |
| 3610 | @staticmethod |
| 3611 | def unpack(reader): |
| 3612 | obj = bsn_gentable_bucket_stats_reply() |
| 3613 | _version = reader.read("!B")[0] |
| 3614 | assert(_version == 4) |
| 3615 | _type = reader.read("!B")[0] |
| 3616 | assert(_type == 19) |
| 3617 | _length = reader.read("!H")[0] |
| 3618 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3619 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3620 | obj.xid = reader.read("!L")[0] |
| 3621 | _stats_type = reader.read("!H")[0] |
| 3622 | assert(_stats_type == 65535) |
| 3623 | obj.flags = reader.read("!H")[0] |
| 3624 | reader.skip(4) |
| 3625 | _experimenter = reader.read("!L")[0] |
| 3626 | assert(_experimenter == 6035143) |
| 3627 | _subtype = reader.read("!L")[0] |
| 3628 | assert(_subtype == 5) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3629 | 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] | 3630 | return obj |
| 3631 | |
| 3632 | def __eq__(self, other): |
| 3633 | if type(self) != type(other): return False |
| 3634 | if self.xid != other.xid: return False |
| 3635 | if self.flags != other.flags: return False |
| 3636 | if self.entries != other.entries: return False |
| 3637 | return True |
| 3638 | |
| 3639 | def pretty_print(self, q): |
| 3640 | q.text("bsn_gentable_bucket_stats_reply {") |
| 3641 | with q.group(): |
| 3642 | with q.indent(2): |
| 3643 | q.breakable() |
| 3644 | q.text("xid = "); |
| 3645 | if self.xid != None: |
| 3646 | q.text("%#x" % self.xid) |
| 3647 | else: |
| 3648 | q.text('None') |
| 3649 | q.text(","); q.breakable() |
| 3650 | q.text("flags = "); |
| 3651 | q.text("%#x" % self.flags) |
| 3652 | q.text(","); q.breakable() |
| 3653 | q.text("entries = "); |
| 3654 | q.pp(self.entries) |
| 3655 | q.breakable() |
| 3656 | q.text('}') |
| 3657 | |
| 3658 | bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply |
| 3659 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3660 | class bsn_gentable_bucket_stats_request(bsn_stats_request): |
| 3661 | version = 4 |
| 3662 | type = 18 |
| 3663 | stats_type = 65535 |
| 3664 | experimenter = 6035143 |
| 3665 | subtype = 5 |
| 3666 | |
| 3667 | def __init__(self, xid=None, flags=None, table_id=None): |
| 3668 | if xid != None: |
| 3669 | self.xid = xid |
| 3670 | else: |
| 3671 | self.xid = None |
| 3672 | if flags != None: |
| 3673 | self.flags = flags |
| 3674 | else: |
| 3675 | self.flags = 0 |
| 3676 | if table_id != None: |
| 3677 | self.table_id = table_id |
| 3678 | else: |
| 3679 | self.table_id = 0 |
| 3680 | return |
| 3681 | |
| 3682 | def pack(self): |
| 3683 | packed = [] |
| 3684 | packed.append(struct.pack("!B", self.version)) |
| 3685 | packed.append(struct.pack("!B", self.type)) |
| 3686 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3687 | packed.append(struct.pack("!L", self.xid)) |
| 3688 | packed.append(struct.pack("!H", self.stats_type)) |
| 3689 | packed.append(struct.pack("!H", self.flags)) |
| 3690 | packed.append('\x00' * 4) |
| 3691 | packed.append(struct.pack("!L", self.experimenter)) |
| 3692 | packed.append(struct.pack("!L", self.subtype)) |
| 3693 | packed.append(struct.pack("!H", self.table_id)) |
| 3694 | length = sum([len(x) for x in packed]) |
| 3695 | packed[2] = struct.pack("!H", length) |
| 3696 | return ''.join(packed) |
| 3697 | |
| 3698 | @staticmethod |
| 3699 | def unpack(reader): |
| 3700 | obj = bsn_gentable_bucket_stats_request() |
| 3701 | _version = reader.read("!B")[0] |
| 3702 | assert(_version == 4) |
| 3703 | _type = reader.read("!B")[0] |
| 3704 | assert(_type == 18) |
| 3705 | _length = reader.read("!H")[0] |
| 3706 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3707 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3708 | obj.xid = reader.read("!L")[0] |
| 3709 | _stats_type = reader.read("!H")[0] |
| 3710 | assert(_stats_type == 65535) |
| 3711 | obj.flags = reader.read("!H")[0] |
| 3712 | reader.skip(4) |
| 3713 | _experimenter = reader.read("!L")[0] |
| 3714 | assert(_experimenter == 6035143) |
| 3715 | _subtype = reader.read("!L")[0] |
| 3716 | assert(_subtype == 5) |
| 3717 | obj.table_id = reader.read("!H")[0] |
| 3718 | return obj |
| 3719 | |
| 3720 | def __eq__(self, other): |
| 3721 | if type(self) != type(other): return False |
| 3722 | if self.xid != other.xid: return False |
| 3723 | if self.flags != other.flags: return False |
| 3724 | if self.table_id != other.table_id: return False |
| 3725 | return True |
| 3726 | |
| 3727 | def pretty_print(self, q): |
| 3728 | q.text("bsn_gentable_bucket_stats_request {") |
| 3729 | with q.group(): |
| 3730 | with q.indent(2): |
| 3731 | q.breakable() |
| 3732 | q.text("xid = "); |
| 3733 | if self.xid != None: |
| 3734 | q.text("%#x" % self.xid) |
| 3735 | else: |
| 3736 | q.text('None') |
| 3737 | q.text(","); q.breakable() |
| 3738 | q.text("flags = "); |
| 3739 | q.text("%#x" % self.flags) |
| 3740 | q.text(","); q.breakable() |
| 3741 | q.text("table_id = "); |
| 3742 | q.text("%#x" % self.table_id) |
| 3743 | q.breakable() |
| 3744 | q.text('}') |
| 3745 | |
| 3746 | bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request |
| 3747 | |
| 3748 | class bsn_gentable_clear_reply(bsn_header): |
| 3749 | version = 4 |
| 3750 | type = 4 |
| 3751 | experimenter = 6035143 |
| 3752 | subtype = 49 |
| 3753 | |
| 3754 | def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None): |
| 3755 | if xid != None: |
| 3756 | self.xid = xid |
| 3757 | else: |
| 3758 | self.xid = None |
| 3759 | if table_id != None: |
| 3760 | self.table_id = table_id |
| 3761 | else: |
| 3762 | self.table_id = 0 |
| 3763 | if deleted_count != None: |
| 3764 | self.deleted_count = deleted_count |
| 3765 | else: |
| 3766 | self.deleted_count = 0 |
| 3767 | if error_count != None: |
| 3768 | self.error_count = error_count |
| 3769 | else: |
| 3770 | self.error_count = 0 |
| 3771 | return |
| 3772 | |
| 3773 | def pack(self): |
| 3774 | packed = [] |
| 3775 | packed.append(struct.pack("!B", self.version)) |
| 3776 | packed.append(struct.pack("!B", self.type)) |
| 3777 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3778 | packed.append(struct.pack("!L", self.xid)) |
| 3779 | packed.append(struct.pack("!L", self.experimenter)) |
| 3780 | packed.append(struct.pack("!L", self.subtype)) |
| 3781 | packed.append(struct.pack("!H", self.table_id)) |
| 3782 | packed.append('\x00' * 2) |
| 3783 | packed.append(struct.pack("!L", self.deleted_count)) |
| 3784 | packed.append(struct.pack("!L", self.error_count)) |
| 3785 | length = sum([len(x) for x in packed]) |
| 3786 | packed[2] = struct.pack("!H", length) |
| 3787 | return ''.join(packed) |
| 3788 | |
| 3789 | @staticmethod |
| 3790 | def unpack(reader): |
| 3791 | obj = bsn_gentable_clear_reply() |
| 3792 | _version = reader.read("!B")[0] |
| 3793 | assert(_version == 4) |
| 3794 | _type = reader.read("!B")[0] |
| 3795 | assert(_type == 4) |
| 3796 | _length = reader.read("!H")[0] |
| 3797 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3798 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3799 | obj.xid = reader.read("!L")[0] |
| 3800 | _experimenter = reader.read("!L")[0] |
| 3801 | assert(_experimenter == 6035143) |
| 3802 | _subtype = reader.read("!L")[0] |
| 3803 | assert(_subtype == 49) |
| 3804 | obj.table_id = reader.read("!H")[0] |
| 3805 | reader.skip(2) |
| 3806 | obj.deleted_count = reader.read("!L")[0] |
| 3807 | obj.error_count = reader.read("!L")[0] |
| 3808 | return obj |
| 3809 | |
| 3810 | def __eq__(self, other): |
| 3811 | if type(self) != type(other): return False |
| 3812 | if self.xid != other.xid: return False |
| 3813 | if self.table_id != other.table_id: return False |
| 3814 | if self.deleted_count != other.deleted_count: return False |
| 3815 | if self.error_count != other.error_count: return False |
| 3816 | return True |
| 3817 | |
| 3818 | def pretty_print(self, q): |
| 3819 | q.text("bsn_gentable_clear_reply {") |
| 3820 | with q.group(): |
| 3821 | with q.indent(2): |
| 3822 | q.breakable() |
| 3823 | q.text("xid = "); |
| 3824 | if self.xid != None: |
| 3825 | q.text("%#x" % self.xid) |
| 3826 | else: |
| 3827 | q.text('None') |
| 3828 | q.text(","); q.breakable() |
| 3829 | q.text("table_id = "); |
| 3830 | q.text("%#x" % self.table_id) |
| 3831 | q.text(","); q.breakable() |
| 3832 | q.text("deleted_count = "); |
| 3833 | q.text("%#x" % self.deleted_count) |
| 3834 | q.text(","); q.breakable() |
| 3835 | q.text("error_count = "); |
| 3836 | q.text("%#x" % self.error_count) |
| 3837 | q.breakable() |
| 3838 | q.text('}') |
| 3839 | |
| 3840 | bsn_header.subtypes[49] = bsn_gentable_clear_reply |
| 3841 | |
| 3842 | class bsn_gentable_clear_request(bsn_header): |
| 3843 | version = 4 |
| 3844 | type = 4 |
| 3845 | experimenter = 6035143 |
| 3846 | subtype = 48 |
| 3847 | |
| 3848 | def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None): |
| 3849 | if xid != None: |
| 3850 | self.xid = xid |
| 3851 | else: |
| 3852 | self.xid = None |
| 3853 | if table_id != None: |
| 3854 | self.table_id = table_id |
| 3855 | else: |
| 3856 | self.table_id = 0 |
| 3857 | if checksum != None: |
| 3858 | self.checksum = checksum |
| 3859 | else: |
| 3860 | self.checksum = 0 |
| 3861 | if checksum_mask != None: |
| 3862 | self.checksum_mask = checksum_mask |
| 3863 | else: |
| 3864 | self.checksum_mask = 0 |
| 3865 | return |
| 3866 | |
| 3867 | def pack(self): |
| 3868 | packed = [] |
| 3869 | packed.append(struct.pack("!B", self.version)) |
| 3870 | packed.append(struct.pack("!B", self.type)) |
| 3871 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3872 | packed.append(struct.pack("!L", self.xid)) |
| 3873 | packed.append(struct.pack("!L", self.experimenter)) |
| 3874 | packed.append(struct.pack("!L", self.subtype)) |
| 3875 | packed.append(struct.pack("!H", self.table_id)) |
| 3876 | packed.append('\x00' * 2) |
| 3877 | packed.append(util.pack_checksum_128(self.checksum)) |
| 3878 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 3879 | length = sum([len(x) for x in packed]) |
| 3880 | packed[2] = struct.pack("!H", length) |
| 3881 | return ''.join(packed) |
| 3882 | |
| 3883 | @staticmethod |
| 3884 | def unpack(reader): |
| 3885 | obj = bsn_gentable_clear_request() |
| 3886 | _version = reader.read("!B")[0] |
| 3887 | assert(_version == 4) |
| 3888 | _type = reader.read("!B")[0] |
| 3889 | assert(_type == 4) |
| 3890 | _length = reader.read("!H")[0] |
| 3891 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3892 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3893 | obj.xid = reader.read("!L")[0] |
| 3894 | _experimenter = reader.read("!L")[0] |
| 3895 | assert(_experimenter == 6035143) |
| 3896 | _subtype = reader.read("!L")[0] |
| 3897 | assert(_subtype == 48) |
| 3898 | obj.table_id = reader.read("!H")[0] |
| 3899 | reader.skip(2) |
| 3900 | obj.checksum = util.unpack_checksum_128(reader) |
| 3901 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 3902 | return obj |
| 3903 | |
| 3904 | def __eq__(self, other): |
| 3905 | if type(self) != type(other): return False |
| 3906 | if self.xid != other.xid: return False |
| 3907 | if self.table_id != other.table_id: return False |
| 3908 | if self.checksum != other.checksum: return False |
| 3909 | if self.checksum_mask != other.checksum_mask: return False |
| 3910 | return True |
| 3911 | |
| 3912 | def pretty_print(self, q): |
| 3913 | q.text("bsn_gentable_clear_request {") |
| 3914 | with q.group(): |
| 3915 | with q.indent(2): |
| 3916 | q.breakable() |
| 3917 | q.text("xid = "); |
| 3918 | if self.xid != None: |
| 3919 | q.text("%#x" % self.xid) |
| 3920 | else: |
| 3921 | q.text('None') |
| 3922 | q.text(","); q.breakable() |
| 3923 | q.text("table_id = "); |
| 3924 | q.text("%#x" % self.table_id) |
| 3925 | q.text(","); q.breakable() |
| 3926 | q.text("checksum = "); |
| 3927 | q.pp(self.checksum) |
| 3928 | q.text(","); q.breakable() |
| 3929 | q.text("checksum_mask = "); |
| 3930 | q.pp(self.checksum_mask) |
| 3931 | q.breakable() |
| 3932 | q.text('}') |
| 3933 | |
| 3934 | bsn_header.subtypes[48] = bsn_gentable_clear_request |
| 3935 | |
| 3936 | class bsn_gentable_desc_stats_reply(bsn_stats_reply): |
| 3937 | version = 4 |
| 3938 | type = 19 |
| 3939 | stats_type = 65535 |
| 3940 | experimenter = 6035143 |
| 3941 | subtype = 4 |
| 3942 | |
| 3943 | def __init__(self, xid=None, flags=None, entries=None): |
| 3944 | if xid != None: |
| 3945 | self.xid = xid |
| 3946 | else: |
| 3947 | self.xid = None |
| 3948 | if flags != None: |
| 3949 | self.flags = flags |
| 3950 | else: |
| 3951 | self.flags = 0 |
| 3952 | if entries != None: |
| 3953 | self.entries = entries |
| 3954 | else: |
| 3955 | self.entries = [] |
| 3956 | return |
| 3957 | |
| 3958 | def pack(self): |
| 3959 | packed = [] |
| 3960 | packed.append(struct.pack("!B", self.version)) |
| 3961 | packed.append(struct.pack("!B", self.type)) |
| 3962 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3963 | packed.append(struct.pack("!L", self.xid)) |
| 3964 | packed.append(struct.pack("!H", self.stats_type)) |
| 3965 | packed.append(struct.pack("!H", self.flags)) |
| 3966 | packed.append('\x00' * 4) |
| 3967 | packed.append(struct.pack("!L", self.experimenter)) |
| 3968 | packed.append(struct.pack("!L", self.subtype)) |
| 3969 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 3970 | length = sum([len(x) for x in packed]) |
| 3971 | packed[2] = struct.pack("!H", length) |
| 3972 | return ''.join(packed) |
| 3973 | |
| 3974 | @staticmethod |
| 3975 | def unpack(reader): |
| 3976 | obj = bsn_gentable_desc_stats_reply() |
| 3977 | _version = reader.read("!B")[0] |
| 3978 | assert(_version == 4) |
| 3979 | _type = reader.read("!B")[0] |
| 3980 | assert(_type == 19) |
| 3981 | _length = reader.read("!H")[0] |
| 3982 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3983 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 3984 | obj.xid = reader.read("!L")[0] |
| 3985 | _stats_type = reader.read("!H")[0] |
| 3986 | assert(_stats_type == 65535) |
| 3987 | obj.flags = reader.read("!H")[0] |
| 3988 | reader.skip(4) |
| 3989 | _experimenter = reader.read("!L")[0] |
| 3990 | assert(_experimenter == 6035143) |
| 3991 | _subtype = reader.read("!L")[0] |
| 3992 | assert(_subtype == 4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3993 | 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] | 3994 | return obj |
| 3995 | |
| 3996 | def __eq__(self, other): |
| 3997 | if type(self) != type(other): return False |
| 3998 | if self.xid != other.xid: return False |
| 3999 | if self.flags != other.flags: return False |
| 4000 | if self.entries != other.entries: return False |
| 4001 | return True |
| 4002 | |
| 4003 | def pretty_print(self, q): |
| 4004 | q.text("bsn_gentable_desc_stats_reply {") |
| 4005 | with q.group(): |
| 4006 | with q.indent(2): |
| 4007 | q.breakable() |
| 4008 | q.text("xid = "); |
| 4009 | if self.xid != None: |
| 4010 | q.text("%#x" % self.xid) |
| 4011 | else: |
| 4012 | q.text('None') |
| 4013 | q.text(","); q.breakable() |
| 4014 | q.text("flags = "); |
| 4015 | q.text("%#x" % self.flags) |
| 4016 | q.text(","); q.breakable() |
| 4017 | q.text("entries = "); |
| 4018 | q.pp(self.entries) |
| 4019 | q.breakable() |
| 4020 | q.text('}') |
| 4021 | |
| 4022 | bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply |
| 4023 | |
| 4024 | class bsn_gentable_desc_stats_request(bsn_stats_request): |
| 4025 | version = 4 |
| 4026 | type = 18 |
| 4027 | stats_type = 65535 |
| 4028 | experimenter = 6035143 |
| 4029 | subtype = 4 |
| 4030 | |
| 4031 | def __init__(self, xid=None, flags=None): |
| 4032 | if xid != None: |
| 4033 | self.xid = xid |
| 4034 | else: |
| 4035 | self.xid = None |
| 4036 | if flags != None: |
| 4037 | self.flags = flags |
| 4038 | else: |
| 4039 | self.flags = 0 |
| 4040 | return |
| 4041 | |
| 4042 | def pack(self): |
| 4043 | packed = [] |
| 4044 | packed.append(struct.pack("!B", self.version)) |
| 4045 | packed.append(struct.pack("!B", self.type)) |
| 4046 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4047 | packed.append(struct.pack("!L", self.xid)) |
| 4048 | packed.append(struct.pack("!H", self.stats_type)) |
| 4049 | packed.append(struct.pack("!H", self.flags)) |
| 4050 | packed.append('\x00' * 4) |
| 4051 | packed.append(struct.pack("!L", self.experimenter)) |
| 4052 | packed.append(struct.pack("!L", self.subtype)) |
| 4053 | length = sum([len(x) for x in packed]) |
| 4054 | packed[2] = struct.pack("!H", length) |
| 4055 | return ''.join(packed) |
| 4056 | |
| 4057 | @staticmethod |
| 4058 | def unpack(reader): |
| 4059 | obj = bsn_gentable_desc_stats_request() |
| 4060 | _version = reader.read("!B")[0] |
| 4061 | assert(_version == 4) |
| 4062 | _type = reader.read("!B")[0] |
| 4063 | assert(_type == 18) |
| 4064 | _length = reader.read("!H")[0] |
| 4065 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4066 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4067 | obj.xid = reader.read("!L")[0] |
| 4068 | _stats_type = reader.read("!H")[0] |
| 4069 | assert(_stats_type == 65535) |
| 4070 | obj.flags = reader.read("!H")[0] |
| 4071 | reader.skip(4) |
| 4072 | _experimenter = reader.read("!L")[0] |
| 4073 | assert(_experimenter == 6035143) |
| 4074 | _subtype = reader.read("!L")[0] |
| 4075 | assert(_subtype == 4) |
| 4076 | return obj |
| 4077 | |
| 4078 | def __eq__(self, other): |
| 4079 | if type(self) != type(other): return False |
| 4080 | if self.xid != other.xid: return False |
| 4081 | if self.flags != other.flags: return False |
| 4082 | return True |
| 4083 | |
| 4084 | def pretty_print(self, q): |
| 4085 | q.text("bsn_gentable_desc_stats_request {") |
| 4086 | with q.group(): |
| 4087 | with q.indent(2): |
| 4088 | q.breakable() |
| 4089 | q.text("xid = "); |
| 4090 | if self.xid != None: |
| 4091 | q.text("%#x" % self.xid) |
| 4092 | else: |
| 4093 | q.text('None') |
| 4094 | q.text(","); q.breakable() |
| 4095 | q.text("flags = "); |
| 4096 | q.text("%#x" % self.flags) |
| 4097 | q.breakable() |
| 4098 | q.text('}') |
| 4099 | |
| 4100 | bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request |
| 4101 | |
| 4102 | class bsn_gentable_entry_add(bsn_header): |
| 4103 | version = 4 |
| 4104 | type = 4 |
| 4105 | experimenter = 6035143 |
| 4106 | subtype = 46 |
| 4107 | |
| 4108 | def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None): |
| 4109 | if xid != None: |
| 4110 | self.xid = xid |
| 4111 | else: |
| 4112 | self.xid = None |
| 4113 | if table_id != None: |
| 4114 | self.table_id = table_id |
| 4115 | else: |
| 4116 | self.table_id = 0 |
| 4117 | if checksum != None: |
| 4118 | self.checksum = checksum |
| 4119 | else: |
| 4120 | self.checksum = 0 |
| 4121 | if key != None: |
| 4122 | self.key = key |
| 4123 | else: |
| 4124 | self.key = [] |
| 4125 | if value != None: |
| 4126 | self.value = value |
| 4127 | else: |
| 4128 | self.value = [] |
| 4129 | return |
| 4130 | |
| 4131 | def pack(self): |
| 4132 | packed = [] |
| 4133 | packed.append(struct.pack("!B", self.version)) |
| 4134 | packed.append(struct.pack("!B", self.type)) |
| 4135 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4136 | packed.append(struct.pack("!L", self.xid)) |
| 4137 | packed.append(struct.pack("!L", self.experimenter)) |
| 4138 | packed.append(struct.pack("!L", self.subtype)) |
| 4139 | packed.append(struct.pack("!H", self.table_id)) |
| 4140 | packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7 |
| 4141 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4142 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4143 | packed[7] = struct.pack("!H", len(packed[-1])) |
| 4144 | packed.append(loxi.generic_util.pack_list(self.value)) |
| 4145 | length = sum([len(x) for x in packed]) |
| 4146 | packed[2] = struct.pack("!H", length) |
| 4147 | return ''.join(packed) |
| 4148 | |
| 4149 | @staticmethod |
| 4150 | def unpack(reader): |
| 4151 | obj = bsn_gentable_entry_add() |
| 4152 | _version = reader.read("!B")[0] |
| 4153 | assert(_version == 4) |
| 4154 | _type = reader.read("!B")[0] |
| 4155 | assert(_type == 4) |
| 4156 | _length = reader.read("!H")[0] |
| 4157 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4158 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4159 | obj.xid = reader.read("!L")[0] |
| 4160 | _experimenter = reader.read("!L")[0] |
| 4161 | assert(_experimenter == 6035143) |
| 4162 | _subtype = reader.read("!L")[0] |
| 4163 | assert(_subtype == 46) |
| 4164 | obj.table_id = reader.read("!H")[0] |
| 4165 | _key_length = reader.read("!H")[0] |
| 4166 | obj.checksum = util.unpack_checksum_128(reader) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4167 | obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), ofp.bsn_tlv.bsn_tlv.unpack) |
| 4168 | 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] | 4169 | return obj |
| 4170 | |
| 4171 | def __eq__(self, other): |
| 4172 | if type(self) != type(other): return False |
| 4173 | if self.xid != other.xid: return False |
| 4174 | if self.table_id != other.table_id: return False |
| 4175 | if self.checksum != other.checksum: return False |
| 4176 | if self.key != other.key: return False |
| 4177 | if self.value != other.value: return False |
| 4178 | return True |
| 4179 | |
| 4180 | def pretty_print(self, q): |
| 4181 | q.text("bsn_gentable_entry_add {") |
| 4182 | with q.group(): |
| 4183 | with q.indent(2): |
| 4184 | q.breakable() |
| 4185 | q.text("xid = "); |
| 4186 | if self.xid != None: |
| 4187 | q.text("%#x" % self.xid) |
| 4188 | else: |
| 4189 | q.text('None') |
| 4190 | q.text(","); q.breakable() |
| 4191 | q.text("table_id = "); |
| 4192 | q.text("%#x" % self.table_id) |
| 4193 | q.text(","); q.breakable() |
| 4194 | q.text("checksum = "); |
| 4195 | q.pp(self.checksum) |
| 4196 | q.text(","); q.breakable() |
| 4197 | q.text("key = "); |
| 4198 | q.pp(self.key) |
| 4199 | q.text(","); q.breakable() |
| 4200 | q.text("value = "); |
| 4201 | q.pp(self.value) |
| 4202 | q.breakable() |
| 4203 | q.text('}') |
| 4204 | |
| 4205 | bsn_header.subtypes[46] = bsn_gentable_entry_add |
| 4206 | |
| 4207 | class bsn_gentable_entry_delete(bsn_header): |
| 4208 | version = 4 |
| 4209 | type = 4 |
| 4210 | experimenter = 6035143 |
| 4211 | subtype = 47 |
| 4212 | |
| 4213 | def __init__(self, xid=None, table_id=None, key=None): |
| 4214 | if xid != None: |
| 4215 | self.xid = xid |
| 4216 | else: |
| 4217 | self.xid = None |
| 4218 | if table_id != None: |
| 4219 | self.table_id = table_id |
| 4220 | else: |
| 4221 | self.table_id = 0 |
| 4222 | if key != None: |
| 4223 | self.key = key |
| 4224 | else: |
| 4225 | self.key = [] |
| 4226 | return |
| 4227 | |
| 4228 | def pack(self): |
| 4229 | packed = [] |
| 4230 | packed.append(struct.pack("!B", self.version)) |
| 4231 | packed.append(struct.pack("!B", self.type)) |
| 4232 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4233 | packed.append(struct.pack("!L", self.xid)) |
| 4234 | packed.append(struct.pack("!L", self.experimenter)) |
| 4235 | packed.append(struct.pack("!L", self.subtype)) |
| 4236 | packed.append(struct.pack("!H", self.table_id)) |
| 4237 | packed.append(loxi.generic_util.pack_list(self.key)) |
| 4238 | length = sum([len(x) for x in packed]) |
| 4239 | packed[2] = struct.pack("!H", length) |
| 4240 | return ''.join(packed) |
| 4241 | |
| 4242 | @staticmethod |
| 4243 | def unpack(reader): |
| 4244 | obj = bsn_gentable_entry_delete() |
| 4245 | _version = reader.read("!B")[0] |
| 4246 | assert(_version == 4) |
| 4247 | _type = reader.read("!B")[0] |
| 4248 | assert(_type == 4) |
| 4249 | _length = reader.read("!H")[0] |
| 4250 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4251 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4252 | obj.xid = reader.read("!L")[0] |
| 4253 | _experimenter = reader.read("!L")[0] |
| 4254 | assert(_experimenter == 6035143) |
| 4255 | _subtype = reader.read("!L")[0] |
| 4256 | assert(_subtype == 47) |
| 4257 | obj.table_id = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4258 | 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] | 4259 | return obj |
| 4260 | |
| 4261 | def __eq__(self, other): |
| 4262 | if type(self) != type(other): return False |
| 4263 | if self.xid != other.xid: return False |
| 4264 | if self.table_id != other.table_id: return False |
| 4265 | if self.key != other.key: return False |
| 4266 | return True |
| 4267 | |
| 4268 | def pretty_print(self, q): |
| 4269 | q.text("bsn_gentable_entry_delete {") |
| 4270 | with q.group(): |
| 4271 | with q.indent(2): |
| 4272 | q.breakable() |
| 4273 | q.text("xid = "); |
| 4274 | if self.xid != None: |
| 4275 | q.text("%#x" % self.xid) |
| 4276 | else: |
| 4277 | q.text('None') |
| 4278 | q.text(","); q.breakable() |
| 4279 | q.text("table_id = "); |
| 4280 | q.text("%#x" % self.table_id) |
| 4281 | q.text(","); q.breakable() |
| 4282 | q.text("key = "); |
| 4283 | q.pp(self.key) |
| 4284 | q.breakable() |
| 4285 | q.text('}') |
| 4286 | |
| 4287 | bsn_header.subtypes[47] = bsn_gentable_entry_delete |
| 4288 | |
| 4289 | class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply): |
| 4290 | version = 4 |
| 4291 | type = 19 |
| 4292 | stats_type = 65535 |
| 4293 | experimenter = 6035143 |
| 4294 | subtype = 2 |
| 4295 | |
| 4296 | def __init__(self, xid=None, flags=None, entries=None): |
| 4297 | if xid != None: |
| 4298 | self.xid = xid |
| 4299 | else: |
| 4300 | self.xid = None |
| 4301 | if flags != None: |
| 4302 | self.flags = flags |
| 4303 | else: |
| 4304 | self.flags = 0 |
| 4305 | if entries != None: |
| 4306 | self.entries = entries |
| 4307 | else: |
| 4308 | self.entries = [] |
| 4309 | return |
| 4310 | |
| 4311 | def pack(self): |
| 4312 | packed = [] |
| 4313 | packed.append(struct.pack("!B", self.version)) |
| 4314 | packed.append(struct.pack("!B", self.type)) |
| 4315 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4316 | packed.append(struct.pack("!L", self.xid)) |
| 4317 | packed.append(struct.pack("!H", self.stats_type)) |
| 4318 | packed.append(struct.pack("!H", self.flags)) |
| 4319 | packed.append('\x00' * 4) |
| 4320 | packed.append(struct.pack("!L", self.experimenter)) |
| 4321 | packed.append(struct.pack("!L", self.subtype)) |
| 4322 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4323 | length = sum([len(x) for x in packed]) |
| 4324 | packed[2] = struct.pack("!H", length) |
| 4325 | return ''.join(packed) |
| 4326 | |
| 4327 | @staticmethod |
| 4328 | def unpack(reader): |
| 4329 | obj = bsn_gentable_entry_desc_stats_reply() |
| 4330 | _version = reader.read("!B")[0] |
| 4331 | assert(_version == 4) |
| 4332 | _type = reader.read("!B")[0] |
| 4333 | assert(_type == 19) |
| 4334 | _length = reader.read("!H")[0] |
| 4335 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4336 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4337 | obj.xid = reader.read("!L")[0] |
| 4338 | _stats_type = reader.read("!H")[0] |
| 4339 | assert(_stats_type == 65535) |
| 4340 | obj.flags = reader.read("!H")[0] |
| 4341 | reader.skip(4) |
| 4342 | _experimenter = reader.read("!L")[0] |
| 4343 | assert(_experimenter == 6035143) |
| 4344 | _subtype = reader.read("!L")[0] |
| 4345 | assert(_subtype == 2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4346 | 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] | 4347 | return obj |
| 4348 | |
| 4349 | def __eq__(self, other): |
| 4350 | if type(self) != type(other): return False |
| 4351 | if self.xid != other.xid: return False |
| 4352 | if self.flags != other.flags: return False |
| 4353 | if self.entries != other.entries: return False |
| 4354 | return True |
| 4355 | |
| 4356 | def pretty_print(self, q): |
| 4357 | q.text("bsn_gentable_entry_desc_stats_reply {") |
| 4358 | with q.group(): |
| 4359 | with q.indent(2): |
| 4360 | q.breakable() |
| 4361 | q.text("xid = "); |
| 4362 | if self.xid != None: |
| 4363 | q.text("%#x" % self.xid) |
| 4364 | else: |
| 4365 | q.text('None') |
| 4366 | q.text(","); q.breakable() |
| 4367 | q.text("flags = "); |
| 4368 | q.text("%#x" % self.flags) |
| 4369 | q.text(","); q.breakable() |
| 4370 | q.text("entries = "); |
| 4371 | q.pp(self.entries) |
| 4372 | q.breakable() |
| 4373 | q.text('}') |
| 4374 | |
| 4375 | bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply |
| 4376 | |
| 4377 | class bsn_gentable_entry_desc_stats_request(bsn_stats_request): |
| 4378 | version = 4 |
| 4379 | type = 18 |
| 4380 | stats_type = 65535 |
| 4381 | experimenter = 6035143 |
| 4382 | subtype = 2 |
| 4383 | |
| 4384 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4385 | if xid != None: |
| 4386 | self.xid = xid |
| 4387 | else: |
| 4388 | self.xid = None |
| 4389 | if flags != None: |
| 4390 | self.flags = flags |
| 4391 | else: |
| 4392 | self.flags = 0 |
| 4393 | if table_id != None: |
| 4394 | self.table_id = table_id |
| 4395 | else: |
| 4396 | self.table_id = 0 |
| 4397 | if checksum != None: |
| 4398 | self.checksum = checksum |
| 4399 | else: |
| 4400 | self.checksum = 0 |
| 4401 | if checksum_mask != None: |
| 4402 | self.checksum_mask = checksum_mask |
| 4403 | else: |
| 4404 | self.checksum_mask = 0 |
| 4405 | return |
| 4406 | |
| 4407 | def pack(self): |
| 4408 | packed = [] |
| 4409 | packed.append(struct.pack("!B", self.version)) |
| 4410 | packed.append(struct.pack("!B", self.type)) |
| 4411 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4412 | packed.append(struct.pack("!L", self.xid)) |
| 4413 | packed.append(struct.pack("!H", self.stats_type)) |
| 4414 | packed.append(struct.pack("!H", self.flags)) |
| 4415 | packed.append('\x00' * 4) |
| 4416 | packed.append(struct.pack("!L", self.experimenter)) |
| 4417 | packed.append(struct.pack("!L", self.subtype)) |
| 4418 | packed.append(struct.pack("!H", self.table_id)) |
| 4419 | packed.append('\x00' * 2) |
| 4420 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4421 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4422 | length = sum([len(x) for x in packed]) |
| 4423 | packed[2] = struct.pack("!H", length) |
| 4424 | return ''.join(packed) |
| 4425 | |
| 4426 | @staticmethod |
| 4427 | def unpack(reader): |
| 4428 | obj = bsn_gentable_entry_desc_stats_request() |
| 4429 | _version = reader.read("!B")[0] |
| 4430 | assert(_version == 4) |
| 4431 | _type = reader.read("!B")[0] |
| 4432 | assert(_type == 18) |
| 4433 | _length = reader.read("!H")[0] |
| 4434 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4435 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4436 | obj.xid = reader.read("!L")[0] |
| 4437 | _stats_type = reader.read("!H")[0] |
| 4438 | assert(_stats_type == 65535) |
| 4439 | obj.flags = reader.read("!H")[0] |
| 4440 | reader.skip(4) |
| 4441 | _experimenter = reader.read("!L")[0] |
| 4442 | assert(_experimenter == 6035143) |
| 4443 | _subtype = reader.read("!L")[0] |
| 4444 | assert(_subtype == 2) |
| 4445 | obj.table_id = reader.read("!H")[0] |
| 4446 | reader.skip(2) |
| 4447 | obj.checksum = util.unpack_checksum_128(reader) |
| 4448 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4449 | return obj |
| 4450 | |
| 4451 | def __eq__(self, other): |
| 4452 | if type(self) != type(other): return False |
| 4453 | if self.xid != other.xid: return False |
| 4454 | if self.flags != other.flags: return False |
| 4455 | if self.table_id != other.table_id: return False |
| 4456 | if self.checksum != other.checksum: return False |
| 4457 | if self.checksum_mask != other.checksum_mask: return False |
| 4458 | return True |
| 4459 | |
| 4460 | def pretty_print(self, q): |
| 4461 | q.text("bsn_gentable_entry_desc_stats_request {") |
| 4462 | with q.group(): |
| 4463 | with q.indent(2): |
| 4464 | q.breakable() |
| 4465 | q.text("xid = "); |
| 4466 | if self.xid != None: |
| 4467 | q.text("%#x" % self.xid) |
| 4468 | else: |
| 4469 | q.text('None') |
| 4470 | q.text(","); q.breakable() |
| 4471 | q.text("flags = "); |
| 4472 | q.text("%#x" % self.flags) |
| 4473 | q.text(","); q.breakable() |
| 4474 | q.text("table_id = "); |
| 4475 | q.text("%#x" % self.table_id) |
| 4476 | q.text(","); q.breakable() |
| 4477 | q.text("checksum = "); |
| 4478 | q.pp(self.checksum) |
| 4479 | q.text(","); q.breakable() |
| 4480 | q.text("checksum_mask = "); |
| 4481 | q.pp(self.checksum_mask) |
| 4482 | q.breakable() |
| 4483 | q.text('}') |
| 4484 | |
| 4485 | bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request |
| 4486 | |
| 4487 | class bsn_gentable_entry_stats_reply(bsn_stats_reply): |
| 4488 | version = 4 |
| 4489 | type = 19 |
| 4490 | stats_type = 65535 |
| 4491 | experimenter = 6035143 |
| 4492 | subtype = 3 |
| 4493 | |
| 4494 | def __init__(self, xid=None, flags=None, entries=None): |
| 4495 | if xid != None: |
| 4496 | self.xid = xid |
| 4497 | else: |
| 4498 | self.xid = None |
| 4499 | if flags != None: |
| 4500 | self.flags = flags |
| 4501 | else: |
| 4502 | self.flags = 0 |
| 4503 | if entries != None: |
| 4504 | self.entries = entries |
| 4505 | else: |
| 4506 | self.entries = [] |
| 4507 | return |
| 4508 | |
| 4509 | def pack(self): |
| 4510 | packed = [] |
| 4511 | packed.append(struct.pack("!B", self.version)) |
| 4512 | packed.append(struct.pack("!B", self.type)) |
| 4513 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4514 | packed.append(struct.pack("!L", self.xid)) |
| 4515 | packed.append(struct.pack("!H", self.stats_type)) |
| 4516 | packed.append(struct.pack("!H", self.flags)) |
| 4517 | packed.append('\x00' * 4) |
| 4518 | packed.append(struct.pack("!L", self.experimenter)) |
| 4519 | packed.append(struct.pack("!L", self.subtype)) |
| 4520 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4521 | length = sum([len(x) for x in packed]) |
| 4522 | packed[2] = struct.pack("!H", length) |
| 4523 | return ''.join(packed) |
| 4524 | |
| 4525 | @staticmethod |
| 4526 | def unpack(reader): |
| 4527 | obj = bsn_gentable_entry_stats_reply() |
| 4528 | _version = reader.read("!B")[0] |
| 4529 | assert(_version == 4) |
| 4530 | _type = reader.read("!B")[0] |
| 4531 | assert(_type == 19) |
| 4532 | _length = reader.read("!H")[0] |
| 4533 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4534 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4535 | obj.xid = reader.read("!L")[0] |
| 4536 | _stats_type = reader.read("!H")[0] |
| 4537 | assert(_stats_type == 65535) |
| 4538 | obj.flags = reader.read("!H")[0] |
| 4539 | reader.skip(4) |
| 4540 | _experimenter = reader.read("!L")[0] |
| 4541 | assert(_experimenter == 6035143) |
| 4542 | _subtype = reader.read("!L")[0] |
| 4543 | assert(_subtype == 3) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4544 | 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] | 4545 | return obj |
| 4546 | |
| 4547 | def __eq__(self, other): |
| 4548 | if type(self) != type(other): return False |
| 4549 | if self.xid != other.xid: return False |
| 4550 | if self.flags != other.flags: return False |
| 4551 | if self.entries != other.entries: return False |
| 4552 | return True |
| 4553 | |
| 4554 | def pretty_print(self, q): |
| 4555 | q.text("bsn_gentable_entry_stats_reply {") |
| 4556 | with q.group(): |
| 4557 | with q.indent(2): |
| 4558 | q.breakable() |
| 4559 | q.text("xid = "); |
| 4560 | if self.xid != None: |
| 4561 | q.text("%#x" % self.xid) |
| 4562 | else: |
| 4563 | q.text('None') |
| 4564 | q.text(","); q.breakable() |
| 4565 | q.text("flags = "); |
| 4566 | q.text("%#x" % self.flags) |
| 4567 | q.text(","); q.breakable() |
| 4568 | q.text("entries = "); |
| 4569 | q.pp(self.entries) |
| 4570 | q.breakable() |
| 4571 | q.text('}') |
| 4572 | |
| 4573 | bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply |
| 4574 | |
| 4575 | class bsn_gentable_entry_stats_request(bsn_stats_request): |
| 4576 | version = 4 |
| 4577 | type = 18 |
| 4578 | stats_type = 65535 |
| 4579 | experimenter = 6035143 |
| 4580 | subtype = 3 |
| 4581 | |
| 4582 | def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None): |
| 4583 | if xid != None: |
| 4584 | self.xid = xid |
| 4585 | else: |
| 4586 | self.xid = None |
| 4587 | if flags != None: |
| 4588 | self.flags = flags |
| 4589 | else: |
| 4590 | self.flags = 0 |
| 4591 | if table_id != None: |
| 4592 | self.table_id = table_id |
| 4593 | else: |
| 4594 | self.table_id = 0 |
| 4595 | if checksum != None: |
| 4596 | self.checksum = checksum |
| 4597 | else: |
| 4598 | self.checksum = 0 |
| 4599 | if checksum_mask != None: |
| 4600 | self.checksum_mask = checksum_mask |
| 4601 | else: |
| 4602 | self.checksum_mask = 0 |
| 4603 | return |
| 4604 | |
| 4605 | def pack(self): |
| 4606 | packed = [] |
| 4607 | packed.append(struct.pack("!B", self.version)) |
| 4608 | packed.append(struct.pack("!B", self.type)) |
| 4609 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4610 | packed.append(struct.pack("!L", self.xid)) |
| 4611 | packed.append(struct.pack("!H", self.stats_type)) |
| 4612 | packed.append(struct.pack("!H", self.flags)) |
| 4613 | packed.append('\x00' * 4) |
| 4614 | packed.append(struct.pack("!L", self.experimenter)) |
| 4615 | packed.append(struct.pack("!L", self.subtype)) |
| 4616 | packed.append(struct.pack("!H", self.table_id)) |
| 4617 | packed.append('\x00' * 2) |
| 4618 | packed.append(util.pack_checksum_128(self.checksum)) |
| 4619 | packed.append(util.pack_checksum_128(self.checksum_mask)) |
| 4620 | length = sum([len(x) for x in packed]) |
| 4621 | packed[2] = struct.pack("!H", length) |
| 4622 | return ''.join(packed) |
| 4623 | |
| 4624 | @staticmethod |
| 4625 | def unpack(reader): |
| 4626 | obj = bsn_gentable_entry_stats_request() |
| 4627 | _version = reader.read("!B")[0] |
| 4628 | assert(_version == 4) |
| 4629 | _type = reader.read("!B")[0] |
| 4630 | assert(_type == 18) |
| 4631 | _length = reader.read("!H")[0] |
| 4632 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4633 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4634 | obj.xid = reader.read("!L")[0] |
| 4635 | _stats_type = reader.read("!H")[0] |
| 4636 | assert(_stats_type == 65535) |
| 4637 | obj.flags = reader.read("!H")[0] |
| 4638 | reader.skip(4) |
| 4639 | _experimenter = reader.read("!L")[0] |
| 4640 | assert(_experimenter == 6035143) |
| 4641 | _subtype = reader.read("!L")[0] |
| 4642 | assert(_subtype == 3) |
| 4643 | obj.table_id = reader.read("!H")[0] |
| 4644 | reader.skip(2) |
| 4645 | obj.checksum = util.unpack_checksum_128(reader) |
| 4646 | obj.checksum_mask = util.unpack_checksum_128(reader) |
| 4647 | return obj |
| 4648 | |
| 4649 | def __eq__(self, other): |
| 4650 | if type(self) != type(other): return False |
| 4651 | if self.xid != other.xid: return False |
| 4652 | if self.flags != other.flags: return False |
| 4653 | if self.table_id != other.table_id: return False |
| 4654 | if self.checksum != other.checksum: return False |
| 4655 | if self.checksum_mask != other.checksum_mask: return False |
| 4656 | return True |
| 4657 | |
| 4658 | def pretty_print(self, q): |
| 4659 | q.text("bsn_gentable_entry_stats_request {") |
| 4660 | with q.group(): |
| 4661 | with q.indent(2): |
| 4662 | q.breakable() |
| 4663 | q.text("xid = "); |
| 4664 | if self.xid != None: |
| 4665 | q.text("%#x" % self.xid) |
| 4666 | else: |
| 4667 | q.text('None') |
| 4668 | q.text(","); q.breakable() |
| 4669 | q.text("flags = "); |
| 4670 | q.text("%#x" % self.flags) |
| 4671 | q.text(","); q.breakable() |
| 4672 | q.text("table_id = "); |
| 4673 | q.text("%#x" % self.table_id) |
| 4674 | q.text(","); q.breakable() |
| 4675 | q.text("checksum = "); |
| 4676 | q.pp(self.checksum) |
| 4677 | q.text(","); q.breakable() |
| 4678 | q.text("checksum_mask = "); |
| 4679 | q.pp(self.checksum_mask) |
| 4680 | q.breakable() |
| 4681 | q.text('}') |
| 4682 | |
| 4683 | bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request |
| 4684 | |
| 4685 | class bsn_gentable_set_buckets_size(bsn_header): |
| 4686 | version = 4 |
| 4687 | type = 4 |
| 4688 | experimenter = 6035143 |
| 4689 | subtype = 50 |
| 4690 | |
| 4691 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 4692 | if xid != None: |
| 4693 | self.xid = xid |
| 4694 | else: |
| 4695 | self.xid = None |
| 4696 | if table_id != None: |
| 4697 | self.table_id = table_id |
| 4698 | else: |
| 4699 | self.table_id = 0 |
| 4700 | if buckets_size != None: |
| 4701 | self.buckets_size = buckets_size |
| 4702 | else: |
| 4703 | self.buckets_size = 0 |
| 4704 | return |
| 4705 | |
| 4706 | def pack(self): |
| 4707 | packed = [] |
| 4708 | packed.append(struct.pack("!B", self.version)) |
| 4709 | packed.append(struct.pack("!B", self.type)) |
| 4710 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4711 | packed.append(struct.pack("!L", self.xid)) |
| 4712 | packed.append(struct.pack("!L", self.experimenter)) |
| 4713 | packed.append(struct.pack("!L", self.subtype)) |
| 4714 | packed.append(struct.pack("!H", self.table_id)) |
| 4715 | packed.append('\x00' * 2) |
| 4716 | packed.append(struct.pack("!L", self.buckets_size)) |
| 4717 | length = sum([len(x) for x in packed]) |
| 4718 | packed[2] = struct.pack("!H", length) |
| 4719 | return ''.join(packed) |
| 4720 | |
| 4721 | @staticmethod |
| 4722 | def unpack(reader): |
| 4723 | obj = bsn_gentable_set_buckets_size() |
| 4724 | _version = reader.read("!B")[0] |
| 4725 | assert(_version == 4) |
| 4726 | _type = reader.read("!B")[0] |
| 4727 | assert(_type == 4) |
| 4728 | _length = reader.read("!H")[0] |
| 4729 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4730 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4731 | obj.xid = reader.read("!L")[0] |
| 4732 | _experimenter = reader.read("!L")[0] |
| 4733 | assert(_experimenter == 6035143) |
| 4734 | _subtype = reader.read("!L")[0] |
| 4735 | assert(_subtype == 50) |
| 4736 | obj.table_id = reader.read("!H")[0] |
| 4737 | reader.skip(2) |
| 4738 | obj.buckets_size = reader.read("!L")[0] |
| 4739 | return obj |
| 4740 | |
| 4741 | def __eq__(self, other): |
| 4742 | if type(self) != type(other): return False |
| 4743 | if self.xid != other.xid: return False |
| 4744 | if self.table_id != other.table_id: return False |
| 4745 | if self.buckets_size != other.buckets_size: return False |
| 4746 | return True |
| 4747 | |
| 4748 | def pretty_print(self, q): |
| 4749 | q.text("bsn_gentable_set_buckets_size {") |
| 4750 | with q.group(): |
| 4751 | with q.indent(2): |
| 4752 | q.breakable() |
| 4753 | q.text("xid = "); |
| 4754 | if self.xid != None: |
| 4755 | q.text("%#x" % self.xid) |
| 4756 | else: |
| 4757 | q.text('None') |
| 4758 | q.text(","); q.breakable() |
| 4759 | q.text("table_id = "); |
| 4760 | q.text("%#x" % self.table_id) |
| 4761 | q.text(","); q.breakable() |
| 4762 | q.text("buckets_size = "); |
| 4763 | q.text("%#x" % self.buckets_size) |
| 4764 | q.breakable() |
| 4765 | q.text('}') |
| 4766 | |
| 4767 | bsn_header.subtypes[50] = bsn_gentable_set_buckets_size |
| 4768 | |
| 4769 | class bsn_gentable_stats_reply(bsn_stats_reply): |
| 4770 | version = 4 |
| 4771 | type = 19 |
| 4772 | stats_type = 65535 |
| 4773 | experimenter = 6035143 |
| 4774 | subtype = 7 |
| 4775 | |
| 4776 | def __init__(self, xid=None, flags=None, entries=None): |
| 4777 | if xid != None: |
| 4778 | self.xid = xid |
| 4779 | else: |
| 4780 | self.xid = None |
| 4781 | if flags != None: |
| 4782 | self.flags = flags |
| 4783 | else: |
| 4784 | self.flags = 0 |
| 4785 | if entries != None: |
| 4786 | self.entries = entries |
| 4787 | else: |
| 4788 | self.entries = [] |
| 4789 | return |
| 4790 | |
| 4791 | def pack(self): |
| 4792 | packed = [] |
| 4793 | packed.append(struct.pack("!B", self.version)) |
| 4794 | packed.append(struct.pack("!B", self.type)) |
| 4795 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4796 | packed.append(struct.pack("!L", self.xid)) |
| 4797 | packed.append(struct.pack("!H", self.stats_type)) |
| 4798 | packed.append(struct.pack("!H", self.flags)) |
| 4799 | packed.append('\x00' * 4) |
| 4800 | packed.append(struct.pack("!L", self.experimenter)) |
| 4801 | packed.append(struct.pack("!L", self.subtype)) |
| 4802 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 4803 | length = sum([len(x) for x in packed]) |
| 4804 | packed[2] = struct.pack("!H", length) |
| 4805 | return ''.join(packed) |
| 4806 | |
| 4807 | @staticmethod |
| 4808 | def unpack(reader): |
| 4809 | obj = bsn_gentable_stats_reply() |
| 4810 | _version = reader.read("!B")[0] |
| 4811 | assert(_version == 4) |
| 4812 | _type = reader.read("!B")[0] |
| 4813 | assert(_type == 19) |
| 4814 | _length = reader.read("!H")[0] |
| 4815 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4816 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4817 | obj.xid = reader.read("!L")[0] |
| 4818 | _stats_type = reader.read("!H")[0] |
| 4819 | assert(_stats_type == 65535) |
| 4820 | obj.flags = reader.read("!H")[0] |
| 4821 | reader.skip(4) |
| 4822 | _experimenter = reader.read("!L")[0] |
| 4823 | assert(_experimenter == 6035143) |
| 4824 | _subtype = reader.read("!L")[0] |
| 4825 | assert(_subtype == 7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4826 | 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] | 4827 | return obj |
| 4828 | |
| 4829 | def __eq__(self, other): |
| 4830 | if type(self) != type(other): return False |
| 4831 | if self.xid != other.xid: return False |
| 4832 | if self.flags != other.flags: return False |
| 4833 | if self.entries != other.entries: return False |
| 4834 | return True |
| 4835 | |
| 4836 | def pretty_print(self, q): |
| 4837 | q.text("bsn_gentable_stats_reply {") |
| 4838 | with q.group(): |
| 4839 | with q.indent(2): |
| 4840 | q.breakable() |
| 4841 | q.text("xid = "); |
| 4842 | if self.xid != None: |
| 4843 | q.text("%#x" % self.xid) |
| 4844 | else: |
| 4845 | q.text('None') |
| 4846 | q.text(","); q.breakable() |
| 4847 | q.text("flags = "); |
| 4848 | q.text("%#x" % self.flags) |
| 4849 | q.text(","); q.breakable() |
| 4850 | q.text("entries = "); |
| 4851 | q.pp(self.entries) |
| 4852 | q.breakable() |
| 4853 | q.text('}') |
| 4854 | |
| 4855 | bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply |
| 4856 | |
| 4857 | class bsn_gentable_stats_request(bsn_stats_request): |
| 4858 | version = 4 |
| 4859 | type = 18 |
| 4860 | stats_type = 65535 |
| 4861 | experimenter = 6035143 |
| 4862 | subtype = 7 |
| 4863 | |
| 4864 | def __init__(self, xid=None, flags=None): |
| 4865 | if xid != None: |
| 4866 | self.xid = xid |
| 4867 | else: |
| 4868 | self.xid = None |
| 4869 | if flags != None: |
| 4870 | self.flags = flags |
| 4871 | else: |
| 4872 | self.flags = 0 |
| 4873 | return |
| 4874 | |
| 4875 | def pack(self): |
| 4876 | packed = [] |
| 4877 | packed.append(struct.pack("!B", self.version)) |
| 4878 | packed.append(struct.pack("!B", self.type)) |
| 4879 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4880 | packed.append(struct.pack("!L", self.xid)) |
| 4881 | packed.append(struct.pack("!H", self.stats_type)) |
| 4882 | packed.append(struct.pack("!H", self.flags)) |
| 4883 | packed.append('\x00' * 4) |
| 4884 | packed.append(struct.pack("!L", self.experimenter)) |
| 4885 | packed.append(struct.pack("!L", self.subtype)) |
| 4886 | length = sum([len(x) for x in packed]) |
| 4887 | packed[2] = struct.pack("!H", length) |
| 4888 | return ''.join(packed) |
| 4889 | |
| 4890 | @staticmethod |
| 4891 | def unpack(reader): |
| 4892 | obj = bsn_gentable_stats_request() |
| 4893 | _version = reader.read("!B")[0] |
| 4894 | assert(_version == 4) |
| 4895 | _type = reader.read("!B")[0] |
| 4896 | assert(_type == 18) |
| 4897 | _length = reader.read("!H")[0] |
| 4898 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4899 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 4900 | obj.xid = reader.read("!L")[0] |
| 4901 | _stats_type = reader.read("!H")[0] |
| 4902 | assert(_stats_type == 65535) |
| 4903 | obj.flags = reader.read("!H")[0] |
| 4904 | reader.skip(4) |
| 4905 | _experimenter = reader.read("!L")[0] |
| 4906 | assert(_experimenter == 6035143) |
| 4907 | _subtype = reader.read("!L")[0] |
| 4908 | assert(_subtype == 7) |
| 4909 | return obj |
| 4910 | |
| 4911 | def __eq__(self, other): |
| 4912 | if type(self) != type(other): return False |
| 4913 | if self.xid != other.xid: return False |
| 4914 | if self.flags != other.flags: return False |
| 4915 | return True |
| 4916 | |
| 4917 | def pretty_print(self, q): |
| 4918 | q.text("bsn_gentable_stats_request {") |
| 4919 | with q.group(): |
| 4920 | with q.indent(2): |
| 4921 | q.breakable() |
| 4922 | q.text("xid = "); |
| 4923 | if self.xid != None: |
| 4924 | q.text("%#x" % self.xid) |
| 4925 | else: |
| 4926 | q.text('None') |
| 4927 | q.text(","); q.breakable() |
| 4928 | q.text("flags = "); |
| 4929 | q.text("%#x" % self.flags) |
| 4930 | q.breakable() |
| 4931 | q.text('}') |
| 4932 | |
| 4933 | bsn_stats_request.subtypes[7] = bsn_gentable_stats_request |
| 4934 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4935 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4936 | version = 4 |
| 4937 | type = 4 |
| 4938 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4939 | subtype = 10 |
| 4940 | |
| 4941 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4942 | if xid != None: |
| 4943 | self.xid = xid |
| 4944 | else: |
| 4945 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4946 | if interfaces != None: |
| 4947 | self.interfaces = interfaces |
| 4948 | else: |
| 4949 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4950 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4951 | |
| 4952 | def pack(self): |
| 4953 | packed = [] |
| 4954 | packed.append(struct.pack("!B", self.version)) |
| 4955 | packed.append(struct.pack("!B", self.type)) |
| 4956 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4957 | packed.append(struct.pack("!L", self.xid)) |
| 4958 | packed.append(struct.pack("!L", self.experimenter)) |
| 4959 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4960 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4961 | length = sum([len(x) for x in packed]) |
| 4962 | packed[2] = struct.pack("!H", length) |
| 4963 | return ''.join(packed) |
| 4964 | |
| 4965 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4966 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4967 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4968 | _version = reader.read("!B")[0] |
| 4969 | assert(_version == 4) |
| 4970 | _type = reader.read("!B")[0] |
| 4971 | assert(_type == 4) |
| 4972 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4973 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4974 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4975 | obj.xid = reader.read("!L")[0] |
| 4976 | _experimenter = reader.read("!L")[0] |
| 4977 | assert(_experimenter == 6035143) |
| 4978 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4979 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4980 | 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] | 4981 | return obj |
| 4982 | |
| 4983 | def __eq__(self, other): |
| 4984 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4985 | if self.xid != other.xid: return False |
| 4986 | if self.interfaces != other.interfaces: return False |
| 4987 | return True |
| 4988 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4989 | def pretty_print(self, q): |
| 4990 | q.text("bsn_get_interfaces_reply {") |
| 4991 | with q.group(): |
| 4992 | with q.indent(2): |
| 4993 | q.breakable() |
| 4994 | q.text("xid = "); |
| 4995 | if self.xid != None: |
| 4996 | q.text("%#x" % self.xid) |
| 4997 | else: |
| 4998 | q.text('None') |
| 4999 | q.text(","); q.breakable() |
| 5000 | q.text("interfaces = "); |
| 5001 | q.pp(self.interfaces) |
| 5002 | q.breakable() |
| 5003 | q.text('}') |
| 5004 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5005 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 5006 | |
| 5007 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5008 | version = 4 |
| 5009 | type = 4 |
| 5010 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5011 | subtype = 9 |
| 5012 | |
| 5013 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5014 | if xid != None: |
| 5015 | self.xid = xid |
| 5016 | else: |
| 5017 | self.xid = None |
| 5018 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5019 | |
| 5020 | def pack(self): |
| 5021 | packed = [] |
| 5022 | packed.append(struct.pack("!B", self.version)) |
| 5023 | packed.append(struct.pack("!B", self.type)) |
| 5024 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5025 | packed.append(struct.pack("!L", self.xid)) |
| 5026 | packed.append(struct.pack("!L", self.experimenter)) |
| 5027 | packed.append(struct.pack("!L", self.subtype)) |
| 5028 | length = sum([len(x) for x in packed]) |
| 5029 | packed[2] = struct.pack("!H", length) |
| 5030 | return ''.join(packed) |
| 5031 | |
| 5032 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5033 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5034 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5035 | _version = reader.read("!B")[0] |
| 5036 | assert(_version == 4) |
| 5037 | _type = reader.read("!B")[0] |
| 5038 | assert(_type == 4) |
| 5039 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5040 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5041 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5042 | obj.xid = reader.read("!L")[0] |
| 5043 | _experimenter = reader.read("!L")[0] |
| 5044 | assert(_experimenter == 6035143) |
| 5045 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5046 | assert(_subtype == 9) |
| 5047 | return obj |
| 5048 | |
| 5049 | def __eq__(self, other): |
| 5050 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5051 | if self.xid != other.xid: return False |
| 5052 | return True |
| 5053 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5054 | def pretty_print(self, q): |
| 5055 | q.text("bsn_get_interfaces_request {") |
| 5056 | with q.group(): |
| 5057 | with q.indent(2): |
| 5058 | q.breakable() |
| 5059 | q.text("xid = "); |
| 5060 | if self.xid != None: |
| 5061 | q.text("%#x" % self.xid) |
| 5062 | else: |
| 5063 | q.text('None') |
| 5064 | q.breakable() |
| 5065 | q.text('}') |
| 5066 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5067 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 5068 | |
| 5069 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5070 | version = 4 |
| 5071 | type = 4 |
| 5072 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5073 | subtype = 5 |
| 5074 | |
| 5075 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5076 | if xid != None: |
| 5077 | self.xid = xid |
| 5078 | else: |
| 5079 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5080 | if report_mirror_ports != None: |
| 5081 | self.report_mirror_ports = report_mirror_ports |
| 5082 | else: |
| 5083 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5084 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5085 | |
| 5086 | def pack(self): |
| 5087 | packed = [] |
| 5088 | packed.append(struct.pack("!B", self.version)) |
| 5089 | packed.append(struct.pack("!B", self.type)) |
| 5090 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5091 | packed.append(struct.pack("!L", self.xid)) |
| 5092 | packed.append(struct.pack("!L", self.experimenter)) |
| 5093 | packed.append(struct.pack("!L", self.subtype)) |
| 5094 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5095 | packed.append('\x00' * 3) |
| 5096 | length = sum([len(x) for x in packed]) |
| 5097 | packed[2] = struct.pack("!H", length) |
| 5098 | return ''.join(packed) |
| 5099 | |
| 5100 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5101 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5102 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5103 | _version = reader.read("!B")[0] |
| 5104 | assert(_version == 4) |
| 5105 | _type = reader.read("!B")[0] |
| 5106 | assert(_type == 4) |
| 5107 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5108 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5109 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5110 | obj.xid = reader.read("!L")[0] |
| 5111 | _experimenter = reader.read("!L")[0] |
| 5112 | assert(_experimenter == 6035143) |
| 5113 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5114 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5115 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5116 | reader.skip(3) |
| 5117 | return obj |
| 5118 | |
| 5119 | def __eq__(self, other): |
| 5120 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5121 | if self.xid != other.xid: return False |
| 5122 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5123 | return True |
| 5124 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5125 | def pretty_print(self, q): |
| 5126 | q.text("bsn_get_mirroring_reply {") |
| 5127 | with q.group(): |
| 5128 | with q.indent(2): |
| 5129 | q.breakable() |
| 5130 | q.text("xid = "); |
| 5131 | if self.xid != None: |
| 5132 | q.text("%#x" % self.xid) |
| 5133 | else: |
| 5134 | q.text('None') |
| 5135 | q.text(","); q.breakable() |
| 5136 | q.text("report_mirror_ports = "); |
| 5137 | q.text("%#x" % self.report_mirror_ports) |
| 5138 | q.breakable() |
| 5139 | q.text('}') |
| 5140 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5141 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 5142 | |
| 5143 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5144 | version = 4 |
| 5145 | type = 4 |
| 5146 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5147 | subtype = 4 |
| 5148 | |
| 5149 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5150 | if xid != None: |
| 5151 | self.xid = xid |
| 5152 | else: |
| 5153 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5154 | if report_mirror_ports != None: |
| 5155 | self.report_mirror_ports = report_mirror_ports |
| 5156 | else: |
| 5157 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5158 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5159 | |
| 5160 | def pack(self): |
| 5161 | packed = [] |
| 5162 | packed.append(struct.pack("!B", self.version)) |
| 5163 | packed.append(struct.pack("!B", self.type)) |
| 5164 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5165 | packed.append(struct.pack("!L", self.xid)) |
| 5166 | packed.append(struct.pack("!L", self.experimenter)) |
| 5167 | packed.append(struct.pack("!L", self.subtype)) |
| 5168 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 5169 | packed.append('\x00' * 3) |
| 5170 | length = sum([len(x) for x in packed]) |
| 5171 | packed[2] = struct.pack("!H", length) |
| 5172 | return ''.join(packed) |
| 5173 | |
| 5174 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5175 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5176 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5177 | _version = reader.read("!B")[0] |
| 5178 | assert(_version == 4) |
| 5179 | _type = reader.read("!B")[0] |
| 5180 | assert(_type == 4) |
| 5181 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5182 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5183 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5184 | obj.xid = reader.read("!L")[0] |
| 5185 | _experimenter = reader.read("!L")[0] |
| 5186 | assert(_experimenter == 6035143) |
| 5187 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5188 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5189 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5190 | reader.skip(3) |
| 5191 | return obj |
| 5192 | |
| 5193 | def __eq__(self, other): |
| 5194 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5195 | if self.xid != other.xid: return False |
| 5196 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 5197 | return True |
| 5198 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5199 | def pretty_print(self, q): |
| 5200 | q.text("bsn_get_mirroring_request {") |
| 5201 | with q.group(): |
| 5202 | with q.indent(2): |
| 5203 | q.breakable() |
| 5204 | q.text("xid = "); |
| 5205 | if self.xid != None: |
| 5206 | q.text("%#x" % self.xid) |
| 5207 | else: |
| 5208 | q.text('None') |
| 5209 | q.text(","); q.breakable() |
| 5210 | q.text("report_mirror_ports = "); |
| 5211 | q.text("%#x" % self.report_mirror_ports) |
| 5212 | q.breakable() |
| 5213 | q.text('}') |
| 5214 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5215 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 5216 | |
| 5217 | class bsn_get_switch_pipeline_reply(bsn_header): |
| 5218 | version = 4 |
| 5219 | type = 4 |
| 5220 | experimenter = 6035143 |
| 5221 | subtype = 52 |
| 5222 | |
| 5223 | def __init__(self, xid=None, pipeline=None): |
| 5224 | if xid != None: |
| 5225 | self.xid = xid |
| 5226 | else: |
| 5227 | self.xid = None |
| 5228 | if pipeline != None: |
| 5229 | self.pipeline = pipeline |
| 5230 | else: |
| 5231 | self.pipeline = "" |
| 5232 | return |
| 5233 | |
| 5234 | def pack(self): |
| 5235 | packed = [] |
| 5236 | packed.append(struct.pack("!B", self.version)) |
| 5237 | packed.append(struct.pack("!B", self.type)) |
| 5238 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5239 | packed.append(struct.pack("!L", self.xid)) |
| 5240 | packed.append(struct.pack("!L", self.experimenter)) |
| 5241 | packed.append(struct.pack("!L", self.subtype)) |
| 5242 | packed.append(struct.pack("!256s", self.pipeline)) |
| 5243 | length = sum([len(x) for x in packed]) |
| 5244 | packed[2] = struct.pack("!H", length) |
| 5245 | return ''.join(packed) |
| 5246 | |
| 5247 | @staticmethod |
| 5248 | def unpack(reader): |
| 5249 | obj = bsn_get_switch_pipeline_reply() |
| 5250 | _version = reader.read("!B")[0] |
| 5251 | assert(_version == 4) |
| 5252 | _type = reader.read("!B")[0] |
| 5253 | assert(_type == 4) |
| 5254 | _length = reader.read("!H")[0] |
| 5255 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5256 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5257 | obj.xid = reader.read("!L")[0] |
| 5258 | _experimenter = reader.read("!L")[0] |
| 5259 | assert(_experimenter == 6035143) |
| 5260 | _subtype = reader.read("!L")[0] |
| 5261 | assert(_subtype == 52) |
| 5262 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 5263 | return obj |
| 5264 | |
| 5265 | def __eq__(self, other): |
| 5266 | if type(self) != type(other): return False |
| 5267 | if self.xid != other.xid: return False |
| 5268 | if self.pipeline != other.pipeline: return False |
| 5269 | return True |
| 5270 | |
| 5271 | def pretty_print(self, q): |
| 5272 | q.text("bsn_get_switch_pipeline_reply {") |
| 5273 | with q.group(): |
| 5274 | with q.indent(2): |
| 5275 | q.breakable() |
| 5276 | q.text("xid = "); |
| 5277 | if self.xid != None: |
| 5278 | q.text("%#x" % self.xid) |
| 5279 | else: |
| 5280 | q.text('None') |
| 5281 | q.text(","); q.breakable() |
| 5282 | q.text("pipeline = "); |
| 5283 | q.pp(self.pipeline) |
| 5284 | q.breakable() |
| 5285 | q.text('}') |
| 5286 | |
| 5287 | bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply |
| 5288 | |
| 5289 | class bsn_get_switch_pipeline_request(bsn_header): |
| 5290 | version = 4 |
| 5291 | type = 4 |
| 5292 | experimenter = 6035143 |
| 5293 | subtype = 51 |
| 5294 | |
| 5295 | def __init__(self, xid=None): |
| 5296 | if xid != None: |
| 5297 | self.xid = xid |
| 5298 | else: |
| 5299 | self.xid = None |
| 5300 | return |
| 5301 | |
| 5302 | def pack(self): |
| 5303 | packed = [] |
| 5304 | packed.append(struct.pack("!B", self.version)) |
| 5305 | packed.append(struct.pack("!B", self.type)) |
| 5306 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5307 | packed.append(struct.pack("!L", self.xid)) |
| 5308 | packed.append(struct.pack("!L", self.experimenter)) |
| 5309 | packed.append(struct.pack("!L", self.subtype)) |
| 5310 | length = sum([len(x) for x in packed]) |
| 5311 | packed[2] = struct.pack("!H", length) |
| 5312 | return ''.join(packed) |
| 5313 | |
| 5314 | @staticmethod |
| 5315 | def unpack(reader): |
| 5316 | obj = bsn_get_switch_pipeline_request() |
| 5317 | _version = reader.read("!B")[0] |
| 5318 | assert(_version == 4) |
| 5319 | _type = reader.read("!B")[0] |
| 5320 | assert(_type == 4) |
| 5321 | _length = reader.read("!H")[0] |
| 5322 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5323 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5324 | obj.xid = reader.read("!L")[0] |
| 5325 | _experimenter = reader.read("!L")[0] |
| 5326 | assert(_experimenter == 6035143) |
| 5327 | _subtype = reader.read("!L")[0] |
| 5328 | assert(_subtype == 51) |
| 5329 | return obj |
| 5330 | |
| 5331 | def __eq__(self, other): |
| 5332 | if type(self) != type(other): return False |
| 5333 | if self.xid != other.xid: return False |
| 5334 | return True |
| 5335 | |
| 5336 | def pretty_print(self, q): |
| 5337 | q.text("bsn_get_switch_pipeline_request {") |
| 5338 | with q.group(): |
| 5339 | with q.indent(2): |
| 5340 | q.breakable() |
| 5341 | q.text("xid = "); |
| 5342 | if self.xid != None: |
| 5343 | q.text("%#x" % self.xid) |
| 5344 | else: |
| 5345 | q.text('None') |
| 5346 | q.breakable() |
| 5347 | q.text('}') |
| 5348 | |
| 5349 | bsn_header.subtypes[51] = bsn_get_switch_pipeline_request |
| 5350 | |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5351 | class bsn_image_desc_stats_reply(bsn_stats_reply): |
| 5352 | version = 4 |
| 5353 | type = 19 |
| 5354 | stats_type = 65535 |
| 5355 | experimenter = 6035143 |
| 5356 | subtype = 14 |
| 5357 | |
| 5358 | def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None): |
| 5359 | if xid != None: |
| 5360 | self.xid = xid |
| 5361 | else: |
| 5362 | self.xid = None |
| 5363 | if flags != None: |
| 5364 | self.flags = flags |
| 5365 | else: |
| 5366 | self.flags = 0 |
| 5367 | if image_checksum != None: |
| 5368 | self.image_checksum = image_checksum |
| 5369 | else: |
| 5370 | self.image_checksum = "" |
| 5371 | if startup_config_checksum != None: |
| 5372 | self.startup_config_checksum = startup_config_checksum |
| 5373 | else: |
| 5374 | self.startup_config_checksum = "" |
| 5375 | return |
| 5376 | |
| 5377 | def pack(self): |
| 5378 | packed = [] |
| 5379 | packed.append(struct.pack("!B", self.version)) |
| 5380 | packed.append(struct.pack("!B", self.type)) |
| 5381 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5382 | packed.append(struct.pack("!L", self.xid)) |
| 5383 | packed.append(struct.pack("!H", self.stats_type)) |
| 5384 | packed.append(struct.pack("!H", self.flags)) |
| 5385 | packed.append('\x00' * 4) |
| 5386 | packed.append(struct.pack("!L", self.experimenter)) |
| 5387 | packed.append(struct.pack("!L", self.subtype)) |
| 5388 | packed.append(struct.pack("!256s", self.image_checksum)) |
| 5389 | packed.append(struct.pack("!256s", self.startup_config_checksum)) |
| 5390 | length = sum([len(x) for x in packed]) |
| 5391 | packed[2] = struct.pack("!H", length) |
| 5392 | return ''.join(packed) |
| 5393 | |
| 5394 | @staticmethod |
| 5395 | def unpack(reader): |
| 5396 | obj = bsn_image_desc_stats_reply() |
| 5397 | _version = reader.read("!B")[0] |
| 5398 | assert(_version == 4) |
| 5399 | _type = reader.read("!B")[0] |
| 5400 | assert(_type == 19) |
| 5401 | _length = reader.read("!H")[0] |
| 5402 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5403 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5404 | obj.xid = reader.read("!L")[0] |
| 5405 | _stats_type = reader.read("!H")[0] |
| 5406 | assert(_stats_type == 65535) |
| 5407 | obj.flags = reader.read("!H")[0] |
| 5408 | reader.skip(4) |
| 5409 | _experimenter = reader.read("!L")[0] |
| 5410 | assert(_experimenter == 6035143) |
| 5411 | _subtype = reader.read("!L")[0] |
| 5412 | assert(_subtype == 14) |
| 5413 | obj.image_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5414 | obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00") |
| 5415 | return obj |
| 5416 | |
| 5417 | def __eq__(self, other): |
| 5418 | if type(self) != type(other): return False |
| 5419 | if self.xid != other.xid: return False |
| 5420 | if self.flags != other.flags: return False |
| 5421 | if self.image_checksum != other.image_checksum: return False |
| 5422 | if self.startup_config_checksum != other.startup_config_checksum: return False |
| 5423 | return True |
| 5424 | |
| 5425 | def pretty_print(self, q): |
| 5426 | q.text("bsn_image_desc_stats_reply {") |
| 5427 | with q.group(): |
| 5428 | with q.indent(2): |
| 5429 | q.breakable() |
| 5430 | q.text("xid = "); |
| 5431 | if self.xid != None: |
| 5432 | q.text("%#x" % self.xid) |
| 5433 | else: |
| 5434 | q.text('None') |
| 5435 | q.text(","); q.breakable() |
| 5436 | q.text("flags = "); |
| 5437 | q.text("%#x" % self.flags) |
| 5438 | q.text(","); q.breakable() |
| 5439 | q.text("image_checksum = "); |
| 5440 | q.pp(self.image_checksum) |
| 5441 | q.text(","); q.breakable() |
| 5442 | q.text("startup_config_checksum = "); |
| 5443 | q.pp(self.startup_config_checksum) |
| 5444 | q.breakable() |
| 5445 | q.text('}') |
| 5446 | |
| 5447 | bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply |
| 5448 | |
| 5449 | class bsn_image_desc_stats_request(bsn_stats_request): |
| 5450 | version = 4 |
| 5451 | type = 18 |
| 5452 | stats_type = 65535 |
| 5453 | experimenter = 6035143 |
| 5454 | subtype = 14 |
| 5455 | |
| 5456 | def __init__(self, xid=None, flags=None): |
| 5457 | if xid != None: |
| 5458 | self.xid = xid |
| 5459 | else: |
| 5460 | self.xid = None |
| 5461 | if flags != None: |
| 5462 | self.flags = flags |
| 5463 | else: |
| 5464 | self.flags = 0 |
| 5465 | return |
| 5466 | |
| 5467 | def pack(self): |
| 5468 | packed = [] |
| 5469 | packed.append(struct.pack("!B", self.version)) |
| 5470 | packed.append(struct.pack("!B", self.type)) |
| 5471 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5472 | packed.append(struct.pack("!L", self.xid)) |
| 5473 | packed.append(struct.pack("!H", self.stats_type)) |
| 5474 | packed.append(struct.pack("!H", self.flags)) |
| 5475 | packed.append('\x00' * 4) |
| 5476 | packed.append(struct.pack("!L", self.experimenter)) |
| 5477 | packed.append(struct.pack("!L", self.subtype)) |
| 5478 | length = sum([len(x) for x in packed]) |
| 5479 | packed[2] = struct.pack("!H", length) |
| 5480 | return ''.join(packed) |
| 5481 | |
| 5482 | @staticmethod |
| 5483 | def unpack(reader): |
| 5484 | obj = bsn_image_desc_stats_request() |
| 5485 | _version = reader.read("!B")[0] |
| 5486 | assert(_version == 4) |
| 5487 | _type = reader.read("!B")[0] |
| 5488 | assert(_type == 18) |
| 5489 | _length = reader.read("!H")[0] |
| 5490 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5491 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 93b3313 | 2014-04-21 12:20:58 -0700 | [diff] [blame] | 5492 | obj.xid = reader.read("!L")[0] |
| 5493 | _stats_type = reader.read("!H")[0] |
| 5494 | assert(_stats_type == 65535) |
| 5495 | obj.flags = reader.read("!H")[0] |
| 5496 | reader.skip(4) |
| 5497 | _experimenter = reader.read("!L")[0] |
| 5498 | assert(_experimenter == 6035143) |
| 5499 | _subtype = reader.read("!L")[0] |
| 5500 | assert(_subtype == 14) |
| 5501 | return obj |
| 5502 | |
| 5503 | def __eq__(self, other): |
| 5504 | if type(self) != type(other): return False |
| 5505 | if self.xid != other.xid: return False |
| 5506 | if self.flags != other.flags: return False |
| 5507 | return True |
| 5508 | |
| 5509 | def pretty_print(self, q): |
| 5510 | q.text("bsn_image_desc_stats_request {") |
| 5511 | with q.group(): |
| 5512 | with q.indent(2): |
| 5513 | q.breakable() |
| 5514 | q.text("xid = "); |
| 5515 | if self.xid != None: |
| 5516 | q.text("%#x" % self.xid) |
| 5517 | else: |
| 5518 | q.text('None') |
| 5519 | q.text(","); q.breakable() |
| 5520 | q.text("flags = "); |
| 5521 | q.text("%#x" % self.flags) |
| 5522 | q.breakable() |
| 5523 | q.text('}') |
| 5524 | |
| 5525 | bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request |
| 5526 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5527 | class bsn_lacp_convergence_notif(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5528 | version = 4 |
| 5529 | type = 4 |
| 5530 | experimenter = 6035143 |
| 5531 | subtype = 43 |
| 5532 | |
| 5533 | 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] | 5534 | if xid != None: |
| 5535 | self.xid = xid |
| 5536 | else: |
| 5537 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5538 | if convergence_status != None: |
| 5539 | self.convergence_status = convergence_status |
| 5540 | else: |
| 5541 | self.convergence_status = 0 |
| 5542 | if port_no != None: |
| 5543 | self.port_no = port_no |
| 5544 | else: |
| 5545 | self.port_no = 0 |
| 5546 | if actor_sys_priority != None: |
| 5547 | self.actor_sys_priority = actor_sys_priority |
| 5548 | else: |
| 5549 | self.actor_sys_priority = 0 |
| 5550 | if actor_sys_mac != None: |
| 5551 | self.actor_sys_mac = actor_sys_mac |
| 5552 | else: |
| 5553 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 5554 | if actor_port_priority != None: |
| 5555 | self.actor_port_priority = actor_port_priority |
| 5556 | else: |
| 5557 | self.actor_port_priority = 0 |
| 5558 | if actor_port_num != None: |
| 5559 | self.actor_port_num = actor_port_num |
| 5560 | else: |
| 5561 | self.actor_port_num = 0 |
| 5562 | if actor_key != None: |
| 5563 | self.actor_key = actor_key |
| 5564 | else: |
| 5565 | self.actor_key = 0 |
| 5566 | if partner_sys_priority != None: |
| 5567 | self.partner_sys_priority = partner_sys_priority |
| 5568 | else: |
| 5569 | self.partner_sys_priority = 0 |
| 5570 | if partner_sys_mac != None: |
| 5571 | self.partner_sys_mac = partner_sys_mac |
| 5572 | else: |
| 5573 | self.partner_sys_mac = [0,0,0,0,0,0] |
| 5574 | if partner_port_priority != None: |
| 5575 | self.partner_port_priority = partner_port_priority |
| 5576 | else: |
| 5577 | self.partner_port_priority = 0 |
| 5578 | if partner_port_num != None: |
| 5579 | self.partner_port_num = partner_port_num |
| 5580 | else: |
| 5581 | self.partner_port_num = 0 |
| 5582 | if partner_key != None: |
| 5583 | self.partner_key = partner_key |
| 5584 | else: |
| 5585 | self.partner_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5586 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5587 | |
| 5588 | def pack(self): |
| 5589 | packed = [] |
| 5590 | packed.append(struct.pack("!B", self.version)) |
| 5591 | packed.append(struct.pack("!B", self.type)) |
| 5592 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5593 | packed.append(struct.pack("!L", self.xid)) |
| 5594 | packed.append(struct.pack("!L", self.experimenter)) |
| 5595 | packed.append(struct.pack("!L", self.subtype)) |
| 5596 | packed.append(struct.pack("!B", self.convergence_status)) |
| 5597 | packed.append('\x00' * 3) |
| 5598 | packed.append(util.pack_port_no(self.port_no)) |
| 5599 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 5600 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 5601 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 5602 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 5603 | packed.append(struct.pack("!H", self.actor_key)) |
| 5604 | packed.append(struct.pack("!H", self.partner_sys_priority)) |
| 5605 | packed.append(struct.pack("!6B", *self.partner_sys_mac)) |
| 5606 | packed.append(struct.pack("!H", self.partner_port_priority)) |
| 5607 | packed.append(struct.pack("!H", self.partner_port_num)) |
| 5608 | packed.append(struct.pack("!H", self.partner_key)) |
| 5609 | length = sum([len(x) for x in packed]) |
| 5610 | packed[2] = struct.pack("!H", length) |
| 5611 | return ''.join(packed) |
| 5612 | |
| 5613 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5614 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5615 | obj = bsn_lacp_convergence_notif() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5616 | _version = reader.read("!B")[0] |
| 5617 | assert(_version == 4) |
| 5618 | _type = reader.read("!B")[0] |
| 5619 | assert(_type == 4) |
| 5620 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5621 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5622 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5623 | obj.xid = reader.read("!L")[0] |
| 5624 | _experimenter = reader.read("!L")[0] |
| 5625 | assert(_experimenter == 6035143) |
| 5626 | _subtype = reader.read("!L")[0] |
| 5627 | assert(_subtype == 43) |
| 5628 | obj.convergence_status = reader.read("!B")[0] |
| 5629 | reader.skip(3) |
| 5630 | obj.port_no = util.unpack_port_no(reader) |
| 5631 | obj.actor_sys_priority = reader.read("!H")[0] |
| 5632 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 5633 | obj.actor_port_priority = reader.read("!H")[0] |
| 5634 | obj.actor_port_num = reader.read("!H")[0] |
| 5635 | obj.actor_key = reader.read("!H")[0] |
| 5636 | obj.partner_sys_priority = reader.read("!H")[0] |
| 5637 | obj.partner_sys_mac = list(reader.read('!6B')) |
| 5638 | obj.partner_port_priority = reader.read("!H")[0] |
| 5639 | obj.partner_port_num = reader.read("!H")[0] |
| 5640 | obj.partner_key = reader.read("!H")[0] |
| 5641 | return obj |
| 5642 | |
| 5643 | def __eq__(self, other): |
| 5644 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5645 | if self.xid != other.xid: return False |
| 5646 | if self.convergence_status != other.convergence_status: return False |
| 5647 | if self.port_no != other.port_no: return False |
| 5648 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 5649 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 5650 | if self.actor_port_priority != other.actor_port_priority: return False |
| 5651 | if self.actor_port_num != other.actor_port_num: return False |
| 5652 | if self.actor_key != other.actor_key: return False |
| 5653 | if self.partner_sys_priority != other.partner_sys_priority: return False |
| 5654 | if self.partner_sys_mac != other.partner_sys_mac: return False |
| 5655 | if self.partner_port_priority != other.partner_port_priority: return False |
| 5656 | if self.partner_port_num != other.partner_port_num: return False |
| 5657 | if self.partner_key != other.partner_key: return False |
| 5658 | return True |
| 5659 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5660 | def pretty_print(self, q): |
| 5661 | q.text("bsn_lacp_convergence_notif {") |
| 5662 | with q.group(): |
| 5663 | with q.indent(2): |
| 5664 | q.breakable() |
| 5665 | q.text("xid = "); |
| 5666 | if self.xid != None: |
| 5667 | q.text("%#x" % self.xid) |
| 5668 | else: |
| 5669 | q.text('None') |
| 5670 | q.text(","); q.breakable() |
| 5671 | q.text("convergence_status = "); |
| 5672 | q.text("%#x" % self.convergence_status) |
| 5673 | q.text(","); q.breakable() |
| 5674 | q.text("port_no = "); |
| 5675 | q.text(util.pretty_port(self.port_no)) |
| 5676 | q.text(","); q.breakable() |
| 5677 | q.text("actor_sys_priority = "); |
| 5678 | q.text("%#x" % self.actor_sys_priority) |
| 5679 | q.text(","); q.breakable() |
| 5680 | q.text("actor_sys_mac = "); |
| 5681 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 5682 | q.text(","); q.breakable() |
| 5683 | q.text("actor_port_priority = "); |
| 5684 | q.text("%#x" % self.actor_port_priority) |
| 5685 | q.text(","); q.breakable() |
| 5686 | q.text("actor_port_num = "); |
| 5687 | q.text("%#x" % self.actor_port_num) |
| 5688 | q.text(","); q.breakable() |
| 5689 | q.text("actor_key = "); |
| 5690 | q.text("%#x" % self.actor_key) |
| 5691 | q.text(","); q.breakable() |
| 5692 | q.text("partner_sys_priority = "); |
| 5693 | q.text("%#x" % self.partner_sys_priority) |
| 5694 | q.text(","); q.breakable() |
| 5695 | q.text("partner_sys_mac = "); |
| 5696 | q.text(util.pretty_mac(self.partner_sys_mac)) |
| 5697 | q.text(","); q.breakable() |
| 5698 | q.text("partner_port_priority = "); |
| 5699 | q.text("%#x" % self.partner_port_priority) |
| 5700 | q.text(","); q.breakable() |
| 5701 | q.text("partner_port_num = "); |
| 5702 | q.text("%#x" % self.partner_port_num) |
| 5703 | q.text(","); q.breakable() |
| 5704 | q.text("partner_key = "); |
| 5705 | q.text("%#x" % self.partner_key) |
| 5706 | q.breakable() |
| 5707 | q.text('}') |
| 5708 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5709 | bsn_header.subtypes[43] = bsn_lacp_convergence_notif |
| 5710 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5711 | class bsn_lacp_stats_reply(bsn_stats_reply): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5712 | version = 4 |
| 5713 | type = 19 |
| 5714 | stats_type = 65535 |
| 5715 | experimenter = 6035143 |
| 5716 | subtype = 1 |
| 5717 | |
| 5718 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5719 | if xid != None: |
| 5720 | self.xid = xid |
| 5721 | else: |
| 5722 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5723 | if flags != None: |
| 5724 | self.flags = flags |
| 5725 | else: |
| 5726 | self.flags = 0 |
| 5727 | if entries != None: |
| 5728 | self.entries = entries |
| 5729 | else: |
| 5730 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5731 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5732 | |
| 5733 | def pack(self): |
| 5734 | packed = [] |
| 5735 | packed.append(struct.pack("!B", self.version)) |
| 5736 | packed.append(struct.pack("!B", self.type)) |
| 5737 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5738 | packed.append(struct.pack("!L", self.xid)) |
| 5739 | packed.append(struct.pack("!H", self.stats_type)) |
| 5740 | packed.append(struct.pack("!H", self.flags)) |
| 5741 | packed.append('\x00' * 4) |
| 5742 | packed.append(struct.pack("!L", self.experimenter)) |
| 5743 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5744 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5745 | length = sum([len(x) for x in packed]) |
| 5746 | packed[2] = struct.pack("!H", length) |
| 5747 | return ''.join(packed) |
| 5748 | |
| 5749 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5750 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5751 | obj = bsn_lacp_stats_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5752 | _version = reader.read("!B")[0] |
| 5753 | assert(_version == 4) |
| 5754 | _type = reader.read("!B")[0] |
| 5755 | assert(_type == 19) |
| 5756 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5757 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5758 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5759 | obj.xid = reader.read("!L")[0] |
| 5760 | _stats_type = reader.read("!H")[0] |
| 5761 | assert(_stats_type == 65535) |
| 5762 | obj.flags = reader.read("!H")[0] |
| 5763 | reader.skip(4) |
| 5764 | _experimenter = reader.read("!L")[0] |
| 5765 | assert(_experimenter == 6035143) |
| 5766 | _subtype = reader.read("!L")[0] |
| 5767 | assert(_subtype == 1) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5768 | 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] | 5769 | return obj |
| 5770 | |
| 5771 | def __eq__(self, other): |
| 5772 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5773 | if self.xid != other.xid: return False |
| 5774 | if self.flags != other.flags: return False |
| 5775 | if self.entries != other.entries: return False |
| 5776 | return True |
| 5777 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5778 | def pretty_print(self, q): |
| 5779 | q.text("bsn_lacp_stats_reply {") |
| 5780 | with q.group(): |
| 5781 | with q.indent(2): |
| 5782 | q.breakable() |
| 5783 | q.text("xid = "); |
| 5784 | if self.xid != None: |
| 5785 | q.text("%#x" % self.xid) |
| 5786 | else: |
| 5787 | q.text('None') |
| 5788 | q.text(","); q.breakable() |
| 5789 | q.text("flags = "); |
| 5790 | q.text("%#x" % self.flags) |
| 5791 | q.text(","); q.breakable() |
| 5792 | q.text("entries = "); |
| 5793 | q.pp(self.entries) |
| 5794 | q.breakable() |
| 5795 | q.text('}') |
| 5796 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5797 | bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply |
| 5798 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5799 | class bsn_lacp_stats_request(bsn_stats_request): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5800 | version = 4 |
| 5801 | type = 18 |
| 5802 | stats_type = 65535 |
| 5803 | experimenter = 6035143 |
| 5804 | subtype = 1 |
| 5805 | |
| 5806 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5807 | if xid != None: |
| 5808 | self.xid = xid |
| 5809 | else: |
| 5810 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5811 | if flags != None: |
| 5812 | self.flags = flags |
| 5813 | else: |
| 5814 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5815 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5816 | |
| 5817 | def pack(self): |
| 5818 | packed = [] |
| 5819 | packed.append(struct.pack("!B", self.version)) |
| 5820 | packed.append(struct.pack("!B", self.type)) |
| 5821 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5822 | packed.append(struct.pack("!L", self.xid)) |
| 5823 | packed.append(struct.pack("!H", self.stats_type)) |
| 5824 | packed.append(struct.pack("!H", self.flags)) |
| 5825 | packed.append('\x00' * 4) |
| 5826 | packed.append(struct.pack("!L", self.experimenter)) |
| 5827 | packed.append(struct.pack("!L", self.subtype)) |
| 5828 | length = sum([len(x) for x in packed]) |
| 5829 | packed[2] = struct.pack("!H", length) |
| 5830 | return ''.join(packed) |
| 5831 | |
| 5832 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5833 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5834 | obj = bsn_lacp_stats_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5835 | _version = reader.read("!B")[0] |
| 5836 | assert(_version == 4) |
| 5837 | _type = reader.read("!B")[0] |
| 5838 | assert(_type == 18) |
| 5839 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5840 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5841 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5842 | obj.xid = reader.read("!L")[0] |
| 5843 | _stats_type = reader.read("!H")[0] |
| 5844 | assert(_stats_type == 65535) |
| 5845 | obj.flags = reader.read("!H")[0] |
| 5846 | reader.skip(4) |
| 5847 | _experimenter = reader.read("!L")[0] |
| 5848 | assert(_experimenter == 6035143) |
| 5849 | _subtype = reader.read("!L")[0] |
| 5850 | assert(_subtype == 1) |
| 5851 | return obj |
| 5852 | |
| 5853 | def __eq__(self, other): |
| 5854 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5855 | if self.xid != other.xid: return False |
| 5856 | if self.flags != other.flags: return False |
| 5857 | return True |
| 5858 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 5859 | def pretty_print(self, q): |
| 5860 | q.text("bsn_lacp_stats_request {") |
| 5861 | with q.group(): |
| 5862 | with q.indent(2): |
| 5863 | q.breakable() |
| 5864 | q.text("xid = "); |
| 5865 | if self.xid != None: |
| 5866 | q.text("%#x" % self.xid) |
| 5867 | else: |
| 5868 | q.text('None') |
| 5869 | q.text(","); q.breakable() |
| 5870 | q.text("flags = "); |
| 5871 | q.text("%#x" % self.flags) |
| 5872 | q.breakable() |
| 5873 | q.text('}') |
| 5874 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5875 | bsn_stats_request.subtypes[1] = bsn_lacp_stats_request |
| 5876 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5877 | class bsn_log(bsn_header): |
| 5878 | version = 4 |
| 5879 | type = 4 |
| 5880 | experimenter = 6035143 |
| 5881 | subtype = 63 |
| 5882 | |
| 5883 | def __init__(self, xid=None, loglevel=None, data=None): |
| 5884 | if xid != None: |
| 5885 | self.xid = xid |
| 5886 | else: |
| 5887 | self.xid = None |
| 5888 | if loglevel != None: |
| 5889 | self.loglevel = loglevel |
| 5890 | else: |
| 5891 | self.loglevel = 0 |
| 5892 | if data != None: |
| 5893 | self.data = data |
| 5894 | else: |
| 5895 | self.data = '' |
| 5896 | return |
| 5897 | |
| 5898 | def pack(self): |
| 5899 | packed = [] |
| 5900 | packed.append(struct.pack("!B", self.version)) |
| 5901 | packed.append(struct.pack("!B", self.type)) |
| 5902 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5903 | packed.append(struct.pack("!L", self.xid)) |
| 5904 | packed.append(struct.pack("!L", self.experimenter)) |
| 5905 | packed.append(struct.pack("!L", self.subtype)) |
| 5906 | packed.append(struct.pack("!B", self.loglevel)) |
| 5907 | packed.append(self.data) |
| 5908 | length = sum([len(x) for x in packed]) |
| 5909 | packed[2] = struct.pack("!H", length) |
| 5910 | return ''.join(packed) |
| 5911 | |
| 5912 | @staticmethod |
| 5913 | def unpack(reader): |
| 5914 | obj = bsn_log() |
| 5915 | _version = reader.read("!B")[0] |
| 5916 | assert(_version == 4) |
| 5917 | _type = reader.read("!B")[0] |
| 5918 | assert(_type == 4) |
| 5919 | _length = reader.read("!H")[0] |
| 5920 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5921 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 5922 | obj.xid = reader.read("!L")[0] |
| 5923 | _experimenter = reader.read("!L")[0] |
| 5924 | assert(_experimenter == 6035143) |
| 5925 | _subtype = reader.read("!L")[0] |
| 5926 | assert(_subtype == 63) |
| 5927 | obj.loglevel = reader.read("!B")[0] |
| 5928 | obj.data = str(reader.read_all()) |
| 5929 | return obj |
| 5930 | |
| 5931 | def __eq__(self, other): |
| 5932 | if type(self) != type(other): return False |
| 5933 | if self.xid != other.xid: return False |
| 5934 | if self.loglevel != other.loglevel: return False |
| 5935 | if self.data != other.data: return False |
| 5936 | return True |
| 5937 | |
| 5938 | def pretty_print(self, q): |
| 5939 | q.text("bsn_log {") |
| 5940 | with q.group(): |
| 5941 | with q.indent(2): |
| 5942 | q.breakable() |
| 5943 | q.text("xid = "); |
| 5944 | if self.xid != None: |
| 5945 | q.text("%#x" % self.xid) |
| 5946 | else: |
| 5947 | q.text('None') |
| 5948 | q.text(","); q.breakable() |
| 5949 | q.text("loglevel = "); |
| 5950 | q.text("%#x" % self.loglevel) |
| 5951 | q.text(","); q.breakable() |
| 5952 | q.text("data = "); |
| 5953 | q.pp(self.data) |
| 5954 | q.breakable() |
| 5955 | q.text('}') |
| 5956 | |
| 5957 | bsn_header.subtypes[63] = bsn_log |
| 5958 | |
Rich Lane | 474324f | 2015-01-14 15:22:56 -0800 | [diff] [blame] | 5959 | class bsn_lua_command_reply(bsn_header): |
| 5960 | version = 4 |
| 5961 | type = 4 |
| 5962 | experimenter = 6035143 |
| 5963 | subtype = 66 |
| 5964 | |
| 5965 | def __init__(self, xid=None, data=None): |
| 5966 | if xid != None: |
| 5967 | self.xid = xid |
| 5968 | else: |
| 5969 | self.xid = None |
| 5970 | if data != None: |
| 5971 | self.data = data |
| 5972 | else: |
| 5973 | self.data = '' |
| 5974 | return |
| 5975 | |
| 5976 | def pack(self): |
| 5977 | packed = [] |
| 5978 | packed.append(struct.pack("!B", self.version)) |
| 5979 | packed.append(struct.pack("!B", self.type)) |
| 5980 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5981 | packed.append(struct.pack("!L", self.xid)) |
| 5982 | packed.append(struct.pack("!L", self.experimenter)) |
| 5983 | packed.append(struct.pack("!L", self.subtype)) |
| 5984 | packed.append(self.data) |
| 5985 | length = sum([len(x) for x in packed]) |
| 5986 | packed[2] = struct.pack("!H", length) |
| 5987 | return ''.join(packed) |
| 5988 | |
| 5989 | @staticmethod |
| 5990 | def unpack(reader): |
| 5991 | obj = bsn_lua_command_reply() |
| 5992 | _version = reader.read("!B")[0] |
| 5993 | assert(_version == 4) |
| 5994 | _type = reader.read("!B")[0] |
| 5995 | assert(_type == 4) |
| 5996 | _length = reader.read("!H")[0] |
| 5997 | orig_reader = reader |
| 5998 | reader = orig_reader.slice(_length, 4) |
| 5999 | obj.xid = reader.read("!L")[0] |
| 6000 | _experimenter = reader.read("!L")[0] |
| 6001 | assert(_experimenter == 6035143) |
| 6002 | _subtype = reader.read("!L")[0] |
| 6003 | assert(_subtype == 66) |
| 6004 | obj.data = str(reader.read_all()) |
| 6005 | return obj |
| 6006 | |
| 6007 | def __eq__(self, other): |
| 6008 | if type(self) != type(other): return False |
| 6009 | if self.xid != other.xid: return False |
| 6010 | if self.data != other.data: return False |
| 6011 | return True |
| 6012 | |
| 6013 | def pretty_print(self, q): |
| 6014 | q.text("bsn_lua_command_reply {") |
| 6015 | with q.group(): |
| 6016 | with q.indent(2): |
| 6017 | q.breakable() |
| 6018 | q.text("xid = "); |
| 6019 | if self.xid != None: |
| 6020 | q.text("%#x" % self.xid) |
| 6021 | else: |
| 6022 | q.text('None') |
| 6023 | q.text(","); q.breakable() |
| 6024 | q.text("data = "); |
| 6025 | q.pp(self.data) |
| 6026 | q.breakable() |
| 6027 | q.text('}') |
| 6028 | |
| 6029 | bsn_header.subtypes[66] = bsn_lua_command_reply |
| 6030 | |
| 6031 | class bsn_lua_command_request(bsn_header): |
| 6032 | version = 4 |
| 6033 | type = 4 |
| 6034 | experimenter = 6035143 |
| 6035 | subtype = 65 |
| 6036 | |
| 6037 | def __init__(self, xid=None, data=None): |
| 6038 | if xid != None: |
| 6039 | self.xid = xid |
| 6040 | else: |
| 6041 | self.xid = None |
| 6042 | if data != None: |
| 6043 | self.data = data |
| 6044 | else: |
| 6045 | self.data = '' |
| 6046 | return |
| 6047 | |
| 6048 | def pack(self): |
| 6049 | packed = [] |
| 6050 | packed.append(struct.pack("!B", self.version)) |
| 6051 | packed.append(struct.pack("!B", self.type)) |
| 6052 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6053 | packed.append(struct.pack("!L", self.xid)) |
| 6054 | packed.append(struct.pack("!L", self.experimenter)) |
| 6055 | packed.append(struct.pack("!L", self.subtype)) |
| 6056 | packed.append(self.data) |
| 6057 | length = sum([len(x) for x in packed]) |
| 6058 | packed[2] = struct.pack("!H", length) |
| 6059 | return ''.join(packed) |
| 6060 | |
| 6061 | @staticmethod |
| 6062 | def unpack(reader): |
| 6063 | obj = bsn_lua_command_request() |
| 6064 | _version = reader.read("!B")[0] |
| 6065 | assert(_version == 4) |
| 6066 | _type = reader.read("!B")[0] |
| 6067 | assert(_type == 4) |
| 6068 | _length = reader.read("!H")[0] |
| 6069 | orig_reader = reader |
| 6070 | reader = orig_reader.slice(_length, 4) |
| 6071 | obj.xid = reader.read("!L")[0] |
| 6072 | _experimenter = reader.read("!L")[0] |
| 6073 | assert(_experimenter == 6035143) |
| 6074 | _subtype = reader.read("!L")[0] |
| 6075 | assert(_subtype == 65) |
| 6076 | obj.data = str(reader.read_all()) |
| 6077 | return obj |
| 6078 | |
| 6079 | def __eq__(self, other): |
| 6080 | if type(self) != type(other): return False |
| 6081 | if self.xid != other.xid: return False |
| 6082 | if self.data != other.data: return False |
| 6083 | return True |
| 6084 | |
| 6085 | def pretty_print(self, q): |
| 6086 | q.text("bsn_lua_command_request {") |
| 6087 | with q.group(): |
| 6088 | with q.indent(2): |
| 6089 | q.breakable() |
| 6090 | q.text("xid = "); |
| 6091 | if self.xid != None: |
| 6092 | q.text("%#x" % self.xid) |
| 6093 | else: |
| 6094 | q.text('None') |
| 6095 | q.text(","); q.breakable() |
| 6096 | q.text("data = "); |
| 6097 | q.pp(self.data) |
| 6098 | q.breakable() |
| 6099 | q.text('}') |
| 6100 | |
| 6101 | bsn_header.subtypes[65] = bsn_lua_command_request |
| 6102 | |
| 6103 | class bsn_lua_notification(bsn_header): |
| 6104 | version = 4 |
| 6105 | type = 4 |
| 6106 | experimenter = 6035143 |
| 6107 | subtype = 67 |
| 6108 | |
| 6109 | def __init__(self, xid=None, data=None): |
| 6110 | if xid != None: |
| 6111 | self.xid = xid |
| 6112 | else: |
| 6113 | self.xid = None |
| 6114 | if data != None: |
| 6115 | self.data = data |
| 6116 | else: |
| 6117 | self.data = '' |
| 6118 | return |
| 6119 | |
| 6120 | def pack(self): |
| 6121 | packed = [] |
| 6122 | packed.append(struct.pack("!B", self.version)) |
| 6123 | packed.append(struct.pack("!B", self.type)) |
| 6124 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6125 | packed.append(struct.pack("!L", self.xid)) |
| 6126 | packed.append(struct.pack("!L", self.experimenter)) |
| 6127 | packed.append(struct.pack("!L", self.subtype)) |
| 6128 | packed.append(self.data) |
| 6129 | length = sum([len(x) for x in packed]) |
| 6130 | packed[2] = struct.pack("!H", length) |
| 6131 | return ''.join(packed) |
| 6132 | |
| 6133 | @staticmethod |
| 6134 | def unpack(reader): |
| 6135 | obj = bsn_lua_notification() |
| 6136 | _version = reader.read("!B")[0] |
| 6137 | assert(_version == 4) |
| 6138 | _type = reader.read("!B")[0] |
| 6139 | assert(_type == 4) |
| 6140 | _length = reader.read("!H")[0] |
| 6141 | orig_reader = reader |
| 6142 | reader = orig_reader.slice(_length, 4) |
| 6143 | obj.xid = reader.read("!L")[0] |
| 6144 | _experimenter = reader.read("!L")[0] |
| 6145 | assert(_experimenter == 6035143) |
| 6146 | _subtype = reader.read("!L")[0] |
| 6147 | assert(_subtype == 67) |
| 6148 | obj.data = str(reader.read_all()) |
| 6149 | return obj |
| 6150 | |
| 6151 | def __eq__(self, other): |
| 6152 | if type(self) != type(other): return False |
| 6153 | if self.xid != other.xid: return False |
| 6154 | if self.data != other.data: return False |
| 6155 | return True |
| 6156 | |
| 6157 | def pretty_print(self, q): |
| 6158 | q.text("bsn_lua_notification {") |
| 6159 | with q.group(): |
| 6160 | with q.indent(2): |
| 6161 | q.breakable() |
| 6162 | q.text("xid = "); |
| 6163 | if self.xid != None: |
| 6164 | q.text("%#x" % self.xid) |
| 6165 | else: |
| 6166 | q.text('None') |
| 6167 | q.text(","); q.breakable() |
| 6168 | q.text("data = "); |
| 6169 | q.pp(self.data) |
| 6170 | q.breakable() |
| 6171 | q.text('}') |
| 6172 | |
| 6173 | bsn_header.subtypes[67] = bsn_lua_notification |
| 6174 | |
| 6175 | class bsn_lua_upload(bsn_header): |
| 6176 | version = 4 |
| 6177 | type = 4 |
| 6178 | experimenter = 6035143 |
| 6179 | subtype = 64 |
| 6180 | |
| 6181 | def __init__(self, xid=None, flags=None, filename=None, data=None): |
| 6182 | if xid != None: |
| 6183 | self.xid = xid |
| 6184 | else: |
| 6185 | self.xid = None |
| 6186 | if flags != None: |
| 6187 | self.flags = flags |
| 6188 | else: |
| 6189 | self.flags = 0 |
| 6190 | if filename != None: |
| 6191 | self.filename = filename |
| 6192 | else: |
| 6193 | self.filename = "" |
| 6194 | if data != None: |
| 6195 | self.data = data |
| 6196 | else: |
| 6197 | self.data = '' |
| 6198 | return |
| 6199 | |
| 6200 | def pack(self): |
| 6201 | packed = [] |
| 6202 | packed.append(struct.pack("!B", self.version)) |
| 6203 | packed.append(struct.pack("!B", self.type)) |
| 6204 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6205 | packed.append(struct.pack("!L", self.xid)) |
| 6206 | packed.append(struct.pack("!L", self.experimenter)) |
| 6207 | packed.append(struct.pack("!L", self.subtype)) |
| 6208 | packed.append(struct.pack("!H", self.flags)) |
| 6209 | packed.append(struct.pack("!64s", self.filename)) |
| 6210 | packed.append(self.data) |
| 6211 | length = sum([len(x) for x in packed]) |
| 6212 | packed[2] = struct.pack("!H", length) |
| 6213 | return ''.join(packed) |
| 6214 | |
| 6215 | @staticmethod |
| 6216 | def unpack(reader): |
| 6217 | obj = bsn_lua_upload() |
| 6218 | _version = reader.read("!B")[0] |
| 6219 | assert(_version == 4) |
| 6220 | _type = reader.read("!B")[0] |
| 6221 | assert(_type == 4) |
| 6222 | _length = reader.read("!H")[0] |
| 6223 | orig_reader = reader |
| 6224 | reader = orig_reader.slice(_length, 4) |
| 6225 | obj.xid = reader.read("!L")[0] |
| 6226 | _experimenter = reader.read("!L")[0] |
| 6227 | assert(_experimenter == 6035143) |
| 6228 | _subtype = reader.read("!L")[0] |
| 6229 | assert(_subtype == 64) |
| 6230 | obj.flags = reader.read("!H")[0] |
| 6231 | obj.filename = reader.read("!64s")[0].rstrip("\x00") |
| 6232 | obj.data = str(reader.read_all()) |
| 6233 | return obj |
| 6234 | |
| 6235 | def __eq__(self, other): |
| 6236 | if type(self) != type(other): return False |
| 6237 | if self.xid != other.xid: return False |
| 6238 | if self.flags != other.flags: return False |
| 6239 | if self.filename != other.filename: return False |
| 6240 | if self.data != other.data: return False |
| 6241 | return True |
| 6242 | |
| 6243 | def pretty_print(self, q): |
| 6244 | q.text("bsn_lua_upload {") |
| 6245 | with q.group(): |
| 6246 | with q.indent(2): |
| 6247 | q.breakable() |
| 6248 | q.text("xid = "); |
| 6249 | if self.xid != None: |
| 6250 | q.text("%#x" % self.xid) |
| 6251 | else: |
| 6252 | q.text('None') |
| 6253 | q.text(","); q.breakable() |
| 6254 | q.text("flags = "); |
| 6255 | q.text("%#x" % self.flags) |
| 6256 | q.text(","); q.breakable() |
| 6257 | q.text("filename = "); |
| 6258 | q.pp(self.filename) |
| 6259 | q.text(","); q.breakable() |
| 6260 | q.text("data = "); |
| 6261 | q.pp(self.data) |
| 6262 | q.breakable() |
| 6263 | q.text('}') |
| 6264 | |
| 6265 | bsn_header.subtypes[64] = bsn_lua_upload |
| 6266 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6267 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6268 | version = 4 |
| 6269 | type = 4 |
| 6270 | experimenter = 6035143 |
| 6271 | subtype = 34 |
| 6272 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6273 | 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] | 6274 | if xid != None: |
| 6275 | self.xid = xid |
| 6276 | else: |
| 6277 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6278 | if status != None: |
| 6279 | self.status = status |
| 6280 | else: |
| 6281 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6282 | if port_no != None: |
| 6283 | self.port_no = port_no |
| 6284 | else: |
| 6285 | self.port_no = 0 |
| 6286 | if slot_num != None: |
| 6287 | self.slot_num = slot_num |
| 6288 | else: |
| 6289 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6290 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6291 | |
| 6292 | def pack(self): |
| 6293 | packed = [] |
| 6294 | packed.append(struct.pack("!B", self.version)) |
| 6295 | packed.append(struct.pack("!B", self.type)) |
| 6296 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6297 | packed.append(struct.pack("!L", self.xid)) |
| 6298 | packed.append(struct.pack("!L", self.experimenter)) |
| 6299 | packed.append(struct.pack("!L", self.subtype)) |
| 6300 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6301 | packed.append(util.pack_port_no(self.port_no)) |
| 6302 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6303 | length = sum([len(x) for x in packed]) |
| 6304 | packed[2] = struct.pack("!H", length) |
| 6305 | return ''.join(packed) |
| 6306 | |
| 6307 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6308 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6309 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6310 | _version = reader.read("!B")[0] |
| 6311 | assert(_version == 4) |
| 6312 | _type = reader.read("!B")[0] |
| 6313 | assert(_type == 4) |
| 6314 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6315 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6316 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6317 | obj.xid = reader.read("!L")[0] |
| 6318 | _experimenter = reader.read("!L")[0] |
| 6319 | assert(_experimenter == 6035143) |
| 6320 | _subtype = reader.read("!L")[0] |
| 6321 | assert(_subtype == 34) |
| 6322 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6323 | obj.port_no = util.unpack_port_no(reader) |
| 6324 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6325 | return obj |
| 6326 | |
| 6327 | def __eq__(self, other): |
| 6328 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6329 | if self.xid != other.xid: return False |
| 6330 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6331 | if self.port_no != other.port_no: return False |
| 6332 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6333 | return True |
| 6334 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6335 | def pretty_print(self, q): |
| 6336 | q.text("bsn_pdu_rx_reply {") |
| 6337 | with q.group(): |
| 6338 | with q.indent(2): |
| 6339 | q.breakable() |
| 6340 | q.text("xid = "); |
| 6341 | if self.xid != None: |
| 6342 | q.text("%#x" % self.xid) |
| 6343 | else: |
| 6344 | q.text('None') |
| 6345 | q.text(","); q.breakable() |
| 6346 | q.text("status = "); |
| 6347 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6348 | q.text(","); q.breakable() |
| 6349 | q.text("port_no = "); |
| 6350 | q.text(util.pretty_port(self.port_no)) |
| 6351 | q.text(","); q.breakable() |
| 6352 | q.text("slot_num = "); |
| 6353 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6354 | q.breakable() |
| 6355 | q.text('}') |
| 6356 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6357 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 6358 | |
| 6359 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6360 | version = 4 |
| 6361 | type = 4 |
| 6362 | experimenter = 6035143 |
| 6363 | subtype = 33 |
| 6364 | |
| 6365 | 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] | 6366 | if xid != None: |
| 6367 | self.xid = xid |
| 6368 | else: |
| 6369 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6370 | if timeout_ms != None: |
| 6371 | self.timeout_ms = timeout_ms |
| 6372 | else: |
| 6373 | self.timeout_ms = 0 |
| 6374 | if port_no != None: |
| 6375 | self.port_no = port_no |
| 6376 | else: |
| 6377 | self.port_no = 0 |
| 6378 | if slot_num != None: |
| 6379 | self.slot_num = slot_num |
| 6380 | else: |
| 6381 | self.slot_num = 0 |
| 6382 | if data != None: |
| 6383 | self.data = data |
| 6384 | else: |
| 6385 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6386 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6387 | |
| 6388 | def pack(self): |
| 6389 | packed = [] |
| 6390 | packed.append(struct.pack("!B", self.version)) |
| 6391 | packed.append(struct.pack("!B", self.type)) |
| 6392 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6393 | packed.append(struct.pack("!L", self.xid)) |
| 6394 | packed.append(struct.pack("!L", self.experimenter)) |
| 6395 | packed.append(struct.pack("!L", self.subtype)) |
| 6396 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 6397 | packed.append(util.pack_port_no(self.port_no)) |
| 6398 | packed.append(struct.pack("!B", self.slot_num)) |
| 6399 | packed.append('\x00' * 3) |
| 6400 | packed.append(self.data) |
| 6401 | length = sum([len(x) for x in packed]) |
| 6402 | packed[2] = struct.pack("!H", length) |
| 6403 | return ''.join(packed) |
| 6404 | |
| 6405 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6406 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6407 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6408 | _version = reader.read("!B")[0] |
| 6409 | assert(_version == 4) |
| 6410 | _type = reader.read("!B")[0] |
| 6411 | assert(_type == 4) |
| 6412 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6413 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6414 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6415 | obj.xid = reader.read("!L")[0] |
| 6416 | _experimenter = reader.read("!L")[0] |
| 6417 | assert(_experimenter == 6035143) |
| 6418 | _subtype = reader.read("!L")[0] |
| 6419 | assert(_subtype == 33) |
| 6420 | obj.timeout_ms = reader.read("!L")[0] |
| 6421 | obj.port_no = util.unpack_port_no(reader) |
| 6422 | obj.slot_num = reader.read("!B")[0] |
| 6423 | reader.skip(3) |
| 6424 | obj.data = str(reader.read_all()) |
| 6425 | return obj |
| 6426 | |
| 6427 | def __eq__(self, other): |
| 6428 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6429 | if self.xid != other.xid: return False |
| 6430 | if self.timeout_ms != other.timeout_ms: return False |
| 6431 | if self.port_no != other.port_no: return False |
| 6432 | if self.slot_num != other.slot_num: return False |
| 6433 | if self.data != other.data: return False |
| 6434 | return True |
| 6435 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6436 | def pretty_print(self, q): |
| 6437 | q.text("bsn_pdu_rx_request {") |
| 6438 | with q.group(): |
| 6439 | with q.indent(2): |
| 6440 | q.breakable() |
| 6441 | q.text("xid = "); |
| 6442 | if self.xid != None: |
| 6443 | q.text("%#x" % self.xid) |
| 6444 | else: |
| 6445 | q.text('None') |
| 6446 | q.text(","); q.breakable() |
| 6447 | q.text("timeout_ms = "); |
| 6448 | q.text("%#x" % self.timeout_ms) |
| 6449 | q.text(","); q.breakable() |
| 6450 | q.text("port_no = "); |
| 6451 | q.text(util.pretty_port(self.port_no)) |
| 6452 | q.text(","); q.breakable() |
| 6453 | q.text("slot_num = "); |
| 6454 | q.text("%#x" % self.slot_num) |
| 6455 | q.text(","); q.breakable() |
| 6456 | q.text("data = "); |
| 6457 | q.pp(self.data) |
| 6458 | q.breakable() |
| 6459 | q.text('}') |
| 6460 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6461 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 6462 | |
| 6463 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6464 | version = 4 |
| 6465 | type = 4 |
| 6466 | experimenter = 6035143 |
| 6467 | subtype = 35 |
| 6468 | |
| 6469 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6470 | if xid != None: |
| 6471 | self.xid = xid |
| 6472 | else: |
| 6473 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6474 | if port_no != None: |
| 6475 | self.port_no = port_no |
| 6476 | else: |
| 6477 | self.port_no = 0 |
| 6478 | if slot_num != None: |
| 6479 | self.slot_num = slot_num |
| 6480 | else: |
| 6481 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6482 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6483 | |
| 6484 | def pack(self): |
| 6485 | packed = [] |
| 6486 | packed.append(struct.pack("!B", self.version)) |
| 6487 | packed.append(struct.pack("!B", self.type)) |
| 6488 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6489 | packed.append(struct.pack("!L", self.xid)) |
| 6490 | packed.append(struct.pack("!L", self.experimenter)) |
| 6491 | packed.append(struct.pack("!L", self.subtype)) |
| 6492 | packed.append(util.pack_port_no(self.port_no)) |
| 6493 | packed.append(struct.pack("!B", self.slot_num)) |
| 6494 | length = sum([len(x) for x in packed]) |
| 6495 | packed[2] = struct.pack("!H", length) |
| 6496 | return ''.join(packed) |
| 6497 | |
| 6498 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6499 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6500 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6501 | _version = reader.read("!B")[0] |
| 6502 | assert(_version == 4) |
| 6503 | _type = reader.read("!B")[0] |
| 6504 | assert(_type == 4) |
| 6505 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6506 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6507 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6508 | obj.xid = reader.read("!L")[0] |
| 6509 | _experimenter = reader.read("!L")[0] |
| 6510 | assert(_experimenter == 6035143) |
| 6511 | _subtype = reader.read("!L")[0] |
| 6512 | assert(_subtype == 35) |
| 6513 | obj.port_no = util.unpack_port_no(reader) |
| 6514 | obj.slot_num = reader.read("!B")[0] |
| 6515 | return obj |
| 6516 | |
| 6517 | def __eq__(self, other): |
| 6518 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6519 | if self.xid != other.xid: return False |
| 6520 | if self.port_no != other.port_no: return False |
| 6521 | if self.slot_num != other.slot_num: return False |
| 6522 | return True |
| 6523 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6524 | def pretty_print(self, q): |
| 6525 | q.text("bsn_pdu_rx_timeout {") |
| 6526 | with q.group(): |
| 6527 | with q.indent(2): |
| 6528 | q.breakable() |
| 6529 | q.text("xid = "); |
| 6530 | if self.xid != None: |
| 6531 | q.text("%#x" % self.xid) |
| 6532 | else: |
| 6533 | q.text('None') |
| 6534 | q.text(","); q.breakable() |
| 6535 | q.text("port_no = "); |
| 6536 | q.text(util.pretty_port(self.port_no)) |
| 6537 | q.text(","); q.breakable() |
| 6538 | q.text("slot_num = "); |
| 6539 | q.text("%#x" % self.slot_num) |
| 6540 | q.breakable() |
| 6541 | q.text('}') |
| 6542 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6543 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 6544 | |
| 6545 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6546 | version = 4 |
| 6547 | type = 4 |
| 6548 | experimenter = 6035143 |
| 6549 | subtype = 32 |
| 6550 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6551 | 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] | 6552 | if xid != None: |
| 6553 | self.xid = xid |
| 6554 | else: |
| 6555 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6556 | if status != None: |
| 6557 | self.status = status |
| 6558 | else: |
| 6559 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6560 | if port_no != None: |
| 6561 | self.port_no = port_no |
| 6562 | else: |
| 6563 | self.port_no = 0 |
| 6564 | if slot_num != None: |
| 6565 | self.slot_num = slot_num |
| 6566 | else: |
| 6567 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6568 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6569 | |
| 6570 | def pack(self): |
| 6571 | packed = [] |
| 6572 | packed.append(struct.pack("!B", self.version)) |
| 6573 | packed.append(struct.pack("!B", self.type)) |
| 6574 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6575 | packed.append(struct.pack("!L", self.xid)) |
| 6576 | packed.append(struct.pack("!L", self.experimenter)) |
| 6577 | packed.append(struct.pack("!L", self.subtype)) |
| 6578 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6579 | packed.append(util.pack_port_no(self.port_no)) |
| 6580 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6581 | length = sum([len(x) for x in packed]) |
| 6582 | packed[2] = struct.pack("!H", length) |
| 6583 | return ''.join(packed) |
| 6584 | |
| 6585 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6586 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6587 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6588 | _version = reader.read("!B")[0] |
| 6589 | assert(_version == 4) |
| 6590 | _type = reader.read("!B")[0] |
| 6591 | assert(_type == 4) |
| 6592 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6593 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6594 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6595 | obj.xid = reader.read("!L")[0] |
| 6596 | _experimenter = reader.read("!L")[0] |
| 6597 | assert(_experimenter == 6035143) |
| 6598 | _subtype = reader.read("!L")[0] |
| 6599 | assert(_subtype == 32) |
| 6600 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6601 | obj.port_no = util.unpack_port_no(reader) |
| 6602 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6603 | return obj |
| 6604 | |
| 6605 | def __eq__(self, other): |
| 6606 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6607 | if self.xid != other.xid: return False |
| 6608 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6609 | if self.port_no != other.port_no: return False |
| 6610 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6611 | return True |
| 6612 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6613 | def pretty_print(self, q): |
| 6614 | q.text("bsn_pdu_tx_reply {") |
| 6615 | with q.group(): |
| 6616 | with q.indent(2): |
| 6617 | q.breakable() |
| 6618 | q.text("xid = "); |
| 6619 | if self.xid != None: |
| 6620 | q.text("%#x" % self.xid) |
| 6621 | else: |
| 6622 | q.text('None') |
| 6623 | q.text(","); q.breakable() |
| 6624 | q.text("status = "); |
| 6625 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 6626 | q.text(","); q.breakable() |
| 6627 | q.text("port_no = "); |
| 6628 | q.text(util.pretty_port(self.port_no)) |
| 6629 | q.text(","); q.breakable() |
| 6630 | q.text("slot_num = "); |
| 6631 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6632 | q.breakable() |
| 6633 | q.text('}') |
| 6634 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6635 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 6636 | |
| 6637 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6638 | version = 4 |
| 6639 | type = 4 |
| 6640 | experimenter = 6035143 |
| 6641 | subtype = 31 |
| 6642 | |
| 6643 | 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] | 6644 | if xid != None: |
| 6645 | self.xid = xid |
| 6646 | else: |
| 6647 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6648 | if tx_interval_ms != None: |
| 6649 | self.tx_interval_ms = tx_interval_ms |
| 6650 | else: |
| 6651 | self.tx_interval_ms = 0 |
| 6652 | if port_no != None: |
| 6653 | self.port_no = port_no |
| 6654 | else: |
| 6655 | self.port_no = 0 |
| 6656 | if slot_num != None: |
| 6657 | self.slot_num = slot_num |
| 6658 | else: |
| 6659 | self.slot_num = 0 |
| 6660 | if data != None: |
| 6661 | self.data = data |
| 6662 | else: |
| 6663 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6664 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6665 | |
| 6666 | def pack(self): |
| 6667 | packed = [] |
| 6668 | packed.append(struct.pack("!B", self.version)) |
| 6669 | packed.append(struct.pack("!B", self.type)) |
| 6670 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6671 | packed.append(struct.pack("!L", self.xid)) |
| 6672 | packed.append(struct.pack("!L", self.experimenter)) |
| 6673 | packed.append(struct.pack("!L", self.subtype)) |
| 6674 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 6675 | packed.append(util.pack_port_no(self.port_no)) |
| 6676 | packed.append(struct.pack("!B", self.slot_num)) |
| 6677 | packed.append('\x00' * 3) |
| 6678 | packed.append(self.data) |
| 6679 | length = sum([len(x) for x in packed]) |
| 6680 | packed[2] = struct.pack("!H", length) |
| 6681 | return ''.join(packed) |
| 6682 | |
| 6683 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6684 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6685 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6686 | _version = reader.read("!B")[0] |
| 6687 | assert(_version == 4) |
| 6688 | _type = reader.read("!B")[0] |
| 6689 | assert(_type == 4) |
| 6690 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6691 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6692 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6693 | obj.xid = reader.read("!L")[0] |
| 6694 | _experimenter = reader.read("!L")[0] |
| 6695 | assert(_experimenter == 6035143) |
| 6696 | _subtype = reader.read("!L")[0] |
| 6697 | assert(_subtype == 31) |
| 6698 | obj.tx_interval_ms = reader.read("!L")[0] |
| 6699 | obj.port_no = util.unpack_port_no(reader) |
| 6700 | obj.slot_num = reader.read("!B")[0] |
| 6701 | reader.skip(3) |
| 6702 | obj.data = str(reader.read_all()) |
| 6703 | return obj |
| 6704 | |
| 6705 | def __eq__(self, other): |
| 6706 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6707 | if self.xid != other.xid: return False |
| 6708 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 6709 | if self.port_no != other.port_no: return False |
| 6710 | if self.slot_num != other.slot_num: return False |
| 6711 | if self.data != other.data: return False |
| 6712 | return True |
| 6713 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6714 | def pretty_print(self, q): |
| 6715 | q.text("bsn_pdu_tx_request {") |
| 6716 | with q.group(): |
| 6717 | with q.indent(2): |
| 6718 | q.breakable() |
| 6719 | q.text("xid = "); |
| 6720 | if self.xid != None: |
| 6721 | q.text("%#x" % self.xid) |
| 6722 | else: |
| 6723 | q.text('None') |
| 6724 | q.text(","); q.breakable() |
| 6725 | q.text("tx_interval_ms = "); |
| 6726 | q.text("%#x" % self.tx_interval_ms) |
| 6727 | q.text(","); q.breakable() |
| 6728 | q.text("port_no = "); |
| 6729 | q.text(util.pretty_port(self.port_no)) |
| 6730 | q.text(","); q.breakable() |
| 6731 | q.text("slot_num = "); |
| 6732 | q.text("%#x" % self.slot_num) |
| 6733 | q.text(","); q.breakable() |
| 6734 | q.text("data = "); |
| 6735 | q.pp(self.data) |
| 6736 | q.breakable() |
| 6737 | q.text('}') |
| 6738 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6739 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 6740 | |
| 6741 | class bsn_port_counter_stats_reply(bsn_stats_reply): |
| 6742 | version = 4 |
| 6743 | type = 19 |
| 6744 | stats_type = 65535 |
| 6745 | experimenter = 6035143 |
| 6746 | subtype = 8 |
| 6747 | |
| 6748 | def __init__(self, xid=None, flags=None, entries=None): |
| 6749 | if xid != None: |
| 6750 | self.xid = xid |
| 6751 | else: |
| 6752 | self.xid = None |
| 6753 | if flags != None: |
| 6754 | self.flags = flags |
| 6755 | else: |
| 6756 | self.flags = 0 |
| 6757 | if entries != None: |
| 6758 | self.entries = entries |
| 6759 | else: |
| 6760 | self.entries = [] |
| 6761 | return |
| 6762 | |
| 6763 | def pack(self): |
| 6764 | packed = [] |
| 6765 | packed.append(struct.pack("!B", self.version)) |
| 6766 | packed.append(struct.pack("!B", self.type)) |
| 6767 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6768 | packed.append(struct.pack("!L", self.xid)) |
| 6769 | packed.append(struct.pack("!H", self.stats_type)) |
| 6770 | packed.append(struct.pack("!H", self.flags)) |
| 6771 | packed.append('\x00' * 4) |
| 6772 | packed.append(struct.pack("!L", self.experimenter)) |
| 6773 | packed.append(struct.pack("!L", self.subtype)) |
| 6774 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 6775 | length = sum([len(x) for x in packed]) |
| 6776 | packed[2] = struct.pack("!H", length) |
| 6777 | return ''.join(packed) |
| 6778 | |
| 6779 | @staticmethod |
| 6780 | def unpack(reader): |
| 6781 | obj = bsn_port_counter_stats_reply() |
| 6782 | _version = reader.read("!B")[0] |
| 6783 | assert(_version == 4) |
| 6784 | _type = reader.read("!B")[0] |
| 6785 | assert(_type == 19) |
| 6786 | _length = reader.read("!H")[0] |
| 6787 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6788 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6789 | obj.xid = reader.read("!L")[0] |
| 6790 | _stats_type = reader.read("!H")[0] |
| 6791 | assert(_stats_type == 65535) |
| 6792 | obj.flags = reader.read("!H")[0] |
| 6793 | reader.skip(4) |
| 6794 | _experimenter = reader.read("!L")[0] |
| 6795 | assert(_experimenter == 6035143) |
| 6796 | _subtype = reader.read("!L")[0] |
| 6797 | assert(_subtype == 8) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6798 | 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] | 6799 | return obj |
| 6800 | |
| 6801 | def __eq__(self, other): |
| 6802 | if type(self) != type(other): return False |
| 6803 | if self.xid != other.xid: return False |
| 6804 | if self.flags != other.flags: return False |
| 6805 | if self.entries != other.entries: return False |
| 6806 | return True |
| 6807 | |
| 6808 | def pretty_print(self, q): |
| 6809 | q.text("bsn_port_counter_stats_reply {") |
| 6810 | with q.group(): |
| 6811 | with q.indent(2): |
| 6812 | q.breakable() |
| 6813 | q.text("xid = "); |
| 6814 | if self.xid != None: |
| 6815 | q.text("%#x" % self.xid) |
| 6816 | else: |
| 6817 | q.text('None') |
| 6818 | q.text(","); q.breakable() |
| 6819 | q.text("flags = "); |
| 6820 | q.text("%#x" % self.flags) |
| 6821 | q.text(","); q.breakable() |
| 6822 | q.text("entries = "); |
| 6823 | q.pp(self.entries) |
| 6824 | q.breakable() |
| 6825 | q.text('}') |
| 6826 | |
| 6827 | bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply |
| 6828 | |
| 6829 | class bsn_port_counter_stats_request(bsn_stats_request): |
| 6830 | version = 4 |
| 6831 | type = 18 |
| 6832 | stats_type = 65535 |
| 6833 | experimenter = 6035143 |
| 6834 | subtype = 8 |
| 6835 | |
| 6836 | def __init__(self, xid=None, flags=None, port_no=None): |
| 6837 | if xid != None: |
| 6838 | self.xid = xid |
| 6839 | else: |
| 6840 | self.xid = None |
| 6841 | if flags != None: |
| 6842 | self.flags = flags |
| 6843 | else: |
| 6844 | self.flags = 0 |
| 6845 | if port_no != None: |
| 6846 | self.port_no = port_no |
| 6847 | else: |
| 6848 | self.port_no = 0 |
| 6849 | return |
| 6850 | |
| 6851 | def pack(self): |
| 6852 | packed = [] |
| 6853 | packed.append(struct.pack("!B", self.version)) |
| 6854 | packed.append(struct.pack("!B", self.type)) |
| 6855 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6856 | packed.append(struct.pack("!L", self.xid)) |
| 6857 | packed.append(struct.pack("!H", self.stats_type)) |
| 6858 | packed.append(struct.pack("!H", self.flags)) |
| 6859 | packed.append('\x00' * 4) |
| 6860 | packed.append(struct.pack("!L", self.experimenter)) |
| 6861 | packed.append(struct.pack("!L", self.subtype)) |
| 6862 | packed.append(util.pack_port_no(self.port_no)) |
| 6863 | length = sum([len(x) for x in packed]) |
| 6864 | packed[2] = struct.pack("!H", length) |
| 6865 | return ''.join(packed) |
| 6866 | |
| 6867 | @staticmethod |
| 6868 | def unpack(reader): |
| 6869 | obj = bsn_port_counter_stats_request() |
| 6870 | _version = reader.read("!B")[0] |
| 6871 | assert(_version == 4) |
| 6872 | _type = reader.read("!B")[0] |
| 6873 | assert(_type == 18) |
| 6874 | _length = reader.read("!H")[0] |
| 6875 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6876 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6877 | obj.xid = reader.read("!L")[0] |
| 6878 | _stats_type = reader.read("!H")[0] |
| 6879 | assert(_stats_type == 65535) |
| 6880 | obj.flags = reader.read("!H")[0] |
| 6881 | reader.skip(4) |
| 6882 | _experimenter = reader.read("!L")[0] |
| 6883 | assert(_experimenter == 6035143) |
| 6884 | _subtype = reader.read("!L")[0] |
| 6885 | assert(_subtype == 8) |
| 6886 | obj.port_no = util.unpack_port_no(reader) |
| 6887 | return obj |
| 6888 | |
| 6889 | def __eq__(self, other): |
| 6890 | if type(self) != type(other): return False |
| 6891 | if self.xid != other.xid: return False |
| 6892 | if self.flags != other.flags: return False |
| 6893 | if self.port_no != other.port_no: return False |
| 6894 | return True |
| 6895 | |
| 6896 | def pretty_print(self, q): |
| 6897 | q.text("bsn_port_counter_stats_request {") |
| 6898 | with q.group(): |
| 6899 | with q.indent(2): |
| 6900 | q.breakable() |
| 6901 | q.text("xid = "); |
| 6902 | if self.xid != None: |
| 6903 | q.text("%#x" % self.xid) |
| 6904 | else: |
| 6905 | q.text('None') |
| 6906 | q.text(","); q.breakable() |
| 6907 | q.text("flags = "); |
| 6908 | q.text("%#x" % self.flags) |
| 6909 | q.text(","); q.breakable() |
| 6910 | q.text("port_no = "); |
| 6911 | q.text(util.pretty_port(self.port_no)) |
| 6912 | q.breakable() |
| 6913 | q.text('}') |
| 6914 | |
| 6915 | bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request |
| 6916 | |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6917 | class bsn_role_status(bsn_header): |
| 6918 | version = 4 |
| 6919 | type = 4 |
| 6920 | experimenter = 6035143 |
| 6921 | subtype = 55 |
| 6922 | |
| 6923 | def __init__(self, xid=None, role=None, reason=None, generation_id=None): |
| 6924 | if xid != None: |
| 6925 | self.xid = xid |
| 6926 | else: |
| 6927 | self.xid = None |
| 6928 | if role != None: |
| 6929 | self.role = role |
| 6930 | else: |
| 6931 | self.role = 0 |
| 6932 | if reason != None: |
| 6933 | self.reason = reason |
| 6934 | else: |
| 6935 | self.reason = 0 |
| 6936 | if generation_id != None: |
| 6937 | self.generation_id = generation_id |
| 6938 | else: |
| 6939 | self.generation_id = 0 |
| 6940 | return |
| 6941 | |
| 6942 | def pack(self): |
| 6943 | packed = [] |
| 6944 | packed.append(struct.pack("!B", self.version)) |
| 6945 | packed.append(struct.pack("!B", self.type)) |
| 6946 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6947 | packed.append(struct.pack("!L", self.xid)) |
| 6948 | packed.append(struct.pack("!L", self.experimenter)) |
| 6949 | packed.append(struct.pack("!L", self.subtype)) |
| 6950 | packed.append(struct.pack("!L", self.role)) |
| 6951 | packed.append(struct.pack("!B", self.reason)) |
| 6952 | packed.append('\x00' * 3) |
| 6953 | packed.append(struct.pack("!Q", self.generation_id)) |
| 6954 | length = sum([len(x) for x in packed]) |
| 6955 | packed[2] = struct.pack("!H", length) |
| 6956 | return ''.join(packed) |
| 6957 | |
| 6958 | @staticmethod |
| 6959 | def unpack(reader): |
| 6960 | obj = bsn_role_status() |
| 6961 | _version = reader.read("!B")[0] |
| 6962 | assert(_version == 4) |
| 6963 | _type = reader.read("!B")[0] |
| 6964 | assert(_type == 4) |
| 6965 | _length = reader.read("!H")[0] |
| 6966 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6967 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5454b68 | 2014-01-14 17:07:36 -0800 | [diff] [blame] | 6968 | obj.xid = reader.read("!L")[0] |
| 6969 | _experimenter = reader.read("!L")[0] |
| 6970 | assert(_experimenter == 6035143) |
| 6971 | _subtype = reader.read("!L")[0] |
| 6972 | assert(_subtype == 55) |
| 6973 | obj.role = reader.read("!L")[0] |
| 6974 | obj.reason = reader.read("!B")[0] |
| 6975 | reader.skip(3) |
| 6976 | obj.generation_id = reader.read("!Q")[0] |
| 6977 | return obj |
| 6978 | |
| 6979 | def __eq__(self, other): |
| 6980 | if type(self) != type(other): return False |
| 6981 | if self.xid != other.xid: return False |
| 6982 | if self.role != other.role: return False |
| 6983 | if self.reason != other.reason: return False |
| 6984 | if self.generation_id != other.generation_id: return False |
| 6985 | return True |
| 6986 | |
| 6987 | def pretty_print(self, q): |
| 6988 | q.text("bsn_role_status {") |
| 6989 | with q.group(): |
| 6990 | with q.indent(2): |
| 6991 | q.breakable() |
| 6992 | q.text("xid = "); |
| 6993 | if self.xid != None: |
| 6994 | q.text("%#x" % self.xid) |
| 6995 | else: |
| 6996 | q.text('None') |
| 6997 | q.text(","); q.breakable() |
| 6998 | q.text("role = "); |
| 6999 | q.text("%#x" % self.role) |
| 7000 | q.text(","); q.breakable() |
| 7001 | q.text("reason = "); |
| 7002 | q.text("%#x" % self.reason) |
| 7003 | q.text(","); q.breakable() |
| 7004 | q.text("generation_id = "); |
| 7005 | q.text("%#x" % self.generation_id) |
| 7006 | q.breakable() |
| 7007 | q.text('}') |
| 7008 | |
| 7009 | bsn_header.subtypes[55] = bsn_role_status |
| 7010 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7011 | class bsn_set_aux_cxns_reply(bsn_header): |
| 7012 | version = 4 |
| 7013 | type = 4 |
| 7014 | experimenter = 6035143 |
| 7015 | subtype = 59 |
| 7016 | |
| 7017 | def __init__(self, xid=None, num_aux=None, status=None): |
| 7018 | if xid != None: |
| 7019 | self.xid = xid |
| 7020 | else: |
| 7021 | self.xid = None |
| 7022 | if num_aux != None: |
| 7023 | self.num_aux = num_aux |
| 7024 | else: |
| 7025 | self.num_aux = 0 |
| 7026 | if status != None: |
| 7027 | self.status = status |
| 7028 | else: |
| 7029 | self.status = 0 |
| 7030 | return |
| 7031 | |
| 7032 | def pack(self): |
| 7033 | packed = [] |
| 7034 | packed.append(struct.pack("!B", self.version)) |
| 7035 | packed.append(struct.pack("!B", self.type)) |
| 7036 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7037 | packed.append(struct.pack("!L", self.xid)) |
| 7038 | packed.append(struct.pack("!L", self.experimenter)) |
| 7039 | packed.append(struct.pack("!L", self.subtype)) |
| 7040 | packed.append(struct.pack("!L", self.num_aux)) |
| 7041 | packed.append(struct.pack("!L", self.status)) |
| 7042 | length = sum([len(x) for x in packed]) |
| 7043 | packed[2] = struct.pack("!H", length) |
| 7044 | return ''.join(packed) |
| 7045 | |
| 7046 | @staticmethod |
| 7047 | def unpack(reader): |
| 7048 | obj = bsn_set_aux_cxns_reply() |
| 7049 | _version = reader.read("!B")[0] |
| 7050 | assert(_version == 4) |
| 7051 | _type = reader.read("!B")[0] |
| 7052 | assert(_type == 4) |
| 7053 | _length = reader.read("!H")[0] |
| 7054 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7055 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7056 | obj.xid = reader.read("!L")[0] |
| 7057 | _experimenter = reader.read("!L")[0] |
| 7058 | assert(_experimenter == 6035143) |
| 7059 | _subtype = reader.read("!L")[0] |
| 7060 | assert(_subtype == 59) |
| 7061 | obj.num_aux = reader.read("!L")[0] |
| 7062 | obj.status = reader.read("!L")[0] |
| 7063 | return obj |
| 7064 | |
| 7065 | def __eq__(self, other): |
| 7066 | if type(self) != type(other): return False |
| 7067 | if self.xid != other.xid: return False |
| 7068 | if self.num_aux != other.num_aux: return False |
| 7069 | if self.status != other.status: return False |
| 7070 | return True |
| 7071 | |
| 7072 | def pretty_print(self, q): |
| 7073 | q.text("bsn_set_aux_cxns_reply {") |
| 7074 | with q.group(): |
| 7075 | with q.indent(2): |
| 7076 | q.breakable() |
| 7077 | q.text("xid = "); |
| 7078 | if self.xid != None: |
| 7079 | q.text("%#x" % self.xid) |
| 7080 | else: |
| 7081 | q.text('None') |
| 7082 | q.text(","); q.breakable() |
| 7083 | q.text("num_aux = "); |
| 7084 | q.text("%#x" % self.num_aux) |
| 7085 | q.text(","); q.breakable() |
| 7086 | q.text("status = "); |
| 7087 | q.text("%#x" % self.status) |
| 7088 | q.breakable() |
| 7089 | q.text('}') |
| 7090 | |
| 7091 | bsn_header.subtypes[59] = bsn_set_aux_cxns_reply |
| 7092 | |
| 7093 | class bsn_set_aux_cxns_request(bsn_header): |
| 7094 | version = 4 |
| 7095 | type = 4 |
| 7096 | experimenter = 6035143 |
| 7097 | subtype = 58 |
| 7098 | |
| 7099 | def __init__(self, xid=None, num_aux=None): |
| 7100 | if xid != None: |
| 7101 | self.xid = xid |
| 7102 | else: |
| 7103 | self.xid = None |
| 7104 | if num_aux != None: |
| 7105 | self.num_aux = num_aux |
| 7106 | else: |
| 7107 | self.num_aux = 0 |
| 7108 | return |
| 7109 | |
| 7110 | def pack(self): |
| 7111 | packed = [] |
| 7112 | packed.append(struct.pack("!B", self.version)) |
| 7113 | packed.append(struct.pack("!B", self.type)) |
| 7114 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7115 | packed.append(struct.pack("!L", self.xid)) |
| 7116 | packed.append(struct.pack("!L", self.experimenter)) |
| 7117 | packed.append(struct.pack("!L", self.subtype)) |
| 7118 | packed.append(struct.pack("!L", self.num_aux)) |
| 7119 | length = sum([len(x) for x in packed]) |
| 7120 | packed[2] = struct.pack("!H", length) |
| 7121 | return ''.join(packed) |
| 7122 | |
| 7123 | @staticmethod |
| 7124 | def unpack(reader): |
| 7125 | obj = bsn_set_aux_cxns_request() |
| 7126 | _version = reader.read("!B")[0] |
| 7127 | assert(_version == 4) |
| 7128 | _type = reader.read("!B")[0] |
| 7129 | assert(_type == 4) |
| 7130 | _length = reader.read("!H")[0] |
| 7131 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7132 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 7133 | obj.xid = reader.read("!L")[0] |
| 7134 | _experimenter = reader.read("!L")[0] |
| 7135 | assert(_experimenter == 6035143) |
| 7136 | _subtype = reader.read("!L")[0] |
| 7137 | assert(_subtype == 58) |
| 7138 | obj.num_aux = reader.read("!L")[0] |
| 7139 | return obj |
| 7140 | |
| 7141 | def __eq__(self, other): |
| 7142 | if type(self) != type(other): return False |
| 7143 | if self.xid != other.xid: return False |
| 7144 | if self.num_aux != other.num_aux: return False |
| 7145 | return True |
| 7146 | |
| 7147 | def pretty_print(self, q): |
| 7148 | q.text("bsn_set_aux_cxns_request {") |
| 7149 | with q.group(): |
| 7150 | with q.indent(2): |
| 7151 | q.breakable() |
| 7152 | q.text("xid = "); |
| 7153 | if self.xid != None: |
| 7154 | q.text("%#x" % self.xid) |
| 7155 | else: |
| 7156 | q.text('None') |
| 7157 | q.text(","); q.breakable() |
| 7158 | q.text("num_aux = "); |
| 7159 | q.text("%#x" % self.num_aux) |
| 7160 | q.breakable() |
| 7161 | q.text('}') |
| 7162 | |
| 7163 | bsn_header.subtypes[58] = bsn_set_aux_cxns_request |
| 7164 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7165 | class bsn_set_lacp_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7166 | version = 4 |
| 7167 | type = 4 |
| 7168 | experimenter = 6035143 |
| 7169 | subtype = 42 |
| 7170 | |
| 7171 | def __init__(self, xid=None, status=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7172 | if xid != None: |
| 7173 | self.xid = xid |
| 7174 | else: |
| 7175 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7176 | if status != None: |
| 7177 | self.status = status |
| 7178 | else: |
| 7179 | self.status = 0 |
| 7180 | if port_no != None: |
| 7181 | self.port_no = port_no |
| 7182 | else: |
| 7183 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7184 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7185 | |
| 7186 | def pack(self): |
| 7187 | packed = [] |
| 7188 | packed.append(struct.pack("!B", self.version)) |
| 7189 | packed.append(struct.pack("!B", self.type)) |
| 7190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7191 | packed.append(struct.pack("!L", self.xid)) |
| 7192 | packed.append(struct.pack("!L", self.experimenter)) |
| 7193 | packed.append(struct.pack("!L", self.subtype)) |
| 7194 | packed.append(struct.pack("!L", self.status)) |
| 7195 | packed.append(util.pack_port_no(self.port_no)) |
| 7196 | length = sum([len(x) for x in packed]) |
| 7197 | packed[2] = struct.pack("!H", length) |
| 7198 | return ''.join(packed) |
| 7199 | |
| 7200 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7201 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7202 | obj = bsn_set_lacp_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7203 | _version = reader.read("!B")[0] |
| 7204 | assert(_version == 4) |
| 7205 | _type = reader.read("!B")[0] |
| 7206 | assert(_type == 4) |
| 7207 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7208 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7209 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7210 | obj.xid = reader.read("!L")[0] |
| 7211 | _experimenter = reader.read("!L")[0] |
| 7212 | assert(_experimenter == 6035143) |
| 7213 | _subtype = reader.read("!L")[0] |
| 7214 | assert(_subtype == 42) |
| 7215 | obj.status = reader.read("!L")[0] |
| 7216 | obj.port_no = util.unpack_port_no(reader) |
| 7217 | return obj |
| 7218 | |
| 7219 | def __eq__(self, other): |
| 7220 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7221 | if self.xid != other.xid: return False |
| 7222 | if self.status != other.status: return False |
| 7223 | if self.port_no != other.port_no: return False |
| 7224 | return True |
| 7225 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7226 | def pretty_print(self, q): |
| 7227 | q.text("bsn_set_lacp_reply {") |
| 7228 | with q.group(): |
| 7229 | with q.indent(2): |
| 7230 | q.breakable() |
| 7231 | q.text("xid = "); |
| 7232 | if self.xid != None: |
| 7233 | q.text("%#x" % self.xid) |
| 7234 | else: |
| 7235 | q.text('None') |
| 7236 | q.text(","); q.breakable() |
| 7237 | q.text("status = "); |
| 7238 | q.text("%#x" % self.status) |
| 7239 | q.text(","); q.breakable() |
| 7240 | q.text("port_no = "); |
| 7241 | q.text(util.pretty_port(self.port_no)) |
| 7242 | q.breakable() |
| 7243 | q.text('}') |
| 7244 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7245 | bsn_header.subtypes[42] = bsn_set_lacp_reply |
| 7246 | |
| 7247 | class bsn_set_lacp_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7248 | version = 4 |
| 7249 | type = 4 |
| 7250 | experimenter = 6035143 |
| 7251 | subtype = 41 |
| 7252 | |
| 7253 | 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] | 7254 | if xid != None: |
| 7255 | self.xid = xid |
| 7256 | else: |
| 7257 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7258 | if enabled != None: |
| 7259 | self.enabled = enabled |
| 7260 | else: |
| 7261 | self.enabled = 0 |
| 7262 | if port_no != None: |
| 7263 | self.port_no = port_no |
| 7264 | else: |
| 7265 | self.port_no = 0 |
| 7266 | if actor_sys_priority != None: |
| 7267 | self.actor_sys_priority = actor_sys_priority |
| 7268 | else: |
| 7269 | self.actor_sys_priority = 0 |
| 7270 | if actor_sys_mac != None: |
| 7271 | self.actor_sys_mac = actor_sys_mac |
| 7272 | else: |
| 7273 | self.actor_sys_mac = [0,0,0,0,0,0] |
| 7274 | if actor_port_priority != None: |
| 7275 | self.actor_port_priority = actor_port_priority |
| 7276 | else: |
| 7277 | self.actor_port_priority = 0 |
| 7278 | if actor_port_num != None: |
| 7279 | self.actor_port_num = actor_port_num |
| 7280 | else: |
| 7281 | self.actor_port_num = 0 |
| 7282 | if actor_key != None: |
| 7283 | self.actor_key = actor_key |
| 7284 | else: |
| 7285 | self.actor_key = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7286 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7287 | |
| 7288 | def pack(self): |
| 7289 | packed = [] |
| 7290 | packed.append(struct.pack("!B", self.version)) |
| 7291 | packed.append(struct.pack("!B", self.type)) |
| 7292 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7293 | packed.append(struct.pack("!L", self.xid)) |
| 7294 | packed.append(struct.pack("!L", self.experimenter)) |
| 7295 | packed.append(struct.pack("!L", self.subtype)) |
| 7296 | packed.append(struct.pack("!B", self.enabled)) |
| 7297 | packed.append('\x00' * 3) |
| 7298 | packed.append(util.pack_port_no(self.port_no)) |
| 7299 | packed.append(struct.pack("!H", self.actor_sys_priority)) |
| 7300 | packed.append(struct.pack("!6B", *self.actor_sys_mac)) |
| 7301 | packed.append(struct.pack("!H", self.actor_port_priority)) |
| 7302 | packed.append(struct.pack("!H", self.actor_port_num)) |
| 7303 | packed.append(struct.pack("!H", self.actor_key)) |
| 7304 | length = sum([len(x) for x in packed]) |
| 7305 | packed[2] = struct.pack("!H", length) |
| 7306 | return ''.join(packed) |
| 7307 | |
| 7308 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7309 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7310 | obj = bsn_set_lacp_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7311 | _version = reader.read("!B")[0] |
| 7312 | assert(_version == 4) |
| 7313 | _type = reader.read("!B")[0] |
| 7314 | assert(_type == 4) |
| 7315 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7316 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7317 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7318 | obj.xid = reader.read("!L")[0] |
| 7319 | _experimenter = reader.read("!L")[0] |
| 7320 | assert(_experimenter == 6035143) |
| 7321 | _subtype = reader.read("!L")[0] |
| 7322 | assert(_subtype == 41) |
| 7323 | obj.enabled = reader.read("!B")[0] |
| 7324 | reader.skip(3) |
| 7325 | obj.port_no = util.unpack_port_no(reader) |
| 7326 | obj.actor_sys_priority = reader.read("!H")[0] |
| 7327 | obj.actor_sys_mac = list(reader.read('!6B')) |
| 7328 | obj.actor_port_priority = reader.read("!H")[0] |
| 7329 | obj.actor_port_num = reader.read("!H")[0] |
| 7330 | obj.actor_key = reader.read("!H")[0] |
| 7331 | return obj |
| 7332 | |
| 7333 | def __eq__(self, other): |
| 7334 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7335 | if self.xid != other.xid: return False |
| 7336 | if self.enabled != other.enabled: return False |
| 7337 | if self.port_no != other.port_no: return False |
| 7338 | if self.actor_sys_priority != other.actor_sys_priority: return False |
| 7339 | if self.actor_sys_mac != other.actor_sys_mac: return False |
| 7340 | if self.actor_port_priority != other.actor_port_priority: return False |
| 7341 | if self.actor_port_num != other.actor_port_num: return False |
| 7342 | if self.actor_key != other.actor_key: return False |
| 7343 | return True |
| 7344 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 7345 | def pretty_print(self, q): |
| 7346 | q.text("bsn_set_lacp_request {") |
| 7347 | with q.group(): |
| 7348 | with q.indent(2): |
| 7349 | q.breakable() |
| 7350 | q.text("xid = "); |
| 7351 | if self.xid != None: |
| 7352 | q.text("%#x" % self.xid) |
| 7353 | else: |
| 7354 | q.text('None') |
| 7355 | q.text(","); q.breakable() |
| 7356 | q.text("enabled = "); |
| 7357 | q.text("%#x" % self.enabled) |
| 7358 | q.text(","); q.breakable() |
| 7359 | q.text("port_no = "); |
| 7360 | q.text(util.pretty_port(self.port_no)) |
| 7361 | q.text(","); q.breakable() |
| 7362 | q.text("actor_sys_priority = "); |
| 7363 | q.text("%#x" % self.actor_sys_priority) |
| 7364 | q.text(","); q.breakable() |
| 7365 | q.text("actor_sys_mac = "); |
| 7366 | q.text(util.pretty_mac(self.actor_sys_mac)) |
| 7367 | q.text(","); q.breakable() |
| 7368 | q.text("actor_port_priority = "); |
| 7369 | q.text("%#x" % self.actor_port_priority) |
| 7370 | q.text(","); q.breakable() |
| 7371 | q.text("actor_port_num = "); |
| 7372 | q.text("%#x" % self.actor_port_num) |
| 7373 | q.text(","); q.breakable() |
| 7374 | q.text("actor_key = "); |
| 7375 | q.text("%#x" % self.actor_key) |
| 7376 | q.breakable() |
| 7377 | q.text('}') |
| 7378 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7379 | bsn_header.subtypes[41] = bsn_set_lacp_request |
| 7380 | |
| 7381 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7382 | version = 4 |
| 7383 | type = 4 |
| 7384 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7385 | subtype = 3 |
| 7386 | |
| 7387 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7388 | if xid != None: |
| 7389 | self.xid = xid |
| 7390 | else: |
| 7391 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7392 | if report_mirror_ports != None: |
| 7393 | self.report_mirror_ports = report_mirror_ports |
| 7394 | else: |
| 7395 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7396 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7397 | |
| 7398 | def pack(self): |
| 7399 | packed = [] |
| 7400 | packed.append(struct.pack("!B", self.version)) |
| 7401 | packed.append(struct.pack("!B", self.type)) |
| 7402 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7403 | packed.append(struct.pack("!L", self.xid)) |
| 7404 | packed.append(struct.pack("!L", self.experimenter)) |
| 7405 | packed.append(struct.pack("!L", self.subtype)) |
| 7406 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
| 7407 | packed.append('\x00' * 3) |
| 7408 | length = sum([len(x) for x in packed]) |
| 7409 | packed[2] = struct.pack("!H", length) |
| 7410 | return ''.join(packed) |
| 7411 | |
| 7412 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7413 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7414 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7415 | _version = reader.read("!B")[0] |
| 7416 | assert(_version == 4) |
| 7417 | _type = reader.read("!B")[0] |
| 7418 | assert(_type == 4) |
| 7419 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7420 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7421 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7422 | obj.xid = reader.read("!L")[0] |
| 7423 | _experimenter = reader.read("!L")[0] |
| 7424 | assert(_experimenter == 6035143) |
| 7425 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7426 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7427 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7428 | reader.skip(3) |
| 7429 | return obj |
| 7430 | |
| 7431 | def __eq__(self, other): |
| 7432 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7433 | if self.xid != other.xid: return False |
| 7434 | if self.report_mirror_ports != other.report_mirror_ports: return False |
| 7435 | return True |
| 7436 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7437 | def pretty_print(self, q): |
| 7438 | q.text("bsn_set_mirroring {") |
| 7439 | with q.group(): |
| 7440 | with q.indent(2): |
| 7441 | q.breakable() |
| 7442 | q.text("xid = "); |
| 7443 | if self.xid != None: |
| 7444 | q.text("%#x" % self.xid) |
| 7445 | else: |
| 7446 | q.text('None') |
| 7447 | q.text(","); q.breakable() |
| 7448 | q.text("report_mirror_ports = "); |
| 7449 | q.text("%#x" % self.report_mirror_ports) |
| 7450 | q.breakable() |
| 7451 | q.text('}') |
| 7452 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7453 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 7454 | |
| 7455 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7456 | version = 4 |
| 7457 | type = 4 |
| 7458 | experimenter = 6035143 |
| 7459 | subtype = 25 |
| 7460 | |
| 7461 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7462 | if xid != None: |
| 7463 | self.xid = xid |
| 7464 | else: |
| 7465 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7466 | if status != None: |
| 7467 | self.status = status |
| 7468 | else: |
| 7469 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7470 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7471 | |
| 7472 | def pack(self): |
| 7473 | packed = [] |
| 7474 | packed.append(struct.pack("!B", self.version)) |
| 7475 | packed.append(struct.pack("!B", self.type)) |
| 7476 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7477 | packed.append(struct.pack("!L", self.xid)) |
| 7478 | packed.append(struct.pack("!L", self.experimenter)) |
| 7479 | packed.append(struct.pack("!L", self.subtype)) |
| 7480 | packed.append(struct.pack("!L", self.status)) |
| 7481 | length = sum([len(x) for x in packed]) |
| 7482 | packed[2] = struct.pack("!H", length) |
| 7483 | return ''.join(packed) |
| 7484 | |
| 7485 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7486 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7487 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7488 | _version = reader.read("!B")[0] |
| 7489 | assert(_version == 4) |
| 7490 | _type = reader.read("!B")[0] |
| 7491 | assert(_type == 4) |
| 7492 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7493 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7494 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7495 | obj.xid = reader.read("!L")[0] |
| 7496 | _experimenter = reader.read("!L")[0] |
| 7497 | assert(_experimenter == 6035143) |
| 7498 | _subtype = reader.read("!L")[0] |
| 7499 | assert(_subtype == 25) |
| 7500 | obj.status = reader.read("!L")[0] |
| 7501 | return obj |
| 7502 | |
| 7503 | def __eq__(self, other): |
| 7504 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7505 | if self.xid != other.xid: return False |
| 7506 | if self.status != other.status: return False |
| 7507 | return True |
| 7508 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7509 | def pretty_print(self, q): |
| 7510 | q.text("bsn_set_pktin_suppression_reply {") |
| 7511 | with q.group(): |
| 7512 | with q.indent(2): |
| 7513 | q.breakable() |
| 7514 | q.text("xid = "); |
| 7515 | if self.xid != None: |
| 7516 | q.text("%#x" % self.xid) |
| 7517 | else: |
| 7518 | q.text('None') |
| 7519 | q.text(","); q.breakable() |
| 7520 | q.text("status = "); |
| 7521 | q.text("%#x" % self.status) |
| 7522 | q.breakable() |
| 7523 | q.text('}') |
| 7524 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7525 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 7526 | |
| 7527 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7528 | version = 4 |
| 7529 | type = 4 |
| 7530 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7531 | subtype = 11 |
| 7532 | |
| 7533 | 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] | 7534 | if xid != None: |
| 7535 | self.xid = xid |
| 7536 | else: |
| 7537 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7538 | if enabled != None: |
| 7539 | self.enabled = enabled |
| 7540 | else: |
| 7541 | self.enabled = 0 |
| 7542 | if idle_timeout != None: |
| 7543 | self.idle_timeout = idle_timeout |
| 7544 | else: |
| 7545 | self.idle_timeout = 0 |
| 7546 | if hard_timeout != None: |
| 7547 | self.hard_timeout = hard_timeout |
| 7548 | else: |
| 7549 | self.hard_timeout = 0 |
| 7550 | if priority != None: |
| 7551 | self.priority = priority |
| 7552 | else: |
| 7553 | self.priority = 0 |
| 7554 | if cookie != None: |
| 7555 | self.cookie = cookie |
| 7556 | else: |
| 7557 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7558 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7559 | |
| 7560 | def pack(self): |
| 7561 | packed = [] |
| 7562 | packed.append(struct.pack("!B", self.version)) |
| 7563 | packed.append(struct.pack("!B", self.type)) |
| 7564 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7565 | packed.append(struct.pack("!L", self.xid)) |
| 7566 | packed.append(struct.pack("!L", self.experimenter)) |
| 7567 | packed.append(struct.pack("!L", self.subtype)) |
| 7568 | packed.append(struct.pack("!B", self.enabled)) |
| 7569 | packed.append('\x00' * 1) |
| 7570 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 7571 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 7572 | packed.append(struct.pack("!H", self.priority)) |
| 7573 | packed.append(struct.pack("!Q", self.cookie)) |
| 7574 | length = sum([len(x) for x in packed]) |
| 7575 | packed[2] = struct.pack("!H", length) |
| 7576 | return ''.join(packed) |
| 7577 | |
| 7578 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7579 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7580 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7581 | _version = reader.read("!B")[0] |
| 7582 | assert(_version == 4) |
| 7583 | _type = reader.read("!B")[0] |
| 7584 | assert(_type == 4) |
| 7585 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7586 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7587 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7588 | obj.xid = reader.read("!L")[0] |
| 7589 | _experimenter = reader.read("!L")[0] |
| 7590 | assert(_experimenter == 6035143) |
| 7591 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7592 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7593 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7594 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7595 | obj.idle_timeout = reader.read("!H")[0] |
| 7596 | obj.hard_timeout = reader.read("!H")[0] |
| 7597 | obj.priority = reader.read("!H")[0] |
| 7598 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7599 | return obj |
| 7600 | |
| 7601 | def __eq__(self, other): |
| 7602 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7603 | if self.xid != other.xid: return False |
| 7604 | if self.enabled != other.enabled: return False |
| 7605 | if self.idle_timeout != other.idle_timeout: return False |
| 7606 | if self.hard_timeout != other.hard_timeout: return False |
| 7607 | if self.priority != other.priority: return False |
| 7608 | if self.cookie != other.cookie: return False |
| 7609 | return True |
| 7610 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7611 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7612 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7613 | with q.group(): |
| 7614 | with q.indent(2): |
| 7615 | q.breakable() |
| 7616 | q.text("xid = "); |
| 7617 | if self.xid != None: |
| 7618 | q.text("%#x" % self.xid) |
| 7619 | else: |
| 7620 | q.text('None') |
| 7621 | q.text(","); q.breakable() |
| 7622 | q.text("enabled = "); |
| 7623 | q.text("%#x" % self.enabled) |
| 7624 | q.text(","); q.breakable() |
| 7625 | q.text("idle_timeout = "); |
| 7626 | q.text("%#x" % self.idle_timeout) |
| 7627 | q.text(","); q.breakable() |
| 7628 | q.text("hard_timeout = "); |
| 7629 | q.text("%#x" % self.hard_timeout) |
| 7630 | q.text(","); q.breakable() |
| 7631 | q.text("priority = "); |
| 7632 | q.text("%#x" % self.priority) |
| 7633 | q.text(","); q.breakable() |
| 7634 | q.text("cookie = "); |
| 7635 | q.text("%#x" % self.cookie) |
| 7636 | q.breakable() |
| 7637 | q.text('}') |
| 7638 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7639 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 7640 | |
| 7641 | class bsn_set_switch_pipeline_reply(bsn_header): |
| 7642 | version = 4 |
| 7643 | type = 4 |
| 7644 | experimenter = 6035143 |
| 7645 | subtype = 54 |
| 7646 | |
| 7647 | def __init__(self, xid=None, status=None): |
| 7648 | if xid != None: |
| 7649 | self.xid = xid |
| 7650 | else: |
| 7651 | self.xid = None |
| 7652 | if status != None: |
| 7653 | self.status = status |
| 7654 | else: |
| 7655 | self.status = 0 |
| 7656 | return |
| 7657 | |
| 7658 | def pack(self): |
| 7659 | packed = [] |
| 7660 | packed.append(struct.pack("!B", self.version)) |
| 7661 | packed.append(struct.pack("!B", self.type)) |
| 7662 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7663 | packed.append(struct.pack("!L", self.xid)) |
| 7664 | packed.append(struct.pack("!L", self.experimenter)) |
| 7665 | packed.append(struct.pack("!L", self.subtype)) |
| 7666 | packed.append(struct.pack("!L", self.status)) |
| 7667 | length = sum([len(x) for x in packed]) |
| 7668 | packed[2] = struct.pack("!H", length) |
| 7669 | return ''.join(packed) |
| 7670 | |
| 7671 | @staticmethod |
| 7672 | def unpack(reader): |
| 7673 | obj = bsn_set_switch_pipeline_reply() |
| 7674 | _version = reader.read("!B")[0] |
| 7675 | assert(_version == 4) |
| 7676 | _type = reader.read("!B")[0] |
| 7677 | assert(_type == 4) |
| 7678 | _length = reader.read("!H")[0] |
| 7679 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7680 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7681 | obj.xid = reader.read("!L")[0] |
| 7682 | _experimenter = reader.read("!L")[0] |
| 7683 | assert(_experimenter == 6035143) |
| 7684 | _subtype = reader.read("!L")[0] |
| 7685 | assert(_subtype == 54) |
| 7686 | obj.status = reader.read("!L")[0] |
| 7687 | return obj |
| 7688 | |
| 7689 | def __eq__(self, other): |
| 7690 | if type(self) != type(other): return False |
| 7691 | if self.xid != other.xid: return False |
| 7692 | if self.status != other.status: return False |
| 7693 | return True |
| 7694 | |
| 7695 | def pretty_print(self, q): |
| 7696 | q.text("bsn_set_switch_pipeline_reply {") |
| 7697 | with q.group(): |
| 7698 | with q.indent(2): |
| 7699 | q.breakable() |
| 7700 | q.text("xid = "); |
| 7701 | if self.xid != None: |
| 7702 | q.text("%#x" % self.xid) |
| 7703 | else: |
| 7704 | q.text('None') |
| 7705 | q.text(","); q.breakable() |
| 7706 | q.text("status = "); |
| 7707 | q.text("%#x" % self.status) |
| 7708 | q.breakable() |
| 7709 | q.text('}') |
| 7710 | |
| 7711 | bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply |
| 7712 | |
| 7713 | class bsn_set_switch_pipeline_request(bsn_header): |
| 7714 | version = 4 |
| 7715 | type = 4 |
| 7716 | experimenter = 6035143 |
| 7717 | subtype = 53 |
| 7718 | |
| 7719 | def __init__(self, xid=None, pipeline=None): |
| 7720 | if xid != None: |
| 7721 | self.xid = xid |
| 7722 | else: |
| 7723 | self.xid = None |
| 7724 | if pipeline != None: |
| 7725 | self.pipeline = pipeline |
| 7726 | else: |
| 7727 | self.pipeline = "" |
| 7728 | return |
| 7729 | |
| 7730 | def pack(self): |
| 7731 | packed = [] |
| 7732 | packed.append(struct.pack("!B", self.version)) |
| 7733 | packed.append(struct.pack("!B", self.type)) |
| 7734 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7735 | packed.append(struct.pack("!L", self.xid)) |
| 7736 | packed.append(struct.pack("!L", self.experimenter)) |
| 7737 | packed.append(struct.pack("!L", self.subtype)) |
| 7738 | packed.append(struct.pack("!256s", self.pipeline)) |
| 7739 | length = sum([len(x) for x in packed]) |
| 7740 | packed[2] = struct.pack("!H", length) |
| 7741 | return ''.join(packed) |
| 7742 | |
| 7743 | @staticmethod |
| 7744 | def unpack(reader): |
| 7745 | obj = bsn_set_switch_pipeline_request() |
| 7746 | _version = reader.read("!B")[0] |
| 7747 | assert(_version == 4) |
| 7748 | _type = reader.read("!B")[0] |
| 7749 | assert(_type == 4) |
| 7750 | _length = reader.read("!H")[0] |
| 7751 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7752 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7753 | obj.xid = reader.read("!L")[0] |
| 7754 | _experimenter = reader.read("!L")[0] |
| 7755 | assert(_experimenter == 6035143) |
| 7756 | _subtype = reader.read("!L")[0] |
| 7757 | assert(_subtype == 53) |
| 7758 | obj.pipeline = reader.read("!256s")[0].rstrip("\x00") |
| 7759 | return obj |
| 7760 | |
| 7761 | def __eq__(self, other): |
| 7762 | if type(self) != type(other): return False |
| 7763 | if self.xid != other.xid: return False |
| 7764 | if self.pipeline != other.pipeline: return False |
| 7765 | return True |
| 7766 | |
| 7767 | def pretty_print(self, q): |
| 7768 | q.text("bsn_set_switch_pipeline_request {") |
| 7769 | with q.group(): |
| 7770 | with q.indent(2): |
| 7771 | q.breakable() |
| 7772 | q.text("xid = "); |
| 7773 | if self.xid != None: |
| 7774 | q.text("%#x" % self.xid) |
| 7775 | else: |
| 7776 | q.text('None') |
| 7777 | q.text(","); q.breakable() |
| 7778 | q.text("pipeline = "); |
| 7779 | q.pp(self.pipeline) |
| 7780 | q.breakable() |
| 7781 | q.text('}') |
| 7782 | |
| 7783 | bsn_header.subtypes[53] = bsn_set_switch_pipeline_request |
| 7784 | |
| 7785 | class bsn_switch_pipeline_stats_reply(bsn_stats_reply): |
| 7786 | version = 4 |
| 7787 | type = 19 |
| 7788 | stats_type = 65535 |
| 7789 | experimenter = 6035143 |
| 7790 | subtype = 6 |
| 7791 | |
| 7792 | def __init__(self, xid=None, flags=None, entries=None): |
| 7793 | if xid != None: |
| 7794 | self.xid = xid |
| 7795 | else: |
| 7796 | self.xid = None |
| 7797 | if flags != None: |
| 7798 | self.flags = flags |
| 7799 | else: |
| 7800 | self.flags = 0 |
| 7801 | if entries != None: |
| 7802 | self.entries = entries |
| 7803 | else: |
| 7804 | self.entries = [] |
| 7805 | return |
| 7806 | |
| 7807 | def pack(self): |
| 7808 | packed = [] |
| 7809 | packed.append(struct.pack("!B", self.version)) |
| 7810 | packed.append(struct.pack("!B", self.type)) |
| 7811 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7812 | packed.append(struct.pack("!L", self.xid)) |
| 7813 | packed.append(struct.pack("!H", self.stats_type)) |
| 7814 | packed.append(struct.pack("!H", self.flags)) |
| 7815 | packed.append('\x00' * 4) |
| 7816 | packed.append(struct.pack("!L", self.experimenter)) |
| 7817 | packed.append(struct.pack("!L", self.subtype)) |
| 7818 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7819 | length = sum([len(x) for x in packed]) |
| 7820 | packed[2] = struct.pack("!H", length) |
| 7821 | return ''.join(packed) |
| 7822 | |
| 7823 | @staticmethod |
| 7824 | def unpack(reader): |
| 7825 | obj = bsn_switch_pipeline_stats_reply() |
| 7826 | _version = reader.read("!B")[0] |
| 7827 | assert(_version == 4) |
| 7828 | _type = reader.read("!B")[0] |
| 7829 | assert(_type == 19) |
| 7830 | _length = reader.read("!H")[0] |
| 7831 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7832 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7833 | obj.xid = reader.read("!L")[0] |
| 7834 | _stats_type = reader.read("!H")[0] |
| 7835 | assert(_stats_type == 65535) |
| 7836 | obj.flags = reader.read("!H")[0] |
| 7837 | reader.skip(4) |
| 7838 | _experimenter = reader.read("!L")[0] |
| 7839 | assert(_experimenter == 6035143) |
| 7840 | _subtype = reader.read("!L")[0] |
| 7841 | assert(_subtype == 6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7842 | 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] | 7843 | return obj |
| 7844 | |
| 7845 | def __eq__(self, other): |
| 7846 | if type(self) != type(other): return False |
| 7847 | if self.xid != other.xid: return False |
| 7848 | if self.flags != other.flags: return False |
| 7849 | if self.entries != other.entries: return False |
| 7850 | return True |
| 7851 | |
| 7852 | def pretty_print(self, q): |
| 7853 | q.text("bsn_switch_pipeline_stats_reply {") |
| 7854 | with q.group(): |
| 7855 | with q.indent(2): |
| 7856 | q.breakable() |
| 7857 | q.text("xid = "); |
| 7858 | if self.xid != None: |
| 7859 | q.text("%#x" % self.xid) |
| 7860 | else: |
| 7861 | q.text('None') |
| 7862 | q.text(","); q.breakable() |
| 7863 | q.text("flags = "); |
| 7864 | q.text("%#x" % self.flags) |
| 7865 | q.text(","); q.breakable() |
| 7866 | q.text("entries = "); |
| 7867 | q.pp(self.entries) |
| 7868 | q.breakable() |
| 7869 | q.text('}') |
| 7870 | |
| 7871 | bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply |
| 7872 | |
| 7873 | class bsn_switch_pipeline_stats_request(bsn_stats_request): |
| 7874 | version = 4 |
| 7875 | type = 18 |
| 7876 | stats_type = 65535 |
| 7877 | experimenter = 6035143 |
| 7878 | subtype = 6 |
| 7879 | |
| 7880 | def __init__(self, xid=None, flags=None): |
| 7881 | if xid != None: |
| 7882 | self.xid = xid |
| 7883 | else: |
| 7884 | self.xid = None |
| 7885 | if flags != None: |
| 7886 | self.flags = flags |
| 7887 | else: |
| 7888 | self.flags = 0 |
| 7889 | return |
| 7890 | |
| 7891 | def pack(self): |
| 7892 | packed = [] |
| 7893 | packed.append(struct.pack("!B", self.version)) |
| 7894 | packed.append(struct.pack("!B", self.type)) |
| 7895 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7896 | packed.append(struct.pack("!L", self.xid)) |
| 7897 | packed.append(struct.pack("!H", self.stats_type)) |
| 7898 | packed.append(struct.pack("!H", self.flags)) |
| 7899 | packed.append('\x00' * 4) |
| 7900 | packed.append(struct.pack("!L", self.experimenter)) |
| 7901 | packed.append(struct.pack("!L", self.subtype)) |
| 7902 | length = sum([len(x) for x in packed]) |
| 7903 | packed[2] = struct.pack("!H", length) |
| 7904 | return ''.join(packed) |
| 7905 | |
| 7906 | @staticmethod |
| 7907 | def unpack(reader): |
| 7908 | obj = bsn_switch_pipeline_stats_request() |
| 7909 | _version = reader.read("!B")[0] |
| 7910 | assert(_version == 4) |
| 7911 | _type = reader.read("!B")[0] |
| 7912 | assert(_type == 18) |
| 7913 | _length = reader.read("!H")[0] |
| 7914 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7915 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7916 | obj.xid = reader.read("!L")[0] |
| 7917 | _stats_type = reader.read("!H")[0] |
| 7918 | assert(_stats_type == 65535) |
| 7919 | obj.flags = reader.read("!H")[0] |
| 7920 | reader.skip(4) |
| 7921 | _experimenter = reader.read("!L")[0] |
| 7922 | assert(_experimenter == 6035143) |
| 7923 | _subtype = reader.read("!L")[0] |
| 7924 | assert(_subtype == 6) |
| 7925 | return obj |
| 7926 | |
| 7927 | def __eq__(self, other): |
| 7928 | if type(self) != type(other): return False |
| 7929 | if self.xid != other.xid: return False |
| 7930 | if self.flags != other.flags: return False |
| 7931 | return True |
| 7932 | |
| 7933 | def pretty_print(self, q): |
| 7934 | q.text("bsn_switch_pipeline_stats_request {") |
| 7935 | with q.group(): |
| 7936 | with q.indent(2): |
| 7937 | q.breakable() |
| 7938 | q.text("xid = "); |
| 7939 | if self.xid != None: |
| 7940 | q.text("%#x" % self.xid) |
| 7941 | else: |
| 7942 | q.text('None') |
| 7943 | q.text(","); q.breakable() |
| 7944 | q.text("flags = "); |
| 7945 | q.text("%#x" % self.flags) |
| 7946 | q.breakable() |
| 7947 | q.text('}') |
| 7948 | |
| 7949 | bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request |
| 7950 | |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7951 | class bsn_table_checksum_stats_reply(bsn_stats_reply): |
| 7952 | version = 4 |
| 7953 | type = 19 |
| 7954 | stats_type = 65535 |
| 7955 | experimenter = 6035143 |
| 7956 | subtype = 11 |
| 7957 | |
| 7958 | def __init__(self, xid=None, flags=None, entries=None): |
| 7959 | if xid != None: |
| 7960 | self.xid = xid |
| 7961 | else: |
| 7962 | self.xid = None |
| 7963 | if flags != None: |
| 7964 | self.flags = flags |
| 7965 | else: |
| 7966 | self.flags = 0 |
| 7967 | if entries != None: |
| 7968 | self.entries = entries |
| 7969 | else: |
| 7970 | self.entries = [] |
| 7971 | return |
| 7972 | |
| 7973 | def pack(self): |
| 7974 | packed = [] |
| 7975 | packed.append(struct.pack("!B", self.version)) |
| 7976 | packed.append(struct.pack("!B", self.type)) |
| 7977 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7978 | packed.append(struct.pack("!L", self.xid)) |
| 7979 | packed.append(struct.pack("!H", self.stats_type)) |
| 7980 | packed.append(struct.pack("!H", self.flags)) |
| 7981 | packed.append('\x00' * 4) |
| 7982 | packed.append(struct.pack("!L", self.experimenter)) |
| 7983 | packed.append(struct.pack("!L", self.subtype)) |
| 7984 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 7985 | length = sum([len(x) for x in packed]) |
| 7986 | packed[2] = struct.pack("!H", length) |
| 7987 | return ''.join(packed) |
| 7988 | |
| 7989 | @staticmethod |
| 7990 | def unpack(reader): |
| 7991 | obj = bsn_table_checksum_stats_reply() |
| 7992 | _version = reader.read("!B")[0] |
| 7993 | assert(_version == 4) |
| 7994 | _type = reader.read("!B")[0] |
| 7995 | assert(_type == 19) |
| 7996 | _length = reader.read("!H")[0] |
| 7997 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7998 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 7999 | obj.xid = reader.read("!L")[0] |
| 8000 | _stats_type = reader.read("!H")[0] |
| 8001 | assert(_stats_type == 65535) |
| 8002 | obj.flags = reader.read("!H")[0] |
| 8003 | reader.skip(4) |
| 8004 | _experimenter = reader.read("!L")[0] |
| 8005 | assert(_experimenter == 6035143) |
| 8006 | _subtype = reader.read("!L")[0] |
| 8007 | assert(_subtype == 11) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8008 | 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] | 8009 | return obj |
| 8010 | |
| 8011 | def __eq__(self, other): |
| 8012 | if type(self) != type(other): return False |
| 8013 | if self.xid != other.xid: return False |
| 8014 | if self.flags != other.flags: return False |
| 8015 | if self.entries != other.entries: return False |
| 8016 | return True |
| 8017 | |
| 8018 | def pretty_print(self, q): |
| 8019 | q.text("bsn_table_checksum_stats_reply {") |
| 8020 | with q.group(): |
| 8021 | with q.indent(2): |
| 8022 | q.breakable() |
| 8023 | q.text("xid = "); |
| 8024 | if self.xid != None: |
| 8025 | q.text("%#x" % self.xid) |
| 8026 | else: |
| 8027 | q.text('None') |
| 8028 | q.text(","); q.breakable() |
| 8029 | q.text("flags = "); |
| 8030 | q.text("%#x" % self.flags) |
| 8031 | q.text(","); q.breakable() |
| 8032 | q.text("entries = "); |
| 8033 | q.pp(self.entries) |
| 8034 | q.breakable() |
| 8035 | q.text('}') |
| 8036 | |
| 8037 | bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply |
| 8038 | |
| 8039 | class bsn_table_checksum_stats_request(bsn_stats_request): |
| 8040 | version = 4 |
| 8041 | type = 18 |
| 8042 | stats_type = 65535 |
| 8043 | experimenter = 6035143 |
| 8044 | subtype = 11 |
| 8045 | |
| 8046 | def __init__(self, xid=None, flags=None): |
| 8047 | if xid != None: |
| 8048 | self.xid = xid |
| 8049 | else: |
| 8050 | self.xid = None |
| 8051 | if flags != None: |
| 8052 | self.flags = flags |
| 8053 | else: |
| 8054 | self.flags = 0 |
| 8055 | return |
| 8056 | |
| 8057 | def pack(self): |
| 8058 | packed = [] |
| 8059 | packed.append(struct.pack("!B", self.version)) |
| 8060 | packed.append(struct.pack("!B", self.type)) |
| 8061 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8062 | packed.append(struct.pack("!L", self.xid)) |
| 8063 | packed.append(struct.pack("!H", self.stats_type)) |
| 8064 | packed.append(struct.pack("!H", self.flags)) |
| 8065 | packed.append('\x00' * 4) |
| 8066 | packed.append(struct.pack("!L", self.experimenter)) |
| 8067 | packed.append(struct.pack("!L", self.subtype)) |
| 8068 | length = sum([len(x) for x in packed]) |
| 8069 | packed[2] = struct.pack("!H", length) |
| 8070 | return ''.join(packed) |
| 8071 | |
| 8072 | @staticmethod |
| 8073 | def unpack(reader): |
| 8074 | obj = bsn_table_checksum_stats_request() |
| 8075 | _version = reader.read("!B")[0] |
| 8076 | assert(_version == 4) |
| 8077 | _type = reader.read("!B")[0] |
| 8078 | assert(_type == 18) |
| 8079 | _length = reader.read("!H")[0] |
| 8080 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8081 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8082 | obj.xid = reader.read("!L")[0] |
| 8083 | _stats_type = reader.read("!H")[0] |
| 8084 | assert(_stats_type == 65535) |
| 8085 | obj.flags = reader.read("!H")[0] |
| 8086 | reader.skip(4) |
| 8087 | _experimenter = reader.read("!L")[0] |
| 8088 | assert(_experimenter == 6035143) |
| 8089 | _subtype = reader.read("!L")[0] |
| 8090 | assert(_subtype == 11) |
| 8091 | return obj |
| 8092 | |
| 8093 | def __eq__(self, other): |
| 8094 | if type(self) != type(other): return False |
| 8095 | if self.xid != other.xid: return False |
| 8096 | if self.flags != other.flags: return False |
| 8097 | return True |
| 8098 | |
| 8099 | def pretty_print(self, q): |
| 8100 | q.text("bsn_table_checksum_stats_request {") |
| 8101 | with q.group(): |
| 8102 | with q.indent(2): |
| 8103 | q.breakable() |
| 8104 | q.text("xid = "); |
| 8105 | if self.xid != None: |
| 8106 | q.text("%#x" % self.xid) |
| 8107 | else: |
| 8108 | q.text('None') |
| 8109 | q.text(","); q.breakable() |
| 8110 | q.text("flags = "); |
| 8111 | q.text("%#x" % self.flags) |
| 8112 | q.breakable() |
| 8113 | q.text('}') |
| 8114 | |
| 8115 | bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request |
| 8116 | |
| 8117 | class bsn_table_set_buckets_size(bsn_header): |
| 8118 | version = 4 |
| 8119 | type = 4 |
| 8120 | experimenter = 6035143 |
| 8121 | subtype = 61 |
| 8122 | |
| 8123 | def __init__(self, xid=None, table_id=None, buckets_size=None): |
| 8124 | if xid != None: |
| 8125 | self.xid = xid |
| 8126 | else: |
| 8127 | self.xid = None |
| 8128 | if table_id != None: |
| 8129 | self.table_id = table_id |
| 8130 | else: |
| 8131 | self.table_id = 0 |
| 8132 | if buckets_size != None: |
| 8133 | self.buckets_size = buckets_size |
| 8134 | else: |
| 8135 | self.buckets_size = 0 |
| 8136 | return |
| 8137 | |
| 8138 | def pack(self): |
| 8139 | packed = [] |
| 8140 | packed.append(struct.pack("!B", self.version)) |
| 8141 | packed.append(struct.pack("!B", self.type)) |
| 8142 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8143 | packed.append(struct.pack("!L", self.xid)) |
| 8144 | packed.append(struct.pack("!L", self.experimenter)) |
| 8145 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8146 | packed.append('\x00' * 1) |
| 8147 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8148 | packed.append('\x00' * 2) |
| 8149 | packed.append(struct.pack("!L", self.buckets_size)) |
| 8150 | length = sum([len(x) for x in packed]) |
| 8151 | packed[2] = struct.pack("!H", length) |
| 8152 | return ''.join(packed) |
| 8153 | |
| 8154 | @staticmethod |
| 8155 | def unpack(reader): |
| 8156 | obj = bsn_table_set_buckets_size() |
| 8157 | _version = reader.read("!B")[0] |
| 8158 | assert(_version == 4) |
| 8159 | _type = reader.read("!B")[0] |
| 8160 | assert(_type == 4) |
| 8161 | _length = reader.read("!H")[0] |
| 8162 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8163 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8164 | obj.xid = reader.read("!L")[0] |
| 8165 | _experimenter = reader.read("!L")[0] |
| 8166 | assert(_experimenter == 6035143) |
| 8167 | _subtype = reader.read("!L")[0] |
| 8168 | assert(_subtype == 61) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8169 | reader.skip(1) |
| 8170 | obj.table_id = reader.read("!B")[0] |
Rich Lane | 9ec3fca | 2014-02-26 16:22:56 -0800 | [diff] [blame] | 8171 | reader.skip(2) |
| 8172 | obj.buckets_size = reader.read("!L")[0] |
| 8173 | return obj |
| 8174 | |
| 8175 | def __eq__(self, other): |
| 8176 | if type(self) != type(other): return False |
| 8177 | if self.xid != other.xid: return False |
| 8178 | if self.table_id != other.table_id: return False |
| 8179 | if self.buckets_size != other.buckets_size: return False |
| 8180 | return True |
| 8181 | |
| 8182 | def pretty_print(self, q): |
| 8183 | q.text("bsn_table_set_buckets_size {") |
| 8184 | with q.group(): |
| 8185 | with q.indent(2): |
| 8186 | q.breakable() |
| 8187 | q.text("xid = "); |
| 8188 | if self.xid != None: |
| 8189 | q.text("%#x" % self.xid) |
| 8190 | else: |
| 8191 | q.text('None') |
| 8192 | q.text(","); q.breakable() |
| 8193 | q.text("table_id = "); |
| 8194 | q.text("%#x" % self.table_id) |
| 8195 | q.text(","); q.breakable() |
| 8196 | q.text("buckets_size = "); |
| 8197 | q.text("%#x" % self.buckets_size) |
| 8198 | q.breakable() |
| 8199 | q.text('}') |
| 8200 | |
| 8201 | bsn_header.subtypes[61] = bsn_table_set_buckets_size |
| 8202 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8203 | class bsn_time_reply(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8204 | version = 4 |
| 8205 | type = 4 |
| 8206 | experimenter = 6035143 |
| 8207 | subtype = 45 |
| 8208 | |
| 8209 | def __init__(self, xid=None, time_ms=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8210 | if xid != None: |
| 8211 | self.xid = xid |
| 8212 | else: |
| 8213 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8214 | if time_ms != None: |
| 8215 | self.time_ms = time_ms |
| 8216 | else: |
| 8217 | self.time_ms = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8218 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8219 | |
| 8220 | def pack(self): |
| 8221 | packed = [] |
| 8222 | packed.append(struct.pack("!B", self.version)) |
| 8223 | packed.append(struct.pack("!B", self.type)) |
| 8224 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8225 | packed.append(struct.pack("!L", self.xid)) |
| 8226 | packed.append(struct.pack("!L", self.experimenter)) |
| 8227 | packed.append(struct.pack("!L", self.subtype)) |
| 8228 | packed.append(struct.pack("!Q", self.time_ms)) |
| 8229 | length = sum([len(x) for x in packed]) |
| 8230 | packed[2] = struct.pack("!H", length) |
| 8231 | return ''.join(packed) |
| 8232 | |
| 8233 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8234 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8235 | obj = bsn_time_reply() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8236 | _version = reader.read("!B")[0] |
| 8237 | assert(_version == 4) |
| 8238 | _type = reader.read("!B")[0] |
| 8239 | assert(_type == 4) |
| 8240 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8241 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8242 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8243 | obj.xid = reader.read("!L")[0] |
| 8244 | _experimenter = reader.read("!L")[0] |
| 8245 | assert(_experimenter == 6035143) |
| 8246 | _subtype = reader.read("!L")[0] |
| 8247 | assert(_subtype == 45) |
| 8248 | obj.time_ms = reader.read("!Q")[0] |
| 8249 | return obj |
| 8250 | |
| 8251 | def __eq__(self, other): |
| 8252 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8253 | if self.xid != other.xid: return False |
| 8254 | if self.time_ms != other.time_ms: return False |
| 8255 | return True |
| 8256 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8257 | def pretty_print(self, q): |
| 8258 | q.text("bsn_time_reply {") |
| 8259 | with q.group(): |
| 8260 | with q.indent(2): |
| 8261 | q.breakable() |
| 8262 | q.text("xid = "); |
| 8263 | if self.xid != None: |
| 8264 | q.text("%#x" % self.xid) |
| 8265 | else: |
| 8266 | q.text('None') |
| 8267 | q.text(","); q.breakable() |
| 8268 | q.text("time_ms = "); |
| 8269 | q.text("%#x" % self.time_ms) |
| 8270 | q.breakable() |
| 8271 | q.text('}') |
| 8272 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8273 | bsn_header.subtypes[45] = bsn_time_reply |
| 8274 | |
| 8275 | class bsn_time_request(bsn_header): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8276 | version = 4 |
| 8277 | type = 4 |
| 8278 | experimenter = 6035143 |
| 8279 | subtype = 44 |
| 8280 | |
| 8281 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8282 | if xid != None: |
| 8283 | self.xid = xid |
| 8284 | else: |
| 8285 | self.xid = None |
| 8286 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8287 | |
| 8288 | def pack(self): |
| 8289 | packed = [] |
| 8290 | packed.append(struct.pack("!B", self.version)) |
| 8291 | packed.append(struct.pack("!B", self.type)) |
| 8292 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8293 | packed.append(struct.pack("!L", self.xid)) |
| 8294 | packed.append(struct.pack("!L", self.experimenter)) |
| 8295 | packed.append(struct.pack("!L", self.subtype)) |
| 8296 | length = sum([len(x) for x in packed]) |
| 8297 | packed[2] = struct.pack("!H", length) |
| 8298 | return ''.join(packed) |
| 8299 | |
| 8300 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8301 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8302 | obj = bsn_time_request() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8303 | _version = reader.read("!B")[0] |
| 8304 | assert(_version == 4) |
| 8305 | _type = reader.read("!B")[0] |
| 8306 | assert(_type == 4) |
| 8307 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8308 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8309 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8310 | obj.xid = reader.read("!L")[0] |
| 8311 | _experimenter = reader.read("!L")[0] |
| 8312 | assert(_experimenter == 6035143) |
| 8313 | _subtype = reader.read("!L")[0] |
| 8314 | assert(_subtype == 44) |
| 8315 | return obj |
| 8316 | |
| 8317 | def __eq__(self, other): |
| 8318 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8319 | if self.xid != other.xid: return False |
| 8320 | return True |
| 8321 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 8322 | def pretty_print(self, q): |
| 8323 | q.text("bsn_time_request {") |
| 8324 | with q.group(): |
| 8325 | with q.indent(2): |
| 8326 | q.breakable() |
| 8327 | q.text("xid = "); |
| 8328 | if self.xid != None: |
| 8329 | q.text("%#x" % self.xid) |
| 8330 | else: |
| 8331 | q.text('None') |
| 8332 | q.breakable() |
| 8333 | q.text('}') |
| 8334 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8335 | bsn_header.subtypes[44] = bsn_time_request |
| 8336 | |
| 8337 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8338 | version = 4 |
| 8339 | type = 4 |
| 8340 | experimenter = 6035143 |
| 8341 | subtype = 16 |
| 8342 | |
| 8343 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8344 | if xid != None: |
| 8345 | self.xid = xid |
| 8346 | else: |
| 8347 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8348 | if status != None: |
| 8349 | self.status = status |
| 8350 | else: |
| 8351 | self.status = 0 |
| 8352 | if vport_no != None: |
| 8353 | self.vport_no = vport_no |
| 8354 | else: |
| 8355 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8356 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8357 | |
| 8358 | def pack(self): |
| 8359 | packed = [] |
| 8360 | packed.append(struct.pack("!B", self.version)) |
| 8361 | packed.append(struct.pack("!B", self.type)) |
| 8362 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8363 | packed.append(struct.pack("!L", self.xid)) |
| 8364 | packed.append(struct.pack("!L", self.experimenter)) |
| 8365 | packed.append(struct.pack("!L", self.subtype)) |
| 8366 | packed.append(struct.pack("!L", self.status)) |
| 8367 | packed.append(struct.pack("!L", self.vport_no)) |
| 8368 | length = sum([len(x) for x in packed]) |
| 8369 | packed[2] = struct.pack("!H", length) |
| 8370 | return ''.join(packed) |
| 8371 | |
| 8372 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8373 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8374 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8375 | _version = reader.read("!B")[0] |
| 8376 | assert(_version == 4) |
| 8377 | _type = reader.read("!B")[0] |
| 8378 | assert(_type == 4) |
| 8379 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8380 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8381 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8382 | obj.xid = reader.read("!L")[0] |
| 8383 | _experimenter = reader.read("!L")[0] |
| 8384 | assert(_experimenter == 6035143) |
| 8385 | _subtype = reader.read("!L")[0] |
| 8386 | assert(_subtype == 16) |
| 8387 | obj.status = reader.read("!L")[0] |
| 8388 | obj.vport_no = reader.read("!L")[0] |
| 8389 | return obj |
| 8390 | |
| 8391 | def __eq__(self, other): |
| 8392 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8393 | if self.xid != other.xid: return False |
| 8394 | if self.status != other.status: return False |
| 8395 | if self.vport_no != other.vport_no: return False |
| 8396 | return True |
| 8397 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8398 | def pretty_print(self, q): |
| 8399 | q.text("bsn_virtual_port_create_reply {") |
| 8400 | with q.group(): |
| 8401 | with q.indent(2): |
| 8402 | q.breakable() |
| 8403 | q.text("xid = "); |
| 8404 | if self.xid != None: |
| 8405 | q.text("%#x" % self.xid) |
| 8406 | else: |
| 8407 | q.text('None') |
| 8408 | q.text(","); q.breakable() |
| 8409 | q.text("status = "); |
| 8410 | q.text("%#x" % self.status) |
| 8411 | q.text(","); q.breakable() |
| 8412 | q.text("vport_no = "); |
| 8413 | q.text("%#x" % self.vport_no) |
| 8414 | q.breakable() |
| 8415 | q.text('}') |
| 8416 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8417 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 8418 | |
| 8419 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8420 | version = 4 |
| 8421 | type = 4 |
| 8422 | experimenter = 6035143 |
| 8423 | subtype = 15 |
| 8424 | |
| 8425 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8426 | if xid != None: |
| 8427 | self.xid = xid |
| 8428 | else: |
| 8429 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8430 | if vport != None: |
| 8431 | self.vport = vport |
| 8432 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8433 | self.vport = ofp.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8434 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8435 | |
| 8436 | def pack(self): |
| 8437 | packed = [] |
| 8438 | packed.append(struct.pack("!B", self.version)) |
| 8439 | packed.append(struct.pack("!B", self.type)) |
| 8440 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8441 | packed.append(struct.pack("!L", self.xid)) |
| 8442 | packed.append(struct.pack("!L", self.experimenter)) |
| 8443 | packed.append(struct.pack("!L", self.subtype)) |
| 8444 | packed.append(self.vport.pack()) |
| 8445 | length = sum([len(x) for x in packed]) |
| 8446 | packed[2] = struct.pack("!H", length) |
| 8447 | return ''.join(packed) |
| 8448 | |
| 8449 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8450 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8451 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8452 | _version = reader.read("!B")[0] |
| 8453 | assert(_version == 4) |
| 8454 | _type = reader.read("!B")[0] |
| 8455 | assert(_type == 4) |
| 8456 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8457 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8458 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8459 | obj.xid = reader.read("!L")[0] |
| 8460 | _experimenter = reader.read("!L")[0] |
| 8461 | assert(_experimenter == 6035143) |
| 8462 | _subtype = reader.read("!L")[0] |
| 8463 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8464 | obj.vport = ofp.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8465 | return obj |
| 8466 | |
| 8467 | def __eq__(self, other): |
| 8468 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8469 | if self.xid != other.xid: return False |
| 8470 | if self.vport != other.vport: return False |
| 8471 | return True |
| 8472 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8473 | def pretty_print(self, q): |
| 8474 | q.text("bsn_virtual_port_create_request {") |
| 8475 | with q.group(): |
| 8476 | with q.indent(2): |
| 8477 | q.breakable() |
| 8478 | q.text("xid = "); |
| 8479 | if self.xid != None: |
| 8480 | q.text("%#x" % self.xid) |
| 8481 | else: |
| 8482 | q.text('None') |
| 8483 | q.text(","); q.breakable() |
| 8484 | q.text("vport = "); |
| 8485 | q.pp(self.vport) |
| 8486 | q.breakable() |
| 8487 | q.text('}') |
| 8488 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8489 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 8490 | |
| 8491 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8492 | version = 4 |
| 8493 | type = 4 |
| 8494 | experimenter = 6035143 |
| 8495 | subtype = 26 |
| 8496 | |
| 8497 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8498 | if xid != None: |
| 8499 | self.xid = xid |
| 8500 | else: |
| 8501 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8502 | if status != None: |
| 8503 | self.status = status |
| 8504 | else: |
| 8505 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8506 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8507 | |
| 8508 | def pack(self): |
| 8509 | packed = [] |
| 8510 | packed.append(struct.pack("!B", self.version)) |
| 8511 | packed.append(struct.pack("!B", self.type)) |
| 8512 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8513 | packed.append(struct.pack("!L", self.xid)) |
| 8514 | packed.append(struct.pack("!L", self.experimenter)) |
| 8515 | packed.append(struct.pack("!L", self.subtype)) |
| 8516 | packed.append(struct.pack("!L", self.status)) |
| 8517 | length = sum([len(x) for x in packed]) |
| 8518 | packed[2] = struct.pack("!H", length) |
| 8519 | return ''.join(packed) |
| 8520 | |
| 8521 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8522 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8523 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8524 | _version = reader.read("!B")[0] |
| 8525 | assert(_version == 4) |
| 8526 | _type = reader.read("!B")[0] |
| 8527 | assert(_type == 4) |
| 8528 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8529 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8530 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8531 | obj.xid = reader.read("!L")[0] |
| 8532 | _experimenter = reader.read("!L")[0] |
| 8533 | assert(_experimenter == 6035143) |
| 8534 | _subtype = reader.read("!L")[0] |
| 8535 | assert(_subtype == 26) |
| 8536 | obj.status = reader.read("!L")[0] |
| 8537 | return obj |
| 8538 | |
| 8539 | def __eq__(self, other): |
| 8540 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8541 | if self.xid != other.xid: return False |
| 8542 | if self.status != other.status: return False |
| 8543 | return True |
| 8544 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8545 | def pretty_print(self, q): |
| 8546 | q.text("bsn_virtual_port_remove_reply {") |
| 8547 | with q.group(): |
| 8548 | with q.indent(2): |
| 8549 | q.breakable() |
| 8550 | q.text("xid = "); |
| 8551 | if self.xid != None: |
| 8552 | q.text("%#x" % self.xid) |
| 8553 | else: |
| 8554 | q.text('None') |
| 8555 | q.text(","); q.breakable() |
| 8556 | q.text("status = "); |
| 8557 | q.text("%#x" % self.status) |
| 8558 | q.breakable() |
| 8559 | q.text('}') |
| 8560 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8561 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 8562 | |
| 8563 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8564 | version = 4 |
| 8565 | type = 4 |
| 8566 | experimenter = 6035143 |
| 8567 | subtype = 17 |
| 8568 | |
| 8569 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8570 | if xid != None: |
| 8571 | self.xid = xid |
| 8572 | else: |
| 8573 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8574 | if vport_no != None: |
| 8575 | self.vport_no = vport_no |
| 8576 | else: |
| 8577 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8578 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8579 | |
| 8580 | def pack(self): |
| 8581 | packed = [] |
| 8582 | packed.append(struct.pack("!B", self.version)) |
| 8583 | packed.append(struct.pack("!B", self.type)) |
| 8584 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8585 | packed.append(struct.pack("!L", self.xid)) |
| 8586 | packed.append(struct.pack("!L", self.experimenter)) |
| 8587 | packed.append(struct.pack("!L", self.subtype)) |
| 8588 | packed.append(struct.pack("!L", self.vport_no)) |
| 8589 | length = sum([len(x) for x in packed]) |
| 8590 | packed[2] = struct.pack("!H", length) |
| 8591 | return ''.join(packed) |
| 8592 | |
| 8593 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8594 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8595 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8596 | _version = reader.read("!B")[0] |
| 8597 | assert(_version == 4) |
| 8598 | _type = reader.read("!B")[0] |
| 8599 | assert(_type == 4) |
| 8600 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8601 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8602 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8603 | obj.xid = reader.read("!L")[0] |
| 8604 | _experimenter = reader.read("!L")[0] |
| 8605 | assert(_experimenter == 6035143) |
| 8606 | _subtype = reader.read("!L")[0] |
| 8607 | assert(_subtype == 17) |
| 8608 | obj.vport_no = reader.read("!L")[0] |
| 8609 | return obj |
| 8610 | |
| 8611 | def __eq__(self, other): |
| 8612 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8613 | if self.xid != other.xid: return False |
| 8614 | if self.vport_no != other.vport_no: return False |
| 8615 | return True |
| 8616 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8617 | def pretty_print(self, q): |
| 8618 | q.text("bsn_virtual_port_remove_request {") |
| 8619 | with q.group(): |
| 8620 | with q.indent(2): |
| 8621 | q.breakable() |
| 8622 | q.text("xid = "); |
| 8623 | if self.xid != None: |
| 8624 | q.text("%#x" % self.xid) |
| 8625 | else: |
| 8626 | q.text('None') |
| 8627 | q.text(","); q.breakable() |
| 8628 | q.text("vport_no = "); |
| 8629 | q.text("%#x" % self.vport_no) |
| 8630 | q.breakable() |
| 8631 | q.text('}') |
| 8632 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8633 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 8634 | |
| 8635 | class bsn_vlan_counter_stats_reply(bsn_stats_reply): |
| 8636 | version = 4 |
| 8637 | type = 19 |
| 8638 | stats_type = 65535 |
| 8639 | experimenter = 6035143 |
| 8640 | subtype = 9 |
| 8641 | |
| 8642 | def __init__(self, xid=None, flags=None, entries=None): |
| 8643 | if xid != None: |
| 8644 | self.xid = xid |
| 8645 | else: |
| 8646 | self.xid = None |
| 8647 | if flags != None: |
| 8648 | self.flags = flags |
| 8649 | else: |
| 8650 | self.flags = 0 |
| 8651 | if entries != None: |
| 8652 | self.entries = entries |
| 8653 | else: |
| 8654 | self.entries = [] |
| 8655 | return |
| 8656 | |
| 8657 | def pack(self): |
| 8658 | packed = [] |
| 8659 | packed.append(struct.pack("!B", self.version)) |
| 8660 | packed.append(struct.pack("!B", self.type)) |
| 8661 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8662 | packed.append(struct.pack("!L", self.xid)) |
| 8663 | packed.append(struct.pack("!H", self.stats_type)) |
| 8664 | packed.append(struct.pack("!H", self.flags)) |
| 8665 | packed.append('\x00' * 4) |
| 8666 | packed.append(struct.pack("!L", self.experimenter)) |
| 8667 | packed.append(struct.pack("!L", self.subtype)) |
| 8668 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8669 | length = sum([len(x) for x in packed]) |
| 8670 | packed[2] = struct.pack("!H", length) |
| 8671 | return ''.join(packed) |
| 8672 | |
| 8673 | @staticmethod |
| 8674 | def unpack(reader): |
| 8675 | obj = bsn_vlan_counter_stats_reply() |
| 8676 | _version = reader.read("!B")[0] |
| 8677 | assert(_version == 4) |
| 8678 | _type = reader.read("!B")[0] |
| 8679 | assert(_type == 19) |
| 8680 | _length = reader.read("!H")[0] |
| 8681 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8682 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8683 | obj.xid = reader.read("!L")[0] |
| 8684 | _stats_type = reader.read("!H")[0] |
| 8685 | assert(_stats_type == 65535) |
| 8686 | obj.flags = reader.read("!H")[0] |
| 8687 | reader.skip(4) |
| 8688 | _experimenter = reader.read("!L")[0] |
| 8689 | assert(_experimenter == 6035143) |
| 8690 | _subtype = reader.read("!L")[0] |
| 8691 | assert(_subtype == 9) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8692 | 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] | 8693 | return obj |
| 8694 | |
| 8695 | def __eq__(self, other): |
| 8696 | if type(self) != type(other): return False |
| 8697 | if self.xid != other.xid: return False |
| 8698 | if self.flags != other.flags: return False |
| 8699 | if self.entries != other.entries: return False |
| 8700 | return True |
| 8701 | |
| 8702 | def pretty_print(self, q): |
| 8703 | q.text("bsn_vlan_counter_stats_reply {") |
| 8704 | with q.group(): |
| 8705 | with q.indent(2): |
| 8706 | q.breakable() |
| 8707 | q.text("xid = "); |
| 8708 | if self.xid != None: |
| 8709 | q.text("%#x" % self.xid) |
| 8710 | else: |
| 8711 | q.text('None') |
| 8712 | q.text(","); q.breakable() |
| 8713 | q.text("flags = "); |
| 8714 | q.text("%#x" % self.flags) |
| 8715 | q.text(","); q.breakable() |
| 8716 | q.text("entries = "); |
| 8717 | q.pp(self.entries) |
| 8718 | q.breakable() |
| 8719 | q.text('}') |
| 8720 | |
| 8721 | bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply |
| 8722 | |
| 8723 | class bsn_vlan_counter_stats_request(bsn_stats_request): |
| 8724 | version = 4 |
| 8725 | type = 18 |
| 8726 | stats_type = 65535 |
| 8727 | experimenter = 6035143 |
| 8728 | subtype = 9 |
| 8729 | |
| 8730 | def __init__(self, xid=None, flags=None, vlan_vid=None): |
| 8731 | if xid != None: |
| 8732 | self.xid = xid |
| 8733 | else: |
| 8734 | self.xid = None |
| 8735 | if flags != None: |
| 8736 | self.flags = flags |
| 8737 | else: |
| 8738 | self.flags = 0 |
| 8739 | if vlan_vid != None: |
| 8740 | self.vlan_vid = vlan_vid |
| 8741 | else: |
| 8742 | self.vlan_vid = 0 |
| 8743 | return |
| 8744 | |
| 8745 | def pack(self): |
| 8746 | packed = [] |
| 8747 | packed.append(struct.pack("!B", self.version)) |
| 8748 | packed.append(struct.pack("!B", self.type)) |
| 8749 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8750 | packed.append(struct.pack("!L", self.xid)) |
| 8751 | packed.append(struct.pack("!H", self.stats_type)) |
| 8752 | packed.append(struct.pack("!H", self.flags)) |
| 8753 | packed.append('\x00' * 4) |
| 8754 | packed.append(struct.pack("!L", self.experimenter)) |
| 8755 | packed.append(struct.pack("!L", self.subtype)) |
| 8756 | packed.append(struct.pack("!H", self.vlan_vid)) |
| 8757 | length = sum([len(x) for x in packed]) |
| 8758 | packed[2] = struct.pack("!H", length) |
| 8759 | return ''.join(packed) |
| 8760 | |
| 8761 | @staticmethod |
| 8762 | def unpack(reader): |
| 8763 | obj = bsn_vlan_counter_stats_request() |
| 8764 | _version = reader.read("!B")[0] |
| 8765 | assert(_version == 4) |
| 8766 | _type = reader.read("!B")[0] |
| 8767 | assert(_type == 18) |
| 8768 | _length = reader.read("!H")[0] |
| 8769 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8770 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8771 | obj.xid = reader.read("!L")[0] |
| 8772 | _stats_type = reader.read("!H")[0] |
| 8773 | assert(_stats_type == 65535) |
| 8774 | obj.flags = reader.read("!H")[0] |
| 8775 | reader.skip(4) |
| 8776 | _experimenter = reader.read("!L")[0] |
| 8777 | assert(_experimenter == 6035143) |
| 8778 | _subtype = reader.read("!L")[0] |
| 8779 | assert(_subtype == 9) |
| 8780 | obj.vlan_vid = reader.read("!H")[0] |
| 8781 | return obj |
| 8782 | |
| 8783 | def __eq__(self, other): |
| 8784 | if type(self) != type(other): return False |
| 8785 | if self.xid != other.xid: return False |
| 8786 | if self.flags != other.flags: return False |
| 8787 | if self.vlan_vid != other.vlan_vid: return False |
| 8788 | return True |
| 8789 | |
| 8790 | def pretty_print(self, q): |
| 8791 | q.text("bsn_vlan_counter_stats_request {") |
| 8792 | with q.group(): |
| 8793 | with q.indent(2): |
| 8794 | q.breakable() |
| 8795 | q.text("xid = "); |
| 8796 | if self.xid != None: |
| 8797 | q.text("%#x" % self.xid) |
| 8798 | else: |
| 8799 | q.text('None') |
| 8800 | q.text(","); q.breakable() |
| 8801 | q.text("flags = "); |
| 8802 | q.text("%#x" % self.flags) |
| 8803 | q.text(","); q.breakable() |
| 8804 | q.text("vlan_vid = "); |
| 8805 | q.text("%#x" % self.vlan_vid) |
| 8806 | q.breakable() |
| 8807 | q.text('}') |
| 8808 | |
| 8809 | bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request |
| 8810 | |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8811 | class bsn_vrf_counter_stats_reply(bsn_stats_reply): |
| 8812 | version = 4 |
| 8813 | type = 19 |
| 8814 | stats_type = 65535 |
| 8815 | experimenter = 6035143 |
| 8816 | subtype = 15 |
| 8817 | |
| 8818 | def __init__(self, xid=None, flags=None, entries=None): |
| 8819 | if xid != None: |
| 8820 | self.xid = xid |
| 8821 | else: |
| 8822 | self.xid = None |
| 8823 | if flags != None: |
| 8824 | self.flags = flags |
| 8825 | else: |
| 8826 | self.flags = 0 |
| 8827 | if entries != None: |
| 8828 | self.entries = entries |
| 8829 | else: |
| 8830 | self.entries = [] |
| 8831 | return |
| 8832 | |
| 8833 | def pack(self): |
| 8834 | packed = [] |
| 8835 | packed.append(struct.pack("!B", self.version)) |
| 8836 | packed.append(struct.pack("!B", self.type)) |
| 8837 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8838 | packed.append(struct.pack("!L", self.xid)) |
| 8839 | packed.append(struct.pack("!H", self.stats_type)) |
| 8840 | packed.append(struct.pack("!H", self.flags)) |
| 8841 | packed.append('\x00' * 4) |
| 8842 | packed.append(struct.pack("!L", self.experimenter)) |
| 8843 | packed.append(struct.pack("!L", self.subtype)) |
| 8844 | packed.append(loxi.generic_util.pack_list(self.entries)) |
| 8845 | length = sum([len(x) for x in packed]) |
| 8846 | packed[2] = struct.pack("!H", length) |
| 8847 | return ''.join(packed) |
| 8848 | |
| 8849 | @staticmethod |
| 8850 | def unpack(reader): |
| 8851 | obj = bsn_vrf_counter_stats_reply() |
| 8852 | _version = reader.read("!B")[0] |
| 8853 | assert(_version == 4) |
| 8854 | _type = reader.read("!B")[0] |
| 8855 | assert(_type == 19) |
| 8856 | _length = reader.read("!H")[0] |
| 8857 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8858 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8859 | obj.xid = reader.read("!L")[0] |
| 8860 | _stats_type = reader.read("!H")[0] |
| 8861 | assert(_stats_type == 65535) |
| 8862 | obj.flags = reader.read("!H")[0] |
| 8863 | reader.skip(4) |
| 8864 | _experimenter = reader.read("!L")[0] |
| 8865 | assert(_experimenter == 6035143) |
| 8866 | _subtype = reader.read("!L")[0] |
| 8867 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 8868 | 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] | 8869 | return obj |
| 8870 | |
| 8871 | def __eq__(self, other): |
| 8872 | if type(self) != type(other): return False |
| 8873 | if self.xid != other.xid: return False |
| 8874 | if self.flags != other.flags: return False |
| 8875 | if self.entries != other.entries: return False |
| 8876 | return True |
| 8877 | |
| 8878 | def pretty_print(self, q): |
| 8879 | q.text("bsn_vrf_counter_stats_reply {") |
| 8880 | with q.group(): |
| 8881 | with q.indent(2): |
| 8882 | q.breakable() |
| 8883 | q.text("xid = "); |
| 8884 | if self.xid != None: |
| 8885 | q.text("%#x" % self.xid) |
| 8886 | else: |
| 8887 | q.text('None') |
| 8888 | q.text(","); q.breakable() |
| 8889 | q.text("flags = "); |
| 8890 | q.text("%#x" % self.flags) |
| 8891 | q.text(","); q.breakable() |
| 8892 | q.text("entries = "); |
| 8893 | q.pp(self.entries) |
| 8894 | q.breakable() |
| 8895 | q.text('}') |
| 8896 | |
| 8897 | bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply |
| 8898 | |
| 8899 | class bsn_vrf_counter_stats_request(bsn_stats_request): |
| 8900 | version = 4 |
| 8901 | type = 18 |
| 8902 | stats_type = 65535 |
| 8903 | experimenter = 6035143 |
| 8904 | subtype = 15 |
| 8905 | |
| 8906 | def __init__(self, xid=None, flags=None, vrf=None): |
| 8907 | if xid != None: |
| 8908 | self.xid = xid |
| 8909 | else: |
| 8910 | self.xid = None |
| 8911 | if flags != None: |
| 8912 | self.flags = flags |
| 8913 | else: |
| 8914 | self.flags = 0 |
| 8915 | if vrf != None: |
| 8916 | self.vrf = vrf |
| 8917 | else: |
| 8918 | self.vrf = 0 |
| 8919 | return |
| 8920 | |
| 8921 | def pack(self): |
| 8922 | packed = [] |
| 8923 | packed.append(struct.pack("!B", self.version)) |
| 8924 | packed.append(struct.pack("!B", self.type)) |
| 8925 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 8926 | packed.append(struct.pack("!L", self.xid)) |
| 8927 | packed.append(struct.pack("!H", self.stats_type)) |
| 8928 | packed.append(struct.pack("!H", self.flags)) |
| 8929 | packed.append('\x00' * 4) |
| 8930 | packed.append(struct.pack("!L", self.experimenter)) |
| 8931 | packed.append(struct.pack("!L", self.subtype)) |
| 8932 | packed.append(struct.pack("!L", self.vrf)) |
| 8933 | length = sum([len(x) for x in packed]) |
| 8934 | packed[2] = struct.pack("!H", length) |
| 8935 | return ''.join(packed) |
| 8936 | |
| 8937 | @staticmethod |
| 8938 | def unpack(reader): |
| 8939 | obj = bsn_vrf_counter_stats_request() |
| 8940 | _version = reader.read("!B")[0] |
| 8941 | assert(_version == 4) |
| 8942 | _type = reader.read("!B")[0] |
| 8943 | assert(_type == 18) |
| 8944 | _length = reader.read("!H")[0] |
| 8945 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 8946 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 5587ab1 | 2014-06-30 11:19:09 -0700 | [diff] [blame] | 8947 | obj.xid = reader.read("!L")[0] |
| 8948 | _stats_type = reader.read("!H")[0] |
| 8949 | assert(_stats_type == 65535) |
| 8950 | obj.flags = reader.read("!H")[0] |
| 8951 | reader.skip(4) |
| 8952 | _experimenter = reader.read("!L")[0] |
| 8953 | assert(_experimenter == 6035143) |
| 8954 | _subtype = reader.read("!L")[0] |
| 8955 | assert(_subtype == 15) |
| 8956 | obj.vrf = reader.read("!L")[0] |
| 8957 | return obj |
| 8958 | |
| 8959 | def __eq__(self, other): |
| 8960 | if type(self) != type(other): return False |
| 8961 | if self.xid != other.xid: return False |
| 8962 | if self.flags != other.flags: return False |
| 8963 | if self.vrf != other.vrf: return False |
| 8964 | return True |
| 8965 | |
| 8966 | def pretty_print(self, q): |
| 8967 | q.text("bsn_vrf_counter_stats_request {") |
| 8968 | with q.group(): |
| 8969 | with q.indent(2): |
| 8970 | q.breakable() |
| 8971 | q.text("xid = "); |
| 8972 | if self.xid != None: |
| 8973 | q.text("%#x" % self.xid) |
| 8974 | else: |
| 8975 | q.text('None') |
| 8976 | q.text(","); q.breakable() |
| 8977 | q.text("flags = "); |
| 8978 | q.text("%#x" % self.flags) |
| 8979 | q.text(","); q.breakable() |
| 8980 | q.text("vrf = "); |
| 8981 | q.text("%#x" % self.vrf) |
| 8982 | q.breakable() |
| 8983 | q.text('}') |
| 8984 | |
| 8985 | bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request |
| 8986 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 8987 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 8988 | version = 4 |
| 8989 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8990 | stats_type = 0 |
| 8991 | |
| 8992 | 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] | 8993 | if xid != None: |
| 8994 | self.xid = xid |
| 8995 | else: |
| 8996 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 8997 | if flags != None: |
| 8998 | self.flags = flags |
| 8999 | else: |
| 9000 | self.flags = 0 |
| 9001 | if mfr_desc != None: |
| 9002 | self.mfr_desc = mfr_desc |
| 9003 | else: |
| 9004 | self.mfr_desc = "" |
| 9005 | if hw_desc != None: |
| 9006 | self.hw_desc = hw_desc |
| 9007 | else: |
| 9008 | self.hw_desc = "" |
| 9009 | if sw_desc != None: |
| 9010 | self.sw_desc = sw_desc |
| 9011 | else: |
| 9012 | self.sw_desc = "" |
| 9013 | if serial_num != None: |
| 9014 | self.serial_num = serial_num |
| 9015 | else: |
| 9016 | self.serial_num = "" |
| 9017 | if dp_desc != None: |
| 9018 | self.dp_desc = dp_desc |
| 9019 | else: |
| 9020 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9021 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9022 | |
| 9023 | def pack(self): |
| 9024 | packed = [] |
| 9025 | packed.append(struct.pack("!B", self.version)) |
| 9026 | packed.append(struct.pack("!B", self.type)) |
| 9027 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9028 | packed.append(struct.pack("!L", self.xid)) |
| 9029 | packed.append(struct.pack("!H", self.stats_type)) |
| 9030 | packed.append(struct.pack("!H", self.flags)) |
| 9031 | packed.append('\x00' * 4) |
| 9032 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 9033 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 9034 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 9035 | packed.append(struct.pack("!32s", self.serial_num)) |
| 9036 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 9037 | length = sum([len(x) for x in packed]) |
| 9038 | packed[2] = struct.pack("!H", length) |
| 9039 | return ''.join(packed) |
| 9040 | |
| 9041 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9042 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9043 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9044 | _version = reader.read("!B")[0] |
| 9045 | assert(_version == 4) |
| 9046 | _type = reader.read("!B")[0] |
| 9047 | assert(_type == 19) |
| 9048 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9049 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9050 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9051 | obj.xid = reader.read("!L")[0] |
| 9052 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9053 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9054 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9055 | reader.skip(4) |
| 9056 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9057 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9058 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9059 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 9060 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
| 9061 | return obj |
| 9062 | |
| 9063 | def __eq__(self, other): |
| 9064 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9065 | if self.xid != other.xid: return False |
| 9066 | if self.flags != other.flags: return False |
| 9067 | if self.mfr_desc != other.mfr_desc: return False |
| 9068 | if self.hw_desc != other.hw_desc: return False |
| 9069 | if self.sw_desc != other.sw_desc: return False |
| 9070 | if self.serial_num != other.serial_num: return False |
| 9071 | if self.dp_desc != other.dp_desc: return False |
| 9072 | return True |
| 9073 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9074 | def pretty_print(self, q): |
| 9075 | q.text("desc_stats_reply {") |
| 9076 | with q.group(): |
| 9077 | with q.indent(2): |
| 9078 | q.breakable() |
| 9079 | q.text("xid = "); |
| 9080 | if self.xid != None: |
| 9081 | q.text("%#x" % self.xid) |
| 9082 | else: |
| 9083 | q.text('None') |
| 9084 | q.text(","); q.breakable() |
| 9085 | q.text("flags = "); |
| 9086 | q.text("%#x" % self.flags) |
| 9087 | q.text(","); q.breakable() |
| 9088 | q.text("mfr_desc = "); |
| 9089 | q.pp(self.mfr_desc) |
| 9090 | q.text(","); q.breakable() |
| 9091 | q.text("hw_desc = "); |
| 9092 | q.pp(self.hw_desc) |
| 9093 | q.text(","); q.breakable() |
| 9094 | q.text("sw_desc = "); |
| 9095 | q.pp(self.sw_desc) |
| 9096 | q.text(","); q.breakable() |
| 9097 | q.text("serial_num = "); |
| 9098 | q.pp(self.serial_num) |
| 9099 | q.text(","); q.breakable() |
| 9100 | q.text("dp_desc = "); |
| 9101 | q.pp(self.dp_desc) |
| 9102 | q.breakable() |
| 9103 | q.text('}') |
| 9104 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9105 | stats_reply.subtypes[0] = desc_stats_reply |
| 9106 | |
| 9107 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9108 | version = 4 |
| 9109 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9110 | stats_type = 0 |
| 9111 | |
| 9112 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9113 | if xid != None: |
| 9114 | self.xid = xid |
| 9115 | else: |
| 9116 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9117 | if flags != None: |
| 9118 | self.flags = flags |
| 9119 | else: |
| 9120 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9121 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9122 | |
| 9123 | def pack(self): |
| 9124 | packed = [] |
| 9125 | packed.append(struct.pack("!B", self.version)) |
| 9126 | packed.append(struct.pack("!B", self.type)) |
| 9127 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9128 | packed.append(struct.pack("!L", self.xid)) |
| 9129 | packed.append(struct.pack("!H", self.stats_type)) |
| 9130 | packed.append(struct.pack("!H", self.flags)) |
| 9131 | packed.append('\x00' * 4) |
| 9132 | length = sum([len(x) for x in packed]) |
| 9133 | packed[2] = struct.pack("!H", length) |
| 9134 | return ''.join(packed) |
| 9135 | |
| 9136 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9137 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9138 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9139 | _version = reader.read("!B")[0] |
| 9140 | assert(_version == 4) |
| 9141 | _type = reader.read("!B")[0] |
| 9142 | assert(_type == 18) |
| 9143 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9144 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9145 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9146 | obj.xid = reader.read("!L")[0] |
| 9147 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9148 | assert(_stats_type == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9149 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9150 | reader.skip(4) |
| 9151 | return obj |
| 9152 | |
| 9153 | def __eq__(self, other): |
| 9154 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9155 | if self.xid != other.xid: return False |
| 9156 | if self.flags != other.flags: return False |
| 9157 | return True |
| 9158 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9159 | def pretty_print(self, q): |
| 9160 | q.text("desc_stats_request {") |
| 9161 | with q.group(): |
| 9162 | with q.indent(2): |
| 9163 | q.breakable() |
| 9164 | q.text("xid = "); |
| 9165 | if self.xid != None: |
| 9166 | q.text("%#x" % self.xid) |
| 9167 | else: |
| 9168 | q.text('None') |
| 9169 | q.text(","); q.breakable() |
| 9170 | q.text("flags = "); |
| 9171 | q.text("%#x" % self.flags) |
| 9172 | q.breakable() |
| 9173 | q.text('}') |
| 9174 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9175 | stats_request.subtypes[0] = desc_stats_request |
| 9176 | |
| 9177 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9178 | version = 4 |
| 9179 | type = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9180 | |
| 9181 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9182 | if xid != None: |
| 9183 | self.xid = xid |
| 9184 | else: |
| 9185 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9186 | if data != None: |
| 9187 | self.data = data |
| 9188 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9189 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9190 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9191 | |
| 9192 | def pack(self): |
| 9193 | packed = [] |
| 9194 | packed.append(struct.pack("!B", self.version)) |
| 9195 | packed.append(struct.pack("!B", self.type)) |
| 9196 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9197 | packed.append(struct.pack("!L", self.xid)) |
| 9198 | packed.append(self.data) |
| 9199 | length = sum([len(x) for x in packed]) |
| 9200 | packed[2] = struct.pack("!H", length) |
| 9201 | return ''.join(packed) |
| 9202 | |
| 9203 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9204 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9205 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9206 | _version = reader.read("!B")[0] |
| 9207 | assert(_version == 4) |
| 9208 | _type = reader.read("!B")[0] |
| 9209 | assert(_type == 3) |
| 9210 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9211 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9212 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9213 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9214 | obj.data = str(reader.read_all()) |
| 9215 | return obj |
| 9216 | |
| 9217 | def __eq__(self, other): |
| 9218 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9219 | if self.xid != other.xid: return False |
| 9220 | if self.data != other.data: return False |
| 9221 | return True |
| 9222 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9223 | def pretty_print(self, q): |
| 9224 | q.text("echo_reply {") |
| 9225 | with q.group(): |
| 9226 | with q.indent(2): |
| 9227 | q.breakable() |
| 9228 | q.text("xid = "); |
| 9229 | if self.xid != None: |
| 9230 | q.text("%#x" % self.xid) |
| 9231 | else: |
| 9232 | q.text('None') |
| 9233 | q.text(","); q.breakable() |
| 9234 | q.text("data = "); |
| 9235 | q.pp(self.data) |
| 9236 | q.breakable() |
| 9237 | q.text('}') |
| 9238 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9239 | message.subtypes[3] = echo_reply |
| 9240 | |
| 9241 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9242 | version = 4 |
| 9243 | type = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9244 | |
| 9245 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9246 | if xid != None: |
| 9247 | self.xid = xid |
| 9248 | else: |
| 9249 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9250 | if data != None: |
| 9251 | self.data = data |
| 9252 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9253 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9254 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9255 | |
| 9256 | def pack(self): |
| 9257 | packed = [] |
| 9258 | packed.append(struct.pack("!B", self.version)) |
| 9259 | packed.append(struct.pack("!B", self.type)) |
| 9260 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9261 | packed.append(struct.pack("!L", self.xid)) |
| 9262 | packed.append(self.data) |
| 9263 | length = sum([len(x) for x in packed]) |
| 9264 | packed[2] = struct.pack("!H", length) |
| 9265 | return ''.join(packed) |
| 9266 | |
| 9267 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9268 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9269 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9270 | _version = reader.read("!B")[0] |
| 9271 | assert(_version == 4) |
| 9272 | _type = reader.read("!B")[0] |
| 9273 | assert(_type == 2) |
| 9274 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9275 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9276 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9277 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9278 | obj.data = str(reader.read_all()) |
| 9279 | return obj |
| 9280 | |
| 9281 | def __eq__(self, other): |
| 9282 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9283 | if self.xid != other.xid: return False |
| 9284 | if self.data != other.data: return False |
| 9285 | return True |
| 9286 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9287 | def pretty_print(self, q): |
| 9288 | q.text("echo_request {") |
| 9289 | with q.group(): |
| 9290 | with q.indent(2): |
| 9291 | q.breakable() |
| 9292 | q.text("xid = "); |
| 9293 | if self.xid != None: |
| 9294 | q.text("%#x" % self.xid) |
| 9295 | else: |
| 9296 | q.text('None') |
| 9297 | q.text(","); q.breakable() |
| 9298 | q.text("data = "); |
| 9299 | q.pp(self.data) |
| 9300 | q.breakable() |
| 9301 | q.text('}') |
| 9302 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9303 | message.subtypes[2] = echo_request |
| 9304 | |
| 9305 | class experimenter_error_msg(error_msg): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9306 | version = 4 |
| 9307 | type = 1 |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9308 | err_type = 65535 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9309 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9310 | def __init__(self, xid=None, subtype=None, experimenter=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9311 | if xid != None: |
| 9312 | self.xid = xid |
| 9313 | else: |
| 9314 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9315 | if subtype != None: |
| 9316 | self.subtype = subtype |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9317 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9318 | self.subtype = 0 |
| 9319 | if experimenter != None: |
| 9320 | self.experimenter = experimenter |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9321 | else: |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9322 | self.experimenter = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9323 | if data != None: |
| 9324 | self.data = data |
| 9325 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9326 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9327 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9328 | |
| 9329 | def pack(self): |
| 9330 | packed = [] |
| 9331 | packed.append(struct.pack("!B", self.version)) |
| 9332 | packed.append(struct.pack("!B", self.type)) |
| 9333 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9334 | packed.append(struct.pack("!L", self.xid)) |
| 9335 | packed.append(struct.pack("!H", self.err_type)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9336 | packed.append(struct.pack("!H", self.subtype)) |
| 9337 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9338 | packed.append(self.data) |
| 9339 | length = sum([len(x) for x in packed]) |
| 9340 | packed[2] = struct.pack("!H", length) |
| 9341 | return ''.join(packed) |
| 9342 | |
| 9343 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9344 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9345 | obj = experimenter_error_msg() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9346 | _version = reader.read("!B")[0] |
| 9347 | assert(_version == 4) |
| 9348 | _type = reader.read("!B")[0] |
| 9349 | assert(_type == 1) |
| 9350 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9351 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9352 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9353 | obj.xid = reader.read("!L")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9354 | _err_type = reader.read("!H")[0] |
| 9355 | assert(_err_type == 65535) |
| 9356 | obj.subtype = reader.read("!H")[0] |
| 9357 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9358 | obj.data = str(reader.read_all()) |
| 9359 | return obj |
| 9360 | |
| 9361 | def __eq__(self, other): |
| 9362 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9363 | if self.xid != other.xid: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9364 | if self.subtype != other.subtype: return False |
| 9365 | if self.experimenter != other.experimenter: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9366 | if self.data != other.data: return False |
| 9367 | return True |
| 9368 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9369 | def pretty_print(self, q): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9370 | q.text("experimenter_error_msg {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9371 | with q.group(): |
| 9372 | with q.indent(2): |
| 9373 | q.breakable() |
| 9374 | q.text("xid = "); |
| 9375 | if self.xid != None: |
| 9376 | q.text("%#x" % self.xid) |
| 9377 | else: |
| 9378 | q.text('None') |
| 9379 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9380 | q.text("subtype = "); |
| 9381 | q.text("%#x" % self.subtype) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9382 | q.text(","); q.breakable() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 9383 | q.text("experimenter = "); |
| 9384 | q.text("%#x" % self.experimenter) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9385 | q.text(","); q.breakable() |
| 9386 | q.text("data = "); |
| 9387 | q.pp(self.data) |
| 9388 | q.breakable() |
| 9389 | q.text('}') |
| 9390 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9391 | error_msg.subtypes[65535] = experimenter_error_msg |
| 9392 | |
| 9393 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9394 | version = 4 |
| 9395 | type = 6 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9396 | |
| 9397 | 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] | 9398 | if xid != None: |
| 9399 | self.xid = xid |
| 9400 | else: |
| 9401 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9402 | if datapath_id != None: |
| 9403 | self.datapath_id = datapath_id |
| 9404 | else: |
| 9405 | self.datapath_id = 0 |
| 9406 | if n_buffers != None: |
| 9407 | self.n_buffers = n_buffers |
| 9408 | else: |
| 9409 | self.n_buffers = 0 |
| 9410 | if n_tables != None: |
| 9411 | self.n_tables = n_tables |
| 9412 | else: |
| 9413 | self.n_tables = 0 |
| 9414 | if auxiliary_id != None: |
| 9415 | self.auxiliary_id = auxiliary_id |
| 9416 | else: |
| 9417 | self.auxiliary_id = 0 |
| 9418 | if capabilities != None: |
| 9419 | self.capabilities = capabilities |
| 9420 | else: |
| 9421 | self.capabilities = 0 |
| 9422 | if reserved != None: |
| 9423 | self.reserved = reserved |
| 9424 | else: |
| 9425 | self.reserved = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9426 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9427 | |
| 9428 | def pack(self): |
| 9429 | packed = [] |
| 9430 | packed.append(struct.pack("!B", self.version)) |
| 9431 | packed.append(struct.pack("!B", self.type)) |
| 9432 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9433 | packed.append(struct.pack("!L", self.xid)) |
| 9434 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 9435 | packed.append(struct.pack("!L", self.n_buffers)) |
| 9436 | packed.append(struct.pack("!B", self.n_tables)) |
| 9437 | packed.append(struct.pack("!B", self.auxiliary_id)) |
| 9438 | packed.append('\x00' * 2) |
| 9439 | packed.append(struct.pack("!L", self.capabilities)) |
| 9440 | packed.append(struct.pack("!L", self.reserved)) |
| 9441 | length = sum([len(x) for x in packed]) |
| 9442 | packed[2] = struct.pack("!H", length) |
| 9443 | return ''.join(packed) |
| 9444 | |
| 9445 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9446 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9447 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9448 | _version = reader.read("!B")[0] |
| 9449 | assert(_version == 4) |
| 9450 | _type = reader.read("!B")[0] |
| 9451 | assert(_type == 6) |
| 9452 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9453 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9454 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9455 | obj.xid = reader.read("!L")[0] |
| 9456 | obj.datapath_id = reader.read("!Q")[0] |
| 9457 | obj.n_buffers = reader.read("!L")[0] |
| 9458 | obj.n_tables = reader.read("!B")[0] |
| 9459 | obj.auxiliary_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9460 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9461 | obj.capabilities = reader.read("!L")[0] |
| 9462 | obj.reserved = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9463 | return obj |
| 9464 | |
| 9465 | def __eq__(self, other): |
| 9466 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9467 | if self.xid != other.xid: return False |
| 9468 | if self.datapath_id != other.datapath_id: return False |
| 9469 | if self.n_buffers != other.n_buffers: return False |
| 9470 | if self.n_tables != other.n_tables: return False |
| 9471 | if self.auxiliary_id != other.auxiliary_id: return False |
| 9472 | if self.capabilities != other.capabilities: return False |
| 9473 | if self.reserved != other.reserved: return False |
| 9474 | return True |
| 9475 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9476 | def pretty_print(self, q): |
| 9477 | q.text("features_reply {") |
| 9478 | with q.group(): |
| 9479 | with q.indent(2): |
| 9480 | q.breakable() |
| 9481 | q.text("xid = "); |
| 9482 | if self.xid != None: |
| 9483 | q.text("%#x" % self.xid) |
| 9484 | else: |
| 9485 | q.text('None') |
| 9486 | q.text(","); q.breakable() |
| 9487 | q.text("datapath_id = "); |
| 9488 | q.text("%#x" % self.datapath_id) |
| 9489 | q.text(","); q.breakable() |
| 9490 | q.text("n_buffers = "); |
| 9491 | q.text("%#x" % self.n_buffers) |
| 9492 | q.text(","); q.breakable() |
| 9493 | q.text("n_tables = "); |
| 9494 | q.text("%#x" % self.n_tables) |
| 9495 | q.text(","); q.breakable() |
| 9496 | q.text("auxiliary_id = "); |
| 9497 | q.text("%#x" % self.auxiliary_id) |
| 9498 | q.text(","); q.breakable() |
| 9499 | q.text("capabilities = "); |
| 9500 | q.text("%#x" % self.capabilities) |
| 9501 | q.text(","); q.breakable() |
| 9502 | q.text("reserved = "); |
| 9503 | q.text("%#x" % self.reserved) |
| 9504 | q.breakable() |
| 9505 | q.text('}') |
| 9506 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9507 | message.subtypes[6] = features_reply |
| 9508 | |
| 9509 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9510 | version = 4 |
| 9511 | type = 5 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9512 | |
| 9513 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9514 | if xid != None: |
| 9515 | self.xid = xid |
| 9516 | else: |
| 9517 | self.xid = None |
| 9518 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9519 | |
| 9520 | def pack(self): |
| 9521 | packed = [] |
| 9522 | packed.append(struct.pack("!B", self.version)) |
| 9523 | packed.append(struct.pack("!B", self.type)) |
| 9524 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9525 | packed.append(struct.pack("!L", self.xid)) |
| 9526 | length = sum([len(x) for x in packed]) |
| 9527 | packed[2] = struct.pack("!H", length) |
| 9528 | return ''.join(packed) |
| 9529 | |
| 9530 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9531 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9532 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9533 | _version = reader.read("!B")[0] |
| 9534 | assert(_version == 4) |
| 9535 | _type = reader.read("!B")[0] |
| 9536 | assert(_type == 5) |
| 9537 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9538 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9539 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9540 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9541 | return obj |
| 9542 | |
| 9543 | def __eq__(self, other): |
| 9544 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9545 | if self.xid != other.xid: return False |
| 9546 | return True |
| 9547 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9548 | def pretty_print(self, q): |
| 9549 | q.text("features_request {") |
| 9550 | with q.group(): |
| 9551 | with q.indent(2): |
| 9552 | q.breakable() |
| 9553 | q.text("xid = "); |
| 9554 | if self.xid != None: |
| 9555 | q.text("%#x" % self.xid) |
| 9556 | else: |
| 9557 | q.text('None') |
| 9558 | q.breakable() |
| 9559 | q.text('}') |
| 9560 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9561 | message.subtypes[5] = features_request |
| 9562 | |
| 9563 | class flow_mod(message): |
| 9564 | subtypes = {} |
| 9565 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9566 | version = 4 |
| 9567 | type = 14 |
| 9568 | |
| 9569 | 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): |
| 9570 | if xid != None: |
| 9571 | self.xid = xid |
| 9572 | else: |
| 9573 | self.xid = None |
| 9574 | if cookie != None: |
| 9575 | self.cookie = cookie |
| 9576 | else: |
| 9577 | self.cookie = 0 |
| 9578 | if cookie_mask != None: |
| 9579 | self.cookie_mask = cookie_mask |
| 9580 | else: |
| 9581 | self.cookie_mask = 0 |
| 9582 | if table_id != None: |
| 9583 | self.table_id = table_id |
| 9584 | else: |
| 9585 | self.table_id = 0 |
| 9586 | if _command != None: |
| 9587 | self._command = _command |
| 9588 | else: |
| 9589 | self._command = 0 |
| 9590 | if idle_timeout != None: |
| 9591 | self.idle_timeout = idle_timeout |
| 9592 | else: |
| 9593 | self.idle_timeout = 0 |
| 9594 | if hard_timeout != None: |
| 9595 | self.hard_timeout = hard_timeout |
| 9596 | else: |
| 9597 | self.hard_timeout = 0 |
| 9598 | if priority != None: |
| 9599 | self.priority = priority |
| 9600 | else: |
| 9601 | self.priority = 0 |
| 9602 | if buffer_id != None: |
| 9603 | self.buffer_id = buffer_id |
| 9604 | else: |
| 9605 | self.buffer_id = 0 |
| 9606 | if out_port != None: |
| 9607 | self.out_port = out_port |
| 9608 | else: |
| 9609 | self.out_port = 0 |
| 9610 | if out_group != None: |
| 9611 | self.out_group = out_group |
| 9612 | else: |
| 9613 | self.out_group = 0 |
| 9614 | if flags != None: |
| 9615 | self.flags = flags |
| 9616 | else: |
| 9617 | self.flags = 0 |
| 9618 | if match != None: |
| 9619 | self.match = match |
| 9620 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9621 | self.match = ofp.match() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9622 | if instructions != None: |
| 9623 | self.instructions = instructions |
| 9624 | else: |
| 9625 | self.instructions = [] |
| 9626 | return |
| 9627 | |
| 9628 | def pack(self): |
| 9629 | packed = [] |
| 9630 | packed.append(struct.pack("!B", self.version)) |
| 9631 | packed.append(struct.pack("!B", self.type)) |
| 9632 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9633 | packed.append(struct.pack("!L", self.xid)) |
| 9634 | packed.append(struct.pack("!Q", self.cookie)) |
| 9635 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9636 | packed.append(struct.pack("!B", self.table_id)) |
| 9637 | packed.append(util.pack_fm_cmd(self._command)) |
| 9638 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9639 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9640 | packed.append(struct.pack("!H", self.priority)) |
| 9641 | packed.append(struct.pack("!L", self.buffer_id)) |
| 9642 | packed.append(util.pack_port_no(self.out_port)) |
| 9643 | packed.append(struct.pack("!L", self.out_group)) |
| 9644 | packed.append(struct.pack("!H", self.flags)) |
| 9645 | packed.append('\x00' * 2) |
| 9646 | packed.append(self.match.pack()) |
| 9647 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
| 9648 | length = sum([len(x) for x in packed]) |
| 9649 | packed[2] = struct.pack("!H", length) |
| 9650 | return ''.join(packed) |
| 9651 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9652 | @staticmethod |
| 9653 | def unpack(reader): |
| 9654 | subtype, = reader.peek('B', 25) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9655 | subclass = flow_mod.subtypes.get(subtype) |
| 9656 | if subclass: |
| 9657 | return subclass.unpack(reader) |
| 9658 | |
| 9659 | obj = flow_mod() |
| 9660 | _version = reader.read("!B")[0] |
| 9661 | assert(_version == 4) |
| 9662 | _type = reader.read("!B")[0] |
| 9663 | assert(_type == 14) |
| 9664 | _length = reader.read("!H")[0] |
| 9665 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9666 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9667 | obj.xid = reader.read("!L")[0] |
| 9668 | obj.cookie = reader.read("!Q")[0] |
| 9669 | obj.cookie_mask = reader.read("!Q")[0] |
| 9670 | obj.table_id = reader.read("!B")[0] |
| 9671 | obj._command = util.unpack_fm_cmd(reader) |
| 9672 | obj.idle_timeout = reader.read("!H")[0] |
| 9673 | obj.hard_timeout = reader.read("!H")[0] |
| 9674 | obj.priority = reader.read("!H")[0] |
| 9675 | obj.buffer_id = reader.read("!L")[0] |
| 9676 | obj.out_port = util.unpack_port_no(reader) |
| 9677 | obj.out_group = reader.read("!L")[0] |
| 9678 | obj.flags = reader.read("!H")[0] |
| 9679 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9680 | obj.match = ofp.match.unpack(reader) |
| 9681 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 9682 | return obj |
| 9683 | |
| 9684 | def __eq__(self, other): |
| 9685 | if type(self) != type(other): return False |
| 9686 | if self.xid != other.xid: return False |
| 9687 | if self.cookie != other.cookie: return False |
| 9688 | if self.cookie_mask != other.cookie_mask: return False |
| 9689 | if self.table_id != other.table_id: return False |
| 9690 | if self._command != other._command: return False |
| 9691 | if self.idle_timeout != other.idle_timeout: return False |
| 9692 | if self.hard_timeout != other.hard_timeout: return False |
| 9693 | if self.priority != other.priority: return False |
| 9694 | if self.buffer_id != other.buffer_id: return False |
| 9695 | if self.out_port != other.out_port: return False |
| 9696 | if self.out_group != other.out_group: return False |
| 9697 | if self.flags != other.flags: return False |
| 9698 | if self.match != other.match: return False |
| 9699 | if self.instructions != other.instructions: return False |
| 9700 | return True |
| 9701 | |
| 9702 | def pretty_print(self, q): |
| 9703 | q.text("flow_mod {") |
| 9704 | with q.group(): |
| 9705 | with q.indent(2): |
| 9706 | q.breakable() |
| 9707 | q.text("xid = "); |
| 9708 | if self.xid != None: |
| 9709 | q.text("%#x" % self.xid) |
| 9710 | else: |
| 9711 | q.text('None') |
| 9712 | q.text(","); q.breakable() |
| 9713 | q.text("cookie = "); |
| 9714 | q.text("%#x" % self.cookie) |
| 9715 | q.text(","); q.breakable() |
| 9716 | q.text("cookie_mask = "); |
| 9717 | q.text("%#x" % self.cookie_mask) |
| 9718 | q.text(","); q.breakable() |
| 9719 | q.text("table_id = "); |
| 9720 | q.text("%#x" % self.table_id) |
| 9721 | q.text(","); q.breakable() |
| 9722 | q.text("idle_timeout = "); |
| 9723 | q.text("%#x" % self.idle_timeout) |
| 9724 | q.text(","); q.breakable() |
| 9725 | q.text("hard_timeout = "); |
| 9726 | q.text("%#x" % self.hard_timeout) |
| 9727 | q.text(","); q.breakable() |
| 9728 | q.text("priority = "); |
| 9729 | q.text("%#x" % self.priority) |
| 9730 | q.text(","); q.breakable() |
| 9731 | q.text("buffer_id = "); |
| 9732 | q.text("%#x" % self.buffer_id) |
| 9733 | q.text(","); q.breakable() |
| 9734 | q.text("out_port = "); |
| 9735 | q.text(util.pretty_port(self.out_port)) |
| 9736 | q.text(","); q.breakable() |
| 9737 | q.text("out_group = "); |
| 9738 | q.text("%#x" % self.out_group) |
| 9739 | q.text(","); q.breakable() |
| 9740 | q.text("flags = "); |
| 9741 | q.text("%#x" % self.flags) |
| 9742 | q.text(","); q.breakable() |
| 9743 | q.text("match = "); |
| 9744 | q.pp(self.match) |
| 9745 | q.text(","); q.breakable() |
| 9746 | q.text("instructions = "); |
| 9747 | q.pp(self.instructions) |
| 9748 | q.breakable() |
| 9749 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9750 | |
| 9751 | message.subtypes[14] = flow_mod |
| 9752 | |
| 9753 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9754 | version = 4 |
| 9755 | type = 14 |
| 9756 | _command = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9757 | |
| 9758 | 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] | 9759 | if xid != None: |
| 9760 | self.xid = xid |
| 9761 | else: |
| 9762 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9763 | if cookie != None: |
| 9764 | self.cookie = cookie |
| 9765 | else: |
| 9766 | self.cookie = 0 |
| 9767 | if cookie_mask != None: |
| 9768 | self.cookie_mask = cookie_mask |
| 9769 | else: |
| 9770 | self.cookie_mask = 0 |
| 9771 | if table_id != None: |
| 9772 | self.table_id = table_id |
| 9773 | else: |
| 9774 | self.table_id = 0 |
| 9775 | if idle_timeout != None: |
| 9776 | self.idle_timeout = idle_timeout |
| 9777 | else: |
| 9778 | self.idle_timeout = 0 |
| 9779 | if hard_timeout != None: |
| 9780 | self.hard_timeout = hard_timeout |
| 9781 | else: |
| 9782 | self.hard_timeout = 0 |
| 9783 | if priority != None: |
| 9784 | self.priority = priority |
| 9785 | else: |
| 9786 | self.priority = 0 |
| 9787 | if buffer_id != None: |
| 9788 | self.buffer_id = buffer_id |
| 9789 | else: |
| 9790 | self.buffer_id = 0 |
| 9791 | if out_port != None: |
| 9792 | self.out_port = out_port |
| 9793 | else: |
| 9794 | self.out_port = 0 |
| 9795 | if out_group != None: |
| 9796 | self.out_group = out_group |
| 9797 | else: |
| 9798 | self.out_group = 0 |
| 9799 | if flags != None: |
| 9800 | self.flags = flags |
| 9801 | else: |
| 9802 | self.flags = 0 |
| 9803 | if match != None: |
| 9804 | self.match = match |
| 9805 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9806 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9807 | if instructions != None: |
| 9808 | self.instructions = instructions |
| 9809 | else: |
| 9810 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9811 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9812 | |
| 9813 | def pack(self): |
| 9814 | packed = [] |
| 9815 | packed.append(struct.pack("!B", self.version)) |
| 9816 | packed.append(struct.pack("!B", self.type)) |
| 9817 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9818 | packed.append(struct.pack("!L", self.xid)) |
| 9819 | packed.append(struct.pack("!Q", self.cookie)) |
| 9820 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 9821 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9822 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9823 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 9824 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 9825 | packed.append(struct.pack("!H", self.priority)) |
| 9826 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9827 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9828 | packed.append(struct.pack("!L", self.out_group)) |
| 9829 | packed.append(struct.pack("!H", self.flags)) |
| 9830 | packed.append('\x00' * 2) |
| 9831 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9832 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9833 | length = sum([len(x) for x in packed]) |
| 9834 | packed[2] = struct.pack("!H", length) |
| 9835 | return ''.join(packed) |
| 9836 | |
| 9837 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9838 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9839 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9840 | _version = reader.read("!B")[0] |
| 9841 | assert(_version == 4) |
| 9842 | _type = reader.read("!B")[0] |
| 9843 | assert(_type == 14) |
| 9844 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9845 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 9846 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9847 | obj.xid = reader.read("!L")[0] |
| 9848 | obj.cookie = reader.read("!Q")[0] |
| 9849 | obj.cookie_mask = reader.read("!Q")[0] |
| 9850 | obj.table_id = reader.read("!B")[0] |
| 9851 | __command = util.unpack_fm_cmd(reader) |
| 9852 | assert(__command == 0) |
| 9853 | obj.idle_timeout = reader.read("!H")[0] |
| 9854 | obj.hard_timeout = reader.read("!H")[0] |
| 9855 | obj.priority = reader.read("!H")[0] |
| 9856 | obj.buffer_id = reader.read("!L")[0] |
| 9857 | obj.out_port = util.unpack_port_no(reader) |
| 9858 | obj.out_group = reader.read("!L")[0] |
| 9859 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9860 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9861 | obj.match = ofp.match.unpack(reader) |
| 9862 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9863 | return obj |
| 9864 | |
| 9865 | def __eq__(self, other): |
| 9866 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9867 | if self.xid != other.xid: return False |
| 9868 | if self.cookie != other.cookie: return False |
| 9869 | if self.cookie_mask != other.cookie_mask: return False |
| 9870 | if self.table_id != other.table_id: return False |
| 9871 | if self.idle_timeout != other.idle_timeout: return False |
| 9872 | if self.hard_timeout != other.hard_timeout: return False |
| 9873 | if self.priority != other.priority: return False |
| 9874 | if self.buffer_id != other.buffer_id: return False |
| 9875 | if self.out_port != other.out_port: return False |
| 9876 | if self.out_group != other.out_group: return False |
| 9877 | if self.flags != other.flags: return False |
| 9878 | if self.match != other.match: return False |
| 9879 | if self.instructions != other.instructions: return False |
| 9880 | return True |
| 9881 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9882 | def pretty_print(self, q): |
| 9883 | q.text("flow_add {") |
| 9884 | with q.group(): |
| 9885 | with q.indent(2): |
| 9886 | q.breakable() |
| 9887 | q.text("xid = "); |
| 9888 | if self.xid != None: |
| 9889 | q.text("%#x" % self.xid) |
| 9890 | else: |
| 9891 | q.text('None') |
| 9892 | q.text(","); q.breakable() |
| 9893 | q.text("cookie = "); |
| 9894 | q.text("%#x" % self.cookie) |
| 9895 | q.text(","); q.breakable() |
| 9896 | q.text("cookie_mask = "); |
| 9897 | q.text("%#x" % self.cookie_mask) |
| 9898 | q.text(","); q.breakable() |
| 9899 | q.text("table_id = "); |
| 9900 | q.text("%#x" % self.table_id) |
| 9901 | q.text(","); q.breakable() |
| 9902 | q.text("idle_timeout = "); |
| 9903 | q.text("%#x" % self.idle_timeout) |
| 9904 | q.text(","); q.breakable() |
| 9905 | q.text("hard_timeout = "); |
| 9906 | q.text("%#x" % self.hard_timeout) |
| 9907 | q.text(","); q.breakable() |
| 9908 | q.text("priority = "); |
| 9909 | q.text("%#x" % self.priority) |
| 9910 | q.text(","); q.breakable() |
| 9911 | q.text("buffer_id = "); |
| 9912 | q.text("%#x" % self.buffer_id) |
| 9913 | q.text(","); q.breakable() |
| 9914 | q.text("out_port = "); |
| 9915 | q.text(util.pretty_port(self.out_port)) |
| 9916 | q.text(","); q.breakable() |
| 9917 | q.text("out_group = "); |
| 9918 | q.text("%#x" % self.out_group) |
| 9919 | q.text(","); q.breakable() |
| 9920 | q.text("flags = "); |
| 9921 | q.text("%#x" % self.flags) |
| 9922 | q.text(","); q.breakable() |
| 9923 | q.text("match = "); |
| 9924 | q.pp(self.match) |
| 9925 | q.text(","); q.breakable() |
| 9926 | q.text("instructions = "); |
| 9927 | q.pp(self.instructions) |
| 9928 | q.breakable() |
| 9929 | q.text('}') |
| 9930 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9931 | flow_mod.subtypes[0] = flow_add |
| 9932 | |
| 9933 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 9934 | version = 4 |
| 9935 | type = 14 |
| 9936 | _command = 3 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9937 | |
| 9938 | 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] | 9939 | if xid != None: |
| 9940 | self.xid = xid |
| 9941 | else: |
| 9942 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9943 | if cookie != None: |
| 9944 | self.cookie = cookie |
| 9945 | else: |
| 9946 | self.cookie = 0 |
| 9947 | if cookie_mask != None: |
| 9948 | self.cookie_mask = cookie_mask |
| 9949 | else: |
| 9950 | self.cookie_mask = 0 |
| 9951 | if table_id != None: |
| 9952 | self.table_id = table_id |
| 9953 | else: |
| 9954 | self.table_id = 0 |
| 9955 | if idle_timeout != None: |
| 9956 | self.idle_timeout = idle_timeout |
| 9957 | else: |
| 9958 | self.idle_timeout = 0 |
| 9959 | if hard_timeout != None: |
| 9960 | self.hard_timeout = hard_timeout |
| 9961 | else: |
| 9962 | self.hard_timeout = 0 |
| 9963 | if priority != None: |
| 9964 | self.priority = priority |
| 9965 | else: |
| 9966 | self.priority = 0 |
| 9967 | if buffer_id != None: |
| 9968 | self.buffer_id = buffer_id |
| 9969 | else: |
| 9970 | self.buffer_id = 0 |
| 9971 | if out_port != None: |
| 9972 | self.out_port = out_port |
| 9973 | else: |
| 9974 | self.out_port = 0 |
| 9975 | if out_group != None: |
| 9976 | self.out_group = out_group |
| 9977 | else: |
| 9978 | self.out_group = 0 |
| 9979 | if flags != None: |
| 9980 | self.flags = flags |
| 9981 | else: |
| 9982 | self.flags = 0 |
| 9983 | if match != None: |
| 9984 | self.match = match |
| 9985 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 9986 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9987 | if instructions != None: |
| 9988 | self.instructions = instructions |
| 9989 | else: |
| 9990 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 9991 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 9992 | |
| 9993 | def pack(self): |
| 9994 | packed = [] |
| 9995 | packed.append(struct.pack("!B", self.version)) |
| 9996 | packed.append(struct.pack("!B", self.type)) |
| 9997 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 9998 | packed.append(struct.pack("!L", self.xid)) |
| 9999 | packed.append(struct.pack("!Q", self.cookie)) |
| 10000 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10001 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10002 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10003 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10004 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10005 | packed.append(struct.pack("!H", self.priority)) |
| 10006 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10007 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10008 | packed.append(struct.pack("!L", self.out_group)) |
| 10009 | packed.append(struct.pack("!H", self.flags)) |
| 10010 | packed.append('\x00' * 2) |
| 10011 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10012 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10013 | length = sum([len(x) for x in packed]) |
| 10014 | packed[2] = struct.pack("!H", length) |
| 10015 | return ''.join(packed) |
| 10016 | |
| 10017 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10018 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10019 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10020 | _version = reader.read("!B")[0] |
| 10021 | assert(_version == 4) |
| 10022 | _type = reader.read("!B")[0] |
| 10023 | assert(_type == 14) |
| 10024 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10025 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10026 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10027 | obj.xid = reader.read("!L")[0] |
| 10028 | obj.cookie = reader.read("!Q")[0] |
| 10029 | obj.cookie_mask = reader.read("!Q")[0] |
| 10030 | obj.table_id = reader.read("!B")[0] |
| 10031 | __command = util.unpack_fm_cmd(reader) |
| 10032 | assert(__command == 3) |
| 10033 | obj.idle_timeout = reader.read("!H")[0] |
| 10034 | obj.hard_timeout = reader.read("!H")[0] |
| 10035 | obj.priority = reader.read("!H")[0] |
| 10036 | obj.buffer_id = reader.read("!L")[0] |
| 10037 | obj.out_port = util.unpack_port_no(reader) |
| 10038 | obj.out_group = reader.read("!L")[0] |
| 10039 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10040 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10041 | obj.match = ofp.match.unpack(reader) |
| 10042 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10043 | return obj |
| 10044 | |
| 10045 | def __eq__(self, other): |
| 10046 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10047 | if self.xid != other.xid: return False |
| 10048 | if self.cookie != other.cookie: return False |
| 10049 | if self.cookie_mask != other.cookie_mask: return False |
| 10050 | if self.table_id != other.table_id: return False |
| 10051 | if self.idle_timeout != other.idle_timeout: return False |
| 10052 | if self.hard_timeout != other.hard_timeout: return False |
| 10053 | if self.priority != other.priority: return False |
| 10054 | if self.buffer_id != other.buffer_id: return False |
| 10055 | if self.out_port != other.out_port: return False |
| 10056 | if self.out_group != other.out_group: return False |
| 10057 | if self.flags != other.flags: return False |
| 10058 | if self.match != other.match: return False |
| 10059 | if self.instructions != other.instructions: return False |
| 10060 | return True |
| 10061 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10062 | def pretty_print(self, q): |
| 10063 | q.text("flow_delete {") |
| 10064 | with q.group(): |
| 10065 | with q.indent(2): |
| 10066 | q.breakable() |
| 10067 | q.text("xid = "); |
| 10068 | if self.xid != None: |
| 10069 | q.text("%#x" % self.xid) |
| 10070 | else: |
| 10071 | q.text('None') |
| 10072 | q.text(","); q.breakable() |
| 10073 | q.text("cookie = "); |
| 10074 | q.text("%#x" % self.cookie) |
| 10075 | q.text(","); q.breakable() |
| 10076 | q.text("cookie_mask = "); |
| 10077 | q.text("%#x" % self.cookie_mask) |
| 10078 | q.text(","); q.breakable() |
| 10079 | q.text("table_id = "); |
| 10080 | q.text("%#x" % self.table_id) |
| 10081 | q.text(","); q.breakable() |
| 10082 | q.text("idle_timeout = "); |
| 10083 | q.text("%#x" % self.idle_timeout) |
| 10084 | q.text(","); q.breakable() |
| 10085 | q.text("hard_timeout = "); |
| 10086 | q.text("%#x" % self.hard_timeout) |
| 10087 | q.text(","); q.breakable() |
| 10088 | q.text("priority = "); |
| 10089 | q.text("%#x" % self.priority) |
| 10090 | q.text(","); q.breakable() |
| 10091 | q.text("buffer_id = "); |
| 10092 | q.text("%#x" % self.buffer_id) |
| 10093 | q.text(","); q.breakable() |
| 10094 | q.text("out_port = "); |
| 10095 | q.text(util.pretty_port(self.out_port)) |
| 10096 | q.text(","); q.breakable() |
| 10097 | q.text("out_group = "); |
| 10098 | q.text("%#x" % self.out_group) |
| 10099 | q.text(","); q.breakable() |
| 10100 | q.text("flags = "); |
| 10101 | q.text("%#x" % self.flags) |
| 10102 | q.text(","); q.breakable() |
| 10103 | q.text("match = "); |
| 10104 | q.pp(self.match) |
| 10105 | q.text(","); q.breakable() |
| 10106 | q.text("instructions = "); |
| 10107 | q.pp(self.instructions) |
| 10108 | q.breakable() |
| 10109 | q.text('}') |
| 10110 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10111 | flow_mod.subtypes[3] = flow_delete |
| 10112 | |
| 10113 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10114 | version = 4 |
| 10115 | type = 14 |
| 10116 | _command = 4 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10117 | |
| 10118 | 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] | 10119 | if xid != None: |
| 10120 | self.xid = xid |
| 10121 | else: |
| 10122 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10123 | if cookie != None: |
| 10124 | self.cookie = cookie |
| 10125 | else: |
| 10126 | self.cookie = 0 |
| 10127 | if cookie_mask != None: |
| 10128 | self.cookie_mask = cookie_mask |
| 10129 | else: |
| 10130 | self.cookie_mask = 0 |
| 10131 | if table_id != None: |
| 10132 | self.table_id = table_id |
| 10133 | else: |
| 10134 | self.table_id = 0 |
| 10135 | if idle_timeout != None: |
| 10136 | self.idle_timeout = idle_timeout |
| 10137 | else: |
| 10138 | self.idle_timeout = 0 |
| 10139 | if hard_timeout != None: |
| 10140 | self.hard_timeout = hard_timeout |
| 10141 | else: |
| 10142 | self.hard_timeout = 0 |
| 10143 | if priority != None: |
| 10144 | self.priority = priority |
| 10145 | else: |
| 10146 | self.priority = 0 |
| 10147 | if buffer_id != None: |
| 10148 | self.buffer_id = buffer_id |
| 10149 | else: |
| 10150 | self.buffer_id = 0 |
| 10151 | if out_port != None: |
| 10152 | self.out_port = out_port |
| 10153 | else: |
| 10154 | self.out_port = 0 |
| 10155 | if out_group != None: |
| 10156 | self.out_group = out_group |
| 10157 | else: |
| 10158 | self.out_group = 0 |
| 10159 | if flags != None: |
| 10160 | self.flags = flags |
| 10161 | else: |
| 10162 | self.flags = 0 |
| 10163 | if match != None: |
| 10164 | self.match = match |
| 10165 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10166 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10167 | if instructions != None: |
| 10168 | self.instructions = instructions |
| 10169 | else: |
| 10170 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10171 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10172 | |
| 10173 | def pack(self): |
| 10174 | packed = [] |
| 10175 | packed.append(struct.pack("!B", self.version)) |
| 10176 | packed.append(struct.pack("!B", self.type)) |
| 10177 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10178 | packed.append(struct.pack("!L", self.xid)) |
| 10179 | packed.append(struct.pack("!Q", self.cookie)) |
| 10180 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10181 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10182 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10183 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10184 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10185 | packed.append(struct.pack("!H", self.priority)) |
| 10186 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10187 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10188 | packed.append(struct.pack("!L", self.out_group)) |
| 10189 | packed.append(struct.pack("!H", self.flags)) |
| 10190 | packed.append('\x00' * 2) |
| 10191 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10192 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10193 | length = sum([len(x) for x in packed]) |
| 10194 | packed[2] = struct.pack("!H", length) |
| 10195 | return ''.join(packed) |
| 10196 | |
| 10197 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10198 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10199 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10200 | _version = reader.read("!B")[0] |
| 10201 | assert(_version == 4) |
| 10202 | _type = reader.read("!B")[0] |
| 10203 | assert(_type == 14) |
| 10204 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10205 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10206 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10207 | obj.xid = reader.read("!L")[0] |
| 10208 | obj.cookie = reader.read("!Q")[0] |
| 10209 | obj.cookie_mask = reader.read("!Q")[0] |
| 10210 | obj.table_id = reader.read("!B")[0] |
| 10211 | __command = util.unpack_fm_cmd(reader) |
| 10212 | assert(__command == 4) |
| 10213 | obj.idle_timeout = reader.read("!H")[0] |
| 10214 | obj.hard_timeout = reader.read("!H")[0] |
| 10215 | obj.priority = reader.read("!H")[0] |
| 10216 | obj.buffer_id = reader.read("!L")[0] |
| 10217 | obj.out_port = util.unpack_port_no(reader) |
| 10218 | obj.out_group = reader.read("!L")[0] |
| 10219 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10220 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10221 | obj.match = ofp.match.unpack(reader) |
| 10222 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10223 | return obj |
| 10224 | |
| 10225 | def __eq__(self, other): |
| 10226 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10227 | if self.xid != other.xid: return False |
| 10228 | if self.cookie != other.cookie: return False |
| 10229 | if self.cookie_mask != other.cookie_mask: return False |
| 10230 | if self.table_id != other.table_id: return False |
| 10231 | if self.idle_timeout != other.idle_timeout: return False |
| 10232 | if self.hard_timeout != other.hard_timeout: return False |
| 10233 | if self.priority != other.priority: return False |
| 10234 | if self.buffer_id != other.buffer_id: return False |
| 10235 | if self.out_port != other.out_port: return False |
| 10236 | if self.out_group != other.out_group: return False |
| 10237 | if self.flags != other.flags: return False |
| 10238 | if self.match != other.match: return False |
| 10239 | if self.instructions != other.instructions: return False |
| 10240 | return True |
| 10241 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10242 | def pretty_print(self, q): |
| 10243 | q.text("flow_delete_strict {") |
| 10244 | with q.group(): |
| 10245 | with q.indent(2): |
| 10246 | q.breakable() |
| 10247 | q.text("xid = "); |
| 10248 | if self.xid != None: |
| 10249 | q.text("%#x" % self.xid) |
| 10250 | else: |
| 10251 | q.text('None') |
| 10252 | q.text(","); q.breakable() |
| 10253 | q.text("cookie = "); |
| 10254 | q.text("%#x" % self.cookie) |
| 10255 | q.text(","); q.breakable() |
| 10256 | q.text("cookie_mask = "); |
| 10257 | q.text("%#x" % self.cookie_mask) |
| 10258 | q.text(","); q.breakable() |
| 10259 | q.text("table_id = "); |
| 10260 | q.text("%#x" % self.table_id) |
| 10261 | q.text(","); q.breakable() |
| 10262 | q.text("idle_timeout = "); |
| 10263 | q.text("%#x" % self.idle_timeout) |
| 10264 | q.text(","); q.breakable() |
| 10265 | q.text("hard_timeout = "); |
| 10266 | q.text("%#x" % self.hard_timeout) |
| 10267 | q.text(","); q.breakable() |
| 10268 | q.text("priority = "); |
| 10269 | q.text("%#x" % self.priority) |
| 10270 | q.text(","); q.breakable() |
| 10271 | q.text("buffer_id = "); |
| 10272 | q.text("%#x" % self.buffer_id) |
| 10273 | q.text(","); q.breakable() |
| 10274 | q.text("out_port = "); |
| 10275 | q.text(util.pretty_port(self.out_port)) |
| 10276 | q.text(","); q.breakable() |
| 10277 | q.text("out_group = "); |
| 10278 | q.text("%#x" % self.out_group) |
| 10279 | q.text(","); q.breakable() |
| 10280 | q.text("flags = "); |
| 10281 | q.text("%#x" % self.flags) |
| 10282 | q.text(","); q.breakable() |
| 10283 | q.text("match = "); |
| 10284 | q.pp(self.match) |
| 10285 | q.text(","); q.breakable() |
| 10286 | q.text("instructions = "); |
| 10287 | q.pp(self.instructions) |
| 10288 | q.breakable() |
| 10289 | q.text('}') |
| 10290 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10291 | flow_mod.subtypes[4] = flow_delete_strict |
| 10292 | |
| 10293 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10294 | version = 4 |
| 10295 | type = 1 |
| 10296 | err_type = 5 |
| 10297 | |
| 10298 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10299 | if xid != None: |
| 10300 | self.xid = xid |
| 10301 | else: |
| 10302 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10303 | if code != None: |
| 10304 | self.code = code |
| 10305 | else: |
| 10306 | self.code = 0 |
| 10307 | if data != None: |
| 10308 | self.data = data |
| 10309 | else: |
| 10310 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10311 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10312 | |
| 10313 | def pack(self): |
| 10314 | packed = [] |
| 10315 | packed.append(struct.pack("!B", self.version)) |
| 10316 | packed.append(struct.pack("!B", self.type)) |
| 10317 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10318 | packed.append(struct.pack("!L", self.xid)) |
| 10319 | packed.append(struct.pack("!H", self.err_type)) |
| 10320 | packed.append(struct.pack("!H", self.code)) |
| 10321 | packed.append(self.data) |
| 10322 | length = sum([len(x) for x in packed]) |
| 10323 | packed[2] = struct.pack("!H", length) |
| 10324 | return ''.join(packed) |
| 10325 | |
| 10326 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10327 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10328 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10329 | _version = reader.read("!B")[0] |
| 10330 | assert(_version == 4) |
| 10331 | _type = reader.read("!B")[0] |
| 10332 | assert(_type == 1) |
| 10333 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10334 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10335 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10336 | obj.xid = reader.read("!L")[0] |
| 10337 | _err_type = reader.read("!H")[0] |
| 10338 | assert(_err_type == 5) |
| 10339 | obj.code = reader.read("!H")[0] |
| 10340 | obj.data = str(reader.read_all()) |
| 10341 | return obj |
| 10342 | |
| 10343 | def __eq__(self, other): |
| 10344 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10345 | if self.xid != other.xid: return False |
| 10346 | if self.code != other.code: return False |
| 10347 | if self.data != other.data: return False |
| 10348 | return True |
| 10349 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 10350 | def pretty_print(self, q): |
| 10351 | q.text("flow_mod_failed_error_msg {") |
| 10352 | with q.group(): |
| 10353 | with q.indent(2): |
| 10354 | q.breakable() |
| 10355 | q.text("xid = "); |
| 10356 | if self.xid != None: |
| 10357 | q.text("%#x" % self.xid) |
| 10358 | else: |
| 10359 | q.text('None') |
| 10360 | q.text(","); q.breakable() |
| 10361 | q.text("code = "); |
| 10362 | q.text("%#x" % self.code) |
| 10363 | q.text(","); q.breakable() |
| 10364 | q.text("data = "); |
| 10365 | q.pp(self.data) |
| 10366 | q.breakable() |
| 10367 | q.text('}') |
| 10368 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10369 | error_msg.subtypes[5] = flow_mod_failed_error_msg |
| 10370 | |
| 10371 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10372 | version = 4 |
| 10373 | type = 14 |
| 10374 | _command = 1 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10375 | |
| 10376 | 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] | 10377 | if xid != None: |
| 10378 | self.xid = xid |
| 10379 | else: |
| 10380 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10381 | if cookie != None: |
| 10382 | self.cookie = cookie |
| 10383 | else: |
| 10384 | self.cookie = 0 |
| 10385 | if cookie_mask != None: |
| 10386 | self.cookie_mask = cookie_mask |
| 10387 | else: |
| 10388 | self.cookie_mask = 0 |
| 10389 | if table_id != None: |
| 10390 | self.table_id = table_id |
| 10391 | else: |
| 10392 | self.table_id = 0 |
| 10393 | if idle_timeout != None: |
| 10394 | self.idle_timeout = idle_timeout |
| 10395 | else: |
| 10396 | self.idle_timeout = 0 |
| 10397 | if hard_timeout != None: |
| 10398 | self.hard_timeout = hard_timeout |
| 10399 | else: |
| 10400 | self.hard_timeout = 0 |
| 10401 | if priority != None: |
| 10402 | self.priority = priority |
| 10403 | else: |
| 10404 | self.priority = 0 |
| 10405 | if buffer_id != None: |
| 10406 | self.buffer_id = buffer_id |
| 10407 | else: |
| 10408 | self.buffer_id = 0 |
| 10409 | if out_port != None: |
| 10410 | self.out_port = out_port |
| 10411 | else: |
| 10412 | self.out_port = 0 |
| 10413 | if out_group != None: |
| 10414 | self.out_group = out_group |
| 10415 | else: |
| 10416 | self.out_group = 0 |
| 10417 | if flags != None: |
| 10418 | self.flags = flags |
| 10419 | else: |
| 10420 | self.flags = 0 |
| 10421 | if match != None: |
| 10422 | self.match = match |
| 10423 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10424 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10425 | if instructions != None: |
| 10426 | self.instructions = instructions |
| 10427 | else: |
| 10428 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10429 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10430 | |
| 10431 | def pack(self): |
| 10432 | packed = [] |
| 10433 | packed.append(struct.pack("!B", self.version)) |
| 10434 | packed.append(struct.pack("!B", self.type)) |
| 10435 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10436 | packed.append(struct.pack("!L", self.xid)) |
| 10437 | packed.append(struct.pack("!Q", self.cookie)) |
| 10438 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10439 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10440 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10441 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10442 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10443 | packed.append(struct.pack("!H", self.priority)) |
| 10444 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10445 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10446 | packed.append(struct.pack("!L", self.out_group)) |
| 10447 | packed.append(struct.pack("!H", self.flags)) |
| 10448 | packed.append('\x00' * 2) |
| 10449 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10450 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10451 | length = sum([len(x) for x in packed]) |
| 10452 | packed[2] = struct.pack("!H", length) |
| 10453 | return ''.join(packed) |
| 10454 | |
| 10455 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10456 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10457 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10458 | _version = reader.read("!B")[0] |
| 10459 | assert(_version == 4) |
| 10460 | _type = reader.read("!B")[0] |
| 10461 | assert(_type == 14) |
| 10462 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10463 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10464 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10465 | obj.xid = reader.read("!L")[0] |
| 10466 | obj.cookie = reader.read("!Q")[0] |
| 10467 | obj.cookie_mask = reader.read("!Q")[0] |
| 10468 | obj.table_id = reader.read("!B")[0] |
| 10469 | __command = util.unpack_fm_cmd(reader) |
| 10470 | assert(__command == 1) |
| 10471 | obj.idle_timeout = reader.read("!H")[0] |
| 10472 | obj.hard_timeout = reader.read("!H")[0] |
| 10473 | obj.priority = reader.read("!H")[0] |
| 10474 | obj.buffer_id = reader.read("!L")[0] |
| 10475 | obj.out_port = util.unpack_port_no(reader) |
| 10476 | obj.out_group = reader.read("!L")[0] |
| 10477 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10478 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10479 | obj.match = ofp.match.unpack(reader) |
| 10480 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10481 | return obj |
| 10482 | |
| 10483 | def __eq__(self, other): |
| 10484 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10485 | if self.xid != other.xid: return False |
| 10486 | if self.cookie != other.cookie: return False |
| 10487 | if self.cookie_mask != other.cookie_mask: return False |
| 10488 | if self.table_id != other.table_id: return False |
| 10489 | if self.idle_timeout != other.idle_timeout: return False |
| 10490 | if self.hard_timeout != other.hard_timeout: return False |
| 10491 | if self.priority != other.priority: return False |
| 10492 | if self.buffer_id != other.buffer_id: return False |
| 10493 | if self.out_port != other.out_port: return False |
| 10494 | if self.out_group != other.out_group: return False |
| 10495 | if self.flags != other.flags: return False |
| 10496 | if self.match != other.match: return False |
| 10497 | if self.instructions != other.instructions: return False |
| 10498 | return True |
| 10499 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10500 | def pretty_print(self, q): |
| 10501 | q.text("flow_modify {") |
| 10502 | with q.group(): |
| 10503 | with q.indent(2): |
| 10504 | q.breakable() |
| 10505 | q.text("xid = "); |
| 10506 | if self.xid != None: |
| 10507 | q.text("%#x" % self.xid) |
| 10508 | else: |
| 10509 | q.text('None') |
| 10510 | q.text(","); q.breakable() |
| 10511 | q.text("cookie = "); |
| 10512 | q.text("%#x" % self.cookie) |
| 10513 | q.text(","); q.breakable() |
| 10514 | q.text("cookie_mask = "); |
| 10515 | q.text("%#x" % self.cookie_mask) |
| 10516 | q.text(","); q.breakable() |
| 10517 | q.text("table_id = "); |
| 10518 | q.text("%#x" % self.table_id) |
| 10519 | q.text(","); q.breakable() |
| 10520 | q.text("idle_timeout = "); |
| 10521 | q.text("%#x" % self.idle_timeout) |
| 10522 | q.text(","); q.breakable() |
| 10523 | q.text("hard_timeout = "); |
| 10524 | q.text("%#x" % self.hard_timeout) |
| 10525 | q.text(","); q.breakable() |
| 10526 | q.text("priority = "); |
| 10527 | q.text("%#x" % self.priority) |
| 10528 | q.text(","); q.breakable() |
| 10529 | q.text("buffer_id = "); |
| 10530 | q.text("%#x" % self.buffer_id) |
| 10531 | q.text(","); q.breakable() |
| 10532 | q.text("out_port = "); |
| 10533 | q.text(util.pretty_port(self.out_port)) |
| 10534 | q.text(","); q.breakable() |
| 10535 | q.text("out_group = "); |
| 10536 | q.text("%#x" % self.out_group) |
| 10537 | q.text(","); q.breakable() |
| 10538 | q.text("flags = "); |
| 10539 | q.text("%#x" % self.flags) |
| 10540 | q.text(","); q.breakable() |
| 10541 | q.text("match = "); |
| 10542 | q.pp(self.match) |
| 10543 | q.text(","); q.breakable() |
| 10544 | q.text("instructions = "); |
| 10545 | q.pp(self.instructions) |
| 10546 | q.breakable() |
| 10547 | q.text('}') |
| 10548 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10549 | flow_mod.subtypes[1] = flow_modify |
| 10550 | |
| 10551 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10552 | version = 4 |
| 10553 | type = 14 |
| 10554 | _command = 2 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10555 | |
| 10556 | 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] | 10557 | if xid != None: |
| 10558 | self.xid = xid |
| 10559 | else: |
| 10560 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10561 | if cookie != None: |
| 10562 | self.cookie = cookie |
| 10563 | else: |
| 10564 | self.cookie = 0 |
| 10565 | if cookie_mask != None: |
| 10566 | self.cookie_mask = cookie_mask |
| 10567 | else: |
| 10568 | self.cookie_mask = 0 |
| 10569 | if table_id != None: |
| 10570 | self.table_id = table_id |
| 10571 | else: |
| 10572 | self.table_id = 0 |
| 10573 | if idle_timeout != None: |
| 10574 | self.idle_timeout = idle_timeout |
| 10575 | else: |
| 10576 | self.idle_timeout = 0 |
| 10577 | if hard_timeout != None: |
| 10578 | self.hard_timeout = hard_timeout |
| 10579 | else: |
| 10580 | self.hard_timeout = 0 |
| 10581 | if priority != None: |
| 10582 | self.priority = priority |
| 10583 | else: |
| 10584 | self.priority = 0 |
| 10585 | if buffer_id != None: |
| 10586 | self.buffer_id = buffer_id |
| 10587 | else: |
| 10588 | self.buffer_id = 0 |
| 10589 | if out_port != None: |
| 10590 | self.out_port = out_port |
| 10591 | else: |
| 10592 | self.out_port = 0 |
| 10593 | if out_group != None: |
| 10594 | self.out_group = out_group |
| 10595 | else: |
| 10596 | self.out_group = 0 |
| 10597 | if flags != None: |
| 10598 | self.flags = flags |
| 10599 | else: |
| 10600 | self.flags = 0 |
| 10601 | if match != None: |
| 10602 | self.match = match |
| 10603 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10604 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10605 | if instructions != None: |
| 10606 | self.instructions = instructions |
| 10607 | else: |
| 10608 | self.instructions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10609 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10610 | |
| 10611 | def pack(self): |
| 10612 | packed = [] |
| 10613 | packed.append(struct.pack("!B", self.version)) |
| 10614 | packed.append(struct.pack("!B", self.type)) |
| 10615 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10616 | packed.append(struct.pack("!L", self.xid)) |
| 10617 | packed.append(struct.pack("!Q", self.cookie)) |
| 10618 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 10619 | packed.append(struct.pack("!B", self.table_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10620 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10621 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10622 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10623 | packed.append(struct.pack("!H", self.priority)) |
| 10624 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10625 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10626 | packed.append(struct.pack("!L", self.out_group)) |
| 10627 | packed.append(struct.pack("!H", self.flags)) |
| 10628 | packed.append('\x00' * 2) |
| 10629 | packed.append(self.match.pack()) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10630 | packed.append(loxi.generic_util.pack_list(self.instructions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10631 | length = sum([len(x) for x in packed]) |
| 10632 | packed[2] = struct.pack("!H", length) |
| 10633 | return ''.join(packed) |
| 10634 | |
| 10635 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10636 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10637 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10638 | _version = reader.read("!B")[0] |
| 10639 | assert(_version == 4) |
| 10640 | _type = reader.read("!B")[0] |
| 10641 | assert(_type == 14) |
| 10642 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10643 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10644 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10645 | obj.xid = reader.read("!L")[0] |
| 10646 | obj.cookie = reader.read("!Q")[0] |
| 10647 | obj.cookie_mask = reader.read("!Q")[0] |
| 10648 | obj.table_id = reader.read("!B")[0] |
| 10649 | __command = util.unpack_fm_cmd(reader) |
| 10650 | assert(__command == 2) |
| 10651 | obj.idle_timeout = reader.read("!H")[0] |
| 10652 | obj.hard_timeout = reader.read("!H")[0] |
| 10653 | obj.priority = reader.read("!H")[0] |
| 10654 | obj.buffer_id = reader.read("!L")[0] |
| 10655 | obj.out_port = util.unpack_port_no(reader) |
| 10656 | obj.out_group = reader.read("!L")[0] |
| 10657 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10658 | reader.skip(2) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10659 | obj.match = ofp.match.unpack(reader) |
| 10660 | obj.instructions = loxi.generic_util.unpack_list(reader, ofp.instruction.instruction.unpack) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10661 | return obj |
| 10662 | |
| 10663 | def __eq__(self, other): |
| 10664 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10665 | if self.xid != other.xid: return False |
| 10666 | if self.cookie != other.cookie: return False |
| 10667 | if self.cookie_mask != other.cookie_mask: return False |
| 10668 | if self.table_id != other.table_id: return False |
| 10669 | if self.idle_timeout != other.idle_timeout: return False |
| 10670 | if self.hard_timeout != other.hard_timeout: return False |
| 10671 | if self.priority != other.priority: return False |
| 10672 | if self.buffer_id != other.buffer_id: return False |
| 10673 | if self.out_port != other.out_port: return False |
| 10674 | if self.out_group != other.out_group: return False |
| 10675 | if self.flags != other.flags: return False |
| 10676 | if self.match != other.match: return False |
| 10677 | if self.instructions != other.instructions: return False |
| 10678 | return True |
| 10679 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10680 | def pretty_print(self, q): |
| 10681 | q.text("flow_modify_strict {") |
| 10682 | with q.group(): |
| 10683 | with q.indent(2): |
| 10684 | q.breakable() |
| 10685 | q.text("xid = "); |
| 10686 | if self.xid != None: |
| 10687 | q.text("%#x" % self.xid) |
| 10688 | else: |
| 10689 | q.text('None') |
| 10690 | q.text(","); q.breakable() |
| 10691 | q.text("cookie = "); |
| 10692 | q.text("%#x" % self.cookie) |
| 10693 | q.text(","); q.breakable() |
| 10694 | q.text("cookie_mask = "); |
| 10695 | q.text("%#x" % self.cookie_mask) |
| 10696 | q.text(","); q.breakable() |
| 10697 | q.text("table_id = "); |
| 10698 | q.text("%#x" % self.table_id) |
| 10699 | q.text(","); q.breakable() |
| 10700 | q.text("idle_timeout = "); |
| 10701 | q.text("%#x" % self.idle_timeout) |
| 10702 | q.text(","); q.breakable() |
| 10703 | q.text("hard_timeout = "); |
| 10704 | q.text("%#x" % self.hard_timeout) |
| 10705 | q.text(","); q.breakable() |
| 10706 | q.text("priority = "); |
| 10707 | q.text("%#x" % self.priority) |
| 10708 | q.text(","); q.breakable() |
| 10709 | q.text("buffer_id = "); |
| 10710 | q.text("%#x" % self.buffer_id) |
| 10711 | q.text(","); q.breakable() |
| 10712 | q.text("out_port = "); |
| 10713 | q.text(util.pretty_port(self.out_port)) |
| 10714 | q.text(","); q.breakable() |
| 10715 | q.text("out_group = "); |
| 10716 | q.text("%#x" % self.out_group) |
| 10717 | q.text(","); q.breakable() |
| 10718 | q.text("flags = "); |
| 10719 | q.text("%#x" % self.flags) |
| 10720 | q.text(","); q.breakable() |
| 10721 | q.text("match = "); |
| 10722 | q.pp(self.match) |
| 10723 | q.text(","); q.breakable() |
| 10724 | q.text("instructions = "); |
| 10725 | q.pp(self.instructions) |
| 10726 | q.breakable() |
| 10727 | q.text('}') |
| 10728 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10729 | flow_mod.subtypes[2] = flow_modify_strict |
| 10730 | |
| 10731 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10732 | version = 4 |
| 10733 | type = 11 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10734 | |
| 10735 | 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] | 10736 | if xid != None: |
| 10737 | self.xid = xid |
| 10738 | else: |
| 10739 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10740 | if cookie != None: |
| 10741 | self.cookie = cookie |
| 10742 | else: |
| 10743 | self.cookie = 0 |
| 10744 | if priority != None: |
| 10745 | self.priority = priority |
| 10746 | else: |
| 10747 | self.priority = 0 |
| 10748 | if reason != None: |
| 10749 | self.reason = reason |
| 10750 | else: |
| 10751 | self.reason = 0 |
| 10752 | if table_id != None: |
| 10753 | self.table_id = table_id |
| 10754 | else: |
| 10755 | self.table_id = 0 |
| 10756 | if duration_sec != None: |
| 10757 | self.duration_sec = duration_sec |
| 10758 | else: |
| 10759 | self.duration_sec = 0 |
| 10760 | if duration_nsec != None: |
| 10761 | self.duration_nsec = duration_nsec |
| 10762 | else: |
| 10763 | self.duration_nsec = 0 |
| 10764 | if idle_timeout != None: |
| 10765 | self.idle_timeout = idle_timeout |
| 10766 | else: |
| 10767 | self.idle_timeout = 0 |
| 10768 | if hard_timeout != None: |
| 10769 | self.hard_timeout = hard_timeout |
| 10770 | else: |
| 10771 | self.hard_timeout = 0 |
| 10772 | if packet_count != None: |
| 10773 | self.packet_count = packet_count |
| 10774 | else: |
| 10775 | self.packet_count = 0 |
| 10776 | if byte_count != None: |
| 10777 | self.byte_count = byte_count |
| 10778 | else: |
| 10779 | self.byte_count = 0 |
| 10780 | if match != None: |
| 10781 | self.match = match |
| 10782 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10783 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10784 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10785 | |
| 10786 | def pack(self): |
| 10787 | packed = [] |
| 10788 | packed.append(struct.pack("!B", self.version)) |
| 10789 | packed.append(struct.pack("!B", self.type)) |
| 10790 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10791 | packed.append(struct.pack("!L", self.xid)) |
| 10792 | packed.append(struct.pack("!Q", self.cookie)) |
| 10793 | packed.append(struct.pack("!H", self.priority)) |
| 10794 | packed.append(struct.pack("!B", self.reason)) |
| 10795 | packed.append(struct.pack("!B", self.table_id)) |
| 10796 | packed.append(struct.pack("!L", self.duration_sec)) |
| 10797 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 10798 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 10799 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 10800 | packed.append(struct.pack("!Q", self.packet_count)) |
| 10801 | packed.append(struct.pack("!Q", self.byte_count)) |
| 10802 | packed.append(self.match.pack()) |
| 10803 | length = sum([len(x) for x in packed]) |
| 10804 | packed[2] = struct.pack("!H", length) |
| 10805 | return ''.join(packed) |
| 10806 | |
| 10807 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10808 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10809 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10810 | _version = reader.read("!B")[0] |
| 10811 | assert(_version == 4) |
| 10812 | _type = reader.read("!B")[0] |
| 10813 | assert(_type == 11) |
| 10814 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10815 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10816 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10817 | obj.xid = reader.read("!L")[0] |
| 10818 | obj.cookie = reader.read("!Q")[0] |
| 10819 | obj.priority = reader.read("!H")[0] |
| 10820 | obj.reason = reader.read("!B")[0] |
| 10821 | obj.table_id = reader.read("!B")[0] |
| 10822 | obj.duration_sec = reader.read("!L")[0] |
| 10823 | obj.duration_nsec = reader.read("!L")[0] |
| 10824 | obj.idle_timeout = reader.read("!H")[0] |
| 10825 | obj.hard_timeout = reader.read("!H")[0] |
| 10826 | obj.packet_count = reader.read("!Q")[0] |
| 10827 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10828 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10829 | return obj |
| 10830 | |
| 10831 | def __eq__(self, other): |
| 10832 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10833 | if self.xid != other.xid: return False |
| 10834 | if self.cookie != other.cookie: return False |
| 10835 | if self.priority != other.priority: return False |
| 10836 | if self.reason != other.reason: return False |
| 10837 | if self.table_id != other.table_id: return False |
| 10838 | if self.duration_sec != other.duration_sec: return False |
| 10839 | if self.duration_nsec != other.duration_nsec: return False |
| 10840 | if self.idle_timeout != other.idle_timeout: return False |
| 10841 | if self.hard_timeout != other.hard_timeout: return False |
| 10842 | if self.packet_count != other.packet_count: return False |
| 10843 | if self.byte_count != other.byte_count: return False |
| 10844 | if self.match != other.match: return False |
| 10845 | return True |
| 10846 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10847 | def pretty_print(self, q): |
| 10848 | q.text("flow_removed {") |
| 10849 | with q.group(): |
| 10850 | with q.indent(2): |
| 10851 | q.breakable() |
| 10852 | q.text("xid = "); |
| 10853 | if self.xid != None: |
| 10854 | q.text("%#x" % self.xid) |
| 10855 | else: |
| 10856 | q.text('None') |
| 10857 | q.text(","); q.breakable() |
| 10858 | q.text("cookie = "); |
| 10859 | q.text("%#x" % self.cookie) |
| 10860 | q.text(","); q.breakable() |
| 10861 | q.text("priority = "); |
| 10862 | q.text("%#x" % self.priority) |
| 10863 | q.text(","); q.breakable() |
| 10864 | q.text("reason = "); |
| 10865 | q.text("%#x" % self.reason) |
| 10866 | q.text(","); q.breakable() |
| 10867 | q.text("table_id = "); |
| 10868 | q.text("%#x" % self.table_id) |
| 10869 | q.text(","); q.breakable() |
| 10870 | q.text("duration_sec = "); |
| 10871 | q.text("%#x" % self.duration_sec) |
| 10872 | q.text(","); q.breakable() |
| 10873 | q.text("duration_nsec = "); |
| 10874 | q.text("%#x" % self.duration_nsec) |
| 10875 | q.text(","); q.breakable() |
| 10876 | q.text("idle_timeout = "); |
| 10877 | q.text("%#x" % self.idle_timeout) |
| 10878 | q.text(","); q.breakable() |
| 10879 | q.text("hard_timeout = "); |
| 10880 | q.text("%#x" % self.hard_timeout) |
| 10881 | q.text(","); q.breakable() |
| 10882 | q.text("packet_count = "); |
| 10883 | q.text("%#x" % self.packet_count) |
| 10884 | q.text(","); q.breakable() |
| 10885 | q.text("byte_count = "); |
| 10886 | q.text("%#x" % self.byte_count) |
| 10887 | q.text(","); q.breakable() |
| 10888 | q.text("match = "); |
| 10889 | q.pp(self.match) |
| 10890 | q.breakable() |
| 10891 | q.text('}') |
| 10892 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10893 | message.subtypes[11] = flow_removed |
| 10894 | |
| 10895 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10896 | version = 4 |
| 10897 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10898 | stats_type = 1 |
| 10899 | |
| 10900 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10901 | if xid != None: |
| 10902 | self.xid = xid |
| 10903 | else: |
| 10904 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10905 | if flags != None: |
| 10906 | self.flags = flags |
| 10907 | else: |
| 10908 | self.flags = 0 |
| 10909 | if entries != None: |
| 10910 | self.entries = entries |
| 10911 | else: |
| 10912 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10913 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10914 | |
| 10915 | def pack(self): |
| 10916 | packed = [] |
| 10917 | packed.append(struct.pack("!B", self.version)) |
| 10918 | packed.append(struct.pack("!B", self.type)) |
| 10919 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 10920 | packed.append(struct.pack("!L", self.xid)) |
| 10921 | packed.append(struct.pack("!H", self.stats_type)) |
| 10922 | packed.append(struct.pack("!H", self.flags)) |
| 10923 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10924 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10925 | length = sum([len(x) for x in packed]) |
| 10926 | packed[2] = struct.pack("!H", length) |
| 10927 | return ''.join(packed) |
| 10928 | |
| 10929 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10930 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10931 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10932 | _version = reader.read("!B")[0] |
| 10933 | assert(_version == 4) |
| 10934 | _type = reader.read("!B")[0] |
| 10935 | assert(_type == 19) |
| 10936 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10937 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 10938 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10939 | obj.xid = reader.read("!L")[0] |
| 10940 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10941 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10942 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10943 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 10944 | 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] | 10945 | return obj |
| 10946 | |
| 10947 | def __eq__(self, other): |
| 10948 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10949 | if self.xid != other.xid: return False |
| 10950 | if self.flags != other.flags: return False |
| 10951 | if self.entries != other.entries: return False |
| 10952 | return True |
| 10953 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10954 | def pretty_print(self, q): |
| 10955 | q.text("flow_stats_reply {") |
| 10956 | with q.group(): |
| 10957 | with q.indent(2): |
| 10958 | q.breakable() |
| 10959 | q.text("xid = "); |
| 10960 | if self.xid != None: |
| 10961 | q.text("%#x" % self.xid) |
| 10962 | else: |
| 10963 | q.text('None') |
| 10964 | q.text(","); q.breakable() |
| 10965 | q.text("flags = "); |
| 10966 | q.text("%#x" % self.flags) |
| 10967 | q.text(","); q.breakable() |
| 10968 | q.text("entries = "); |
| 10969 | q.pp(self.entries) |
| 10970 | q.breakable() |
| 10971 | q.text('}') |
| 10972 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 10973 | stats_reply.subtypes[1] = flow_stats_reply |
| 10974 | |
| 10975 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 10976 | version = 4 |
| 10977 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10978 | stats_type = 1 |
| 10979 | |
| 10980 | 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] | 10981 | if xid != None: |
| 10982 | self.xid = xid |
| 10983 | else: |
| 10984 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 10985 | if flags != None: |
| 10986 | self.flags = flags |
| 10987 | else: |
| 10988 | self.flags = 0 |
| 10989 | if table_id != None: |
| 10990 | self.table_id = table_id |
| 10991 | else: |
| 10992 | self.table_id = 0 |
| 10993 | if out_port != None: |
| 10994 | self.out_port = out_port |
| 10995 | else: |
| 10996 | self.out_port = 0 |
| 10997 | if out_group != None: |
| 10998 | self.out_group = out_group |
| 10999 | else: |
| 11000 | self.out_group = 0 |
| 11001 | if cookie != None: |
| 11002 | self.cookie = cookie |
| 11003 | else: |
| 11004 | self.cookie = 0 |
| 11005 | if cookie_mask != None: |
| 11006 | self.cookie_mask = cookie_mask |
| 11007 | else: |
| 11008 | self.cookie_mask = 0 |
| 11009 | if match != None: |
| 11010 | self.match = match |
| 11011 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11012 | self.match = ofp.match() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11013 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11014 | |
| 11015 | def pack(self): |
| 11016 | packed = [] |
| 11017 | packed.append(struct.pack("!B", self.version)) |
| 11018 | packed.append(struct.pack("!B", self.type)) |
| 11019 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11020 | packed.append(struct.pack("!L", self.xid)) |
| 11021 | packed.append(struct.pack("!H", self.stats_type)) |
| 11022 | packed.append(struct.pack("!H", self.flags)) |
| 11023 | packed.append('\x00' * 4) |
| 11024 | packed.append(struct.pack("!B", self.table_id)) |
| 11025 | packed.append('\x00' * 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11026 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11027 | packed.append(struct.pack("!L", self.out_group)) |
| 11028 | packed.append('\x00' * 4) |
| 11029 | packed.append(struct.pack("!Q", self.cookie)) |
| 11030 | packed.append(struct.pack("!Q", self.cookie_mask)) |
| 11031 | packed.append(self.match.pack()) |
| 11032 | length = sum([len(x) for x in packed]) |
| 11033 | packed[2] = struct.pack("!H", length) |
| 11034 | return ''.join(packed) |
| 11035 | |
| 11036 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11037 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11038 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11039 | _version = reader.read("!B")[0] |
| 11040 | assert(_version == 4) |
| 11041 | _type = reader.read("!B")[0] |
| 11042 | assert(_type == 18) |
| 11043 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11044 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11045 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11046 | obj.xid = reader.read("!L")[0] |
| 11047 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11048 | assert(_stats_type == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11049 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11050 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11051 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11052 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11053 | obj.out_port = util.unpack_port_no(reader) |
| 11054 | obj.out_group = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11055 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11056 | obj.cookie = reader.read("!Q")[0] |
| 11057 | obj.cookie_mask = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11058 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11059 | return obj |
| 11060 | |
| 11061 | def __eq__(self, other): |
| 11062 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11063 | if self.xid != other.xid: return False |
| 11064 | if self.flags != other.flags: return False |
| 11065 | if self.table_id != other.table_id: return False |
| 11066 | if self.out_port != other.out_port: return False |
| 11067 | if self.out_group != other.out_group: return False |
| 11068 | if self.cookie != other.cookie: return False |
| 11069 | if self.cookie_mask != other.cookie_mask: return False |
| 11070 | if self.match != other.match: return False |
| 11071 | return True |
| 11072 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11073 | def pretty_print(self, q): |
| 11074 | q.text("flow_stats_request {") |
| 11075 | with q.group(): |
| 11076 | with q.indent(2): |
| 11077 | q.breakable() |
| 11078 | q.text("xid = "); |
| 11079 | if self.xid != None: |
| 11080 | q.text("%#x" % self.xid) |
| 11081 | else: |
| 11082 | q.text('None') |
| 11083 | q.text(","); q.breakable() |
| 11084 | q.text("flags = "); |
| 11085 | q.text("%#x" % self.flags) |
| 11086 | q.text(","); q.breakable() |
| 11087 | q.text("table_id = "); |
| 11088 | q.text("%#x" % self.table_id) |
| 11089 | q.text(","); q.breakable() |
| 11090 | q.text("out_port = "); |
| 11091 | q.text(util.pretty_port(self.out_port)) |
| 11092 | q.text(","); q.breakable() |
| 11093 | q.text("out_group = "); |
| 11094 | q.text("%#x" % self.out_group) |
| 11095 | q.text(","); q.breakable() |
| 11096 | q.text("cookie = "); |
| 11097 | q.text("%#x" % self.cookie) |
| 11098 | q.text(","); q.breakable() |
| 11099 | q.text("cookie_mask = "); |
| 11100 | q.text("%#x" % self.cookie_mask) |
| 11101 | q.text(","); q.breakable() |
| 11102 | q.text("match = "); |
| 11103 | q.pp(self.match) |
| 11104 | q.breakable() |
| 11105 | q.text('}') |
| 11106 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11107 | stats_request.subtypes[1] = flow_stats_request |
| 11108 | |
| 11109 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11110 | version = 4 |
| 11111 | type = 8 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11112 | |
| 11113 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11114 | if xid != None: |
| 11115 | self.xid = xid |
| 11116 | else: |
| 11117 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11118 | if flags != None: |
| 11119 | self.flags = flags |
| 11120 | else: |
| 11121 | self.flags = 0 |
| 11122 | if miss_send_len != None: |
| 11123 | self.miss_send_len = miss_send_len |
| 11124 | else: |
| 11125 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11126 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11127 | |
| 11128 | def pack(self): |
| 11129 | packed = [] |
| 11130 | packed.append(struct.pack("!B", self.version)) |
| 11131 | packed.append(struct.pack("!B", self.type)) |
| 11132 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11133 | packed.append(struct.pack("!L", self.xid)) |
| 11134 | packed.append(struct.pack("!H", self.flags)) |
| 11135 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 11136 | length = sum([len(x) for x in packed]) |
| 11137 | packed[2] = struct.pack("!H", length) |
| 11138 | return ''.join(packed) |
| 11139 | |
| 11140 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11141 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11142 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11143 | _version = reader.read("!B")[0] |
| 11144 | assert(_version == 4) |
| 11145 | _type = reader.read("!B")[0] |
| 11146 | assert(_type == 8) |
| 11147 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11148 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11149 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11150 | obj.xid = reader.read("!L")[0] |
| 11151 | obj.flags = reader.read("!H")[0] |
| 11152 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11153 | return obj |
| 11154 | |
| 11155 | def __eq__(self, other): |
| 11156 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11157 | if self.xid != other.xid: return False |
| 11158 | if self.flags != other.flags: return False |
| 11159 | if self.miss_send_len != other.miss_send_len: return False |
| 11160 | return True |
| 11161 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11162 | def pretty_print(self, q): |
| 11163 | q.text("get_config_reply {") |
| 11164 | with q.group(): |
| 11165 | with q.indent(2): |
| 11166 | q.breakable() |
| 11167 | q.text("xid = "); |
| 11168 | if self.xid != None: |
| 11169 | q.text("%#x" % self.xid) |
| 11170 | else: |
| 11171 | q.text('None') |
| 11172 | q.text(","); q.breakable() |
| 11173 | q.text("flags = "); |
| 11174 | q.text("%#x" % self.flags) |
| 11175 | q.text(","); q.breakable() |
| 11176 | q.text("miss_send_len = "); |
| 11177 | q.text("%#x" % self.miss_send_len) |
| 11178 | q.breakable() |
| 11179 | q.text('}') |
| 11180 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11181 | message.subtypes[8] = get_config_reply |
| 11182 | |
| 11183 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11184 | version = 4 |
| 11185 | type = 7 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11186 | |
| 11187 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11188 | if xid != None: |
| 11189 | self.xid = xid |
| 11190 | else: |
| 11191 | self.xid = None |
| 11192 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11193 | |
| 11194 | def pack(self): |
| 11195 | packed = [] |
| 11196 | packed.append(struct.pack("!B", self.version)) |
| 11197 | packed.append(struct.pack("!B", self.type)) |
| 11198 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11199 | packed.append(struct.pack("!L", self.xid)) |
| 11200 | length = sum([len(x) for x in packed]) |
| 11201 | packed[2] = struct.pack("!H", length) |
| 11202 | return ''.join(packed) |
| 11203 | |
| 11204 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11205 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11206 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11207 | _version = reader.read("!B")[0] |
| 11208 | assert(_version == 4) |
| 11209 | _type = reader.read("!B")[0] |
| 11210 | assert(_type == 7) |
| 11211 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11212 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11213 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11214 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11215 | return obj |
| 11216 | |
| 11217 | def __eq__(self, other): |
| 11218 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11219 | if self.xid != other.xid: return False |
| 11220 | return True |
| 11221 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11222 | def pretty_print(self, q): |
| 11223 | q.text("get_config_request {") |
| 11224 | with q.group(): |
| 11225 | with q.indent(2): |
| 11226 | q.breakable() |
| 11227 | q.text("xid = "); |
| 11228 | if self.xid != None: |
| 11229 | q.text("%#x" % self.xid) |
| 11230 | else: |
| 11231 | q.text('None') |
| 11232 | q.breakable() |
| 11233 | q.text('}') |
| 11234 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11235 | message.subtypes[7] = get_config_request |
| 11236 | |
| 11237 | class group_mod(message): |
| 11238 | subtypes = {} |
| 11239 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11240 | version = 4 |
| 11241 | type = 15 |
| 11242 | |
| 11243 | def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None): |
| 11244 | if xid != None: |
| 11245 | self.xid = xid |
| 11246 | else: |
| 11247 | self.xid = None |
| 11248 | if command != None: |
| 11249 | self.command = command |
| 11250 | else: |
| 11251 | self.command = 0 |
| 11252 | if group_type != None: |
| 11253 | self.group_type = group_type |
| 11254 | else: |
| 11255 | self.group_type = 0 |
| 11256 | if group_id != None: |
| 11257 | self.group_id = group_id |
| 11258 | else: |
| 11259 | self.group_id = 0 |
| 11260 | if buckets != None: |
| 11261 | self.buckets = buckets |
| 11262 | else: |
| 11263 | self.buckets = [] |
| 11264 | return |
| 11265 | |
| 11266 | def pack(self): |
| 11267 | packed = [] |
| 11268 | packed.append(struct.pack("!B", self.version)) |
| 11269 | packed.append(struct.pack("!B", self.type)) |
| 11270 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11271 | packed.append(struct.pack("!L", self.xid)) |
| 11272 | packed.append(struct.pack("!H", self.command)) |
| 11273 | packed.append(struct.pack("!B", self.group_type)) |
| 11274 | packed.append('\x00' * 1) |
| 11275 | packed.append(struct.pack("!L", self.group_id)) |
| 11276 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
| 11277 | length = sum([len(x) for x in packed]) |
| 11278 | packed[2] = struct.pack("!H", length) |
| 11279 | return ''.join(packed) |
| 11280 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11281 | @staticmethod |
| 11282 | def unpack(reader): |
| 11283 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11284 | subclass = group_mod.subtypes.get(subtype) |
| 11285 | if subclass: |
| 11286 | return subclass.unpack(reader) |
| 11287 | |
| 11288 | obj = group_mod() |
| 11289 | _version = reader.read("!B")[0] |
| 11290 | assert(_version == 4) |
| 11291 | _type = reader.read("!B")[0] |
| 11292 | assert(_type == 15) |
| 11293 | _length = reader.read("!H")[0] |
| 11294 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11295 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11296 | obj.xid = reader.read("!L")[0] |
| 11297 | obj.command = reader.read("!H")[0] |
| 11298 | obj.group_type = reader.read("!B")[0] |
| 11299 | reader.skip(1) |
| 11300 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11301 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 11302 | return obj |
| 11303 | |
| 11304 | def __eq__(self, other): |
| 11305 | if type(self) != type(other): return False |
| 11306 | if self.xid != other.xid: return False |
| 11307 | if self.command != other.command: return False |
| 11308 | if self.group_type != other.group_type: return False |
| 11309 | if self.group_id != other.group_id: return False |
| 11310 | if self.buckets != other.buckets: return False |
| 11311 | return True |
| 11312 | |
| 11313 | def pretty_print(self, q): |
| 11314 | q.text("group_mod {") |
| 11315 | with q.group(): |
| 11316 | with q.indent(2): |
| 11317 | q.breakable() |
| 11318 | q.text("xid = "); |
| 11319 | if self.xid != None: |
| 11320 | q.text("%#x" % self.xid) |
| 11321 | else: |
| 11322 | q.text('None') |
| 11323 | q.text(","); q.breakable() |
| 11324 | q.text("group_type = "); |
| 11325 | q.text("%#x" % self.group_type) |
| 11326 | q.text(","); q.breakable() |
| 11327 | q.text("group_id = "); |
| 11328 | q.text("%#x" % self.group_id) |
| 11329 | q.text(","); q.breakable() |
| 11330 | q.text("buckets = "); |
| 11331 | q.pp(self.buckets) |
| 11332 | q.breakable() |
| 11333 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11334 | |
| 11335 | message.subtypes[15] = group_mod |
| 11336 | |
| 11337 | class group_add(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11338 | version = 4 |
| 11339 | type = 15 |
| 11340 | command = 0 |
| 11341 | |
| 11342 | 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] | 11343 | if xid != None: |
| 11344 | self.xid = xid |
| 11345 | else: |
| 11346 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11347 | if group_type != None: |
| 11348 | self.group_type = group_type |
| 11349 | else: |
| 11350 | self.group_type = 0 |
| 11351 | if group_id != None: |
| 11352 | self.group_id = group_id |
| 11353 | else: |
| 11354 | self.group_id = 0 |
| 11355 | if buckets != None: |
| 11356 | self.buckets = buckets |
| 11357 | else: |
| 11358 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11359 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11360 | |
| 11361 | def pack(self): |
| 11362 | packed = [] |
| 11363 | packed.append(struct.pack("!B", self.version)) |
| 11364 | packed.append(struct.pack("!B", self.type)) |
| 11365 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11366 | packed.append(struct.pack("!L", self.xid)) |
| 11367 | packed.append(struct.pack("!H", self.command)) |
| 11368 | packed.append(struct.pack("!B", self.group_type)) |
| 11369 | packed.append('\x00' * 1) |
| 11370 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11371 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11372 | length = sum([len(x) for x in packed]) |
| 11373 | packed[2] = struct.pack("!H", length) |
| 11374 | return ''.join(packed) |
| 11375 | |
| 11376 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11377 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11378 | obj = group_add() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11379 | _version = reader.read("!B")[0] |
| 11380 | assert(_version == 4) |
| 11381 | _type = reader.read("!B")[0] |
| 11382 | assert(_type == 15) |
| 11383 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11384 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11385 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11386 | obj.xid = reader.read("!L")[0] |
| 11387 | _command = reader.read("!H")[0] |
| 11388 | assert(_command == 0) |
| 11389 | obj.group_type = reader.read("!B")[0] |
| 11390 | reader.skip(1) |
| 11391 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11392 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11393 | return obj |
| 11394 | |
| 11395 | def __eq__(self, other): |
| 11396 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11397 | if self.xid != other.xid: return False |
| 11398 | if self.group_type != other.group_type: return False |
| 11399 | if self.group_id != other.group_id: return False |
| 11400 | if self.buckets != other.buckets: return False |
| 11401 | return True |
| 11402 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11403 | def pretty_print(self, q): |
| 11404 | q.text("group_add {") |
| 11405 | with q.group(): |
| 11406 | with q.indent(2): |
| 11407 | q.breakable() |
| 11408 | q.text("xid = "); |
| 11409 | if self.xid != None: |
| 11410 | q.text("%#x" % self.xid) |
| 11411 | else: |
| 11412 | q.text('None') |
| 11413 | q.text(","); q.breakable() |
| 11414 | q.text("group_type = "); |
| 11415 | q.text("%#x" % self.group_type) |
| 11416 | q.text(","); q.breakable() |
| 11417 | q.text("group_id = "); |
| 11418 | q.text("%#x" % self.group_id) |
| 11419 | q.text(","); q.breakable() |
| 11420 | q.text("buckets = "); |
| 11421 | q.pp(self.buckets) |
| 11422 | q.breakable() |
| 11423 | q.text('}') |
| 11424 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11425 | group_mod.subtypes[0] = group_add |
| 11426 | |
| 11427 | class group_delete(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11428 | version = 4 |
| 11429 | type = 15 |
| 11430 | command = 2 |
| 11431 | |
| 11432 | 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] | 11433 | if xid != None: |
| 11434 | self.xid = xid |
| 11435 | else: |
| 11436 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11437 | if group_type != None: |
| 11438 | self.group_type = group_type |
| 11439 | else: |
| 11440 | self.group_type = 0 |
| 11441 | if group_id != None: |
| 11442 | self.group_id = group_id |
| 11443 | else: |
| 11444 | self.group_id = 0 |
| 11445 | if buckets != None: |
| 11446 | self.buckets = buckets |
| 11447 | else: |
| 11448 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11449 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11450 | |
| 11451 | def pack(self): |
| 11452 | packed = [] |
| 11453 | packed.append(struct.pack("!B", self.version)) |
| 11454 | packed.append(struct.pack("!B", self.type)) |
| 11455 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11456 | packed.append(struct.pack("!L", self.xid)) |
| 11457 | packed.append(struct.pack("!H", self.command)) |
| 11458 | packed.append(struct.pack("!B", self.group_type)) |
| 11459 | packed.append('\x00' * 1) |
| 11460 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11461 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11462 | length = sum([len(x) for x in packed]) |
| 11463 | packed[2] = struct.pack("!H", length) |
| 11464 | return ''.join(packed) |
| 11465 | |
| 11466 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11467 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11468 | obj = group_delete() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11469 | _version = reader.read("!B")[0] |
| 11470 | assert(_version == 4) |
| 11471 | _type = reader.read("!B")[0] |
| 11472 | assert(_type == 15) |
| 11473 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11474 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11475 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11476 | obj.xid = reader.read("!L")[0] |
| 11477 | _command = reader.read("!H")[0] |
| 11478 | assert(_command == 2) |
| 11479 | obj.group_type = reader.read("!B")[0] |
| 11480 | reader.skip(1) |
| 11481 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11482 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11483 | return obj |
| 11484 | |
| 11485 | def __eq__(self, other): |
| 11486 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11487 | if self.xid != other.xid: return False |
| 11488 | if self.group_type != other.group_type: return False |
| 11489 | if self.group_id != other.group_id: return False |
| 11490 | if self.buckets != other.buckets: return False |
| 11491 | return True |
| 11492 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11493 | def pretty_print(self, q): |
| 11494 | q.text("group_delete {") |
| 11495 | with q.group(): |
| 11496 | with q.indent(2): |
| 11497 | q.breakable() |
| 11498 | q.text("xid = "); |
| 11499 | if self.xid != None: |
| 11500 | q.text("%#x" % self.xid) |
| 11501 | else: |
| 11502 | q.text('None') |
| 11503 | q.text(","); q.breakable() |
| 11504 | q.text("group_type = "); |
| 11505 | q.text("%#x" % self.group_type) |
| 11506 | q.text(","); q.breakable() |
| 11507 | q.text("group_id = "); |
| 11508 | q.text("%#x" % self.group_id) |
| 11509 | q.text(","); q.breakable() |
| 11510 | q.text("buckets = "); |
| 11511 | q.pp(self.buckets) |
| 11512 | q.breakable() |
| 11513 | q.text('}') |
| 11514 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11515 | group_mod.subtypes[2] = group_delete |
| 11516 | |
| 11517 | class group_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11518 | version = 4 |
| 11519 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11520 | stats_type = 7 |
| 11521 | |
| 11522 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11523 | if xid != None: |
| 11524 | self.xid = xid |
| 11525 | else: |
| 11526 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11527 | if flags != None: |
| 11528 | self.flags = flags |
| 11529 | else: |
| 11530 | self.flags = 0 |
| 11531 | if entries != None: |
| 11532 | self.entries = entries |
| 11533 | else: |
| 11534 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11535 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11536 | |
| 11537 | def pack(self): |
| 11538 | packed = [] |
| 11539 | packed.append(struct.pack("!B", self.version)) |
| 11540 | packed.append(struct.pack("!B", self.type)) |
| 11541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11542 | packed.append(struct.pack("!L", self.xid)) |
| 11543 | packed.append(struct.pack("!H", self.stats_type)) |
| 11544 | packed.append(struct.pack("!H", self.flags)) |
| 11545 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11546 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11547 | length = sum([len(x) for x in packed]) |
| 11548 | packed[2] = struct.pack("!H", length) |
| 11549 | return ''.join(packed) |
| 11550 | |
| 11551 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11552 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11553 | obj = group_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11554 | _version = reader.read("!B")[0] |
| 11555 | assert(_version == 4) |
| 11556 | _type = reader.read("!B")[0] |
| 11557 | assert(_type == 19) |
| 11558 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11559 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11560 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11561 | obj.xid = reader.read("!L")[0] |
| 11562 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11563 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11564 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11565 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 11566 | 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] | 11567 | return obj |
| 11568 | |
| 11569 | def __eq__(self, other): |
| 11570 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11571 | if self.xid != other.xid: return False |
| 11572 | if self.flags != other.flags: return False |
| 11573 | if self.entries != other.entries: return False |
| 11574 | return True |
| 11575 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11576 | def pretty_print(self, q): |
| 11577 | q.text("group_desc_stats_reply {") |
| 11578 | with q.group(): |
| 11579 | with q.indent(2): |
| 11580 | q.breakable() |
| 11581 | q.text("xid = "); |
| 11582 | if self.xid != None: |
| 11583 | q.text("%#x" % self.xid) |
| 11584 | else: |
| 11585 | q.text('None') |
| 11586 | q.text(","); q.breakable() |
| 11587 | q.text("flags = "); |
| 11588 | q.text("%#x" % self.flags) |
| 11589 | q.text(","); q.breakable() |
| 11590 | q.text("entries = "); |
| 11591 | q.pp(self.entries) |
| 11592 | q.breakable() |
| 11593 | q.text('}') |
| 11594 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11595 | stats_reply.subtypes[7] = group_desc_stats_reply |
| 11596 | |
| 11597 | class group_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11598 | version = 4 |
| 11599 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11600 | stats_type = 7 |
| 11601 | |
| 11602 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11603 | if xid != None: |
| 11604 | self.xid = xid |
| 11605 | else: |
| 11606 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11607 | if flags != None: |
| 11608 | self.flags = flags |
| 11609 | else: |
| 11610 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11611 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11612 | |
| 11613 | def pack(self): |
| 11614 | packed = [] |
| 11615 | packed.append(struct.pack("!B", self.version)) |
| 11616 | packed.append(struct.pack("!B", self.type)) |
| 11617 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11618 | packed.append(struct.pack("!L", self.xid)) |
| 11619 | packed.append(struct.pack("!H", self.stats_type)) |
| 11620 | packed.append(struct.pack("!H", self.flags)) |
| 11621 | packed.append('\x00' * 4) |
| 11622 | length = sum([len(x) for x in packed]) |
| 11623 | packed[2] = struct.pack("!H", length) |
| 11624 | return ''.join(packed) |
| 11625 | |
| 11626 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11627 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11628 | obj = group_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11629 | _version = reader.read("!B")[0] |
| 11630 | assert(_version == 4) |
| 11631 | _type = reader.read("!B")[0] |
| 11632 | assert(_type == 18) |
| 11633 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11634 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11635 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11636 | obj.xid = reader.read("!L")[0] |
| 11637 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11638 | assert(_stats_type == 7) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11639 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11640 | reader.skip(4) |
| 11641 | return obj |
| 11642 | |
| 11643 | def __eq__(self, other): |
| 11644 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11645 | if self.xid != other.xid: return False |
| 11646 | if self.flags != other.flags: return False |
| 11647 | return True |
| 11648 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11649 | def pretty_print(self, q): |
| 11650 | q.text("group_desc_stats_request {") |
| 11651 | with q.group(): |
| 11652 | with q.indent(2): |
| 11653 | q.breakable() |
| 11654 | q.text("xid = "); |
| 11655 | if self.xid != None: |
| 11656 | q.text("%#x" % self.xid) |
| 11657 | else: |
| 11658 | q.text('None') |
| 11659 | q.text(","); q.breakable() |
| 11660 | q.text("flags = "); |
| 11661 | q.text("%#x" % self.flags) |
| 11662 | q.breakable() |
| 11663 | q.text('}') |
| 11664 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11665 | stats_request.subtypes[7] = group_desc_stats_request |
| 11666 | |
| 11667 | class group_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11668 | version = 4 |
| 11669 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11670 | stats_type = 8 |
| 11671 | |
| 11672 | 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] | 11673 | if xid != None: |
| 11674 | self.xid = xid |
| 11675 | else: |
| 11676 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11677 | if flags != None: |
| 11678 | self.flags = flags |
| 11679 | else: |
| 11680 | self.flags = 0 |
| 11681 | if types != None: |
| 11682 | self.types = types |
| 11683 | else: |
| 11684 | self.types = 0 |
| 11685 | if capabilities != None: |
| 11686 | self.capabilities = capabilities |
| 11687 | else: |
| 11688 | self.capabilities = 0 |
| 11689 | if max_groups_all != None: |
| 11690 | self.max_groups_all = max_groups_all |
| 11691 | else: |
| 11692 | self.max_groups_all = 0 |
| 11693 | if max_groups_select != None: |
| 11694 | self.max_groups_select = max_groups_select |
| 11695 | else: |
| 11696 | self.max_groups_select = 0 |
| 11697 | if max_groups_indirect != None: |
| 11698 | self.max_groups_indirect = max_groups_indirect |
| 11699 | else: |
| 11700 | self.max_groups_indirect = 0 |
| 11701 | if max_groups_ff != None: |
| 11702 | self.max_groups_ff = max_groups_ff |
| 11703 | else: |
| 11704 | self.max_groups_ff = 0 |
| 11705 | if actions_all != None: |
| 11706 | self.actions_all = actions_all |
| 11707 | else: |
| 11708 | self.actions_all = 0 |
| 11709 | if actions_select != None: |
| 11710 | self.actions_select = actions_select |
| 11711 | else: |
| 11712 | self.actions_select = 0 |
| 11713 | if actions_indirect != None: |
| 11714 | self.actions_indirect = actions_indirect |
| 11715 | else: |
| 11716 | self.actions_indirect = 0 |
| 11717 | if actions_ff != None: |
| 11718 | self.actions_ff = actions_ff |
| 11719 | else: |
| 11720 | self.actions_ff = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11721 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11722 | |
| 11723 | def pack(self): |
| 11724 | packed = [] |
| 11725 | packed.append(struct.pack("!B", self.version)) |
| 11726 | packed.append(struct.pack("!B", self.type)) |
| 11727 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11728 | packed.append(struct.pack("!L", self.xid)) |
| 11729 | packed.append(struct.pack("!H", self.stats_type)) |
| 11730 | packed.append(struct.pack("!H", self.flags)) |
| 11731 | packed.append('\x00' * 4) |
| 11732 | packed.append(struct.pack("!L", self.types)) |
| 11733 | packed.append(struct.pack("!L", self.capabilities)) |
| 11734 | packed.append(struct.pack("!L", self.max_groups_all)) |
| 11735 | packed.append(struct.pack("!L", self.max_groups_select)) |
| 11736 | packed.append(struct.pack("!L", self.max_groups_indirect)) |
| 11737 | packed.append(struct.pack("!L", self.max_groups_ff)) |
| 11738 | packed.append(struct.pack("!L", self.actions_all)) |
| 11739 | packed.append(struct.pack("!L", self.actions_select)) |
| 11740 | packed.append(struct.pack("!L", self.actions_indirect)) |
| 11741 | packed.append(struct.pack("!L", self.actions_ff)) |
| 11742 | length = sum([len(x) for x in packed]) |
| 11743 | packed[2] = struct.pack("!H", length) |
| 11744 | return ''.join(packed) |
| 11745 | |
| 11746 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11747 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11748 | obj = group_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11749 | _version = reader.read("!B")[0] |
| 11750 | assert(_version == 4) |
| 11751 | _type = reader.read("!B")[0] |
| 11752 | assert(_type == 19) |
| 11753 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11754 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11755 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11756 | obj.xid = reader.read("!L")[0] |
| 11757 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11758 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11759 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11760 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11761 | obj.types = reader.read("!L")[0] |
| 11762 | obj.capabilities = reader.read("!L")[0] |
| 11763 | obj.max_groups_all = reader.read("!L")[0] |
| 11764 | obj.max_groups_select = reader.read("!L")[0] |
| 11765 | obj.max_groups_indirect = reader.read("!L")[0] |
| 11766 | obj.max_groups_ff = reader.read("!L")[0] |
| 11767 | obj.actions_all = reader.read("!L")[0] |
| 11768 | obj.actions_select = reader.read("!L")[0] |
| 11769 | obj.actions_indirect = reader.read("!L")[0] |
| 11770 | obj.actions_ff = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11771 | return obj |
| 11772 | |
| 11773 | def __eq__(self, other): |
| 11774 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11775 | if self.xid != other.xid: return False |
| 11776 | if self.flags != other.flags: return False |
| 11777 | if self.types != other.types: return False |
| 11778 | if self.capabilities != other.capabilities: return False |
| 11779 | if self.max_groups_all != other.max_groups_all: return False |
| 11780 | if self.max_groups_select != other.max_groups_select: return False |
| 11781 | if self.max_groups_indirect != other.max_groups_indirect: return False |
| 11782 | if self.max_groups_ff != other.max_groups_ff: return False |
| 11783 | if self.actions_all != other.actions_all: return False |
| 11784 | if self.actions_select != other.actions_select: return False |
| 11785 | if self.actions_indirect != other.actions_indirect: return False |
| 11786 | if self.actions_ff != other.actions_ff: return False |
| 11787 | return True |
| 11788 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11789 | def pretty_print(self, q): |
| 11790 | q.text("group_features_stats_reply {") |
| 11791 | with q.group(): |
| 11792 | with q.indent(2): |
| 11793 | q.breakable() |
| 11794 | q.text("xid = "); |
| 11795 | if self.xid != None: |
| 11796 | q.text("%#x" % self.xid) |
| 11797 | else: |
| 11798 | q.text('None') |
| 11799 | q.text(","); q.breakable() |
| 11800 | q.text("flags = "); |
| 11801 | q.text("%#x" % self.flags) |
| 11802 | q.text(","); q.breakable() |
| 11803 | q.text("types = "); |
| 11804 | q.text("%#x" % self.types) |
| 11805 | q.text(","); q.breakable() |
| 11806 | q.text("capabilities = "); |
| 11807 | q.text("%#x" % self.capabilities) |
| 11808 | q.text(","); q.breakable() |
| 11809 | q.text("max_groups_all = "); |
| 11810 | q.text("%#x" % self.max_groups_all) |
| 11811 | q.text(","); q.breakable() |
| 11812 | q.text("max_groups_select = "); |
| 11813 | q.text("%#x" % self.max_groups_select) |
| 11814 | q.text(","); q.breakable() |
| 11815 | q.text("max_groups_indirect = "); |
| 11816 | q.text("%#x" % self.max_groups_indirect) |
| 11817 | q.text(","); q.breakable() |
| 11818 | q.text("max_groups_ff = "); |
| 11819 | q.text("%#x" % self.max_groups_ff) |
| 11820 | q.text(","); q.breakable() |
| 11821 | q.text("actions_all = "); |
| 11822 | q.text("%#x" % self.actions_all) |
| 11823 | q.text(","); q.breakable() |
| 11824 | q.text("actions_select = "); |
| 11825 | q.text("%#x" % self.actions_select) |
| 11826 | q.text(","); q.breakable() |
| 11827 | q.text("actions_indirect = "); |
| 11828 | q.text("%#x" % self.actions_indirect) |
| 11829 | q.text(","); q.breakable() |
| 11830 | q.text("actions_ff = "); |
| 11831 | q.text("%#x" % self.actions_ff) |
| 11832 | q.breakable() |
| 11833 | q.text('}') |
| 11834 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11835 | stats_reply.subtypes[8] = group_features_stats_reply |
| 11836 | |
| 11837 | class group_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11838 | version = 4 |
| 11839 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11840 | stats_type = 8 |
| 11841 | |
| 11842 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11843 | if xid != None: |
| 11844 | self.xid = xid |
| 11845 | else: |
| 11846 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11847 | if flags != None: |
| 11848 | self.flags = flags |
| 11849 | else: |
| 11850 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11851 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11852 | |
| 11853 | def pack(self): |
| 11854 | packed = [] |
| 11855 | packed.append(struct.pack("!B", self.version)) |
| 11856 | packed.append(struct.pack("!B", self.type)) |
| 11857 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11858 | packed.append(struct.pack("!L", self.xid)) |
| 11859 | packed.append(struct.pack("!H", self.stats_type)) |
| 11860 | packed.append(struct.pack("!H", self.flags)) |
| 11861 | packed.append('\x00' * 4) |
| 11862 | length = sum([len(x) for x in packed]) |
| 11863 | packed[2] = struct.pack("!H", length) |
| 11864 | return ''.join(packed) |
| 11865 | |
| 11866 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11867 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11868 | obj = group_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11869 | _version = reader.read("!B")[0] |
| 11870 | assert(_version == 4) |
| 11871 | _type = reader.read("!B")[0] |
| 11872 | assert(_type == 18) |
| 11873 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11874 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11875 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11876 | obj.xid = reader.read("!L")[0] |
| 11877 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11878 | assert(_stats_type == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 11879 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11880 | reader.skip(4) |
| 11881 | return obj |
| 11882 | |
| 11883 | def __eq__(self, other): |
| 11884 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11885 | if self.xid != other.xid: return False |
| 11886 | if self.flags != other.flags: return False |
| 11887 | return True |
| 11888 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 11889 | def pretty_print(self, q): |
| 11890 | q.text("group_features_stats_request {") |
| 11891 | with q.group(): |
| 11892 | with q.indent(2): |
| 11893 | q.breakable() |
| 11894 | q.text("xid = "); |
| 11895 | if self.xid != None: |
| 11896 | q.text("%#x" % self.xid) |
| 11897 | else: |
| 11898 | q.text('None') |
| 11899 | q.text(","); q.breakable() |
| 11900 | q.text("flags = "); |
| 11901 | q.text("%#x" % self.flags) |
| 11902 | q.breakable() |
| 11903 | q.text('}') |
| 11904 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11905 | stats_request.subtypes[8] = group_features_stats_request |
| 11906 | |
| 11907 | class group_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11908 | version = 4 |
| 11909 | type = 1 |
| 11910 | err_type = 6 |
| 11911 | |
| 11912 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11913 | if xid != None: |
| 11914 | self.xid = xid |
| 11915 | else: |
| 11916 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11917 | if code != None: |
| 11918 | self.code = code |
| 11919 | else: |
| 11920 | self.code = 0 |
| 11921 | if data != None: |
| 11922 | self.data = data |
| 11923 | else: |
| 11924 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11925 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11926 | |
| 11927 | def pack(self): |
| 11928 | packed = [] |
| 11929 | packed.append(struct.pack("!B", self.version)) |
| 11930 | packed.append(struct.pack("!B", self.type)) |
| 11931 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 11932 | packed.append(struct.pack("!L", self.xid)) |
| 11933 | packed.append(struct.pack("!H", self.err_type)) |
| 11934 | packed.append(struct.pack("!H", self.code)) |
| 11935 | packed.append(self.data) |
| 11936 | length = sum([len(x) for x in packed]) |
| 11937 | packed[2] = struct.pack("!H", length) |
| 11938 | return ''.join(packed) |
| 11939 | |
| 11940 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11941 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11942 | obj = group_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11943 | _version = reader.read("!B")[0] |
| 11944 | assert(_version == 4) |
| 11945 | _type = reader.read("!B")[0] |
| 11946 | assert(_type == 1) |
| 11947 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11948 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 11949 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11950 | obj.xid = reader.read("!L")[0] |
| 11951 | _err_type = reader.read("!H")[0] |
| 11952 | assert(_err_type == 6) |
| 11953 | obj.code = reader.read("!H")[0] |
| 11954 | obj.data = str(reader.read_all()) |
| 11955 | return obj |
| 11956 | |
| 11957 | def __eq__(self, other): |
| 11958 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11959 | if self.xid != other.xid: return False |
| 11960 | if self.code != other.code: return False |
| 11961 | if self.data != other.data: return False |
| 11962 | return True |
| 11963 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 11964 | def pretty_print(self, q): |
| 11965 | q.text("group_mod_failed_error_msg {") |
| 11966 | with q.group(): |
| 11967 | with q.indent(2): |
| 11968 | q.breakable() |
| 11969 | q.text("xid = "); |
| 11970 | if self.xid != None: |
| 11971 | q.text("%#x" % self.xid) |
| 11972 | else: |
| 11973 | q.text('None') |
| 11974 | q.text(","); q.breakable() |
| 11975 | q.text("code = "); |
| 11976 | q.text("%#x" % self.code) |
| 11977 | q.text(","); q.breakable() |
| 11978 | q.text("data = "); |
| 11979 | q.pp(self.data) |
| 11980 | q.breakable() |
| 11981 | q.text('}') |
| 11982 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 11983 | error_msg.subtypes[6] = group_mod_failed_error_msg |
| 11984 | |
| 11985 | class group_modify(group_mod): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11986 | version = 4 |
| 11987 | type = 15 |
| 11988 | command = 1 |
| 11989 | |
| 11990 | 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] | 11991 | if xid != None: |
| 11992 | self.xid = xid |
| 11993 | else: |
| 11994 | self.xid = None |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 11995 | if group_type != None: |
| 11996 | self.group_type = group_type |
| 11997 | else: |
| 11998 | self.group_type = 0 |
| 11999 | if group_id != None: |
| 12000 | self.group_id = group_id |
| 12001 | else: |
| 12002 | self.group_id = 0 |
| 12003 | if buckets != None: |
| 12004 | self.buckets = buckets |
| 12005 | else: |
| 12006 | self.buckets = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12007 | return |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12008 | |
| 12009 | def pack(self): |
| 12010 | packed = [] |
| 12011 | packed.append(struct.pack("!B", self.version)) |
| 12012 | packed.append(struct.pack("!B", self.type)) |
| 12013 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12014 | packed.append(struct.pack("!L", self.xid)) |
| 12015 | packed.append(struct.pack("!H", self.command)) |
| 12016 | packed.append(struct.pack("!B", self.group_type)) |
| 12017 | packed.append('\x00' * 1) |
| 12018 | packed.append(struct.pack("!L", self.group_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12019 | packed.append(loxi.generic_util.pack_list(self.buckets)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12020 | length = sum([len(x) for x in packed]) |
| 12021 | packed[2] = struct.pack("!H", length) |
| 12022 | return ''.join(packed) |
| 12023 | |
| 12024 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12025 | def unpack(reader): |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12026 | obj = group_modify() |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12027 | _version = reader.read("!B")[0] |
| 12028 | assert(_version == 4) |
| 12029 | _type = reader.read("!B")[0] |
| 12030 | assert(_type == 15) |
| 12031 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12032 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12033 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12034 | obj.xid = reader.read("!L")[0] |
| 12035 | _command = reader.read("!H")[0] |
| 12036 | assert(_command == 1) |
| 12037 | obj.group_type = reader.read("!B")[0] |
| 12038 | reader.skip(1) |
| 12039 | obj.group_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12040 | obj.buckets = loxi.generic_util.unpack_list(reader, ofp.common.bucket.unpack) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12041 | return obj |
| 12042 | |
| 12043 | def __eq__(self, other): |
| 12044 | if type(self) != type(other): return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12045 | if self.xid != other.xid: return False |
| 12046 | if self.group_type != other.group_type: return False |
| 12047 | if self.group_id != other.group_id: return False |
| 12048 | if self.buckets != other.buckets: return False |
| 12049 | return True |
| 12050 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 12051 | def pretty_print(self, q): |
| 12052 | q.text("group_modify {") |
| 12053 | with q.group(): |
| 12054 | with q.indent(2): |
| 12055 | q.breakable() |
| 12056 | q.text("xid = "); |
| 12057 | if self.xid != None: |
| 12058 | q.text("%#x" % self.xid) |
| 12059 | else: |
| 12060 | q.text('None') |
| 12061 | q.text(","); q.breakable() |
| 12062 | q.text("group_type = "); |
| 12063 | q.text("%#x" % self.group_type) |
| 12064 | q.text(","); q.breakable() |
| 12065 | q.text("group_id = "); |
| 12066 | q.text("%#x" % self.group_id) |
| 12067 | q.text(","); q.breakable() |
| 12068 | q.text("buckets = "); |
| 12069 | q.pp(self.buckets) |
| 12070 | q.breakable() |
| 12071 | q.text('}') |
| 12072 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12073 | group_mod.subtypes[1] = group_modify |
| 12074 | |
| 12075 | class group_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12076 | version = 4 |
| 12077 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12078 | stats_type = 6 |
| 12079 | |
| 12080 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12081 | if xid != None: |
| 12082 | self.xid = xid |
| 12083 | else: |
| 12084 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12085 | if flags != None: |
| 12086 | self.flags = flags |
| 12087 | else: |
| 12088 | self.flags = 0 |
| 12089 | if entries != None: |
| 12090 | self.entries = entries |
| 12091 | else: |
| 12092 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12093 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12094 | |
| 12095 | def pack(self): |
| 12096 | packed = [] |
| 12097 | packed.append(struct.pack("!B", self.version)) |
| 12098 | packed.append(struct.pack("!B", self.type)) |
| 12099 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12100 | packed.append(struct.pack("!L", self.xid)) |
| 12101 | packed.append(struct.pack("!H", self.stats_type)) |
| 12102 | packed.append(struct.pack("!H", self.flags)) |
| 12103 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12104 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12105 | length = sum([len(x) for x in packed]) |
| 12106 | packed[2] = struct.pack("!H", length) |
| 12107 | return ''.join(packed) |
| 12108 | |
| 12109 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12110 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12111 | obj = group_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12112 | _version = reader.read("!B")[0] |
| 12113 | assert(_version == 4) |
| 12114 | _type = reader.read("!B")[0] |
| 12115 | assert(_type == 19) |
| 12116 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12117 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12118 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12119 | obj.xid = reader.read("!L")[0] |
| 12120 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12121 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12122 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12123 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12124 | 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] | 12125 | return obj |
| 12126 | |
| 12127 | def __eq__(self, other): |
| 12128 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12129 | if self.xid != other.xid: return False |
| 12130 | if self.flags != other.flags: return False |
| 12131 | if self.entries != other.entries: return False |
| 12132 | return True |
| 12133 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12134 | def pretty_print(self, q): |
| 12135 | q.text("group_stats_reply {") |
| 12136 | with q.group(): |
| 12137 | with q.indent(2): |
| 12138 | q.breakable() |
| 12139 | q.text("xid = "); |
| 12140 | if self.xid != None: |
| 12141 | q.text("%#x" % self.xid) |
| 12142 | else: |
| 12143 | q.text('None') |
| 12144 | q.text(","); q.breakable() |
| 12145 | q.text("flags = "); |
| 12146 | q.text("%#x" % self.flags) |
| 12147 | q.text(","); q.breakable() |
| 12148 | q.text("entries = "); |
| 12149 | q.pp(self.entries) |
| 12150 | q.breakable() |
| 12151 | q.text('}') |
| 12152 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12153 | stats_reply.subtypes[6] = group_stats_reply |
| 12154 | |
| 12155 | class group_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12156 | version = 4 |
| 12157 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12158 | stats_type = 6 |
| 12159 | |
| 12160 | def __init__(self, xid=None, flags=None, group_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12161 | if xid != None: |
| 12162 | self.xid = xid |
| 12163 | else: |
| 12164 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12165 | if flags != None: |
| 12166 | self.flags = flags |
| 12167 | else: |
| 12168 | self.flags = 0 |
| 12169 | if group_id != None: |
| 12170 | self.group_id = group_id |
| 12171 | else: |
| 12172 | self.group_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12173 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12174 | |
| 12175 | def pack(self): |
| 12176 | packed = [] |
| 12177 | packed.append(struct.pack("!B", self.version)) |
| 12178 | packed.append(struct.pack("!B", self.type)) |
| 12179 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12180 | packed.append(struct.pack("!L", self.xid)) |
| 12181 | packed.append(struct.pack("!H", self.stats_type)) |
| 12182 | packed.append(struct.pack("!H", self.flags)) |
| 12183 | packed.append('\x00' * 4) |
| 12184 | packed.append(struct.pack("!L", self.group_id)) |
| 12185 | packed.append('\x00' * 4) |
| 12186 | length = sum([len(x) for x in packed]) |
| 12187 | packed[2] = struct.pack("!H", length) |
| 12188 | return ''.join(packed) |
| 12189 | |
| 12190 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12191 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12192 | obj = group_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12193 | _version = reader.read("!B")[0] |
| 12194 | assert(_version == 4) |
| 12195 | _type = reader.read("!B")[0] |
| 12196 | assert(_type == 18) |
| 12197 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12198 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12199 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12200 | obj.xid = reader.read("!L")[0] |
| 12201 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12202 | assert(_stats_type == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12203 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12204 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12205 | obj.group_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12206 | reader.skip(4) |
| 12207 | return obj |
| 12208 | |
| 12209 | def __eq__(self, other): |
| 12210 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12211 | if self.xid != other.xid: return False |
| 12212 | if self.flags != other.flags: return False |
| 12213 | if self.group_id != other.group_id: return False |
| 12214 | return True |
| 12215 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12216 | def pretty_print(self, q): |
| 12217 | q.text("group_stats_request {") |
| 12218 | with q.group(): |
| 12219 | with q.indent(2): |
| 12220 | q.breakable() |
| 12221 | q.text("xid = "); |
| 12222 | if self.xid != None: |
| 12223 | q.text("%#x" % self.xid) |
| 12224 | else: |
| 12225 | q.text('None') |
| 12226 | q.text(","); q.breakable() |
| 12227 | q.text("flags = "); |
| 12228 | q.text("%#x" % self.flags) |
| 12229 | q.text(","); q.breakable() |
| 12230 | q.text("group_id = "); |
| 12231 | q.text("%#x" % self.group_id) |
| 12232 | q.breakable() |
| 12233 | q.text('}') |
| 12234 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12235 | stats_request.subtypes[6] = group_stats_request |
| 12236 | |
| 12237 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12238 | version = 4 |
| 12239 | type = 0 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12240 | |
| 12241 | def __init__(self, xid=None, elements=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12242 | if xid != None: |
| 12243 | self.xid = xid |
| 12244 | else: |
| 12245 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12246 | if elements != None: |
| 12247 | self.elements = elements |
| 12248 | else: |
| 12249 | self.elements = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12250 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12251 | |
| 12252 | def pack(self): |
| 12253 | packed = [] |
| 12254 | packed.append(struct.pack("!B", self.version)) |
| 12255 | packed.append(struct.pack("!B", self.type)) |
| 12256 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12257 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12258 | packed.append(loxi.generic_util.pack_list(self.elements)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12259 | length = sum([len(x) for x in packed]) |
| 12260 | packed[2] = struct.pack("!H", length) |
| 12261 | return ''.join(packed) |
| 12262 | |
| 12263 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12264 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12265 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12266 | _version = reader.read("!B")[0] |
| 12267 | assert(_version == 4) |
| 12268 | _type = reader.read("!B")[0] |
| 12269 | assert(_type == 0) |
| 12270 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12271 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12272 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12273 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12274 | 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] | 12275 | return obj |
| 12276 | |
| 12277 | def __eq__(self, other): |
| 12278 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12279 | if self.xid != other.xid: return False |
| 12280 | if self.elements != other.elements: return False |
| 12281 | return True |
| 12282 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12283 | def pretty_print(self, q): |
| 12284 | q.text("hello {") |
| 12285 | with q.group(): |
| 12286 | with q.indent(2): |
| 12287 | q.breakable() |
| 12288 | q.text("xid = "); |
| 12289 | if self.xid != None: |
| 12290 | q.text("%#x" % self.xid) |
| 12291 | else: |
| 12292 | q.text('None') |
| 12293 | q.text(","); q.breakable() |
| 12294 | q.text("elements = "); |
| 12295 | q.pp(self.elements) |
| 12296 | q.breakable() |
| 12297 | q.text('}') |
| 12298 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12299 | message.subtypes[0] = hello |
| 12300 | |
| 12301 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12302 | version = 4 |
| 12303 | type = 1 |
| 12304 | err_type = 0 |
| 12305 | |
| 12306 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12307 | if xid != None: |
| 12308 | self.xid = xid |
| 12309 | else: |
| 12310 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12311 | if code != None: |
| 12312 | self.code = code |
| 12313 | else: |
| 12314 | self.code = 0 |
| 12315 | if data != None: |
| 12316 | self.data = data |
| 12317 | else: |
| 12318 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12319 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12320 | |
| 12321 | def pack(self): |
| 12322 | packed = [] |
| 12323 | packed.append(struct.pack("!B", self.version)) |
| 12324 | packed.append(struct.pack("!B", self.type)) |
| 12325 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12326 | packed.append(struct.pack("!L", self.xid)) |
| 12327 | packed.append(struct.pack("!H", self.err_type)) |
| 12328 | packed.append(struct.pack("!H", self.code)) |
| 12329 | packed.append(self.data) |
| 12330 | length = sum([len(x) for x in packed]) |
| 12331 | packed[2] = struct.pack("!H", length) |
| 12332 | return ''.join(packed) |
| 12333 | |
| 12334 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12335 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12336 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12337 | _version = reader.read("!B")[0] |
| 12338 | assert(_version == 4) |
| 12339 | _type = reader.read("!B")[0] |
| 12340 | assert(_type == 1) |
| 12341 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12342 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12343 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12344 | obj.xid = reader.read("!L")[0] |
| 12345 | _err_type = reader.read("!H")[0] |
| 12346 | assert(_err_type == 0) |
| 12347 | obj.code = reader.read("!H")[0] |
| 12348 | obj.data = str(reader.read_all()) |
| 12349 | return obj |
| 12350 | |
| 12351 | def __eq__(self, other): |
| 12352 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12353 | if self.xid != other.xid: return False |
| 12354 | if self.code != other.code: return False |
| 12355 | if self.data != other.data: return False |
| 12356 | return True |
| 12357 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12358 | def pretty_print(self, q): |
| 12359 | q.text("hello_failed_error_msg {") |
| 12360 | with q.group(): |
| 12361 | with q.indent(2): |
| 12362 | q.breakable() |
| 12363 | q.text("xid = "); |
| 12364 | if self.xid != None: |
| 12365 | q.text("%#x" % self.xid) |
| 12366 | else: |
| 12367 | q.text('None') |
| 12368 | q.text(","); q.breakable() |
| 12369 | q.text("code = "); |
| 12370 | q.text("%#x" % self.code) |
| 12371 | q.text(","); q.breakable() |
| 12372 | q.text("data = "); |
| 12373 | q.pp(self.data) |
| 12374 | q.breakable() |
| 12375 | q.text('}') |
| 12376 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12377 | error_msg.subtypes[0] = hello_failed_error_msg |
| 12378 | |
| 12379 | class meter_config_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12380 | version = 4 |
| 12381 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12382 | stats_type = 10 |
| 12383 | |
| 12384 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12385 | if xid != None: |
| 12386 | self.xid = xid |
| 12387 | else: |
| 12388 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12389 | if flags != None: |
| 12390 | self.flags = flags |
| 12391 | else: |
| 12392 | self.flags = 0 |
| 12393 | if entries != None: |
| 12394 | self.entries = entries |
| 12395 | else: |
| 12396 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12397 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12398 | |
| 12399 | def pack(self): |
| 12400 | packed = [] |
| 12401 | packed.append(struct.pack("!B", self.version)) |
| 12402 | packed.append(struct.pack("!B", self.type)) |
| 12403 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12404 | packed.append(struct.pack("!L", self.xid)) |
| 12405 | packed.append(struct.pack("!H", self.stats_type)) |
| 12406 | packed.append(struct.pack("!H", self.flags)) |
| 12407 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12408 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12409 | length = sum([len(x) for x in packed]) |
| 12410 | packed[2] = struct.pack("!H", length) |
| 12411 | return ''.join(packed) |
| 12412 | |
| 12413 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12414 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12415 | obj = meter_config_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12416 | _version = reader.read("!B")[0] |
| 12417 | assert(_version == 4) |
| 12418 | _type = reader.read("!B")[0] |
| 12419 | assert(_type == 19) |
| 12420 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12421 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12422 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12423 | obj.xid = reader.read("!L")[0] |
| 12424 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12425 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12426 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12427 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12428 | 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] | 12429 | return obj |
| 12430 | |
| 12431 | def __eq__(self, other): |
| 12432 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12433 | if self.xid != other.xid: return False |
| 12434 | if self.flags != other.flags: return False |
| 12435 | if self.entries != other.entries: return False |
| 12436 | return True |
| 12437 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12438 | def pretty_print(self, q): |
| 12439 | q.text("meter_config_stats_reply {") |
| 12440 | with q.group(): |
| 12441 | with q.indent(2): |
| 12442 | q.breakable() |
| 12443 | q.text("xid = "); |
| 12444 | if self.xid != None: |
| 12445 | q.text("%#x" % self.xid) |
| 12446 | else: |
| 12447 | q.text('None') |
| 12448 | q.text(","); q.breakable() |
| 12449 | q.text("flags = "); |
| 12450 | q.text("%#x" % self.flags) |
| 12451 | q.text(","); q.breakable() |
| 12452 | q.text("entries = "); |
| 12453 | q.pp(self.entries) |
| 12454 | q.breakable() |
| 12455 | q.text('}') |
| 12456 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12457 | stats_reply.subtypes[10] = meter_config_stats_reply |
| 12458 | |
| 12459 | class meter_config_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12460 | version = 4 |
| 12461 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12462 | stats_type = 10 |
| 12463 | |
| 12464 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12465 | if xid != None: |
| 12466 | self.xid = xid |
| 12467 | else: |
| 12468 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12469 | if flags != None: |
| 12470 | self.flags = flags |
| 12471 | else: |
| 12472 | self.flags = 0 |
| 12473 | if meter_id != None: |
| 12474 | self.meter_id = meter_id |
| 12475 | else: |
| 12476 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12477 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12478 | |
| 12479 | def pack(self): |
| 12480 | packed = [] |
| 12481 | packed.append(struct.pack("!B", self.version)) |
| 12482 | packed.append(struct.pack("!B", self.type)) |
| 12483 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12484 | packed.append(struct.pack("!L", self.xid)) |
| 12485 | packed.append(struct.pack("!H", self.stats_type)) |
| 12486 | packed.append(struct.pack("!H", self.flags)) |
| 12487 | packed.append('\x00' * 4) |
| 12488 | packed.append(struct.pack("!L", self.meter_id)) |
| 12489 | packed.append('\x00' * 4) |
| 12490 | length = sum([len(x) for x in packed]) |
| 12491 | packed[2] = struct.pack("!H", length) |
| 12492 | return ''.join(packed) |
| 12493 | |
| 12494 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12495 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12496 | obj = meter_config_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12497 | _version = reader.read("!B")[0] |
| 12498 | assert(_version == 4) |
| 12499 | _type = reader.read("!B")[0] |
| 12500 | assert(_type == 18) |
| 12501 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12502 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12503 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12504 | obj.xid = reader.read("!L")[0] |
| 12505 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12506 | assert(_stats_type == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12507 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12508 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12509 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12510 | reader.skip(4) |
| 12511 | return obj |
| 12512 | |
| 12513 | def __eq__(self, other): |
| 12514 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12515 | if self.xid != other.xid: return False |
| 12516 | if self.flags != other.flags: return False |
| 12517 | if self.meter_id != other.meter_id: return False |
| 12518 | return True |
| 12519 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12520 | def pretty_print(self, q): |
| 12521 | q.text("meter_config_stats_request {") |
| 12522 | with q.group(): |
| 12523 | with q.indent(2): |
| 12524 | q.breakable() |
| 12525 | q.text("xid = "); |
| 12526 | if self.xid != None: |
| 12527 | q.text("%#x" % self.xid) |
| 12528 | else: |
| 12529 | q.text('None') |
| 12530 | q.text(","); q.breakable() |
| 12531 | q.text("flags = "); |
| 12532 | q.text("%#x" % self.flags) |
| 12533 | q.text(","); q.breakable() |
| 12534 | q.text("meter_id = "); |
| 12535 | q.text("%#x" % self.meter_id) |
| 12536 | q.breakable() |
| 12537 | q.text('}') |
| 12538 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12539 | stats_request.subtypes[10] = meter_config_stats_request |
| 12540 | |
| 12541 | class meter_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12542 | version = 4 |
| 12543 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12544 | stats_type = 11 |
| 12545 | |
| 12546 | def __init__(self, xid=None, flags=None, features=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12547 | if xid != None: |
| 12548 | self.xid = xid |
| 12549 | else: |
| 12550 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12551 | if flags != None: |
| 12552 | self.flags = flags |
| 12553 | else: |
| 12554 | self.flags = 0 |
| 12555 | if features != None: |
| 12556 | self.features = features |
| 12557 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12558 | self.features = ofp.meter_features() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12559 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12560 | |
| 12561 | def pack(self): |
| 12562 | packed = [] |
| 12563 | packed.append(struct.pack("!B", self.version)) |
| 12564 | packed.append(struct.pack("!B", self.type)) |
| 12565 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12566 | packed.append(struct.pack("!L", self.xid)) |
| 12567 | packed.append(struct.pack("!H", self.stats_type)) |
| 12568 | packed.append(struct.pack("!H", self.flags)) |
| 12569 | packed.append('\x00' * 4) |
| 12570 | packed.append(self.features.pack()) |
| 12571 | length = sum([len(x) for x in packed]) |
| 12572 | packed[2] = struct.pack("!H", length) |
| 12573 | return ''.join(packed) |
| 12574 | |
| 12575 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12576 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12577 | obj = meter_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12578 | _version = reader.read("!B")[0] |
| 12579 | assert(_version == 4) |
| 12580 | _type = reader.read("!B")[0] |
| 12581 | assert(_type == 19) |
| 12582 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12583 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12584 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12585 | obj.xid = reader.read("!L")[0] |
| 12586 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12587 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12588 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12589 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12590 | obj.features = ofp.meter_features.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12591 | return obj |
| 12592 | |
| 12593 | def __eq__(self, other): |
| 12594 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12595 | if self.xid != other.xid: return False |
| 12596 | if self.flags != other.flags: return False |
| 12597 | if self.features != other.features: return False |
| 12598 | return True |
| 12599 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12600 | def pretty_print(self, q): |
| 12601 | q.text("meter_features_stats_reply {") |
| 12602 | with q.group(): |
| 12603 | with q.indent(2): |
| 12604 | q.breakable() |
| 12605 | q.text("xid = "); |
| 12606 | if self.xid != None: |
| 12607 | q.text("%#x" % self.xid) |
| 12608 | else: |
| 12609 | q.text('None') |
| 12610 | q.text(","); q.breakable() |
| 12611 | q.text("flags = "); |
| 12612 | q.text("%#x" % self.flags) |
| 12613 | q.text(","); q.breakable() |
| 12614 | q.text("features = "); |
| 12615 | q.pp(self.features) |
| 12616 | q.breakable() |
| 12617 | q.text('}') |
| 12618 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12619 | stats_reply.subtypes[11] = meter_features_stats_reply |
| 12620 | |
| 12621 | class meter_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12622 | version = 4 |
| 12623 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12624 | stats_type = 11 |
| 12625 | |
| 12626 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12627 | if xid != None: |
| 12628 | self.xid = xid |
| 12629 | else: |
| 12630 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12631 | if flags != None: |
| 12632 | self.flags = flags |
| 12633 | else: |
| 12634 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12635 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12636 | |
| 12637 | def pack(self): |
| 12638 | packed = [] |
| 12639 | packed.append(struct.pack("!B", self.version)) |
| 12640 | packed.append(struct.pack("!B", self.type)) |
| 12641 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12642 | packed.append(struct.pack("!L", self.xid)) |
| 12643 | packed.append(struct.pack("!H", self.stats_type)) |
| 12644 | packed.append(struct.pack("!H", self.flags)) |
| 12645 | packed.append('\x00' * 4) |
| 12646 | length = sum([len(x) for x in packed]) |
| 12647 | packed[2] = struct.pack("!H", length) |
| 12648 | return ''.join(packed) |
| 12649 | |
| 12650 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12651 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12652 | obj = meter_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12653 | _version = reader.read("!B")[0] |
| 12654 | assert(_version == 4) |
| 12655 | _type = reader.read("!B")[0] |
| 12656 | assert(_type == 18) |
| 12657 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12658 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12659 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12660 | obj.xid = reader.read("!L")[0] |
| 12661 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12662 | assert(_stats_type == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12663 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12664 | reader.skip(4) |
| 12665 | return obj |
| 12666 | |
| 12667 | def __eq__(self, other): |
| 12668 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12669 | if self.xid != other.xid: return False |
| 12670 | if self.flags != other.flags: return False |
| 12671 | return True |
| 12672 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12673 | def pretty_print(self, q): |
| 12674 | q.text("meter_features_stats_request {") |
| 12675 | with q.group(): |
| 12676 | with q.indent(2): |
| 12677 | q.breakable() |
| 12678 | q.text("xid = "); |
| 12679 | if self.xid != None: |
| 12680 | q.text("%#x" % self.xid) |
| 12681 | else: |
| 12682 | q.text('None') |
| 12683 | q.text(","); q.breakable() |
| 12684 | q.text("flags = "); |
| 12685 | q.text("%#x" % self.flags) |
| 12686 | q.breakable() |
| 12687 | q.text('}') |
| 12688 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12689 | stats_request.subtypes[11] = meter_features_stats_request |
| 12690 | |
| 12691 | class meter_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12692 | version = 4 |
| 12693 | type = 29 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12694 | |
| 12695 | 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] | 12696 | if xid != None: |
| 12697 | self.xid = xid |
| 12698 | else: |
| 12699 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12700 | if command != None: |
| 12701 | self.command = command |
| 12702 | else: |
| 12703 | self.command = 0 |
| 12704 | if flags != None: |
| 12705 | self.flags = flags |
| 12706 | else: |
| 12707 | self.flags = 0 |
| 12708 | if meter_id != None: |
| 12709 | self.meter_id = meter_id |
| 12710 | else: |
| 12711 | self.meter_id = 0 |
| 12712 | if meters != None: |
| 12713 | self.meters = meters |
| 12714 | else: |
| 12715 | self.meters = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12716 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12717 | |
| 12718 | def pack(self): |
| 12719 | packed = [] |
| 12720 | packed.append(struct.pack("!B", self.version)) |
| 12721 | packed.append(struct.pack("!B", self.type)) |
| 12722 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12723 | packed.append(struct.pack("!L", self.xid)) |
| 12724 | packed.append(struct.pack("!H", self.command)) |
| 12725 | packed.append(struct.pack("!H", self.flags)) |
| 12726 | packed.append(struct.pack("!L", self.meter_id)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12727 | packed.append(loxi.generic_util.pack_list(self.meters)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12728 | length = sum([len(x) for x in packed]) |
| 12729 | packed[2] = struct.pack("!H", length) |
| 12730 | return ''.join(packed) |
| 12731 | |
| 12732 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12733 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12734 | obj = meter_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12735 | _version = reader.read("!B")[0] |
| 12736 | assert(_version == 4) |
| 12737 | _type = reader.read("!B")[0] |
| 12738 | assert(_type == 29) |
| 12739 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12740 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12741 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12742 | obj.xid = reader.read("!L")[0] |
| 12743 | obj.command = reader.read("!H")[0] |
| 12744 | obj.flags = reader.read("!H")[0] |
| 12745 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12746 | 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] | 12747 | return obj |
| 12748 | |
| 12749 | def __eq__(self, other): |
| 12750 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12751 | if self.xid != other.xid: return False |
| 12752 | if self.command != other.command: return False |
| 12753 | if self.flags != other.flags: return False |
| 12754 | if self.meter_id != other.meter_id: return False |
| 12755 | if self.meters != other.meters: return False |
| 12756 | return True |
| 12757 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12758 | def pretty_print(self, q): |
| 12759 | q.text("meter_mod {") |
| 12760 | with q.group(): |
| 12761 | with q.indent(2): |
| 12762 | q.breakable() |
| 12763 | q.text("xid = "); |
| 12764 | if self.xid != None: |
| 12765 | q.text("%#x" % self.xid) |
| 12766 | else: |
| 12767 | q.text('None') |
| 12768 | q.text(","); q.breakable() |
| 12769 | q.text("command = "); |
| 12770 | q.text("%#x" % self.command) |
| 12771 | q.text(","); q.breakable() |
| 12772 | q.text("flags = "); |
| 12773 | q.text("%#x" % self.flags) |
| 12774 | q.text(","); q.breakable() |
| 12775 | q.text("meter_id = "); |
| 12776 | q.text("%#x" % self.meter_id) |
| 12777 | q.text(","); q.breakable() |
| 12778 | q.text("meters = "); |
| 12779 | q.pp(self.meters) |
| 12780 | q.breakable() |
| 12781 | q.text('}') |
| 12782 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12783 | message.subtypes[29] = meter_mod |
| 12784 | |
| 12785 | class meter_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12786 | version = 4 |
| 12787 | type = 1 |
| 12788 | err_type = 12 |
| 12789 | |
| 12790 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12791 | if xid != None: |
| 12792 | self.xid = xid |
| 12793 | else: |
| 12794 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12795 | if code != None: |
| 12796 | self.code = code |
| 12797 | else: |
| 12798 | self.code = 0 |
| 12799 | if data != None: |
| 12800 | self.data = data |
| 12801 | else: |
| 12802 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12803 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12804 | |
| 12805 | def pack(self): |
| 12806 | packed = [] |
| 12807 | packed.append(struct.pack("!B", self.version)) |
| 12808 | packed.append(struct.pack("!B", self.type)) |
| 12809 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12810 | packed.append(struct.pack("!L", self.xid)) |
| 12811 | packed.append(struct.pack("!H", self.err_type)) |
| 12812 | packed.append(struct.pack("!H", self.code)) |
| 12813 | packed.append(self.data) |
| 12814 | length = sum([len(x) for x in packed]) |
| 12815 | packed[2] = struct.pack("!H", length) |
| 12816 | return ''.join(packed) |
| 12817 | |
| 12818 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12819 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12820 | obj = meter_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12821 | _version = reader.read("!B")[0] |
| 12822 | assert(_version == 4) |
| 12823 | _type = reader.read("!B")[0] |
| 12824 | assert(_type == 1) |
| 12825 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12826 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12827 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12828 | obj.xid = reader.read("!L")[0] |
| 12829 | _err_type = reader.read("!H")[0] |
| 12830 | assert(_err_type == 12) |
| 12831 | obj.code = reader.read("!H")[0] |
| 12832 | obj.data = str(reader.read_all()) |
| 12833 | return obj |
| 12834 | |
| 12835 | def __eq__(self, other): |
| 12836 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12837 | if self.xid != other.xid: return False |
| 12838 | if self.code != other.code: return False |
| 12839 | if self.data != other.data: return False |
| 12840 | return True |
| 12841 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 12842 | def pretty_print(self, q): |
| 12843 | q.text("meter_mod_failed_error_msg {") |
| 12844 | with q.group(): |
| 12845 | with q.indent(2): |
| 12846 | q.breakable() |
| 12847 | q.text("xid = "); |
| 12848 | if self.xid != None: |
| 12849 | q.text("%#x" % self.xid) |
| 12850 | else: |
| 12851 | q.text('None') |
| 12852 | q.text(","); q.breakable() |
| 12853 | q.text("code = "); |
| 12854 | q.text("%#x" % self.code) |
| 12855 | q.text(","); q.breakable() |
| 12856 | q.text("data = "); |
| 12857 | q.pp(self.data) |
| 12858 | q.breakable() |
| 12859 | q.text('}') |
| 12860 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12861 | error_msg.subtypes[12] = meter_mod_failed_error_msg |
| 12862 | |
| 12863 | class meter_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12864 | version = 4 |
| 12865 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12866 | stats_type = 9 |
| 12867 | |
| 12868 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12869 | if xid != None: |
| 12870 | self.xid = xid |
| 12871 | else: |
| 12872 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12873 | if flags != None: |
| 12874 | self.flags = flags |
| 12875 | else: |
| 12876 | self.flags = 0 |
| 12877 | if entries != None: |
| 12878 | self.entries = entries |
| 12879 | else: |
| 12880 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12881 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12882 | |
| 12883 | def pack(self): |
| 12884 | packed = [] |
| 12885 | packed.append(struct.pack("!B", self.version)) |
| 12886 | packed.append(struct.pack("!B", self.type)) |
| 12887 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12888 | packed.append(struct.pack("!L", self.xid)) |
| 12889 | packed.append(struct.pack("!H", self.stats_type)) |
| 12890 | packed.append(struct.pack("!H", self.flags)) |
| 12891 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12892 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12893 | length = sum([len(x) for x in packed]) |
| 12894 | packed[2] = struct.pack("!H", length) |
| 12895 | return ''.join(packed) |
| 12896 | |
| 12897 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12898 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12899 | obj = meter_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12900 | _version = reader.read("!B")[0] |
| 12901 | assert(_version == 4) |
| 12902 | _type = reader.read("!B")[0] |
| 12903 | assert(_type == 19) |
| 12904 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12905 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12906 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12907 | obj.xid = reader.read("!L")[0] |
| 12908 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12909 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12910 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12911 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 12912 | 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] | 12913 | return obj |
| 12914 | |
| 12915 | def __eq__(self, other): |
| 12916 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12917 | if self.xid != other.xid: return False |
| 12918 | if self.flags != other.flags: return False |
| 12919 | if self.entries != other.entries: return False |
| 12920 | return True |
| 12921 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12922 | def pretty_print(self, q): |
| 12923 | q.text("meter_stats_reply {") |
| 12924 | with q.group(): |
| 12925 | with q.indent(2): |
| 12926 | q.breakable() |
| 12927 | q.text("xid = "); |
| 12928 | if self.xid != None: |
| 12929 | q.text("%#x" % self.xid) |
| 12930 | else: |
| 12931 | q.text('None') |
| 12932 | q.text(","); q.breakable() |
| 12933 | q.text("flags = "); |
| 12934 | q.text("%#x" % self.flags) |
| 12935 | q.text(","); q.breakable() |
| 12936 | q.text("entries = "); |
| 12937 | q.pp(self.entries) |
| 12938 | q.breakable() |
| 12939 | q.text('}') |
| 12940 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12941 | stats_reply.subtypes[9] = meter_stats_reply |
| 12942 | |
| 12943 | class meter_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12944 | version = 4 |
| 12945 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12946 | stats_type = 9 |
| 12947 | |
| 12948 | def __init__(self, xid=None, flags=None, meter_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12949 | if xid != None: |
| 12950 | self.xid = xid |
| 12951 | else: |
| 12952 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12953 | if flags != None: |
| 12954 | self.flags = flags |
| 12955 | else: |
| 12956 | self.flags = 0 |
| 12957 | if meter_id != None: |
| 12958 | self.meter_id = meter_id |
| 12959 | else: |
| 12960 | self.meter_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12961 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12962 | |
| 12963 | def pack(self): |
| 12964 | packed = [] |
| 12965 | packed.append(struct.pack("!B", self.version)) |
| 12966 | packed.append(struct.pack("!B", self.type)) |
| 12967 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 12968 | packed.append(struct.pack("!L", self.xid)) |
| 12969 | packed.append(struct.pack("!H", self.stats_type)) |
| 12970 | packed.append(struct.pack("!H", self.flags)) |
| 12971 | packed.append('\x00' * 4) |
| 12972 | packed.append(struct.pack("!L", self.meter_id)) |
| 12973 | packed.append('\x00' * 4) |
| 12974 | length = sum([len(x) for x in packed]) |
| 12975 | packed[2] = struct.pack("!H", length) |
| 12976 | return ''.join(packed) |
| 12977 | |
| 12978 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12979 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12980 | obj = meter_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12981 | _version = reader.read("!B")[0] |
| 12982 | assert(_version == 4) |
| 12983 | _type = reader.read("!B")[0] |
| 12984 | assert(_type == 18) |
| 12985 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 12986 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 12987 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12988 | obj.xid = reader.read("!L")[0] |
| 12989 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12990 | assert(_stats_type == 9) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12991 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12992 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 12993 | obj.meter_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12994 | reader.skip(4) |
| 12995 | return obj |
| 12996 | |
| 12997 | def __eq__(self, other): |
| 12998 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 12999 | if self.xid != other.xid: return False |
| 13000 | if self.flags != other.flags: return False |
| 13001 | if self.meter_id != other.meter_id: return False |
| 13002 | return True |
| 13003 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13004 | def pretty_print(self, q): |
| 13005 | q.text("meter_stats_request {") |
| 13006 | with q.group(): |
| 13007 | with q.indent(2): |
| 13008 | q.breakable() |
| 13009 | q.text("xid = "); |
| 13010 | if self.xid != None: |
| 13011 | q.text("%#x" % self.xid) |
| 13012 | else: |
| 13013 | q.text('None') |
| 13014 | q.text(","); q.breakable() |
| 13015 | q.text("flags = "); |
| 13016 | q.text("%#x" % self.flags) |
| 13017 | q.text(","); q.breakable() |
| 13018 | q.text("meter_id = "); |
| 13019 | q.text("%#x" % self.meter_id) |
| 13020 | q.breakable() |
| 13021 | q.text('}') |
| 13022 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13023 | stats_request.subtypes[9] = meter_stats_request |
| 13024 | |
| 13025 | class nicira_header(experimenter): |
| 13026 | subtypes = {} |
| 13027 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13028 | version = 4 |
| 13029 | type = 4 |
| 13030 | experimenter = 8992 |
| 13031 | |
| 13032 | def __init__(self, xid=None, subtype=None): |
| 13033 | if xid != None: |
| 13034 | self.xid = xid |
| 13035 | else: |
| 13036 | self.xid = None |
| 13037 | if subtype != None: |
| 13038 | self.subtype = subtype |
| 13039 | else: |
| 13040 | self.subtype = 0 |
| 13041 | return |
| 13042 | |
| 13043 | def pack(self): |
| 13044 | packed = [] |
| 13045 | packed.append(struct.pack("!B", self.version)) |
| 13046 | packed.append(struct.pack("!B", self.type)) |
| 13047 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13048 | packed.append(struct.pack("!L", self.xid)) |
| 13049 | packed.append(struct.pack("!L", self.experimenter)) |
| 13050 | packed.append(struct.pack("!L", self.subtype)) |
| 13051 | length = sum([len(x) for x in packed]) |
| 13052 | packed[2] = struct.pack("!H", length) |
| 13053 | return ''.join(packed) |
| 13054 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13055 | @staticmethod |
| 13056 | def unpack(reader): |
| 13057 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13058 | subclass = nicira_header.subtypes.get(subtype) |
| 13059 | if subclass: |
| 13060 | return subclass.unpack(reader) |
| 13061 | |
| 13062 | obj = nicira_header() |
| 13063 | _version = reader.read("!B")[0] |
| 13064 | assert(_version == 4) |
| 13065 | _type = reader.read("!B")[0] |
| 13066 | assert(_type == 4) |
| 13067 | _length = reader.read("!H")[0] |
| 13068 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13069 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 13070 | obj.xid = reader.read("!L")[0] |
| 13071 | _experimenter = reader.read("!L")[0] |
| 13072 | assert(_experimenter == 8992) |
| 13073 | obj.subtype = reader.read("!L")[0] |
| 13074 | return obj |
| 13075 | |
| 13076 | def __eq__(self, other): |
| 13077 | if type(self) != type(other): return False |
| 13078 | if self.xid != other.xid: return False |
| 13079 | if self.subtype != other.subtype: return False |
| 13080 | return True |
| 13081 | |
| 13082 | def pretty_print(self, q): |
| 13083 | q.text("nicira_header {") |
| 13084 | with q.group(): |
| 13085 | with q.indent(2): |
| 13086 | q.breakable() |
| 13087 | q.text("xid = "); |
| 13088 | if self.xid != None: |
| 13089 | q.text("%#x" % self.xid) |
| 13090 | else: |
| 13091 | q.text('None') |
| 13092 | q.breakable() |
| 13093 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13094 | |
| 13095 | experimenter.subtypes[8992] = nicira_header |
| 13096 | |
| 13097 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13098 | version = 4 |
| 13099 | type = 10 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13100 | |
| 13101 | 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] | 13102 | if xid != None: |
| 13103 | self.xid = xid |
| 13104 | else: |
| 13105 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13106 | if buffer_id != None: |
| 13107 | self.buffer_id = buffer_id |
| 13108 | else: |
| 13109 | self.buffer_id = 0 |
| 13110 | if total_len != None: |
| 13111 | self.total_len = total_len |
| 13112 | else: |
| 13113 | self.total_len = 0 |
| 13114 | if reason != None: |
| 13115 | self.reason = reason |
| 13116 | else: |
| 13117 | self.reason = 0 |
| 13118 | if table_id != None: |
| 13119 | self.table_id = table_id |
| 13120 | else: |
| 13121 | self.table_id = 0 |
| 13122 | if cookie != None: |
| 13123 | self.cookie = cookie |
| 13124 | else: |
| 13125 | self.cookie = 0 |
| 13126 | if match != None: |
| 13127 | self.match = match |
| 13128 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13129 | self.match = ofp.match() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13130 | if data != None: |
| 13131 | self.data = data |
| 13132 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13133 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13134 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13135 | |
| 13136 | def pack(self): |
| 13137 | packed = [] |
| 13138 | packed.append(struct.pack("!B", self.version)) |
| 13139 | packed.append(struct.pack("!B", self.type)) |
| 13140 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13141 | packed.append(struct.pack("!L", self.xid)) |
| 13142 | packed.append(struct.pack("!L", self.buffer_id)) |
| 13143 | packed.append(struct.pack("!H", self.total_len)) |
| 13144 | packed.append(struct.pack("!B", self.reason)) |
| 13145 | packed.append(struct.pack("!B", self.table_id)) |
| 13146 | packed.append(struct.pack("!Q", self.cookie)) |
| 13147 | packed.append(self.match.pack()) |
| 13148 | packed.append('\x00' * 2) |
| 13149 | packed.append(self.data) |
| 13150 | length = sum([len(x) for x in packed]) |
| 13151 | packed[2] = struct.pack("!H", length) |
| 13152 | return ''.join(packed) |
| 13153 | |
| 13154 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13155 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13156 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13157 | _version = reader.read("!B")[0] |
| 13158 | assert(_version == 4) |
| 13159 | _type = reader.read("!B")[0] |
| 13160 | assert(_type == 10) |
| 13161 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13162 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13163 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13164 | obj.xid = reader.read("!L")[0] |
| 13165 | obj.buffer_id = reader.read("!L")[0] |
| 13166 | obj.total_len = reader.read("!H")[0] |
| 13167 | obj.reason = reader.read("!B")[0] |
| 13168 | obj.table_id = reader.read("!B")[0] |
| 13169 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13170 | obj.match = ofp.match.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13171 | reader.skip(2) |
| 13172 | obj.data = str(reader.read_all()) |
| 13173 | return obj |
| 13174 | |
| 13175 | def __eq__(self, other): |
| 13176 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13177 | if self.xid != other.xid: return False |
| 13178 | if self.buffer_id != other.buffer_id: return False |
| 13179 | if self.total_len != other.total_len: return False |
| 13180 | if self.reason != other.reason: return False |
| 13181 | if self.table_id != other.table_id: return False |
| 13182 | if self.cookie != other.cookie: return False |
| 13183 | if self.match != other.match: return False |
| 13184 | if self.data != other.data: return False |
| 13185 | return True |
| 13186 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13187 | def pretty_print(self, q): |
| 13188 | q.text("packet_in {") |
| 13189 | with q.group(): |
| 13190 | with q.indent(2): |
| 13191 | q.breakable() |
| 13192 | q.text("xid = "); |
| 13193 | if self.xid != None: |
| 13194 | q.text("%#x" % self.xid) |
| 13195 | else: |
| 13196 | q.text('None') |
| 13197 | q.text(","); q.breakable() |
| 13198 | q.text("buffer_id = "); |
| 13199 | q.text("%#x" % self.buffer_id) |
| 13200 | q.text(","); q.breakable() |
| 13201 | q.text("total_len = "); |
| 13202 | q.text("%#x" % self.total_len) |
| 13203 | q.text(","); q.breakable() |
| 13204 | q.text("reason = "); |
| 13205 | q.text("%#x" % self.reason) |
| 13206 | q.text(","); q.breakable() |
| 13207 | q.text("table_id = "); |
| 13208 | q.text("%#x" % self.table_id) |
| 13209 | q.text(","); q.breakable() |
| 13210 | q.text("cookie = "); |
| 13211 | q.text("%#x" % self.cookie) |
| 13212 | q.text(","); q.breakable() |
| 13213 | q.text("match = "); |
| 13214 | q.pp(self.match) |
| 13215 | q.text(","); q.breakable() |
| 13216 | q.text("data = "); |
| 13217 | q.pp(self.data) |
| 13218 | q.breakable() |
| 13219 | q.text('}') |
| 13220 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13221 | message.subtypes[10] = packet_in |
| 13222 | |
| 13223 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13224 | version = 4 |
| 13225 | type = 13 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13226 | |
| 13227 | 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] | 13228 | if xid != None: |
| 13229 | self.xid = xid |
| 13230 | else: |
| 13231 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13232 | if buffer_id != None: |
| 13233 | self.buffer_id = buffer_id |
| 13234 | else: |
| 13235 | self.buffer_id = 0 |
| 13236 | if in_port != None: |
| 13237 | self.in_port = in_port |
| 13238 | else: |
| 13239 | self.in_port = 0 |
| 13240 | if actions != None: |
| 13241 | self.actions = actions |
| 13242 | else: |
| 13243 | self.actions = [] |
| 13244 | if data != None: |
| 13245 | self.data = data |
| 13246 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13247 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13248 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13249 | |
| 13250 | def pack(self): |
| 13251 | packed = [] |
| 13252 | packed.append(struct.pack("!B", self.version)) |
| 13253 | packed.append(struct.pack("!B", self.type)) |
| 13254 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13255 | packed.append(struct.pack("!L", self.xid)) |
| 13256 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13257 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13258 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
| 13259 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13260 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13261 | packed[6] = struct.pack("!H", len(packed[-1])) |
| 13262 | packed.append(self.data) |
| 13263 | length = sum([len(x) for x in packed]) |
| 13264 | packed[2] = struct.pack("!H", length) |
| 13265 | return ''.join(packed) |
| 13266 | |
| 13267 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13268 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13269 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13270 | _version = reader.read("!B")[0] |
| 13271 | assert(_version == 4) |
| 13272 | _type = reader.read("!B")[0] |
| 13273 | assert(_type == 13) |
| 13274 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13275 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13276 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13277 | obj.xid = reader.read("!L")[0] |
| 13278 | obj.buffer_id = reader.read("!L")[0] |
| 13279 | obj.in_port = util.unpack_port_no(reader) |
| 13280 | _actions_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13281 | reader.skip(6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13282 | 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] | 13283 | obj.data = str(reader.read_all()) |
| 13284 | return obj |
| 13285 | |
| 13286 | def __eq__(self, other): |
| 13287 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13288 | if self.xid != other.xid: return False |
| 13289 | if self.buffer_id != other.buffer_id: return False |
| 13290 | if self.in_port != other.in_port: return False |
| 13291 | if self.actions != other.actions: return False |
| 13292 | if self.data != other.data: return False |
| 13293 | return True |
| 13294 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13295 | def pretty_print(self, q): |
| 13296 | q.text("packet_out {") |
| 13297 | with q.group(): |
| 13298 | with q.indent(2): |
| 13299 | q.breakable() |
| 13300 | q.text("xid = "); |
| 13301 | if self.xid != None: |
| 13302 | q.text("%#x" % self.xid) |
| 13303 | else: |
| 13304 | q.text('None') |
| 13305 | q.text(","); q.breakable() |
| 13306 | q.text("buffer_id = "); |
| 13307 | q.text("%#x" % self.buffer_id) |
| 13308 | q.text(","); q.breakable() |
| 13309 | q.text("in_port = "); |
| 13310 | q.text(util.pretty_port(self.in_port)) |
| 13311 | q.text(","); q.breakable() |
| 13312 | q.text("actions = "); |
| 13313 | q.pp(self.actions) |
| 13314 | q.text(","); q.breakable() |
| 13315 | q.text("data = "); |
| 13316 | q.pp(self.data) |
| 13317 | q.breakable() |
| 13318 | q.text('}') |
| 13319 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13320 | message.subtypes[13] = packet_out |
| 13321 | |
| 13322 | class port_desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13323 | version = 4 |
| 13324 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13325 | stats_type = 13 |
| 13326 | |
| 13327 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13328 | if xid != None: |
| 13329 | self.xid = xid |
| 13330 | else: |
| 13331 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13332 | if flags != None: |
| 13333 | self.flags = flags |
| 13334 | else: |
| 13335 | self.flags = 0 |
| 13336 | if entries != None: |
| 13337 | self.entries = entries |
| 13338 | else: |
| 13339 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13340 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13341 | |
| 13342 | def pack(self): |
| 13343 | packed = [] |
| 13344 | packed.append(struct.pack("!B", self.version)) |
| 13345 | packed.append(struct.pack("!B", self.type)) |
| 13346 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13347 | packed.append(struct.pack("!L", self.xid)) |
| 13348 | packed.append(struct.pack("!H", self.stats_type)) |
| 13349 | packed.append(struct.pack("!H", self.flags)) |
| 13350 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13351 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13352 | length = sum([len(x) for x in packed]) |
| 13353 | packed[2] = struct.pack("!H", length) |
| 13354 | return ''.join(packed) |
| 13355 | |
| 13356 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13357 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13358 | obj = port_desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13359 | _version = reader.read("!B")[0] |
| 13360 | assert(_version == 4) |
| 13361 | _type = reader.read("!B")[0] |
| 13362 | assert(_type == 19) |
| 13363 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13364 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13365 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13366 | obj.xid = reader.read("!L")[0] |
| 13367 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13368 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13369 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13370 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13371 | 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] | 13372 | return obj |
| 13373 | |
| 13374 | def __eq__(self, other): |
| 13375 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13376 | if self.xid != other.xid: return False |
| 13377 | if self.flags != other.flags: return False |
| 13378 | if self.entries != other.entries: return False |
| 13379 | return True |
| 13380 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13381 | def pretty_print(self, q): |
| 13382 | q.text("port_desc_stats_reply {") |
| 13383 | with q.group(): |
| 13384 | with q.indent(2): |
| 13385 | q.breakable() |
| 13386 | q.text("xid = "); |
| 13387 | if self.xid != None: |
| 13388 | q.text("%#x" % self.xid) |
| 13389 | else: |
| 13390 | q.text('None') |
| 13391 | q.text(","); q.breakable() |
| 13392 | q.text("flags = "); |
| 13393 | q.text("%#x" % self.flags) |
| 13394 | q.text(","); q.breakable() |
| 13395 | q.text("entries = "); |
| 13396 | q.pp(self.entries) |
| 13397 | q.breakable() |
| 13398 | q.text('}') |
| 13399 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13400 | stats_reply.subtypes[13] = port_desc_stats_reply |
| 13401 | |
| 13402 | class port_desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13403 | version = 4 |
| 13404 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13405 | stats_type = 13 |
| 13406 | |
| 13407 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13408 | if xid != None: |
| 13409 | self.xid = xid |
| 13410 | else: |
| 13411 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13412 | if flags != None: |
| 13413 | self.flags = flags |
| 13414 | else: |
| 13415 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13416 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13417 | |
| 13418 | def pack(self): |
| 13419 | packed = [] |
| 13420 | packed.append(struct.pack("!B", self.version)) |
| 13421 | packed.append(struct.pack("!B", self.type)) |
| 13422 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13423 | packed.append(struct.pack("!L", self.xid)) |
| 13424 | packed.append(struct.pack("!H", self.stats_type)) |
| 13425 | packed.append(struct.pack("!H", self.flags)) |
| 13426 | packed.append('\x00' * 4) |
| 13427 | length = sum([len(x) for x in packed]) |
| 13428 | packed[2] = struct.pack("!H", length) |
| 13429 | return ''.join(packed) |
| 13430 | |
| 13431 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13432 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13433 | obj = port_desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13434 | _version = reader.read("!B")[0] |
| 13435 | assert(_version == 4) |
| 13436 | _type = reader.read("!B")[0] |
| 13437 | assert(_type == 18) |
| 13438 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13439 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13440 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13441 | obj.xid = reader.read("!L")[0] |
| 13442 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13443 | assert(_stats_type == 13) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13444 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13445 | reader.skip(4) |
| 13446 | return obj |
| 13447 | |
| 13448 | def __eq__(self, other): |
| 13449 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13450 | if self.xid != other.xid: return False |
| 13451 | if self.flags != other.flags: return False |
| 13452 | return True |
| 13453 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13454 | def pretty_print(self, q): |
| 13455 | q.text("port_desc_stats_request {") |
| 13456 | with q.group(): |
| 13457 | with q.indent(2): |
| 13458 | q.breakable() |
| 13459 | q.text("xid = "); |
| 13460 | if self.xid != None: |
| 13461 | q.text("%#x" % self.xid) |
| 13462 | else: |
| 13463 | q.text('None') |
| 13464 | q.text(","); q.breakable() |
| 13465 | q.text("flags = "); |
| 13466 | q.text("%#x" % self.flags) |
| 13467 | q.breakable() |
| 13468 | q.text('}') |
| 13469 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13470 | stats_request.subtypes[13] = port_desc_stats_request |
| 13471 | |
| 13472 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13473 | version = 4 |
| 13474 | type = 16 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13475 | |
| 13476 | 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] | 13477 | if xid != None: |
| 13478 | self.xid = xid |
| 13479 | else: |
| 13480 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13481 | if port_no != None: |
| 13482 | self.port_no = port_no |
| 13483 | else: |
| 13484 | self.port_no = 0 |
| 13485 | if hw_addr != None: |
| 13486 | self.hw_addr = hw_addr |
| 13487 | else: |
| 13488 | self.hw_addr = [0,0,0,0,0,0] |
| 13489 | if config != None: |
| 13490 | self.config = config |
| 13491 | else: |
| 13492 | self.config = 0 |
| 13493 | if mask != None: |
| 13494 | self.mask = mask |
| 13495 | else: |
| 13496 | self.mask = 0 |
| 13497 | if advertise != None: |
| 13498 | self.advertise = advertise |
| 13499 | else: |
| 13500 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13501 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13502 | |
| 13503 | def pack(self): |
| 13504 | packed = [] |
| 13505 | packed.append(struct.pack("!B", self.version)) |
| 13506 | packed.append(struct.pack("!B", self.type)) |
| 13507 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13508 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13509 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13510 | packed.append('\x00' * 4) |
| 13511 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 13512 | packed.append('\x00' * 2) |
| 13513 | packed.append(struct.pack("!L", self.config)) |
| 13514 | packed.append(struct.pack("!L", self.mask)) |
| 13515 | packed.append(struct.pack("!L", self.advertise)) |
| 13516 | packed.append('\x00' * 4) |
| 13517 | length = sum([len(x) for x in packed]) |
| 13518 | packed[2] = struct.pack("!H", length) |
| 13519 | return ''.join(packed) |
| 13520 | |
| 13521 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13522 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13523 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13524 | _version = reader.read("!B")[0] |
| 13525 | assert(_version == 4) |
| 13526 | _type = reader.read("!B")[0] |
| 13527 | assert(_type == 16) |
| 13528 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13529 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13530 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13531 | obj.xid = reader.read("!L")[0] |
| 13532 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13533 | reader.skip(4) |
| 13534 | obj.hw_addr = list(reader.read('!6B')) |
| 13535 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13536 | obj.config = reader.read("!L")[0] |
| 13537 | obj.mask = reader.read("!L")[0] |
| 13538 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13539 | reader.skip(4) |
| 13540 | return obj |
| 13541 | |
| 13542 | def __eq__(self, other): |
| 13543 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13544 | if self.xid != other.xid: return False |
| 13545 | if self.port_no != other.port_no: return False |
| 13546 | if self.hw_addr != other.hw_addr: return False |
| 13547 | if self.config != other.config: return False |
| 13548 | if self.mask != other.mask: return False |
| 13549 | if self.advertise != other.advertise: return False |
| 13550 | return True |
| 13551 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13552 | def pretty_print(self, q): |
| 13553 | q.text("port_mod {") |
| 13554 | with q.group(): |
| 13555 | with q.indent(2): |
| 13556 | q.breakable() |
| 13557 | q.text("xid = "); |
| 13558 | if self.xid != None: |
| 13559 | q.text("%#x" % self.xid) |
| 13560 | else: |
| 13561 | q.text('None') |
| 13562 | q.text(","); q.breakable() |
| 13563 | q.text("port_no = "); |
| 13564 | q.text(util.pretty_port(self.port_no)) |
| 13565 | q.text(","); q.breakable() |
| 13566 | q.text("hw_addr = "); |
| 13567 | q.text(util.pretty_mac(self.hw_addr)) |
| 13568 | q.text(","); q.breakable() |
| 13569 | q.text("config = "); |
| 13570 | q.text("%#x" % self.config) |
| 13571 | q.text(","); q.breakable() |
| 13572 | q.text("mask = "); |
| 13573 | q.text("%#x" % self.mask) |
| 13574 | q.text(","); q.breakable() |
| 13575 | q.text("advertise = "); |
| 13576 | q.text("%#x" % self.advertise) |
| 13577 | q.breakable() |
| 13578 | q.text('}') |
| 13579 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13580 | message.subtypes[16] = port_mod |
| 13581 | |
| 13582 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13583 | version = 4 |
| 13584 | type = 1 |
| 13585 | err_type = 7 |
| 13586 | |
| 13587 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13588 | if xid != None: |
| 13589 | self.xid = xid |
| 13590 | else: |
| 13591 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13592 | if code != None: |
| 13593 | self.code = code |
| 13594 | else: |
| 13595 | self.code = 0 |
| 13596 | if data != None: |
| 13597 | self.data = data |
| 13598 | else: |
| 13599 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13600 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13601 | |
| 13602 | def pack(self): |
| 13603 | packed = [] |
| 13604 | packed.append(struct.pack("!B", self.version)) |
| 13605 | packed.append(struct.pack("!B", self.type)) |
| 13606 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13607 | packed.append(struct.pack("!L", self.xid)) |
| 13608 | packed.append(struct.pack("!H", self.err_type)) |
| 13609 | packed.append(struct.pack("!H", self.code)) |
| 13610 | packed.append(self.data) |
| 13611 | length = sum([len(x) for x in packed]) |
| 13612 | packed[2] = struct.pack("!H", length) |
| 13613 | return ''.join(packed) |
| 13614 | |
| 13615 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13616 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13617 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13618 | _version = reader.read("!B")[0] |
| 13619 | assert(_version == 4) |
| 13620 | _type = reader.read("!B")[0] |
| 13621 | assert(_type == 1) |
| 13622 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13623 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13624 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13625 | obj.xid = reader.read("!L")[0] |
| 13626 | _err_type = reader.read("!H")[0] |
| 13627 | assert(_err_type == 7) |
| 13628 | obj.code = reader.read("!H")[0] |
| 13629 | obj.data = str(reader.read_all()) |
| 13630 | return obj |
| 13631 | |
| 13632 | def __eq__(self, other): |
| 13633 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13634 | if self.xid != other.xid: return False |
| 13635 | if self.code != other.code: return False |
| 13636 | if self.data != other.data: return False |
| 13637 | return True |
| 13638 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 13639 | def pretty_print(self, q): |
| 13640 | q.text("port_mod_failed_error_msg {") |
| 13641 | with q.group(): |
| 13642 | with q.indent(2): |
| 13643 | q.breakable() |
| 13644 | q.text("xid = "); |
| 13645 | if self.xid != None: |
| 13646 | q.text("%#x" % self.xid) |
| 13647 | else: |
| 13648 | q.text('None') |
| 13649 | q.text(","); q.breakable() |
| 13650 | q.text("code = "); |
| 13651 | q.text("%#x" % self.code) |
| 13652 | q.text(","); q.breakable() |
| 13653 | q.text("data = "); |
| 13654 | q.pp(self.data) |
| 13655 | q.breakable() |
| 13656 | q.text('}') |
| 13657 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13658 | error_msg.subtypes[7] = port_mod_failed_error_msg |
| 13659 | |
| 13660 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13661 | version = 4 |
| 13662 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13663 | stats_type = 4 |
| 13664 | |
| 13665 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13666 | if xid != None: |
| 13667 | self.xid = xid |
| 13668 | else: |
| 13669 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13670 | if flags != None: |
| 13671 | self.flags = flags |
| 13672 | else: |
| 13673 | self.flags = 0 |
| 13674 | if entries != None: |
| 13675 | self.entries = entries |
| 13676 | else: |
| 13677 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13678 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13679 | |
| 13680 | def pack(self): |
| 13681 | packed = [] |
| 13682 | packed.append(struct.pack("!B", self.version)) |
| 13683 | packed.append(struct.pack("!B", self.type)) |
| 13684 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13685 | packed.append(struct.pack("!L", self.xid)) |
| 13686 | packed.append(struct.pack("!H", self.stats_type)) |
| 13687 | packed.append(struct.pack("!H", self.flags)) |
| 13688 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13689 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13690 | length = sum([len(x) for x in packed]) |
| 13691 | packed[2] = struct.pack("!H", length) |
| 13692 | return ''.join(packed) |
| 13693 | |
| 13694 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13695 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13696 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13697 | _version = reader.read("!B")[0] |
| 13698 | assert(_version == 4) |
| 13699 | _type = reader.read("!B")[0] |
| 13700 | assert(_type == 19) |
| 13701 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13702 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13703 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13704 | obj.xid = reader.read("!L")[0] |
| 13705 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13706 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13707 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13708 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13709 | 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] | 13710 | return obj |
| 13711 | |
| 13712 | def __eq__(self, other): |
| 13713 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13714 | if self.xid != other.xid: return False |
| 13715 | if self.flags != other.flags: return False |
| 13716 | if self.entries != other.entries: return False |
| 13717 | return True |
| 13718 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13719 | def pretty_print(self, q): |
| 13720 | q.text("port_stats_reply {") |
| 13721 | with q.group(): |
| 13722 | with q.indent(2): |
| 13723 | q.breakable() |
| 13724 | q.text("xid = "); |
| 13725 | if self.xid != None: |
| 13726 | q.text("%#x" % self.xid) |
| 13727 | else: |
| 13728 | q.text('None') |
| 13729 | q.text(","); q.breakable() |
| 13730 | q.text("flags = "); |
| 13731 | q.text("%#x" % self.flags) |
| 13732 | q.text(","); q.breakable() |
| 13733 | q.text("entries = "); |
| 13734 | q.pp(self.entries) |
| 13735 | q.breakable() |
| 13736 | q.text('}') |
| 13737 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13738 | stats_reply.subtypes[4] = port_stats_reply |
| 13739 | |
| 13740 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13741 | version = 4 |
| 13742 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13743 | stats_type = 4 |
| 13744 | |
| 13745 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13746 | if xid != None: |
| 13747 | self.xid = xid |
| 13748 | else: |
| 13749 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13750 | if flags != None: |
| 13751 | self.flags = flags |
| 13752 | else: |
| 13753 | self.flags = 0 |
| 13754 | if port_no != None: |
| 13755 | self.port_no = port_no |
| 13756 | else: |
| 13757 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13758 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13759 | |
| 13760 | def pack(self): |
| 13761 | packed = [] |
| 13762 | packed.append(struct.pack("!B", self.version)) |
| 13763 | packed.append(struct.pack("!B", self.type)) |
| 13764 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13765 | packed.append(struct.pack("!L", self.xid)) |
| 13766 | packed.append(struct.pack("!H", self.stats_type)) |
| 13767 | packed.append(struct.pack("!H", self.flags)) |
| 13768 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13769 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13770 | packed.append('\x00' * 4) |
| 13771 | length = sum([len(x) for x in packed]) |
| 13772 | packed[2] = struct.pack("!H", length) |
| 13773 | return ''.join(packed) |
| 13774 | |
| 13775 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13776 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13777 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13778 | _version = reader.read("!B")[0] |
| 13779 | assert(_version == 4) |
| 13780 | _type = reader.read("!B")[0] |
| 13781 | assert(_type == 18) |
| 13782 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13783 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13784 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13785 | obj.xid = reader.read("!L")[0] |
| 13786 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13787 | assert(_stats_type == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13788 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13789 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13790 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13791 | reader.skip(4) |
| 13792 | return obj |
| 13793 | |
| 13794 | def __eq__(self, other): |
| 13795 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13796 | if self.xid != other.xid: return False |
| 13797 | if self.flags != other.flags: return False |
| 13798 | if self.port_no != other.port_no: return False |
| 13799 | return True |
| 13800 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13801 | def pretty_print(self, q): |
| 13802 | q.text("port_stats_request {") |
| 13803 | with q.group(): |
| 13804 | with q.indent(2): |
| 13805 | q.breakable() |
| 13806 | q.text("xid = "); |
| 13807 | if self.xid != None: |
| 13808 | q.text("%#x" % self.xid) |
| 13809 | else: |
| 13810 | q.text('None') |
| 13811 | q.text(","); q.breakable() |
| 13812 | q.text("flags = "); |
| 13813 | q.text("%#x" % self.flags) |
| 13814 | q.text(","); q.breakable() |
| 13815 | q.text("port_no = "); |
| 13816 | q.text(util.pretty_port(self.port_no)) |
| 13817 | q.breakable() |
| 13818 | q.text('}') |
| 13819 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13820 | stats_request.subtypes[4] = port_stats_request |
| 13821 | |
| 13822 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13823 | version = 4 |
| 13824 | type = 12 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13825 | |
| 13826 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13827 | if xid != None: |
| 13828 | self.xid = xid |
| 13829 | else: |
| 13830 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13831 | if reason != None: |
| 13832 | self.reason = reason |
| 13833 | else: |
| 13834 | self.reason = 0 |
| 13835 | if desc != None: |
| 13836 | self.desc = desc |
| 13837 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13838 | self.desc = ofp.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13839 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13840 | |
| 13841 | def pack(self): |
| 13842 | packed = [] |
| 13843 | packed.append(struct.pack("!B", self.version)) |
| 13844 | packed.append(struct.pack("!B", self.type)) |
| 13845 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13846 | packed.append(struct.pack("!L", self.xid)) |
| 13847 | packed.append(struct.pack("!B", self.reason)) |
| 13848 | packed.append('\x00' * 7) |
| 13849 | packed.append(self.desc.pack()) |
| 13850 | length = sum([len(x) for x in packed]) |
| 13851 | packed[2] = struct.pack("!H", length) |
| 13852 | return ''.join(packed) |
| 13853 | |
| 13854 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13855 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13856 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13857 | _version = reader.read("!B")[0] |
| 13858 | assert(_version == 4) |
| 13859 | _type = reader.read("!B")[0] |
| 13860 | assert(_type == 12) |
| 13861 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13862 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13863 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13864 | obj.xid = reader.read("!L")[0] |
| 13865 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13866 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13867 | obj.desc = ofp.port_desc.unpack(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13868 | return obj |
| 13869 | |
| 13870 | def __eq__(self, other): |
| 13871 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13872 | if self.xid != other.xid: return False |
| 13873 | if self.reason != other.reason: return False |
| 13874 | if self.desc != other.desc: return False |
| 13875 | return True |
| 13876 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13877 | def pretty_print(self, q): |
| 13878 | q.text("port_status {") |
| 13879 | with q.group(): |
| 13880 | with q.indent(2): |
| 13881 | q.breakable() |
| 13882 | q.text("xid = "); |
| 13883 | if self.xid != None: |
| 13884 | q.text("%#x" % self.xid) |
| 13885 | else: |
| 13886 | q.text('None') |
| 13887 | q.text(","); q.breakable() |
| 13888 | q.text("reason = "); |
| 13889 | q.text("%#x" % self.reason) |
| 13890 | q.text(","); q.breakable() |
| 13891 | q.text("desc = "); |
| 13892 | q.pp(self.desc) |
| 13893 | q.breakable() |
| 13894 | q.text('}') |
| 13895 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13896 | message.subtypes[12] = port_status |
| 13897 | |
| 13898 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13899 | version = 4 |
| 13900 | type = 23 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13901 | |
| 13902 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13903 | if xid != None: |
| 13904 | self.xid = xid |
| 13905 | else: |
| 13906 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13907 | if port != None: |
| 13908 | self.port = port |
| 13909 | else: |
| 13910 | self.port = 0 |
| 13911 | if queues != None: |
| 13912 | self.queues = queues |
| 13913 | else: |
| 13914 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13915 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13916 | |
| 13917 | def pack(self): |
| 13918 | packed = [] |
| 13919 | packed.append(struct.pack("!B", self.version)) |
| 13920 | packed.append(struct.pack("!B", self.type)) |
| 13921 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13922 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13923 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13924 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13925 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13926 | length = sum([len(x) for x in packed]) |
| 13927 | packed[2] = struct.pack("!H", length) |
| 13928 | return ''.join(packed) |
| 13929 | |
| 13930 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13931 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13932 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13933 | _version = reader.read("!B")[0] |
| 13934 | assert(_version == 4) |
| 13935 | _type = reader.read("!B")[0] |
| 13936 | assert(_type == 23) |
| 13937 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13938 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 13939 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13940 | obj.xid = reader.read("!L")[0] |
| 13941 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13942 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 13943 | 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] | 13944 | return obj |
| 13945 | |
| 13946 | def __eq__(self, other): |
| 13947 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13948 | if self.xid != other.xid: return False |
| 13949 | if self.port != other.port: return False |
| 13950 | if self.queues != other.queues: return False |
| 13951 | return True |
| 13952 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13953 | def pretty_print(self, q): |
| 13954 | q.text("queue_get_config_reply {") |
| 13955 | with q.group(): |
| 13956 | with q.indent(2): |
| 13957 | q.breakable() |
| 13958 | q.text("xid = "); |
| 13959 | if self.xid != None: |
| 13960 | q.text("%#x" % self.xid) |
| 13961 | else: |
| 13962 | q.text('None') |
| 13963 | q.text(","); q.breakable() |
| 13964 | q.text("port = "); |
| 13965 | q.text(util.pretty_port(self.port)) |
| 13966 | q.text(","); q.breakable() |
| 13967 | q.text("queues = "); |
| 13968 | q.pp(self.queues) |
| 13969 | q.breakable() |
| 13970 | q.text('}') |
| 13971 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13972 | message.subtypes[23] = queue_get_config_reply |
| 13973 | |
| 13974 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13975 | version = 4 |
| 13976 | type = 22 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13977 | |
| 13978 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13979 | if xid != None: |
| 13980 | self.xid = xid |
| 13981 | else: |
| 13982 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13983 | if port != None: |
| 13984 | self.port = port |
| 13985 | else: |
| 13986 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 13987 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13988 | |
| 13989 | def pack(self): |
| 13990 | packed = [] |
| 13991 | packed.append(struct.pack("!B", self.version)) |
| 13992 | packed.append(struct.pack("!B", self.type)) |
| 13993 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 13994 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 13995 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 13996 | packed.append('\x00' * 4) |
| 13997 | length = sum([len(x) for x in packed]) |
| 13998 | packed[2] = struct.pack("!H", length) |
| 13999 | return ''.join(packed) |
| 14000 | |
| 14001 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14002 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14003 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14004 | _version = reader.read("!B")[0] |
| 14005 | assert(_version == 4) |
| 14006 | _type = reader.read("!B")[0] |
| 14007 | assert(_type == 22) |
| 14008 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14009 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14010 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14011 | obj.xid = reader.read("!L")[0] |
| 14012 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14013 | reader.skip(4) |
| 14014 | return obj |
| 14015 | |
| 14016 | def __eq__(self, other): |
| 14017 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14018 | if self.xid != other.xid: return False |
| 14019 | if self.port != other.port: return False |
| 14020 | return True |
| 14021 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14022 | def pretty_print(self, q): |
| 14023 | q.text("queue_get_config_request {") |
| 14024 | with q.group(): |
| 14025 | with q.indent(2): |
| 14026 | q.breakable() |
| 14027 | q.text("xid = "); |
| 14028 | if self.xid != None: |
| 14029 | q.text("%#x" % self.xid) |
| 14030 | else: |
| 14031 | q.text('None') |
| 14032 | q.text(","); q.breakable() |
| 14033 | q.text("port = "); |
| 14034 | q.text(util.pretty_port(self.port)) |
| 14035 | q.breakable() |
| 14036 | q.text('}') |
| 14037 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14038 | message.subtypes[22] = queue_get_config_request |
| 14039 | |
| 14040 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14041 | version = 4 |
| 14042 | type = 1 |
| 14043 | err_type = 9 |
| 14044 | |
| 14045 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14046 | if xid != None: |
| 14047 | self.xid = xid |
| 14048 | else: |
| 14049 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14050 | if code != None: |
| 14051 | self.code = code |
| 14052 | else: |
| 14053 | self.code = 0 |
| 14054 | if data != None: |
| 14055 | self.data = data |
| 14056 | else: |
| 14057 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14058 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14059 | |
| 14060 | def pack(self): |
| 14061 | packed = [] |
| 14062 | packed.append(struct.pack("!B", self.version)) |
| 14063 | packed.append(struct.pack("!B", self.type)) |
| 14064 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14065 | packed.append(struct.pack("!L", self.xid)) |
| 14066 | packed.append(struct.pack("!H", self.err_type)) |
| 14067 | packed.append(struct.pack("!H", self.code)) |
| 14068 | packed.append(self.data) |
| 14069 | length = sum([len(x) for x in packed]) |
| 14070 | packed[2] = struct.pack("!H", length) |
| 14071 | return ''.join(packed) |
| 14072 | |
| 14073 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14074 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14075 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14076 | _version = reader.read("!B")[0] |
| 14077 | assert(_version == 4) |
| 14078 | _type = reader.read("!B")[0] |
| 14079 | assert(_type == 1) |
| 14080 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14081 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14082 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14083 | obj.xid = reader.read("!L")[0] |
| 14084 | _err_type = reader.read("!H")[0] |
| 14085 | assert(_err_type == 9) |
| 14086 | obj.code = reader.read("!H")[0] |
| 14087 | obj.data = str(reader.read_all()) |
| 14088 | return obj |
| 14089 | |
| 14090 | def __eq__(self, other): |
| 14091 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14092 | if self.xid != other.xid: return False |
| 14093 | if self.code != other.code: return False |
| 14094 | if self.data != other.data: return False |
| 14095 | return True |
| 14096 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14097 | def pretty_print(self, q): |
| 14098 | q.text("queue_op_failed_error_msg {") |
| 14099 | with q.group(): |
| 14100 | with q.indent(2): |
| 14101 | q.breakable() |
| 14102 | q.text("xid = "); |
| 14103 | if self.xid != None: |
| 14104 | q.text("%#x" % self.xid) |
| 14105 | else: |
| 14106 | q.text('None') |
| 14107 | q.text(","); q.breakable() |
| 14108 | q.text("code = "); |
| 14109 | q.text("%#x" % self.code) |
| 14110 | q.text(","); q.breakable() |
| 14111 | q.text("data = "); |
| 14112 | q.pp(self.data) |
| 14113 | q.breakable() |
| 14114 | q.text('}') |
| 14115 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14116 | error_msg.subtypes[9] = queue_op_failed_error_msg |
| 14117 | |
| 14118 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14119 | version = 4 |
| 14120 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14121 | stats_type = 5 |
| 14122 | |
| 14123 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14124 | if xid != None: |
| 14125 | self.xid = xid |
| 14126 | else: |
| 14127 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14128 | if flags != None: |
| 14129 | self.flags = flags |
| 14130 | else: |
| 14131 | self.flags = 0 |
| 14132 | if entries != None: |
| 14133 | self.entries = entries |
| 14134 | else: |
| 14135 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14136 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14137 | |
| 14138 | def pack(self): |
| 14139 | packed = [] |
| 14140 | packed.append(struct.pack("!B", self.version)) |
| 14141 | packed.append(struct.pack("!B", self.type)) |
| 14142 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14143 | packed.append(struct.pack("!L", self.xid)) |
| 14144 | packed.append(struct.pack("!H", self.stats_type)) |
| 14145 | packed.append(struct.pack("!H", self.flags)) |
| 14146 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14147 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14148 | length = sum([len(x) for x in packed]) |
| 14149 | packed[2] = struct.pack("!H", length) |
| 14150 | return ''.join(packed) |
| 14151 | |
| 14152 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14153 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14154 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14155 | _version = reader.read("!B")[0] |
| 14156 | assert(_version == 4) |
| 14157 | _type = reader.read("!B")[0] |
| 14158 | assert(_type == 19) |
| 14159 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14160 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14161 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14162 | obj.xid = reader.read("!L")[0] |
| 14163 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14164 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14165 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14166 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14167 | 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] | 14168 | return obj |
| 14169 | |
| 14170 | def __eq__(self, other): |
| 14171 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14172 | if self.xid != other.xid: return False |
| 14173 | if self.flags != other.flags: return False |
| 14174 | if self.entries != other.entries: return False |
| 14175 | return True |
| 14176 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14177 | def pretty_print(self, q): |
| 14178 | q.text("queue_stats_reply {") |
| 14179 | with q.group(): |
| 14180 | with q.indent(2): |
| 14181 | q.breakable() |
| 14182 | q.text("xid = "); |
| 14183 | if self.xid != None: |
| 14184 | q.text("%#x" % self.xid) |
| 14185 | else: |
| 14186 | q.text('None') |
| 14187 | q.text(","); q.breakable() |
| 14188 | q.text("flags = "); |
| 14189 | q.text("%#x" % self.flags) |
| 14190 | q.text(","); q.breakable() |
| 14191 | q.text("entries = "); |
| 14192 | q.pp(self.entries) |
| 14193 | q.breakable() |
| 14194 | q.text('}') |
| 14195 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14196 | stats_reply.subtypes[5] = queue_stats_reply |
| 14197 | |
| 14198 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14199 | version = 4 |
| 14200 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14201 | stats_type = 5 |
| 14202 | |
| 14203 | 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] | 14204 | if xid != None: |
| 14205 | self.xid = xid |
| 14206 | else: |
| 14207 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14208 | if flags != None: |
| 14209 | self.flags = flags |
| 14210 | else: |
| 14211 | self.flags = 0 |
| 14212 | if port_no != None: |
| 14213 | self.port_no = port_no |
| 14214 | else: |
| 14215 | self.port_no = 0 |
| 14216 | if queue_id != None: |
| 14217 | self.queue_id = queue_id |
| 14218 | else: |
| 14219 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14220 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14221 | |
| 14222 | def pack(self): |
| 14223 | packed = [] |
| 14224 | packed.append(struct.pack("!B", self.version)) |
| 14225 | packed.append(struct.pack("!B", self.type)) |
| 14226 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14227 | packed.append(struct.pack("!L", self.xid)) |
| 14228 | packed.append(struct.pack("!H", self.stats_type)) |
| 14229 | packed.append(struct.pack("!H", self.flags)) |
| 14230 | packed.append('\x00' * 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14231 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14232 | packed.append(struct.pack("!L", self.queue_id)) |
| 14233 | length = sum([len(x) for x in packed]) |
| 14234 | packed[2] = struct.pack("!H", length) |
| 14235 | return ''.join(packed) |
| 14236 | |
| 14237 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14238 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14239 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14240 | _version = reader.read("!B")[0] |
| 14241 | assert(_version == 4) |
| 14242 | _type = reader.read("!B")[0] |
| 14243 | assert(_type == 18) |
| 14244 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14245 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14246 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14247 | obj.xid = reader.read("!L")[0] |
| 14248 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14249 | assert(_stats_type == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14250 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14251 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14252 | obj.port_no = util.unpack_port_no(reader) |
| 14253 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14254 | return obj |
| 14255 | |
| 14256 | def __eq__(self, other): |
| 14257 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14258 | if self.xid != other.xid: return False |
| 14259 | if self.flags != other.flags: return False |
| 14260 | if self.port_no != other.port_no: return False |
| 14261 | if self.queue_id != other.queue_id: return False |
| 14262 | return True |
| 14263 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14264 | def pretty_print(self, q): |
| 14265 | q.text("queue_stats_request {") |
| 14266 | with q.group(): |
| 14267 | with q.indent(2): |
| 14268 | q.breakable() |
| 14269 | q.text("xid = "); |
| 14270 | if self.xid != None: |
| 14271 | q.text("%#x" % self.xid) |
| 14272 | else: |
| 14273 | q.text('None') |
| 14274 | q.text(","); q.breakable() |
| 14275 | q.text("flags = "); |
| 14276 | q.text("%#x" % self.flags) |
| 14277 | q.text(","); q.breakable() |
| 14278 | q.text("port_no = "); |
| 14279 | q.text(util.pretty_port(self.port_no)) |
| 14280 | q.text(","); q.breakable() |
| 14281 | q.text("queue_id = "); |
| 14282 | q.text("%#x" % self.queue_id) |
| 14283 | q.breakable() |
| 14284 | q.text('}') |
| 14285 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14286 | stats_request.subtypes[5] = queue_stats_request |
| 14287 | |
| 14288 | class role_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14289 | version = 4 |
| 14290 | type = 25 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14291 | |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14292 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14293 | if xid != None: |
| 14294 | self.xid = xid |
| 14295 | else: |
| 14296 | self.xid = None |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14297 | if role != None: |
| 14298 | self.role = role |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14299 | else: |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14300 | self.role = 0 |
| 14301 | if generation_id != None: |
| 14302 | self.generation_id = generation_id |
| 14303 | else: |
| 14304 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14305 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14306 | |
| 14307 | def pack(self): |
| 14308 | packed = [] |
| 14309 | packed.append(struct.pack("!B", self.version)) |
| 14310 | packed.append(struct.pack("!B", self.type)) |
| 14311 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14312 | packed.append(struct.pack("!L", self.xid)) |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14313 | packed.append(struct.pack("!L", self.role)) |
| 14314 | packed.append('\x00' * 4) |
| 14315 | packed.append(struct.pack("!Q", self.generation_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14316 | length = sum([len(x) for x in packed]) |
| 14317 | packed[2] = struct.pack("!H", length) |
| 14318 | return ''.join(packed) |
| 14319 | |
| 14320 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14321 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14322 | obj = role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14323 | _version = reader.read("!B")[0] |
| 14324 | assert(_version == 4) |
| 14325 | _type = reader.read("!B")[0] |
| 14326 | assert(_type == 25) |
| 14327 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14328 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14329 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14330 | obj.xid = reader.read("!L")[0] |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14331 | obj.role = reader.read("!L")[0] |
| 14332 | reader.skip(4) |
| 14333 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14334 | return obj |
| 14335 | |
| 14336 | def __eq__(self, other): |
| 14337 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14338 | if self.xid != other.xid: return False |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14339 | if self.role != other.role: return False |
| 14340 | if self.generation_id != other.generation_id: return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14341 | return True |
| 14342 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14343 | def pretty_print(self, q): |
| 14344 | q.text("role_reply {") |
| 14345 | with q.group(): |
| 14346 | with q.indent(2): |
| 14347 | q.breakable() |
| 14348 | q.text("xid = "); |
| 14349 | if self.xid != None: |
| 14350 | q.text("%#x" % self.xid) |
| 14351 | else: |
| 14352 | q.text('None') |
| 14353 | q.text(","); q.breakable() |
Rich Lane | d9e3f7b | 2013-11-04 11:40:43 -0800 | [diff] [blame] | 14354 | q.text("role = "); |
| 14355 | q.text("%#x" % self.role) |
| 14356 | q.text(","); q.breakable() |
| 14357 | q.text("generation_id = "); |
| 14358 | q.text("%#x" % self.generation_id) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14359 | q.breakable() |
| 14360 | q.text('}') |
| 14361 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14362 | message.subtypes[25] = role_reply |
| 14363 | |
| 14364 | class role_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14365 | version = 4 |
| 14366 | type = 24 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14367 | |
| 14368 | def __init__(self, xid=None, role=None, generation_id=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14369 | if xid != None: |
| 14370 | self.xid = xid |
| 14371 | else: |
| 14372 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14373 | if role != None: |
| 14374 | self.role = role |
| 14375 | else: |
| 14376 | self.role = 0 |
| 14377 | if generation_id != None: |
| 14378 | self.generation_id = generation_id |
| 14379 | else: |
| 14380 | self.generation_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14381 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14382 | |
| 14383 | def pack(self): |
| 14384 | packed = [] |
| 14385 | packed.append(struct.pack("!B", self.version)) |
| 14386 | packed.append(struct.pack("!B", self.type)) |
| 14387 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14388 | packed.append(struct.pack("!L", self.xid)) |
| 14389 | packed.append(struct.pack("!L", self.role)) |
| 14390 | packed.append('\x00' * 4) |
| 14391 | packed.append(struct.pack("!Q", self.generation_id)) |
| 14392 | length = sum([len(x) for x in packed]) |
| 14393 | packed[2] = struct.pack("!H", length) |
| 14394 | return ''.join(packed) |
| 14395 | |
| 14396 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14397 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14398 | obj = role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14399 | _version = reader.read("!B")[0] |
| 14400 | assert(_version == 4) |
| 14401 | _type = reader.read("!B")[0] |
| 14402 | assert(_type == 24) |
| 14403 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14404 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14405 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14406 | obj.xid = reader.read("!L")[0] |
| 14407 | obj.role = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14408 | reader.skip(4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14409 | obj.generation_id = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14410 | return obj |
| 14411 | |
| 14412 | def __eq__(self, other): |
| 14413 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14414 | if self.xid != other.xid: return False |
| 14415 | if self.role != other.role: return False |
| 14416 | if self.generation_id != other.generation_id: return False |
| 14417 | return True |
| 14418 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14419 | def pretty_print(self, q): |
| 14420 | q.text("role_request {") |
| 14421 | with q.group(): |
| 14422 | with q.indent(2): |
| 14423 | q.breakable() |
| 14424 | q.text("xid = "); |
| 14425 | if self.xid != None: |
| 14426 | q.text("%#x" % self.xid) |
| 14427 | else: |
| 14428 | q.text('None') |
| 14429 | q.text(","); q.breakable() |
| 14430 | q.text("role = "); |
| 14431 | q.text("%#x" % self.role) |
| 14432 | q.text(","); q.breakable() |
| 14433 | q.text("generation_id = "); |
| 14434 | q.text("%#x" % self.generation_id) |
| 14435 | q.breakable() |
| 14436 | q.text('}') |
| 14437 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14438 | message.subtypes[24] = role_request |
| 14439 | |
| 14440 | class role_request_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14441 | version = 4 |
| 14442 | type = 1 |
| 14443 | err_type = 11 |
| 14444 | |
| 14445 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14446 | if xid != None: |
| 14447 | self.xid = xid |
| 14448 | else: |
| 14449 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14450 | if code != None: |
| 14451 | self.code = code |
| 14452 | else: |
| 14453 | self.code = 0 |
| 14454 | if data != None: |
| 14455 | self.data = data |
| 14456 | else: |
| 14457 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14458 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14459 | |
| 14460 | def pack(self): |
| 14461 | packed = [] |
| 14462 | packed.append(struct.pack("!B", self.version)) |
| 14463 | packed.append(struct.pack("!B", self.type)) |
| 14464 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14465 | packed.append(struct.pack("!L", self.xid)) |
| 14466 | packed.append(struct.pack("!H", self.err_type)) |
| 14467 | packed.append(struct.pack("!H", self.code)) |
| 14468 | packed.append(self.data) |
| 14469 | length = sum([len(x) for x in packed]) |
| 14470 | packed[2] = struct.pack("!H", length) |
| 14471 | return ''.join(packed) |
| 14472 | |
| 14473 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14474 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14475 | obj = role_request_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14476 | _version = reader.read("!B")[0] |
| 14477 | assert(_version == 4) |
| 14478 | _type = reader.read("!B")[0] |
| 14479 | assert(_type == 1) |
| 14480 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14481 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14482 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14483 | obj.xid = reader.read("!L")[0] |
| 14484 | _err_type = reader.read("!H")[0] |
| 14485 | assert(_err_type == 11) |
| 14486 | obj.code = reader.read("!H")[0] |
| 14487 | obj.data = str(reader.read_all()) |
| 14488 | return obj |
| 14489 | |
| 14490 | def __eq__(self, other): |
| 14491 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14492 | if self.xid != other.xid: return False |
| 14493 | if self.code != other.code: return False |
| 14494 | if self.data != other.data: return False |
| 14495 | return True |
| 14496 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14497 | def pretty_print(self, q): |
| 14498 | q.text("role_request_failed_error_msg {") |
| 14499 | with q.group(): |
| 14500 | with q.indent(2): |
| 14501 | q.breakable() |
| 14502 | q.text("xid = "); |
| 14503 | if self.xid != None: |
| 14504 | q.text("%#x" % self.xid) |
| 14505 | else: |
| 14506 | q.text('None') |
| 14507 | q.text(","); q.breakable() |
| 14508 | q.text("code = "); |
| 14509 | q.text("%#x" % self.code) |
| 14510 | q.text(","); q.breakable() |
| 14511 | q.text("data = "); |
| 14512 | q.pp(self.data) |
| 14513 | q.breakable() |
| 14514 | q.text('}') |
| 14515 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14516 | error_msg.subtypes[11] = role_request_failed_error_msg |
| 14517 | |
| 14518 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14519 | version = 4 |
| 14520 | type = 9 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14521 | |
| 14522 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14523 | if xid != None: |
| 14524 | self.xid = xid |
| 14525 | else: |
| 14526 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14527 | if flags != None: |
| 14528 | self.flags = flags |
| 14529 | else: |
| 14530 | self.flags = 0 |
| 14531 | if miss_send_len != None: |
| 14532 | self.miss_send_len = miss_send_len |
| 14533 | else: |
| 14534 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14535 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14536 | |
| 14537 | def pack(self): |
| 14538 | packed = [] |
| 14539 | packed.append(struct.pack("!B", self.version)) |
| 14540 | packed.append(struct.pack("!B", self.type)) |
| 14541 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14542 | packed.append(struct.pack("!L", self.xid)) |
| 14543 | packed.append(struct.pack("!H", self.flags)) |
| 14544 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 14545 | length = sum([len(x) for x in packed]) |
| 14546 | packed[2] = struct.pack("!H", length) |
| 14547 | return ''.join(packed) |
| 14548 | |
| 14549 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14550 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14551 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14552 | _version = reader.read("!B")[0] |
| 14553 | assert(_version == 4) |
| 14554 | _type = reader.read("!B")[0] |
| 14555 | assert(_type == 9) |
| 14556 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14557 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14558 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14559 | obj.xid = reader.read("!L")[0] |
| 14560 | obj.flags = reader.read("!H")[0] |
| 14561 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14562 | return obj |
| 14563 | |
| 14564 | def __eq__(self, other): |
| 14565 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14566 | if self.xid != other.xid: return False |
| 14567 | if self.flags != other.flags: return False |
| 14568 | if self.miss_send_len != other.miss_send_len: return False |
| 14569 | return True |
| 14570 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14571 | def pretty_print(self, q): |
| 14572 | q.text("set_config {") |
| 14573 | with q.group(): |
| 14574 | with q.indent(2): |
| 14575 | q.breakable() |
| 14576 | q.text("xid = "); |
| 14577 | if self.xid != None: |
| 14578 | q.text("%#x" % self.xid) |
| 14579 | else: |
| 14580 | q.text('None') |
| 14581 | q.text(","); q.breakable() |
| 14582 | q.text("flags = "); |
| 14583 | q.text("%#x" % self.flags) |
| 14584 | q.text(","); q.breakable() |
| 14585 | q.text("miss_send_len = "); |
| 14586 | q.text("%#x" % self.miss_send_len) |
| 14587 | q.breakable() |
| 14588 | q.text('}') |
| 14589 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14590 | message.subtypes[9] = set_config |
| 14591 | |
| 14592 | class switch_config_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14593 | version = 4 |
| 14594 | type = 1 |
| 14595 | err_type = 10 |
| 14596 | |
| 14597 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14598 | if xid != None: |
| 14599 | self.xid = xid |
| 14600 | else: |
| 14601 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14602 | if code != None: |
| 14603 | self.code = code |
| 14604 | else: |
| 14605 | self.code = 0 |
| 14606 | if data != None: |
| 14607 | self.data = data |
| 14608 | else: |
| 14609 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14610 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14611 | |
| 14612 | def pack(self): |
| 14613 | packed = [] |
| 14614 | packed.append(struct.pack("!B", self.version)) |
| 14615 | packed.append(struct.pack("!B", self.type)) |
| 14616 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14617 | packed.append(struct.pack("!L", self.xid)) |
| 14618 | packed.append(struct.pack("!H", self.err_type)) |
| 14619 | packed.append(struct.pack("!H", self.code)) |
| 14620 | packed.append(self.data) |
| 14621 | length = sum([len(x) for x in packed]) |
| 14622 | packed[2] = struct.pack("!H", length) |
| 14623 | return ''.join(packed) |
| 14624 | |
| 14625 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14626 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14627 | obj = switch_config_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14628 | _version = reader.read("!B")[0] |
| 14629 | assert(_version == 4) |
| 14630 | _type = reader.read("!B")[0] |
| 14631 | assert(_type == 1) |
| 14632 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14633 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14634 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14635 | obj.xid = reader.read("!L")[0] |
| 14636 | _err_type = reader.read("!H")[0] |
| 14637 | assert(_err_type == 10) |
| 14638 | obj.code = reader.read("!H")[0] |
| 14639 | obj.data = str(reader.read_all()) |
| 14640 | return obj |
| 14641 | |
| 14642 | def __eq__(self, other): |
| 14643 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14644 | if self.xid != other.xid: return False |
| 14645 | if self.code != other.code: return False |
| 14646 | if self.data != other.data: return False |
| 14647 | return True |
| 14648 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14649 | def pretty_print(self, q): |
| 14650 | q.text("switch_config_failed_error_msg {") |
| 14651 | with q.group(): |
| 14652 | with q.indent(2): |
| 14653 | q.breakable() |
| 14654 | q.text("xid = "); |
| 14655 | if self.xid != None: |
| 14656 | q.text("%#x" % self.xid) |
| 14657 | else: |
| 14658 | q.text('None') |
| 14659 | q.text(","); q.breakable() |
| 14660 | q.text("code = "); |
| 14661 | q.text("%#x" % self.code) |
| 14662 | q.text(","); q.breakable() |
| 14663 | q.text("data = "); |
| 14664 | q.pp(self.data) |
| 14665 | q.breakable() |
| 14666 | q.text('}') |
| 14667 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14668 | error_msg.subtypes[10] = switch_config_failed_error_msg |
| 14669 | |
| 14670 | class table_features_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14671 | version = 4 |
| 14672 | type = 1 |
| 14673 | err_type = 13 |
| 14674 | |
| 14675 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14676 | if xid != None: |
| 14677 | self.xid = xid |
| 14678 | else: |
| 14679 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14680 | if code != None: |
| 14681 | self.code = code |
| 14682 | else: |
| 14683 | self.code = 0 |
| 14684 | if data != None: |
| 14685 | self.data = data |
| 14686 | else: |
| 14687 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14688 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14689 | |
| 14690 | def pack(self): |
| 14691 | packed = [] |
| 14692 | packed.append(struct.pack("!B", self.version)) |
| 14693 | packed.append(struct.pack("!B", self.type)) |
| 14694 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14695 | packed.append(struct.pack("!L", self.xid)) |
| 14696 | packed.append(struct.pack("!H", self.err_type)) |
| 14697 | packed.append(struct.pack("!H", self.code)) |
| 14698 | packed.append(self.data) |
| 14699 | length = sum([len(x) for x in packed]) |
| 14700 | packed[2] = struct.pack("!H", length) |
| 14701 | return ''.join(packed) |
| 14702 | |
| 14703 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14704 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14705 | obj = table_features_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14706 | _version = reader.read("!B")[0] |
| 14707 | assert(_version == 4) |
| 14708 | _type = reader.read("!B")[0] |
| 14709 | assert(_type == 1) |
| 14710 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14711 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14712 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14713 | obj.xid = reader.read("!L")[0] |
| 14714 | _err_type = reader.read("!H")[0] |
| 14715 | assert(_err_type == 13) |
| 14716 | obj.code = reader.read("!H")[0] |
| 14717 | obj.data = str(reader.read_all()) |
| 14718 | return obj |
| 14719 | |
| 14720 | def __eq__(self, other): |
| 14721 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14722 | if self.xid != other.xid: return False |
| 14723 | if self.code != other.code: return False |
| 14724 | if self.data != other.data: return False |
| 14725 | return True |
| 14726 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14727 | def pretty_print(self, q): |
| 14728 | q.text("table_features_failed_error_msg {") |
| 14729 | with q.group(): |
| 14730 | with q.indent(2): |
| 14731 | q.breakable() |
| 14732 | q.text("xid = "); |
| 14733 | if self.xid != None: |
| 14734 | q.text("%#x" % self.xid) |
| 14735 | else: |
| 14736 | q.text('None') |
| 14737 | q.text(","); q.breakable() |
| 14738 | q.text("code = "); |
| 14739 | q.text("%#x" % self.code) |
| 14740 | q.text(","); q.breakable() |
| 14741 | q.text("data = "); |
| 14742 | q.pp(self.data) |
| 14743 | q.breakable() |
| 14744 | q.text('}') |
| 14745 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14746 | error_msg.subtypes[13] = table_features_failed_error_msg |
| 14747 | |
| 14748 | class table_features_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14749 | version = 4 |
| 14750 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14751 | stats_type = 12 |
| 14752 | |
| 14753 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14754 | if xid != None: |
| 14755 | self.xid = xid |
| 14756 | else: |
| 14757 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14758 | if flags != None: |
| 14759 | self.flags = flags |
| 14760 | else: |
| 14761 | self.flags = 0 |
| 14762 | if entries != None: |
| 14763 | self.entries = entries |
| 14764 | else: |
| 14765 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14766 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14767 | |
| 14768 | def pack(self): |
| 14769 | packed = [] |
| 14770 | packed.append(struct.pack("!B", self.version)) |
| 14771 | packed.append(struct.pack("!B", self.type)) |
| 14772 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14773 | packed.append(struct.pack("!L", self.xid)) |
| 14774 | packed.append(struct.pack("!H", self.stats_type)) |
| 14775 | packed.append(struct.pack("!H", self.flags)) |
| 14776 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14777 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14778 | length = sum([len(x) for x in packed]) |
| 14779 | packed[2] = struct.pack("!H", length) |
| 14780 | return ''.join(packed) |
| 14781 | |
| 14782 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14783 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14784 | obj = table_features_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14785 | _version = reader.read("!B")[0] |
| 14786 | assert(_version == 4) |
| 14787 | _type = reader.read("!B")[0] |
| 14788 | assert(_type == 19) |
| 14789 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14790 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14791 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14792 | obj.xid = reader.read("!L")[0] |
| 14793 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14794 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14795 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14796 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14797 | 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] | 14798 | return obj |
| 14799 | |
| 14800 | def __eq__(self, other): |
| 14801 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14802 | if self.xid != other.xid: return False |
| 14803 | if self.flags != other.flags: return False |
| 14804 | if self.entries != other.entries: return False |
| 14805 | return True |
| 14806 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14807 | def pretty_print(self, q): |
| 14808 | q.text("table_features_stats_reply {") |
| 14809 | with q.group(): |
| 14810 | with q.indent(2): |
| 14811 | q.breakable() |
| 14812 | q.text("xid = "); |
| 14813 | if self.xid != None: |
| 14814 | q.text("%#x" % self.xid) |
| 14815 | else: |
| 14816 | q.text('None') |
| 14817 | q.text(","); q.breakable() |
| 14818 | q.text("flags = "); |
| 14819 | q.text("%#x" % self.flags) |
| 14820 | q.text(","); q.breakable() |
| 14821 | q.text("entries = "); |
| 14822 | q.pp(self.entries) |
| 14823 | q.breakable() |
| 14824 | q.text('}') |
| 14825 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14826 | stats_reply.subtypes[12] = table_features_stats_reply |
| 14827 | |
| 14828 | class table_features_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14829 | version = 4 |
| 14830 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14831 | stats_type = 12 |
| 14832 | |
| 14833 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14834 | if xid != None: |
| 14835 | self.xid = xid |
| 14836 | else: |
| 14837 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14838 | if flags != None: |
| 14839 | self.flags = flags |
| 14840 | else: |
| 14841 | self.flags = 0 |
| 14842 | if entries != None: |
| 14843 | self.entries = entries |
| 14844 | else: |
| 14845 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14846 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14847 | |
| 14848 | def pack(self): |
| 14849 | packed = [] |
| 14850 | packed.append(struct.pack("!B", self.version)) |
| 14851 | packed.append(struct.pack("!B", self.type)) |
| 14852 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14853 | packed.append(struct.pack("!L", self.xid)) |
| 14854 | packed.append(struct.pack("!H", self.stats_type)) |
| 14855 | packed.append(struct.pack("!H", self.flags)) |
| 14856 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14857 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14858 | length = sum([len(x) for x in packed]) |
| 14859 | packed[2] = struct.pack("!H", length) |
| 14860 | return ''.join(packed) |
| 14861 | |
| 14862 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14863 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14864 | obj = table_features_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14865 | _version = reader.read("!B")[0] |
| 14866 | assert(_version == 4) |
| 14867 | _type = reader.read("!B")[0] |
| 14868 | assert(_type == 18) |
| 14869 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14870 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14871 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14872 | obj.xid = reader.read("!L")[0] |
| 14873 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14874 | assert(_stats_type == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14875 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14876 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14877 | 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] | 14878 | return obj |
| 14879 | |
| 14880 | def __eq__(self, other): |
| 14881 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14882 | if self.xid != other.xid: return False |
| 14883 | if self.flags != other.flags: return False |
| 14884 | if self.entries != other.entries: return False |
| 14885 | return True |
| 14886 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14887 | def pretty_print(self, q): |
| 14888 | q.text("table_features_stats_request {") |
| 14889 | with q.group(): |
| 14890 | with q.indent(2): |
| 14891 | q.breakable() |
| 14892 | q.text("xid = "); |
| 14893 | if self.xid != None: |
| 14894 | q.text("%#x" % self.xid) |
| 14895 | else: |
| 14896 | q.text('None') |
| 14897 | q.text(","); q.breakable() |
| 14898 | q.text("flags = "); |
| 14899 | q.text("%#x" % self.flags) |
| 14900 | q.text(","); q.breakable() |
| 14901 | q.text("entries = "); |
| 14902 | q.pp(self.entries) |
| 14903 | q.breakable() |
| 14904 | q.text('}') |
| 14905 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14906 | stats_request.subtypes[12] = table_features_stats_request |
| 14907 | |
| 14908 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14909 | version = 4 |
| 14910 | type = 17 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14911 | |
| 14912 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14913 | if xid != None: |
| 14914 | self.xid = xid |
| 14915 | else: |
| 14916 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14917 | if table_id != None: |
| 14918 | self.table_id = table_id |
| 14919 | else: |
| 14920 | self.table_id = 0 |
| 14921 | if config != None: |
| 14922 | self.config = config |
| 14923 | else: |
| 14924 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14925 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14926 | |
| 14927 | def pack(self): |
| 14928 | packed = [] |
| 14929 | packed.append(struct.pack("!B", self.version)) |
| 14930 | packed.append(struct.pack("!B", self.type)) |
| 14931 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 14932 | packed.append(struct.pack("!L", self.xid)) |
| 14933 | packed.append(struct.pack("!B", self.table_id)) |
| 14934 | packed.append('\x00' * 3) |
| 14935 | packed.append(struct.pack("!L", self.config)) |
| 14936 | length = sum([len(x) for x in packed]) |
| 14937 | packed[2] = struct.pack("!H", length) |
| 14938 | return ''.join(packed) |
| 14939 | |
| 14940 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14941 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14942 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14943 | _version = reader.read("!B")[0] |
| 14944 | assert(_version == 4) |
| 14945 | _type = reader.read("!B")[0] |
| 14946 | assert(_type == 17) |
| 14947 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14948 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 14949 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14950 | obj.xid = reader.read("!L")[0] |
| 14951 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14952 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 14953 | obj.config = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14954 | return obj |
| 14955 | |
| 14956 | def __eq__(self, other): |
| 14957 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14958 | if self.xid != other.xid: return False |
| 14959 | if self.table_id != other.table_id: return False |
| 14960 | if self.config != other.config: return False |
| 14961 | return True |
| 14962 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 14963 | def pretty_print(self, q): |
| 14964 | q.text("table_mod {") |
| 14965 | with q.group(): |
| 14966 | with q.indent(2): |
| 14967 | q.breakable() |
| 14968 | q.text("xid = "); |
| 14969 | if self.xid != None: |
| 14970 | q.text("%#x" % self.xid) |
| 14971 | else: |
| 14972 | q.text('None') |
| 14973 | q.text(","); q.breakable() |
| 14974 | q.text("table_id = "); |
| 14975 | q.text("%#x" % self.table_id) |
| 14976 | q.text(","); q.breakable() |
| 14977 | q.text("config = "); |
| 14978 | q.text("%#x" % self.config) |
| 14979 | q.breakable() |
| 14980 | q.text('}') |
| 14981 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14982 | message.subtypes[17] = table_mod |
| 14983 | |
| 14984 | class table_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14985 | version = 4 |
| 14986 | type = 1 |
| 14987 | err_type = 8 |
| 14988 | |
| 14989 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 14990 | if xid != None: |
| 14991 | self.xid = xid |
| 14992 | else: |
| 14993 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 14994 | if code != None: |
| 14995 | self.code = code |
| 14996 | else: |
| 14997 | self.code = 0 |
| 14998 | if data != None: |
| 14999 | self.data = data |
| 15000 | else: |
| 15001 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15002 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15003 | |
| 15004 | def pack(self): |
| 15005 | packed = [] |
| 15006 | packed.append(struct.pack("!B", self.version)) |
| 15007 | packed.append(struct.pack("!B", self.type)) |
| 15008 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15009 | packed.append(struct.pack("!L", self.xid)) |
| 15010 | packed.append(struct.pack("!H", self.err_type)) |
| 15011 | packed.append(struct.pack("!H", self.code)) |
| 15012 | packed.append(self.data) |
| 15013 | length = sum([len(x) for x in packed]) |
| 15014 | packed[2] = struct.pack("!H", length) |
| 15015 | return ''.join(packed) |
| 15016 | |
| 15017 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15018 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15019 | obj = table_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15020 | _version = reader.read("!B")[0] |
| 15021 | assert(_version == 4) |
| 15022 | _type = reader.read("!B")[0] |
| 15023 | assert(_type == 1) |
| 15024 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15025 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15026 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15027 | obj.xid = reader.read("!L")[0] |
| 15028 | _err_type = reader.read("!H")[0] |
| 15029 | assert(_err_type == 8) |
| 15030 | obj.code = reader.read("!H")[0] |
| 15031 | obj.data = str(reader.read_all()) |
| 15032 | return obj |
| 15033 | |
| 15034 | def __eq__(self, other): |
| 15035 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15036 | if self.xid != other.xid: return False |
| 15037 | if self.code != other.code: return False |
| 15038 | if self.data != other.data: return False |
| 15039 | return True |
| 15040 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 15041 | def pretty_print(self, q): |
| 15042 | q.text("table_mod_failed_error_msg {") |
| 15043 | with q.group(): |
| 15044 | with q.indent(2): |
| 15045 | q.breakable() |
| 15046 | q.text("xid = "); |
| 15047 | if self.xid != None: |
| 15048 | q.text("%#x" % self.xid) |
| 15049 | else: |
| 15050 | q.text('None') |
| 15051 | q.text(","); q.breakable() |
| 15052 | q.text("code = "); |
| 15053 | q.text("%#x" % self.code) |
| 15054 | q.text(","); q.breakable() |
| 15055 | q.text("data = "); |
| 15056 | q.pp(self.data) |
| 15057 | q.breakable() |
| 15058 | q.text('}') |
| 15059 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15060 | error_msg.subtypes[8] = table_mod_failed_error_msg |
| 15061 | |
| 15062 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15063 | version = 4 |
| 15064 | type = 19 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15065 | stats_type = 3 |
| 15066 | |
| 15067 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15068 | if xid != None: |
| 15069 | self.xid = xid |
| 15070 | else: |
| 15071 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15072 | if flags != None: |
| 15073 | self.flags = flags |
| 15074 | else: |
| 15075 | self.flags = 0 |
| 15076 | if entries != None: |
| 15077 | self.entries = entries |
| 15078 | else: |
| 15079 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15080 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15081 | |
| 15082 | def pack(self): |
| 15083 | packed = [] |
| 15084 | packed.append(struct.pack("!B", self.version)) |
| 15085 | packed.append(struct.pack("!B", self.type)) |
| 15086 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15087 | packed.append(struct.pack("!L", self.xid)) |
| 15088 | packed.append(struct.pack("!H", self.stats_type)) |
| 15089 | packed.append(struct.pack("!H", self.flags)) |
| 15090 | packed.append('\x00' * 4) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15091 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15092 | length = sum([len(x) for x in packed]) |
| 15093 | packed[2] = struct.pack("!H", length) |
| 15094 | return ''.join(packed) |
| 15095 | |
| 15096 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15097 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15098 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15099 | _version = reader.read("!B")[0] |
| 15100 | assert(_version == 4) |
| 15101 | _type = reader.read("!B")[0] |
| 15102 | assert(_type == 19) |
| 15103 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15104 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15105 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15106 | obj.xid = reader.read("!L")[0] |
| 15107 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15108 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15109 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15110 | reader.skip(4) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15111 | 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] | 15112 | return obj |
| 15113 | |
| 15114 | def __eq__(self, other): |
| 15115 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15116 | if self.xid != other.xid: return False |
| 15117 | if self.flags != other.flags: return False |
| 15118 | if self.entries != other.entries: return False |
| 15119 | return True |
| 15120 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15121 | def pretty_print(self, q): |
| 15122 | q.text("table_stats_reply {") |
| 15123 | with q.group(): |
| 15124 | with q.indent(2): |
| 15125 | q.breakable() |
| 15126 | q.text("xid = "); |
| 15127 | if self.xid != None: |
| 15128 | q.text("%#x" % self.xid) |
| 15129 | else: |
| 15130 | q.text('None') |
| 15131 | q.text(","); q.breakable() |
| 15132 | q.text("flags = "); |
| 15133 | q.text("%#x" % self.flags) |
| 15134 | q.text(","); q.breakable() |
| 15135 | q.text("entries = "); |
| 15136 | q.pp(self.entries) |
| 15137 | q.breakable() |
| 15138 | q.text('}') |
| 15139 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15140 | stats_reply.subtypes[3] = table_stats_reply |
| 15141 | |
| 15142 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15143 | version = 4 |
| 15144 | type = 18 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15145 | stats_type = 3 |
| 15146 | |
| 15147 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15148 | if xid != None: |
| 15149 | self.xid = xid |
| 15150 | else: |
| 15151 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15152 | if flags != None: |
| 15153 | self.flags = flags |
| 15154 | else: |
| 15155 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15156 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15157 | |
| 15158 | def pack(self): |
| 15159 | packed = [] |
| 15160 | packed.append(struct.pack("!B", self.version)) |
| 15161 | packed.append(struct.pack("!B", self.type)) |
| 15162 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 15163 | packed.append(struct.pack("!L", self.xid)) |
| 15164 | packed.append(struct.pack("!H", self.stats_type)) |
| 15165 | packed.append(struct.pack("!H", self.flags)) |
| 15166 | packed.append('\x00' * 4) |
| 15167 | length = sum([len(x) for x in packed]) |
| 15168 | packed[2] = struct.pack("!H", length) |
| 15169 | return ''.join(packed) |
| 15170 | |
| 15171 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15172 | def unpack(reader): |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15173 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15174 | _version = reader.read("!B")[0] |
| 15175 | assert(_version == 4) |
| 15176 | _type = reader.read("!B")[0] |
| 15177 | assert(_type == 18) |
| 15178 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15179 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 15180 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15181 | obj.xid = reader.read("!L")[0] |
| 15182 | _stats_type = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15183 | assert(_stats_type == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 15184 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15185 | reader.skip(4) |
| 15186 | return obj |
| 15187 | |
| 15188 | def __eq__(self, other): |
| 15189 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15190 | if self.xid != other.xid: return False |
| 15191 | if self.flags != other.flags: return False |
| 15192 | return True |
| 15193 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15194 | def pretty_print(self, q): |
| 15195 | q.text("table_stats_request {") |
| 15196 | with q.group(): |
| 15197 | with q.indent(2): |
| 15198 | q.breakable() |
| 15199 | q.text("xid = "); |
| 15200 | if self.xid != None: |
| 15201 | q.text("%#x" % self.xid) |
| 15202 | else: |
| 15203 | q.text('None') |
| 15204 | q.text(","); q.breakable() |
| 15205 | q.text("flags = "); |
| 15206 | q.text("%#x" % self.flags) |
| 15207 | q.breakable() |
| 15208 | q.text('}') |
| 15209 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15210 | stats_request.subtypes[3] = table_stats_request |
| 15211 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 15212 | |
| 15213 | def parse_header(buf): |
| 15214 | if len(buf) < 8: |
| 15215 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 15216 | return struct.unpack_from("!BBHL", buf) |
| 15217 | |
| 15218 | def parse_message(buf): |
| 15219 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 15220 | if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO: |
| 15221 | 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] | 15222 | if len(buf) != msg_len: |
| 15223 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 15224 | return message.unpack(loxi.generic_util.OFReader(buf)) |