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 | b658ddd | 2013-03-12 10:15:10 -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 | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 23 | # Do not modify |
| 24 | |
| 25 | import struct |
| 26 | import loxi |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 27 | import util |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 28 | import loxi.generic_util |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 29 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 30 | import sys |
| 31 | ofp = sys.modules['loxi.of10'] |
| 32 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 33 | class message(loxi.OFObject): |
| 34 | subtypes = {} |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 35 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 36 | version = 1 |
| 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 == 1) |
| 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 = 1 |
| 100 | type = 17 |
| 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 | length = sum([len(x) for x in packed]) |
| 126 | packed[2] = struct.pack("!H", length) |
| 127 | return ''.join(packed) |
| 128 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 129 | @staticmethod |
| 130 | def unpack(reader): |
| 131 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 132 | subclass = stats_reply.subtypes.get(subtype) |
| 133 | if subclass: |
| 134 | return subclass.unpack(reader) |
| 135 | |
| 136 | obj = stats_reply() |
| 137 | _version = reader.read("!B")[0] |
| 138 | assert(_version == 1) |
| 139 | _type = reader.read("!B")[0] |
| 140 | assert(_type == 17) |
| 141 | _length = reader.read("!H")[0] |
| 142 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 143 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 144 | obj.xid = reader.read("!L")[0] |
| 145 | obj.stats_type = reader.read("!H")[0] |
| 146 | obj.flags = reader.read("!H")[0] |
| 147 | return obj |
| 148 | |
| 149 | def __eq__(self, other): |
| 150 | if type(self) != type(other): return False |
| 151 | if self.xid != other.xid: return False |
| 152 | if self.stats_type != other.stats_type: return False |
| 153 | if self.flags != other.flags: return False |
| 154 | return True |
| 155 | |
| 156 | def pretty_print(self, q): |
| 157 | q.text("stats_reply {") |
| 158 | with q.group(): |
| 159 | with q.indent(2): |
| 160 | q.breakable() |
| 161 | q.text("xid = "); |
| 162 | if self.xid != None: |
| 163 | q.text("%#x" % self.xid) |
| 164 | else: |
| 165 | q.text('None') |
| 166 | q.text(","); q.breakable() |
| 167 | q.text("flags = "); |
| 168 | q.text("%#x" % self.flags) |
| 169 | q.breakable() |
| 170 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 171 | |
| 172 | message.subtypes[17] = stats_reply |
| 173 | |
| 174 | class aggregate_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 175 | version = 1 |
| 176 | type = 17 |
| 177 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 178 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 179 | 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] | 180 | if xid != None: |
| 181 | self.xid = xid |
| 182 | else: |
| 183 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 184 | if flags != None: |
| 185 | self.flags = flags |
| 186 | else: |
| 187 | self.flags = 0 |
| 188 | if packet_count != None: |
| 189 | self.packet_count = packet_count |
| 190 | else: |
| 191 | self.packet_count = 0 |
| 192 | if byte_count != None: |
| 193 | self.byte_count = byte_count |
| 194 | else: |
| 195 | self.byte_count = 0 |
| 196 | if flow_count != None: |
| 197 | self.flow_count = flow_count |
| 198 | else: |
| 199 | self.flow_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 200 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 201 | |
| 202 | def pack(self): |
| 203 | packed = [] |
| 204 | packed.append(struct.pack("!B", self.version)) |
| 205 | packed.append(struct.pack("!B", self.type)) |
| 206 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 207 | packed.append(struct.pack("!L", self.xid)) |
| 208 | packed.append(struct.pack("!H", self.stats_type)) |
| 209 | packed.append(struct.pack("!H", self.flags)) |
| 210 | packed.append(struct.pack("!Q", self.packet_count)) |
| 211 | packed.append(struct.pack("!Q", self.byte_count)) |
| 212 | packed.append(struct.pack("!L", self.flow_count)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 213 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 214 | length = sum([len(x) for x in packed]) |
| 215 | packed[2] = struct.pack("!H", length) |
| 216 | return ''.join(packed) |
| 217 | |
| 218 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 219 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 220 | obj = aggregate_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 221 | _version = reader.read("!B")[0] |
| 222 | assert(_version == 1) |
| 223 | _type = reader.read("!B")[0] |
| 224 | assert(_type == 17) |
| 225 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 226 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 227 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 228 | obj.xid = reader.read("!L")[0] |
| 229 | _stats_type = reader.read("!H")[0] |
| 230 | assert(_stats_type == 2) |
| 231 | obj.flags = reader.read("!H")[0] |
| 232 | obj.packet_count = reader.read("!Q")[0] |
| 233 | obj.byte_count = reader.read("!Q")[0] |
| 234 | obj.flow_count = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 235 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 236 | return obj |
| 237 | |
| 238 | def __eq__(self, other): |
| 239 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 240 | if self.xid != other.xid: return False |
| 241 | if self.flags != other.flags: return False |
| 242 | if self.packet_count != other.packet_count: return False |
| 243 | if self.byte_count != other.byte_count: return False |
| 244 | if self.flow_count != other.flow_count: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 245 | return True |
| 246 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 247 | def pretty_print(self, q): |
| 248 | q.text("aggregate_stats_reply {") |
| 249 | with q.group(): |
| 250 | with q.indent(2): |
| 251 | q.breakable() |
| 252 | q.text("xid = "); |
| 253 | if self.xid != None: |
| 254 | q.text("%#x" % self.xid) |
| 255 | else: |
| 256 | q.text('None') |
| 257 | q.text(","); q.breakable() |
| 258 | q.text("flags = "); |
| 259 | q.text("%#x" % self.flags) |
| 260 | q.text(","); q.breakable() |
| 261 | q.text("packet_count = "); |
| 262 | q.text("%#x" % self.packet_count) |
| 263 | q.text(","); q.breakable() |
| 264 | q.text("byte_count = "); |
| 265 | q.text("%#x" % self.byte_count) |
| 266 | q.text(","); q.breakable() |
| 267 | q.text("flow_count = "); |
| 268 | q.text("%#x" % self.flow_count) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 269 | q.breakable() |
| 270 | q.text('}') |
| 271 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 272 | stats_reply.subtypes[2] = aggregate_stats_reply |
| 273 | |
| 274 | class stats_request(message): |
| 275 | subtypes = {} |
| 276 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 277 | version = 1 |
| 278 | type = 16 |
| 279 | |
| 280 | def __init__(self, xid=None, stats_type=None, flags=None): |
| 281 | if xid != None: |
| 282 | self.xid = xid |
| 283 | else: |
| 284 | self.xid = None |
| 285 | if stats_type != None: |
| 286 | self.stats_type = stats_type |
| 287 | else: |
| 288 | self.stats_type = 0 |
| 289 | if flags != None: |
| 290 | self.flags = flags |
| 291 | else: |
| 292 | self.flags = 0 |
| 293 | return |
| 294 | |
| 295 | def pack(self): |
| 296 | packed = [] |
| 297 | packed.append(struct.pack("!B", self.version)) |
| 298 | packed.append(struct.pack("!B", self.type)) |
| 299 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 300 | packed.append(struct.pack("!L", self.xid)) |
| 301 | packed.append(struct.pack("!H", self.stats_type)) |
| 302 | packed.append(struct.pack("!H", self.flags)) |
| 303 | length = sum([len(x) for x in packed]) |
| 304 | packed[2] = struct.pack("!H", length) |
| 305 | return ''.join(packed) |
| 306 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 307 | @staticmethod |
| 308 | def unpack(reader): |
| 309 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 310 | subclass = stats_request.subtypes.get(subtype) |
| 311 | if subclass: |
| 312 | return subclass.unpack(reader) |
| 313 | |
| 314 | obj = stats_request() |
| 315 | _version = reader.read("!B")[0] |
| 316 | assert(_version == 1) |
| 317 | _type = reader.read("!B")[0] |
| 318 | assert(_type == 16) |
| 319 | _length = reader.read("!H")[0] |
| 320 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 321 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 322 | obj.xid = reader.read("!L")[0] |
| 323 | obj.stats_type = reader.read("!H")[0] |
| 324 | obj.flags = reader.read("!H")[0] |
| 325 | return obj |
| 326 | |
| 327 | def __eq__(self, other): |
| 328 | if type(self) != type(other): return False |
| 329 | if self.xid != other.xid: return False |
| 330 | if self.stats_type != other.stats_type: return False |
| 331 | if self.flags != other.flags: return False |
| 332 | return True |
| 333 | |
| 334 | def pretty_print(self, q): |
| 335 | q.text("stats_request {") |
| 336 | with q.group(): |
| 337 | with q.indent(2): |
| 338 | q.breakable() |
| 339 | q.text("xid = "); |
| 340 | if self.xid != None: |
| 341 | q.text("%#x" % self.xid) |
| 342 | else: |
| 343 | q.text('None') |
| 344 | q.text(","); q.breakable() |
| 345 | q.text("flags = "); |
| 346 | q.text("%#x" % self.flags) |
| 347 | q.breakable() |
| 348 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 349 | |
| 350 | message.subtypes[16] = stats_request |
| 351 | |
| 352 | class aggregate_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 353 | version = 1 |
| 354 | type = 16 |
| 355 | stats_type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 356 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 357 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 358 | if xid != None: |
| 359 | self.xid = xid |
| 360 | else: |
| 361 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 362 | if flags != None: |
| 363 | self.flags = flags |
| 364 | else: |
| 365 | self.flags = 0 |
| 366 | if match != None: |
| 367 | self.match = match |
| 368 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 369 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 370 | if table_id != None: |
| 371 | self.table_id = table_id |
| 372 | else: |
| 373 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 374 | if out_port != None: |
| 375 | self.out_port = out_port |
| 376 | else: |
| 377 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 378 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 379 | |
| 380 | def pack(self): |
| 381 | packed = [] |
| 382 | packed.append(struct.pack("!B", self.version)) |
| 383 | packed.append(struct.pack("!B", self.type)) |
| 384 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 385 | packed.append(struct.pack("!L", self.xid)) |
| 386 | packed.append(struct.pack("!H", self.stats_type)) |
| 387 | packed.append(struct.pack("!H", self.flags)) |
| 388 | packed.append(self.match.pack()) |
| 389 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 390 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 391 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 392 | length = sum([len(x) for x in packed]) |
| 393 | packed[2] = struct.pack("!H", length) |
| 394 | return ''.join(packed) |
| 395 | |
| 396 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 397 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 398 | obj = aggregate_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 399 | _version = reader.read("!B")[0] |
| 400 | assert(_version == 1) |
| 401 | _type = reader.read("!B")[0] |
| 402 | assert(_type == 16) |
| 403 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 404 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 405 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 406 | obj.xid = reader.read("!L")[0] |
| 407 | _stats_type = reader.read("!H")[0] |
| 408 | assert(_stats_type == 2) |
| 409 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 410 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 411 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 412 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 413 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 414 | return obj |
| 415 | |
| 416 | def __eq__(self, other): |
| 417 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 418 | if self.xid != other.xid: return False |
| 419 | if self.flags != other.flags: return False |
| 420 | if self.match != other.match: return False |
| 421 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 422 | if self.out_port != other.out_port: return False |
| 423 | return True |
| 424 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 425 | def pretty_print(self, q): |
| 426 | q.text("aggregate_stats_request {") |
| 427 | with q.group(): |
| 428 | with q.indent(2): |
| 429 | q.breakable() |
| 430 | q.text("xid = "); |
| 431 | if self.xid != None: |
| 432 | q.text("%#x" % self.xid) |
| 433 | else: |
| 434 | q.text('None') |
| 435 | q.text(","); q.breakable() |
| 436 | q.text("flags = "); |
| 437 | q.text("%#x" % self.flags) |
| 438 | q.text(","); q.breakable() |
| 439 | q.text("match = "); |
| 440 | q.pp(self.match) |
| 441 | q.text(","); q.breakable() |
| 442 | q.text("table_id = "); |
| 443 | q.text("%#x" % self.table_id) |
| 444 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 445 | q.text("out_port = "); |
| 446 | q.text(util.pretty_port(self.out_port)) |
| 447 | q.breakable() |
| 448 | q.text('}') |
| 449 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 450 | stats_request.subtypes[2] = aggregate_stats_request |
| 451 | |
| 452 | class error_msg(message): |
| 453 | subtypes = {} |
| 454 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 455 | version = 1 |
| 456 | type = 1 |
| 457 | |
| 458 | def __init__(self, xid=None, err_type=None): |
| 459 | if xid != None: |
| 460 | self.xid = xid |
| 461 | else: |
| 462 | self.xid = None |
| 463 | if err_type != None: |
| 464 | self.err_type = err_type |
| 465 | else: |
| 466 | self.err_type = 0 |
| 467 | return |
| 468 | |
| 469 | def pack(self): |
| 470 | packed = [] |
| 471 | packed.append(struct.pack("!B", self.version)) |
| 472 | packed.append(struct.pack("!B", self.type)) |
| 473 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 474 | packed.append(struct.pack("!L", self.xid)) |
| 475 | packed.append(struct.pack("!H", self.err_type)) |
| 476 | length = sum([len(x) for x in packed]) |
| 477 | packed[2] = struct.pack("!H", length) |
| 478 | return ''.join(packed) |
| 479 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 480 | @staticmethod |
| 481 | def unpack(reader): |
| 482 | subtype, = reader.peek('!H', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 483 | subclass = error_msg.subtypes.get(subtype) |
| 484 | if subclass: |
| 485 | return subclass.unpack(reader) |
| 486 | |
| 487 | obj = error_msg() |
| 488 | _version = reader.read("!B")[0] |
| 489 | assert(_version == 1) |
| 490 | _type = reader.read("!B")[0] |
| 491 | assert(_type == 1) |
| 492 | _length = reader.read("!H")[0] |
| 493 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 494 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 495 | obj.xid = reader.read("!L")[0] |
| 496 | obj.err_type = reader.read("!H")[0] |
| 497 | return obj |
| 498 | |
| 499 | def __eq__(self, other): |
| 500 | if type(self) != type(other): return False |
| 501 | if self.xid != other.xid: return False |
| 502 | if self.err_type != other.err_type: return False |
| 503 | return True |
| 504 | |
| 505 | def pretty_print(self, q): |
| 506 | q.text("error_msg {") |
| 507 | with q.group(): |
| 508 | with q.indent(2): |
| 509 | q.breakable() |
| 510 | q.text("xid = "); |
| 511 | if self.xid != None: |
| 512 | q.text("%#x" % self.xid) |
| 513 | else: |
| 514 | q.text('None') |
| 515 | q.breakable() |
| 516 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 517 | |
| 518 | message.subtypes[1] = error_msg |
| 519 | |
| 520 | class bad_action_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 521 | version = 1 |
| 522 | type = 1 |
| 523 | err_type = 2 |
| 524 | |
| 525 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 526 | if xid != None: |
| 527 | self.xid = xid |
| 528 | else: |
| 529 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 530 | if code != None: |
| 531 | self.code = code |
| 532 | else: |
| 533 | self.code = 0 |
| 534 | if data != None: |
| 535 | self.data = data |
| 536 | else: |
| 537 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 538 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 539 | |
| 540 | def pack(self): |
| 541 | packed = [] |
| 542 | packed.append(struct.pack("!B", self.version)) |
| 543 | packed.append(struct.pack("!B", self.type)) |
| 544 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 545 | packed.append(struct.pack("!L", self.xid)) |
| 546 | packed.append(struct.pack("!H", self.err_type)) |
| 547 | packed.append(struct.pack("!H", self.code)) |
| 548 | packed.append(self.data) |
| 549 | length = sum([len(x) for x in packed]) |
| 550 | packed[2] = struct.pack("!H", length) |
| 551 | return ''.join(packed) |
| 552 | |
| 553 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 554 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 555 | obj = bad_action_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 556 | _version = reader.read("!B")[0] |
| 557 | assert(_version == 1) |
| 558 | _type = reader.read("!B")[0] |
| 559 | assert(_type == 1) |
| 560 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 561 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 562 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 563 | obj.xid = reader.read("!L")[0] |
| 564 | _err_type = reader.read("!H")[0] |
| 565 | assert(_err_type == 2) |
| 566 | obj.code = reader.read("!H")[0] |
| 567 | obj.data = str(reader.read_all()) |
| 568 | return obj |
| 569 | |
| 570 | def __eq__(self, other): |
| 571 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 572 | if self.xid != other.xid: return False |
| 573 | if self.code != other.code: return False |
| 574 | if self.data != other.data: return False |
| 575 | return True |
| 576 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 577 | def pretty_print(self, q): |
| 578 | q.text("bad_action_error_msg {") |
| 579 | with q.group(): |
| 580 | with q.indent(2): |
| 581 | q.breakable() |
| 582 | q.text("xid = "); |
| 583 | if self.xid != None: |
| 584 | q.text("%#x" % self.xid) |
| 585 | else: |
| 586 | q.text('None') |
| 587 | q.text(","); q.breakable() |
| 588 | q.text("code = "); |
| 589 | q.text("%#x" % self.code) |
| 590 | q.text(","); q.breakable() |
| 591 | q.text("data = "); |
| 592 | q.pp(self.data) |
| 593 | q.breakable() |
| 594 | q.text('}') |
| 595 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 596 | error_msg.subtypes[2] = bad_action_error_msg |
| 597 | |
| 598 | class bad_request_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 599 | version = 1 |
| 600 | type = 1 |
| 601 | err_type = 1 |
| 602 | |
| 603 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 604 | if xid != None: |
| 605 | self.xid = xid |
| 606 | else: |
| 607 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 608 | if code != None: |
| 609 | self.code = code |
| 610 | else: |
| 611 | self.code = 0 |
| 612 | if data != None: |
| 613 | self.data = data |
| 614 | else: |
| 615 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 616 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 617 | |
| 618 | def pack(self): |
| 619 | packed = [] |
| 620 | packed.append(struct.pack("!B", self.version)) |
| 621 | packed.append(struct.pack("!B", self.type)) |
| 622 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 623 | packed.append(struct.pack("!L", self.xid)) |
| 624 | packed.append(struct.pack("!H", self.err_type)) |
| 625 | packed.append(struct.pack("!H", self.code)) |
| 626 | packed.append(self.data) |
| 627 | length = sum([len(x) for x in packed]) |
| 628 | packed[2] = struct.pack("!H", length) |
| 629 | return ''.join(packed) |
| 630 | |
| 631 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 632 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 633 | obj = bad_request_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 634 | _version = reader.read("!B")[0] |
| 635 | assert(_version == 1) |
| 636 | _type = reader.read("!B")[0] |
| 637 | assert(_type == 1) |
| 638 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 639 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 640 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 641 | obj.xid = reader.read("!L")[0] |
| 642 | _err_type = reader.read("!H")[0] |
| 643 | assert(_err_type == 1) |
| 644 | obj.code = reader.read("!H")[0] |
| 645 | obj.data = str(reader.read_all()) |
| 646 | return obj |
| 647 | |
| 648 | def __eq__(self, other): |
| 649 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 650 | if self.xid != other.xid: return False |
| 651 | if self.code != other.code: return False |
| 652 | if self.data != other.data: return False |
| 653 | return True |
| 654 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 655 | def pretty_print(self, q): |
| 656 | q.text("bad_request_error_msg {") |
| 657 | with q.group(): |
| 658 | with q.indent(2): |
| 659 | q.breakable() |
| 660 | q.text("xid = "); |
| 661 | if self.xid != None: |
| 662 | q.text("%#x" % self.xid) |
| 663 | else: |
| 664 | q.text('None') |
| 665 | q.text(","); q.breakable() |
| 666 | q.text("code = "); |
| 667 | q.text("%#x" % self.code) |
| 668 | q.text(","); q.breakable() |
| 669 | q.text("data = "); |
| 670 | q.pp(self.data) |
| 671 | q.breakable() |
| 672 | q.text('}') |
| 673 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 674 | error_msg.subtypes[1] = bad_request_error_msg |
| 675 | |
| 676 | class barrier_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 677 | version = 1 |
| 678 | type = 19 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 679 | |
| 680 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 681 | if xid != None: |
| 682 | self.xid = xid |
| 683 | else: |
| 684 | self.xid = None |
| 685 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 686 | |
| 687 | def pack(self): |
| 688 | packed = [] |
| 689 | packed.append(struct.pack("!B", self.version)) |
| 690 | packed.append(struct.pack("!B", self.type)) |
| 691 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 692 | packed.append(struct.pack("!L", self.xid)) |
| 693 | length = sum([len(x) for x in packed]) |
| 694 | packed[2] = struct.pack("!H", length) |
| 695 | return ''.join(packed) |
| 696 | |
| 697 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 698 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 699 | obj = barrier_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 700 | _version = reader.read("!B")[0] |
| 701 | assert(_version == 1) |
| 702 | _type = reader.read("!B")[0] |
| 703 | assert(_type == 19) |
| 704 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 705 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 706 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 707 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 708 | return obj |
| 709 | |
| 710 | def __eq__(self, other): |
| 711 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 712 | if self.xid != other.xid: return False |
| 713 | return True |
| 714 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 715 | def pretty_print(self, q): |
| 716 | q.text("barrier_reply {") |
| 717 | with q.group(): |
| 718 | with q.indent(2): |
| 719 | q.breakable() |
| 720 | q.text("xid = "); |
| 721 | if self.xid != None: |
| 722 | q.text("%#x" % self.xid) |
| 723 | else: |
| 724 | q.text('None') |
| 725 | q.breakable() |
| 726 | q.text('}') |
| 727 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 728 | message.subtypes[19] = barrier_reply |
| 729 | |
| 730 | class barrier_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 731 | version = 1 |
| 732 | type = 18 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 733 | |
| 734 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 735 | if xid != None: |
| 736 | self.xid = xid |
| 737 | else: |
| 738 | self.xid = None |
| 739 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 740 | |
| 741 | def pack(self): |
| 742 | packed = [] |
| 743 | packed.append(struct.pack("!B", self.version)) |
| 744 | packed.append(struct.pack("!B", self.type)) |
| 745 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 746 | packed.append(struct.pack("!L", self.xid)) |
| 747 | length = sum([len(x) for x in packed]) |
| 748 | packed[2] = struct.pack("!H", length) |
| 749 | return ''.join(packed) |
| 750 | |
| 751 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 752 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 753 | obj = barrier_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 754 | _version = reader.read("!B")[0] |
| 755 | assert(_version == 1) |
| 756 | _type = reader.read("!B")[0] |
| 757 | assert(_type == 18) |
| 758 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 759 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 760 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 761 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 762 | return obj |
| 763 | |
| 764 | def __eq__(self, other): |
| 765 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 766 | if self.xid != other.xid: return False |
| 767 | return True |
| 768 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 769 | def pretty_print(self, q): |
| 770 | q.text("barrier_request {") |
| 771 | with q.group(): |
| 772 | with q.indent(2): |
| 773 | q.breakable() |
| 774 | q.text("xid = "); |
| 775 | if self.xid != None: |
| 776 | q.text("%#x" % self.xid) |
| 777 | else: |
| 778 | q.text('None') |
| 779 | q.breakable() |
| 780 | q.text('}') |
| 781 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 782 | message.subtypes[18] = barrier_request |
| 783 | |
| 784 | class experimenter(message): |
| 785 | subtypes = {} |
| 786 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 787 | version = 1 |
| 788 | type = 4 |
| 789 | |
Harshmeet Singh | c0378a9 | 2014-07-22 17:09:36 -0700 | [diff] [blame] | 790 | def __init__(self, xid=None, experimenter=None, data=None): |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 791 | if xid != None: |
| 792 | self.xid = xid |
| 793 | else: |
| 794 | self.xid = None |
| 795 | if experimenter != None: |
| 796 | self.experimenter = experimenter |
| 797 | else: |
| 798 | self.experimenter = 0 |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 799 | if data != None: |
| 800 | self.data = data |
| 801 | else: |
| 802 | self.data = '' |
| 803 | return |
| 804 | |
| 805 | def pack(self): |
| 806 | packed = [] |
| 807 | packed.append(struct.pack("!B", self.version)) |
| 808 | packed.append(struct.pack("!B", self.type)) |
| 809 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 810 | packed.append(struct.pack("!L", self.xid)) |
| 811 | packed.append(struct.pack("!L", self.experimenter)) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 812 | packed.append(self.data) |
| 813 | length = sum([len(x) for x in packed]) |
| 814 | packed[2] = struct.pack("!H", length) |
| 815 | return ''.join(packed) |
| 816 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 817 | @staticmethod |
| 818 | def unpack(reader): |
| 819 | subtype, = reader.peek('!L', 8) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 820 | subclass = experimenter.subtypes.get(subtype) |
| 821 | if subclass: |
| 822 | return subclass.unpack(reader) |
| 823 | |
| 824 | obj = experimenter() |
| 825 | _version = reader.read("!B")[0] |
| 826 | assert(_version == 1) |
| 827 | _type = reader.read("!B")[0] |
| 828 | assert(_type == 4) |
| 829 | _length = reader.read("!H")[0] |
| 830 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 831 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 832 | obj.xid = reader.read("!L")[0] |
| 833 | obj.experimenter = reader.read("!L")[0] |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 834 | obj.data = str(reader.read_all()) |
| 835 | return obj |
| 836 | |
| 837 | def __eq__(self, other): |
| 838 | if type(self) != type(other): return False |
| 839 | if self.xid != other.xid: return False |
| 840 | if self.experimenter != other.experimenter: return False |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 841 | if self.data != other.data: return False |
| 842 | return True |
| 843 | |
| 844 | def pretty_print(self, q): |
| 845 | q.text("experimenter {") |
| 846 | with q.group(): |
| 847 | with q.indent(2): |
| 848 | q.breakable() |
| 849 | q.text("xid = "); |
| 850 | if self.xid != None: |
| 851 | q.text("%#x" % self.xid) |
| 852 | else: |
| 853 | q.text('None') |
| 854 | q.text(","); q.breakable() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 855 | q.text("data = "); |
| 856 | q.pp(self.data) |
| 857 | q.breakable() |
| 858 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 859 | |
| 860 | message.subtypes[4] = experimenter |
| 861 | |
| 862 | class bsn_header(experimenter): |
| 863 | subtypes = {} |
| 864 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 865 | version = 1 |
| 866 | type = 4 |
| 867 | experimenter = 6035143 |
| 868 | |
| 869 | def __init__(self, xid=None, subtype=None): |
| 870 | if xid != None: |
| 871 | self.xid = xid |
| 872 | else: |
| 873 | self.xid = None |
| 874 | if subtype != None: |
| 875 | self.subtype = subtype |
| 876 | else: |
| 877 | self.subtype = 0 |
| 878 | return |
| 879 | |
| 880 | def pack(self): |
| 881 | packed = [] |
| 882 | packed.append(struct.pack("!B", self.version)) |
| 883 | packed.append(struct.pack("!B", self.type)) |
| 884 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 885 | packed.append(struct.pack("!L", self.xid)) |
| 886 | packed.append(struct.pack("!L", self.experimenter)) |
| 887 | packed.append(struct.pack("!L", self.subtype)) |
| 888 | length = sum([len(x) for x in packed]) |
| 889 | packed[2] = struct.pack("!H", length) |
| 890 | return ''.join(packed) |
| 891 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 892 | @staticmethod |
| 893 | def unpack(reader): |
| 894 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 895 | subclass = bsn_header.subtypes.get(subtype) |
| 896 | if subclass: |
| 897 | return subclass.unpack(reader) |
| 898 | |
| 899 | obj = bsn_header() |
| 900 | _version = reader.read("!B")[0] |
| 901 | assert(_version == 1) |
| 902 | _type = reader.read("!B")[0] |
| 903 | assert(_type == 4) |
| 904 | _length = reader.read("!H")[0] |
| 905 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 906 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 907 | obj.xid = reader.read("!L")[0] |
| 908 | _experimenter = reader.read("!L")[0] |
| 909 | assert(_experimenter == 6035143) |
| 910 | obj.subtype = reader.read("!L")[0] |
| 911 | return obj |
| 912 | |
| 913 | def __eq__(self, other): |
| 914 | if type(self) != type(other): return False |
| 915 | if self.xid != other.xid: return False |
| 916 | if self.subtype != other.subtype: return False |
| 917 | return True |
| 918 | |
| 919 | def pretty_print(self, q): |
| 920 | q.text("bsn_header {") |
| 921 | with q.group(): |
| 922 | with q.indent(2): |
| 923 | q.breakable() |
| 924 | q.text("xid = "); |
| 925 | if self.xid != None: |
| 926 | q.text("%#x" % self.xid) |
| 927 | else: |
| 928 | q.text('None') |
| 929 | q.breakable() |
| 930 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 931 | |
| 932 | experimenter.subtypes[6035143] = bsn_header |
| 933 | |
| 934 | class bsn_bw_clear_data_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 935 | version = 1 |
| 936 | type = 4 |
| 937 | experimenter = 6035143 |
| 938 | subtype = 22 |
| 939 | |
| 940 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 941 | if xid != None: |
| 942 | self.xid = xid |
| 943 | else: |
| 944 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 945 | if status != None: |
| 946 | self.status = status |
| 947 | else: |
| 948 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 949 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 950 | |
| 951 | def pack(self): |
| 952 | packed = [] |
| 953 | packed.append(struct.pack("!B", self.version)) |
| 954 | packed.append(struct.pack("!B", self.type)) |
| 955 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 956 | packed.append(struct.pack("!L", self.xid)) |
| 957 | packed.append(struct.pack("!L", self.experimenter)) |
| 958 | packed.append(struct.pack("!L", self.subtype)) |
| 959 | packed.append(struct.pack("!L", self.status)) |
| 960 | length = sum([len(x) for x in packed]) |
| 961 | packed[2] = struct.pack("!H", length) |
| 962 | return ''.join(packed) |
| 963 | |
| 964 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 965 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 966 | obj = bsn_bw_clear_data_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 967 | _version = reader.read("!B")[0] |
| 968 | assert(_version == 1) |
| 969 | _type = reader.read("!B")[0] |
| 970 | assert(_type == 4) |
| 971 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 972 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 973 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 974 | obj.xid = reader.read("!L")[0] |
| 975 | _experimenter = reader.read("!L")[0] |
| 976 | assert(_experimenter == 6035143) |
| 977 | _subtype = reader.read("!L")[0] |
| 978 | assert(_subtype == 22) |
| 979 | obj.status = reader.read("!L")[0] |
| 980 | return obj |
| 981 | |
| 982 | def __eq__(self, other): |
| 983 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 984 | if self.xid != other.xid: return False |
| 985 | if self.status != other.status: return False |
| 986 | return True |
| 987 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 988 | def pretty_print(self, q): |
| 989 | q.text("bsn_bw_clear_data_reply {") |
| 990 | with q.group(): |
| 991 | with q.indent(2): |
| 992 | q.breakable() |
| 993 | q.text("xid = "); |
| 994 | if self.xid != None: |
| 995 | q.text("%#x" % self.xid) |
| 996 | else: |
| 997 | q.text('None') |
| 998 | q.text(","); q.breakable() |
| 999 | q.text("status = "); |
| 1000 | q.text("%#x" % self.status) |
| 1001 | q.breakable() |
| 1002 | q.text('}') |
| 1003 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1004 | bsn_header.subtypes[22] = bsn_bw_clear_data_reply |
| 1005 | |
| 1006 | class bsn_bw_clear_data_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1007 | version = 1 |
| 1008 | type = 4 |
| 1009 | experimenter = 6035143 |
| 1010 | subtype = 21 |
| 1011 | |
| 1012 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1013 | if xid != None: |
| 1014 | self.xid = xid |
| 1015 | else: |
| 1016 | self.xid = None |
| 1017 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1018 | |
| 1019 | def pack(self): |
| 1020 | packed = [] |
| 1021 | packed.append(struct.pack("!B", self.version)) |
| 1022 | packed.append(struct.pack("!B", self.type)) |
| 1023 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1024 | packed.append(struct.pack("!L", self.xid)) |
| 1025 | packed.append(struct.pack("!L", self.experimenter)) |
| 1026 | packed.append(struct.pack("!L", self.subtype)) |
| 1027 | length = sum([len(x) for x in packed]) |
| 1028 | packed[2] = struct.pack("!H", length) |
| 1029 | return ''.join(packed) |
| 1030 | |
| 1031 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1032 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1033 | obj = bsn_bw_clear_data_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1034 | _version = reader.read("!B")[0] |
| 1035 | assert(_version == 1) |
| 1036 | _type = reader.read("!B")[0] |
| 1037 | assert(_type == 4) |
| 1038 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1039 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1040 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1041 | obj.xid = reader.read("!L")[0] |
| 1042 | _experimenter = reader.read("!L")[0] |
| 1043 | assert(_experimenter == 6035143) |
| 1044 | _subtype = reader.read("!L")[0] |
| 1045 | assert(_subtype == 21) |
| 1046 | return obj |
| 1047 | |
| 1048 | def __eq__(self, other): |
| 1049 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1050 | if self.xid != other.xid: return False |
| 1051 | return True |
| 1052 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1053 | def pretty_print(self, q): |
| 1054 | q.text("bsn_bw_clear_data_request {") |
| 1055 | with q.group(): |
| 1056 | with q.indent(2): |
| 1057 | q.breakable() |
| 1058 | q.text("xid = "); |
| 1059 | if self.xid != None: |
| 1060 | q.text("%#x" % self.xid) |
| 1061 | else: |
| 1062 | q.text('None') |
| 1063 | q.breakable() |
| 1064 | q.text('}') |
| 1065 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1066 | bsn_header.subtypes[21] = bsn_bw_clear_data_request |
| 1067 | |
| 1068 | class bsn_bw_enable_get_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1069 | version = 1 |
| 1070 | type = 4 |
| 1071 | experimenter = 6035143 |
| 1072 | subtype = 20 |
| 1073 | |
| 1074 | def __init__(self, xid=None, enabled=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1075 | if xid != None: |
| 1076 | self.xid = xid |
| 1077 | else: |
| 1078 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1079 | if enabled != None: |
| 1080 | self.enabled = enabled |
| 1081 | else: |
| 1082 | self.enabled = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1083 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1084 | |
| 1085 | def pack(self): |
| 1086 | packed = [] |
| 1087 | packed.append(struct.pack("!B", self.version)) |
| 1088 | packed.append(struct.pack("!B", self.type)) |
| 1089 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1090 | packed.append(struct.pack("!L", self.xid)) |
| 1091 | packed.append(struct.pack("!L", self.experimenter)) |
| 1092 | packed.append(struct.pack("!L", self.subtype)) |
| 1093 | packed.append(struct.pack("!L", self.enabled)) |
| 1094 | length = sum([len(x) for x in packed]) |
| 1095 | packed[2] = struct.pack("!H", length) |
| 1096 | return ''.join(packed) |
| 1097 | |
| 1098 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1099 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1100 | obj = bsn_bw_enable_get_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1101 | _version = reader.read("!B")[0] |
| 1102 | assert(_version == 1) |
| 1103 | _type = reader.read("!B")[0] |
| 1104 | assert(_type == 4) |
| 1105 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1106 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1107 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1108 | obj.xid = reader.read("!L")[0] |
| 1109 | _experimenter = reader.read("!L")[0] |
| 1110 | assert(_experimenter == 6035143) |
| 1111 | _subtype = reader.read("!L")[0] |
| 1112 | assert(_subtype == 20) |
| 1113 | obj.enabled = reader.read("!L")[0] |
| 1114 | return obj |
| 1115 | |
| 1116 | def __eq__(self, other): |
| 1117 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1118 | if self.xid != other.xid: return False |
| 1119 | if self.enabled != other.enabled: return False |
| 1120 | return True |
| 1121 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1122 | def pretty_print(self, q): |
| 1123 | q.text("bsn_bw_enable_get_reply {") |
| 1124 | with q.group(): |
| 1125 | with q.indent(2): |
| 1126 | q.breakable() |
| 1127 | q.text("xid = "); |
| 1128 | if self.xid != None: |
| 1129 | q.text("%#x" % self.xid) |
| 1130 | else: |
| 1131 | q.text('None') |
| 1132 | q.text(","); q.breakable() |
| 1133 | q.text("enabled = "); |
| 1134 | q.text("%#x" % self.enabled) |
| 1135 | q.breakable() |
| 1136 | q.text('}') |
| 1137 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1138 | bsn_header.subtypes[20] = bsn_bw_enable_get_reply |
| 1139 | |
| 1140 | class bsn_bw_enable_get_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1141 | version = 1 |
| 1142 | type = 4 |
| 1143 | experimenter = 6035143 |
| 1144 | subtype = 19 |
| 1145 | |
| 1146 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1147 | if xid != None: |
| 1148 | self.xid = xid |
| 1149 | else: |
| 1150 | self.xid = None |
| 1151 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1152 | |
| 1153 | def pack(self): |
| 1154 | packed = [] |
| 1155 | packed.append(struct.pack("!B", self.version)) |
| 1156 | packed.append(struct.pack("!B", self.type)) |
| 1157 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1158 | packed.append(struct.pack("!L", self.xid)) |
| 1159 | packed.append(struct.pack("!L", self.experimenter)) |
| 1160 | packed.append(struct.pack("!L", self.subtype)) |
| 1161 | length = sum([len(x) for x in packed]) |
| 1162 | packed[2] = struct.pack("!H", length) |
| 1163 | return ''.join(packed) |
| 1164 | |
| 1165 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1166 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1167 | obj = bsn_bw_enable_get_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1168 | _version = reader.read("!B")[0] |
| 1169 | assert(_version == 1) |
| 1170 | _type = reader.read("!B")[0] |
| 1171 | assert(_type == 4) |
| 1172 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1173 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1174 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1175 | obj.xid = reader.read("!L")[0] |
| 1176 | _experimenter = reader.read("!L")[0] |
| 1177 | assert(_experimenter == 6035143) |
| 1178 | _subtype = reader.read("!L")[0] |
| 1179 | assert(_subtype == 19) |
| 1180 | return obj |
| 1181 | |
| 1182 | def __eq__(self, other): |
| 1183 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1184 | if self.xid != other.xid: return False |
| 1185 | return True |
| 1186 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1187 | def pretty_print(self, q): |
| 1188 | q.text("bsn_bw_enable_get_request {") |
| 1189 | with q.group(): |
| 1190 | with q.indent(2): |
| 1191 | q.breakable() |
| 1192 | q.text("xid = "); |
| 1193 | if self.xid != None: |
| 1194 | q.text("%#x" % self.xid) |
| 1195 | else: |
| 1196 | q.text('None') |
| 1197 | q.breakable() |
| 1198 | q.text('}') |
| 1199 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1200 | bsn_header.subtypes[19] = bsn_bw_enable_get_request |
| 1201 | |
| 1202 | class bsn_bw_enable_set_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1203 | version = 1 |
| 1204 | type = 4 |
| 1205 | experimenter = 6035143 |
| 1206 | subtype = 23 |
| 1207 | |
| 1208 | def __init__(self, xid=None, enable=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1209 | if xid != None: |
| 1210 | self.xid = xid |
| 1211 | else: |
| 1212 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1213 | if enable != None: |
| 1214 | self.enable = enable |
| 1215 | else: |
| 1216 | self.enable = 0 |
| 1217 | if status != None: |
| 1218 | self.status = status |
| 1219 | else: |
| 1220 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1221 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1222 | |
| 1223 | def pack(self): |
| 1224 | packed = [] |
| 1225 | packed.append(struct.pack("!B", self.version)) |
| 1226 | packed.append(struct.pack("!B", self.type)) |
| 1227 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1228 | packed.append(struct.pack("!L", self.xid)) |
| 1229 | packed.append(struct.pack("!L", self.experimenter)) |
| 1230 | packed.append(struct.pack("!L", self.subtype)) |
| 1231 | packed.append(struct.pack("!L", self.enable)) |
| 1232 | packed.append(struct.pack("!L", self.status)) |
| 1233 | length = sum([len(x) for x in packed]) |
| 1234 | packed[2] = struct.pack("!H", length) |
| 1235 | return ''.join(packed) |
| 1236 | |
| 1237 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1238 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1239 | obj = bsn_bw_enable_set_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1240 | _version = reader.read("!B")[0] |
| 1241 | assert(_version == 1) |
| 1242 | _type = reader.read("!B")[0] |
| 1243 | assert(_type == 4) |
| 1244 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1245 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1246 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1247 | obj.xid = reader.read("!L")[0] |
| 1248 | _experimenter = reader.read("!L")[0] |
| 1249 | assert(_experimenter == 6035143) |
| 1250 | _subtype = reader.read("!L")[0] |
| 1251 | assert(_subtype == 23) |
| 1252 | obj.enable = reader.read("!L")[0] |
| 1253 | obj.status = reader.read("!L")[0] |
| 1254 | return obj |
| 1255 | |
| 1256 | def __eq__(self, other): |
| 1257 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1258 | if self.xid != other.xid: return False |
| 1259 | if self.enable != other.enable: return False |
| 1260 | if self.status != other.status: return False |
| 1261 | return True |
| 1262 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1263 | def pretty_print(self, q): |
| 1264 | q.text("bsn_bw_enable_set_reply {") |
| 1265 | with q.group(): |
| 1266 | with q.indent(2): |
| 1267 | q.breakable() |
| 1268 | q.text("xid = "); |
| 1269 | if self.xid != None: |
| 1270 | q.text("%#x" % self.xid) |
| 1271 | else: |
| 1272 | q.text('None') |
| 1273 | q.text(","); q.breakable() |
| 1274 | q.text("enable = "); |
| 1275 | q.text("%#x" % self.enable) |
| 1276 | q.text(","); q.breakable() |
| 1277 | q.text("status = "); |
| 1278 | q.text("%#x" % self.status) |
| 1279 | q.breakable() |
| 1280 | q.text('}') |
| 1281 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1282 | bsn_header.subtypes[23] = bsn_bw_enable_set_reply |
| 1283 | |
| 1284 | class bsn_bw_enable_set_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1285 | version = 1 |
| 1286 | type = 4 |
| 1287 | experimenter = 6035143 |
| 1288 | subtype = 18 |
| 1289 | |
| 1290 | def __init__(self, xid=None, enable=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1291 | if xid != None: |
| 1292 | self.xid = xid |
| 1293 | else: |
| 1294 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1295 | if enable != None: |
| 1296 | self.enable = enable |
| 1297 | else: |
| 1298 | self.enable = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1299 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1300 | |
| 1301 | def pack(self): |
| 1302 | packed = [] |
| 1303 | packed.append(struct.pack("!B", self.version)) |
| 1304 | packed.append(struct.pack("!B", self.type)) |
| 1305 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1306 | packed.append(struct.pack("!L", self.xid)) |
| 1307 | packed.append(struct.pack("!L", self.experimenter)) |
| 1308 | packed.append(struct.pack("!L", self.subtype)) |
| 1309 | packed.append(struct.pack("!L", self.enable)) |
| 1310 | length = sum([len(x) for x in packed]) |
| 1311 | packed[2] = struct.pack("!H", length) |
| 1312 | return ''.join(packed) |
| 1313 | |
| 1314 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1315 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1316 | obj = bsn_bw_enable_set_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1317 | _version = reader.read("!B")[0] |
| 1318 | assert(_version == 1) |
| 1319 | _type = reader.read("!B")[0] |
| 1320 | assert(_type == 4) |
| 1321 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1322 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1323 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1324 | obj.xid = reader.read("!L")[0] |
| 1325 | _experimenter = reader.read("!L")[0] |
| 1326 | assert(_experimenter == 6035143) |
| 1327 | _subtype = reader.read("!L")[0] |
| 1328 | assert(_subtype == 18) |
| 1329 | obj.enable = reader.read("!L")[0] |
| 1330 | return obj |
| 1331 | |
| 1332 | def __eq__(self, other): |
| 1333 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1334 | if self.xid != other.xid: return False |
| 1335 | if self.enable != other.enable: return False |
| 1336 | return True |
| 1337 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1338 | def pretty_print(self, q): |
| 1339 | q.text("bsn_bw_enable_set_request {") |
| 1340 | with q.group(): |
| 1341 | with q.indent(2): |
| 1342 | q.breakable() |
| 1343 | q.text("xid = "); |
| 1344 | if self.xid != None: |
| 1345 | q.text("%#x" % self.xid) |
| 1346 | else: |
| 1347 | q.text('None') |
| 1348 | q.text(","); q.breakable() |
| 1349 | q.text("enable = "); |
| 1350 | q.text("%#x" % self.enable) |
| 1351 | q.breakable() |
| 1352 | q.text('}') |
| 1353 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1354 | bsn_header.subtypes[18] = bsn_bw_enable_set_request |
| 1355 | |
| 1356 | class bsn_get_interfaces_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1357 | version = 1 |
| 1358 | type = 4 |
| 1359 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1360 | subtype = 10 |
| 1361 | |
| 1362 | def __init__(self, xid=None, interfaces=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1363 | if xid != None: |
| 1364 | self.xid = xid |
| 1365 | else: |
| 1366 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1367 | if interfaces != None: |
| 1368 | self.interfaces = interfaces |
| 1369 | else: |
| 1370 | self.interfaces = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1371 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1372 | |
| 1373 | def pack(self): |
| 1374 | packed = [] |
| 1375 | packed.append(struct.pack("!B", self.version)) |
| 1376 | packed.append(struct.pack("!B", self.type)) |
| 1377 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1378 | packed.append(struct.pack("!L", self.xid)) |
| 1379 | packed.append(struct.pack("!L", self.experimenter)) |
| 1380 | packed.append(struct.pack("!L", self.subtype)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1381 | packed.append(loxi.generic_util.pack_list(self.interfaces)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1382 | length = sum([len(x) for x in packed]) |
| 1383 | packed[2] = struct.pack("!H", length) |
| 1384 | return ''.join(packed) |
| 1385 | |
| 1386 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1387 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1388 | obj = bsn_get_interfaces_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1389 | _version = reader.read("!B")[0] |
| 1390 | assert(_version == 1) |
| 1391 | _type = reader.read("!B")[0] |
| 1392 | assert(_type == 4) |
| 1393 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1394 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1395 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1396 | obj.xid = reader.read("!L")[0] |
| 1397 | _experimenter = reader.read("!L")[0] |
| 1398 | assert(_experimenter == 6035143) |
| 1399 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1400 | assert(_subtype == 10) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 1401 | obj.interfaces = loxi.generic_util.unpack_list(reader, ofp.common.bsn_interface.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1402 | return obj |
| 1403 | |
| 1404 | def __eq__(self, other): |
| 1405 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1406 | if self.xid != other.xid: return False |
| 1407 | if self.interfaces != other.interfaces: return False |
| 1408 | return True |
| 1409 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1410 | def pretty_print(self, q): |
| 1411 | q.text("bsn_get_interfaces_reply {") |
| 1412 | with q.group(): |
| 1413 | with q.indent(2): |
| 1414 | q.breakable() |
| 1415 | q.text("xid = "); |
| 1416 | if self.xid != None: |
| 1417 | q.text("%#x" % self.xid) |
| 1418 | else: |
| 1419 | q.text('None') |
| 1420 | q.text(","); q.breakable() |
| 1421 | q.text("interfaces = "); |
| 1422 | q.pp(self.interfaces) |
| 1423 | q.breakable() |
| 1424 | q.text('}') |
| 1425 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1426 | bsn_header.subtypes[10] = bsn_get_interfaces_reply |
| 1427 | |
| 1428 | class bsn_get_interfaces_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1429 | version = 1 |
| 1430 | type = 4 |
| 1431 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1432 | subtype = 9 |
| 1433 | |
| 1434 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1435 | if xid != None: |
| 1436 | self.xid = xid |
| 1437 | else: |
| 1438 | self.xid = None |
| 1439 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1440 | |
| 1441 | def pack(self): |
| 1442 | packed = [] |
| 1443 | packed.append(struct.pack("!B", self.version)) |
| 1444 | packed.append(struct.pack("!B", self.type)) |
| 1445 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1446 | packed.append(struct.pack("!L", self.xid)) |
| 1447 | packed.append(struct.pack("!L", self.experimenter)) |
| 1448 | packed.append(struct.pack("!L", self.subtype)) |
| 1449 | length = sum([len(x) for x in packed]) |
| 1450 | packed[2] = struct.pack("!H", length) |
| 1451 | return ''.join(packed) |
| 1452 | |
| 1453 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1454 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1455 | obj = bsn_get_interfaces_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1456 | _version = reader.read("!B")[0] |
| 1457 | assert(_version == 1) |
| 1458 | _type = reader.read("!B")[0] |
| 1459 | assert(_type == 4) |
| 1460 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1461 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1462 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1463 | obj.xid = reader.read("!L")[0] |
| 1464 | _experimenter = reader.read("!L")[0] |
| 1465 | assert(_experimenter == 6035143) |
| 1466 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1467 | assert(_subtype == 9) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1468 | return obj |
| 1469 | |
| 1470 | def __eq__(self, other): |
| 1471 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1472 | if self.xid != other.xid: return False |
| 1473 | return True |
| 1474 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1475 | def pretty_print(self, q): |
| 1476 | q.text("bsn_get_interfaces_request {") |
| 1477 | with q.group(): |
| 1478 | with q.indent(2): |
| 1479 | q.breakable() |
| 1480 | q.text("xid = "); |
| 1481 | if self.xid != None: |
| 1482 | q.text("%#x" % self.xid) |
| 1483 | else: |
| 1484 | q.text('None') |
| 1485 | q.breakable() |
| 1486 | q.text('}') |
| 1487 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1488 | bsn_header.subtypes[9] = bsn_get_interfaces_request |
| 1489 | |
| 1490 | class bsn_get_ip_mask_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1491 | version = 1 |
| 1492 | type = 4 |
| 1493 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1494 | subtype = 2 |
| 1495 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1496 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1497 | if xid != None: |
| 1498 | self.xid = xid |
| 1499 | else: |
| 1500 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1501 | if index != None: |
| 1502 | self.index = index |
| 1503 | else: |
| 1504 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1505 | if mask != None: |
| 1506 | self.mask = mask |
| 1507 | else: |
| 1508 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1509 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1510 | |
| 1511 | def pack(self): |
| 1512 | packed = [] |
| 1513 | packed.append(struct.pack("!B", self.version)) |
| 1514 | packed.append(struct.pack("!B", self.type)) |
| 1515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1516 | packed.append(struct.pack("!L", self.xid)) |
| 1517 | packed.append(struct.pack("!L", self.experimenter)) |
| 1518 | packed.append(struct.pack("!L", self.subtype)) |
| 1519 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1520 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1521 | packed.append(struct.pack("!L", self.mask)) |
| 1522 | length = sum([len(x) for x in packed]) |
| 1523 | packed[2] = struct.pack("!H", length) |
| 1524 | return ''.join(packed) |
| 1525 | |
| 1526 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1527 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1528 | obj = bsn_get_ip_mask_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1529 | _version = reader.read("!B")[0] |
| 1530 | assert(_version == 1) |
| 1531 | _type = reader.read("!B")[0] |
| 1532 | assert(_type == 4) |
| 1533 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1534 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1535 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1536 | obj.xid = reader.read("!L")[0] |
| 1537 | _experimenter = reader.read("!L")[0] |
| 1538 | assert(_experimenter == 6035143) |
| 1539 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1540 | assert(_subtype == 2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1541 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1542 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1543 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1544 | return obj |
| 1545 | |
| 1546 | def __eq__(self, other): |
| 1547 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1548 | if self.xid != other.xid: return False |
| 1549 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1550 | if self.mask != other.mask: return False |
| 1551 | return True |
| 1552 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1553 | def pretty_print(self, q): |
| 1554 | q.text("bsn_get_ip_mask_reply {") |
| 1555 | with q.group(): |
| 1556 | with q.indent(2): |
| 1557 | q.breakable() |
| 1558 | q.text("xid = "); |
| 1559 | if self.xid != None: |
| 1560 | q.text("%#x" % self.xid) |
| 1561 | else: |
| 1562 | q.text('None') |
| 1563 | q.text(","); q.breakable() |
| 1564 | q.text("index = "); |
| 1565 | q.text("%#x" % self.index) |
| 1566 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1567 | q.text("mask = "); |
| 1568 | q.text("%#x" % self.mask) |
| 1569 | q.breakable() |
| 1570 | q.text('}') |
| 1571 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1572 | bsn_header.subtypes[2] = bsn_get_ip_mask_reply |
| 1573 | |
| 1574 | class bsn_get_ip_mask_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1575 | version = 1 |
| 1576 | type = 4 |
| 1577 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1578 | subtype = 1 |
| 1579 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1580 | def __init__(self, xid=None, index=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1581 | if xid != None: |
| 1582 | self.xid = xid |
| 1583 | else: |
| 1584 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1585 | if index != None: |
| 1586 | self.index = index |
| 1587 | else: |
| 1588 | self.index = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1589 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1590 | |
| 1591 | def pack(self): |
| 1592 | packed = [] |
| 1593 | packed.append(struct.pack("!B", self.version)) |
| 1594 | packed.append(struct.pack("!B", self.type)) |
| 1595 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1596 | packed.append(struct.pack("!L", self.xid)) |
| 1597 | packed.append(struct.pack("!L", self.experimenter)) |
| 1598 | packed.append(struct.pack("!L", self.subtype)) |
| 1599 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1600 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1601 | length = sum([len(x) for x in packed]) |
| 1602 | packed[2] = struct.pack("!H", length) |
| 1603 | return ''.join(packed) |
| 1604 | |
| 1605 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1606 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1607 | obj = bsn_get_ip_mask_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1608 | _version = reader.read("!B")[0] |
| 1609 | assert(_version == 1) |
| 1610 | _type = reader.read("!B")[0] |
| 1611 | assert(_type == 4) |
| 1612 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1613 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1614 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1615 | obj.xid = reader.read("!L")[0] |
| 1616 | _experimenter = reader.read("!L")[0] |
| 1617 | assert(_experimenter == 6035143) |
| 1618 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1619 | assert(_subtype == 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1620 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1621 | reader.skip(7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1622 | return obj |
| 1623 | |
| 1624 | def __eq__(self, other): |
| 1625 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1626 | if self.xid != other.xid: return False |
| 1627 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1628 | return True |
| 1629 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1630 | def pretty_print(self, q): |
| 1631 | q.text("bsn_get_ip_mask_request {") |
| 1632 | with q.group(): |
| 1633 | with q.indent(2): |
| 1634 | q.breakable() |
| 1635 | q.text("xid = "); |
| 1636 | if self.xid != None: |
| 1637 | q.text("%#x" % self.xid) |
| 1638 | else: |
| 1639 | q.text('None') |
| 1640 | q.text(","); q.breakable() |
| 1641 | q.text("index = "); |
| 1642 | q.text("%#x" % self.index) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1643 | q.breakable() |
| 1644 | q.text('}') |
| 1645 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1646 | bsn_header.subtypes[1] = bsn_get_ip_mask_request |
| 1647 | |
| 1648 | class bsn_get_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1649 | version = 1 |
| 1650 | type = 4 |
| 1651 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1652 | subtype = 14 |
| 1653 | |
| 1654 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1655 | if xid != None: |
| 1656 | self.xid = xid |
| 1657 | else: |
| 1658 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1659 | if l2_table_enable != None: |
| 1660 | self.l2_table_enable = l2_table_enable |
| 1661 | else: |
| 1662 | self.l2_table_enable = 0 |
| 1663 | if l2_table_priority != None: |
| 1664 | self.l2_table_priority = l2_table_priority |
| 1665 | else: |
| 1666 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1667 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1668 | |
| 1669 | def pack(self): |
| 1670 | packed = [] |
| 1671 | packed.append(struct.pack("!B", self.version)) |
| 1672 | packed.append(struct.pack("!B", self.type)) |
| 1673 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1674 | packed.append(struct.pack("!L", self.xid)) |
| 1675 | packed.append(struct.pack("!L", self.experimenter)) |
| 1676 | packed.append(struct.pack("!L", self.subtype)) |
| 1677 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 1678 | packed.append('\x00' * 1) |
| 1679 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 1680 | packed.append('\x00' * 4) |
| 1681 | length = sum([len(x) for x in packed]) |
| 1682 | packed[2] = struct.pack("!H", length) |
| 1683 | return ''.join(packed) |
| 1684 | |
| 1685 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1686 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1687 | obj = bsn_get_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1688 | _version = reader.read("!B")[0] |
| 1689 | assert(_version == 1) |
| 1690 | _type = reader.read("!B")[0] |
| 1691 | assert(_type == 4) |
| 1692 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1693 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1694 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1695 | obj.xid = reader.read("!L")[0] |
| 1696 | _experimenter = reader.read("!L")[0] |
| 1697 | assert(_experimenter == 6035143) |
| 1698 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1699 | assert(_subtype == 14) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1700 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1701 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1702 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1703 | reader.skip(4) |
| 1704 | return obj |
| 1705 | |
| 1706 | def __eq__(self, other): |
| 1707 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1708 | if self.xid != other.xid: return False |
| 1709 | if self.l2_table_enable != other.l2_table_enable: return False |
| 1710 | if self.l2_table_priority != other.l2_table_priority: return False |
| 1711 | return True |
| 1712 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1713 | def pretty_print(self, q): |
| 1714 | q.text("bsn_get_l2_table_reply {") |
| 1715 | with q.group(): |
| 1716 | with q.indent(2): |
| 1717 | q.breakable() |
| 1718 | q.text("xid = "); |
| 1719 | if self.xid != None: |
| 1720 | q.text("%#x" % self.xid) |
| 1721 | else: |
| 1722 | q.text('None') |
| 1723 | q.text(","); q.breakable() |
| 1724 | q.text("l2_table_enable = "); |
| 1725 | q.text("%#x" % self.l2_table_enable) |
| 1726 | q.text(","); q.breakable() |
| 1727 | q.text("l2_table_priority = "); |
| 1728 | q.text("%#x" % self.l2_table_priority) |
| 1729 | q.breakable() |
| 1730 | q.text('}') |
| 1731 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1732 | bsn_header.subtypes[14] = bsn_get_l2_table_reply |
| 1733 | |
| 1734 | class bsn_get_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1735 | version = 1 |
| 1736 | type = 4 |
| 1737 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1738 | subtype = 13 |
| 1739 | |
| 1740 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1741 | if xid != None: |
| 1742 | self.xid = xid |
| 1743 | else: |
| 1744 | self.xid = None |
| 1745 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1746 | |
| 1747 | def pack(self): |
| 1748 | packed = [] |
| 1749 | packed.append(struct.pack("!B", self.version)) |
| 1750 | packed.append(struct.pack("!B", self.type)) |
| 1751 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1752 | packed.append(struct.pack("!L", self.xid)) |
| 1753 | packed.append(struct.pack("!L", self.experimenter)) |
| 1754 | packed.append(struct.pack("!L", self.subtype)) |
| 1755 | length = sum([len(x) for x in packed]) |
| 1756 | packed[2] = struct.pack("!H", length) |
| 1757 | return ''.join(packed) |
| 1758 | |
| 1759 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1760 | def unpack(reader): |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1761 | obj = bsn_get_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1762 | _version = reader.read("!B")[0] |
| 1763 | assert(_version == 1) |
| 1764 | _type = reader.read("!B")[0] |
| 1765 | assert(_type == 4) |
| 1766 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1767 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1768 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1769 | obj.xid = reader.read("!L")[0] |
| 1770 | _experimenter = reader.read("!L")[0] |
| 1771 | assert(_experimenter == 6035143) |
| 1772 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1773 | assert(_subtype == 13) |
| 1774 | return obj |
| 1775 | |
| 1776 | def __eq__(self, other): |
| 1777 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1778 | if self.xid != other.xid: return False |
| 1779 | return True |
| 1780 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 1781 | def pretty_print(self, q): |
| 1782 | q.text("bsn_get_l2_table_request {") |
| 1783 | with q.group(): |
| 1784 | with q.indent(2): |
| 1785 | q.breakable() |
| 1786 | q.text("xid = "); |
| 1787 | if self.xid != None: |
| 1788 | q.text("%#x" % self.xid) |
| 1789 | else: |
| 1790 | q.text('None') |
| 1791 | q.breakable() |
| 1792 | q.text('}') |
| 1793 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1794 | bsn_header.subtypes[13] = bsn_get_l2_table_request |
| 1795 | |
| 1796 | class bsn_get_mirroring_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1797 | version = 1 |
| 1798 | type = 4 |
| 1799 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1800 | subtype = 5 |
| 1801 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1802 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1803 | if xid != None: |
| 1804 | self.xid = xid |
| 1805 | else: |
| 1806 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1807 | if report_mirror_ports != None: |
| 1808 | self.report_mirror_ports = report_mirror_ports |
| 1809 | else: |
| 1810 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1811 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1812 | |
| 1813 | def pack(self): |
| 1814 | packed = [] |
| 1815 | packed.append(struct.pack("!B", self.version)) |
| 1816 | packed.append(struct.pack("!B", self.type)) |
| 1817 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1818 | packed.append(struct.pack("!L", self.xid)) |
| 1819 | packed.append(struct.pack("!L", self.experimenter)) |
| 1820 | packed.append(struct.pack("!L", self.subtype)) |
| 1821 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1822 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1823 | length = sum([len(x) for x in packed]) |
| 1824 | packed[2] = struct.pack("!H", length) |
| 1825 | return ''.join(packed) |
| 1826 | |
| 1827 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1828 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1829 | obj = bsn_get_mirroring_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1830 | _version = reader.read("!B")[0] |
| 1831 | assert(_version == 1) |
| 1832 | _type = reader.read("!B")[0] |
| 1833 | assert(_type == 4) |
| 1834 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1835 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1836 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1837 | obj.xid = reader.read("!L")[0] |
| 1838 | _experimenter = reader.read("!L")[0] |
| 1839 | assert(_experimenter == 6035143) |
| 1840 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1841 | assert(_subtype == 5) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1842 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1843 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1844 | return obj |
| 1845 | |
| 1846 | def __eq__(self, other): |
| 1847 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1848 | if self.xid != other.xid: return False |
| 1849 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1850 | return True |
| 1851 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1852 | def pretty_print(self, q): |
| 1853 | q.text("bsn_get_mirroring_reply {") |
| 1854 | with q.group(): |
| 1855 | with q.indent(2): |
| 1856 | q.breakable() |
| 1857 | q.text("xid = "); |
| 1858 | if self.xid != None: |
| 1859 | q.text("%#x" % self.xid) |
| 1860 | else: |
| 1861 | q.text('None') |
| 1862 | q.text(","); q.breakable() |
| 1863 | q.text("report_mirror_ports = "); |
| 1864 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1865 | q.breakable() |
| 1866 | q.text('}') |
| 1867 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1868 | bsn_header.subtypes[5] = bsn_get_mirroring_reply |
| 1869 | |
| 1870 | class bsn_get_mirroring_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1871 | version = 1 |
| 1872 | type = 4 |
| 1873 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1874 | subtype = 4 |
| 1875 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1876 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1877 | if xid != None: |
| 1878 | self.xid = xid |
| 1879 | else: |
| 1880 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1881 | if report_mirror_ports != None: |
| 1882 | self.report_mirror_ports = report_mirror_ports |
| 1883 | else: |
| 1884 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1885 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1886 | |
| 1887 | def pack(self): |
| 1888 | packed = [] |
| 1889 | packed.append(struct.pack("!B", self.version)) |
| 1890 | packed.append(struct.pack("!B", self.type)) |
| 1891 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1892 | packed.append(struct.pack("!L", self.xid)) |
| 1893 | packed.append(struct.pack("!L", self.experimenter)) |
| 1894 | packed.append(struct.pack("!L", self.subtype)) |
| 1895 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1896 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1897 | length = sum([len(x) for x in packed]) |
| 1898 | packed[2] = struct.pack("!H", length) |
| 1899 | return ''.join(packed) |
| 1900 | |
| 1901 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1902 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1903 | obj = bsn_get_mirroring_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1904 | _version = reader.read("!B")[0] |
| 1905 | assert(_version == 1) |
| 1906 | _type = reader.read("!B")[0] |
| 1907 | assert(_type == 4) |
| 1908 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1909 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1910 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1911 | obj.xid = reader.read("!L")[0] |
| 1912 | _experimenter = reader.read("!L")[0] |
| 1913 | assert(_experimenter == 6035143) |
| 1914 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1915 | assert(_subtype == 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 1916 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 1917 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1918 | return obj |
| 1919 | |
| 1920 | def __eq__(self, other): |
| 1921 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1922 | if self.xid != other.xid: return False |
| 1923 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1924 | return True |
| 1925 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1926 | def pretty_print(self, q): |
| 1927 | q.text("bsn_get_mirroring_request {") |
| 1928 | with q.group(): |
| 1929 | with q.indent(2): |
| 1930 | q.breakable() |
| 1931 | q.text("xid = "); |
| 1932 | if self.xid != None: |
| 1933 | q.text("%#x" % self.xid) |
| 1934 | else: |
| 1935 | q.text('None') |
| 1936 | q.text(","); q.breakable() |
| 1937 | q.text("report_mirror_ports = "); |
| 1938 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 1939 | q.breakable() |
| 1940 | q.text('}') |
| 1941 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1942 | bsn_header.subtypes[4] = bsn_get_mirroring_request |
| 1943 | |
| 1944 | class bsn_hybrid_get_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1945 | version = 1 |
| 1946 | type = 4 |
| 1947 | experimenter = 6035143 |
| 1948 | subtype = 28 |
| 1949 | |
| 1950 | def __init__(self, xid=None, hybrid_enable=None, hybrid_version=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1951 | if xid != None: |
| 1952 | self.xid = xid |
| 1953 | else: |
| 1954 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1955 | if hybrid_enable != None: |
| 1956 | self.hybrid_enable = hybrid_enable |
| 1957 | else: |
| 1958 | self.hybrid_enable = 0 |
| 1959 | if hybrid_version != None: |
| 1960 | self.hybrid_version = hybrid_version |
| 1961 | else: |
| 1962 | self.hybrid_version = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1963 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1964 | |
| 1965 | def pack(self): |
| 1966 | packed = [] |
| 1967 | packed.append(struct.pack("!B", self.version)) |
| 1968 | packed.append(struct.pack("!B", self.type)) |
| 1969 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 1970 | packed.append(struct.pack("!L", self.xid)) |
| 1971 | packed.append(struct.pack("!L", self.experimenter)) |
| 1972 | packed.append(struct.pack("!L", self.subtype)) |
| 1973 | packed.append(struct.pack("!B", self.hybrid_enable)) |
| 1974 | packed.append('\x00' * 1) |
| 1975 | packed.append(struct.pack("!H", self.hybrid_version)) |
| 1976 | packed.append('\x00' * 4) |
| 1977 | length = sum([len(x) for x in packed]) |
| 1978 | packed[2] = struct.pack("!H", length) |
| 1979 | return ''.join(packed) |
| 1980 | |
| 1981 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1982 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1983 | obj = bsn_hybrid_get_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1984 | _version = reader.read("!B")[0] |
| 1985 | assert(_version == 1) |
| 1986 | _type = reader.read("!B")[0] |
| 1987 | assert(_type == 4) |
| 1988 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 1989 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 1990 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 1991 | obj.xid = reader.read("!L")[0] |
| 1992 | _experimenter = reader.read("!L")[0] |
| 1993 | assert(_experimenter == 6035143) |
| 1994 | _subtype = reader.read("!L")[0] |
| 1995 | assert(_subtype == 28) |
| 1996 | obj.hybrid_enable = reader.read("!B")[0] |
| 1997 | reader.skip(1) |
| 1998 | obj.hybrid_version = reader.read("!H")[0] |
| 1999 | reader.skip(4) |
| 2000 | return obj |
| 2001 | |
| 2002 | def __eq__(self, other): |
| 2003 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2004 | if self.xid != other.xid: return False |
| 2005 | if self.hybrid_enable != other.hybrid_enable: return False |
| 2006 | if self.hybrid_version != other.hybrid_version: return False |
| 2007 | return True |
| 2008 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2009 | def pretty_print(self, q): |
| 2010 | q.text("bsn_hybrid_get_reply {") |
| 2011 | with q.group(): |
| 2012 | with q.indent(2): |
| 2013 | q.breakable() |
| 2014 | q.text("xid = "); |
| 2015 | if self.xid != None: |
| 2016 | q.text("%#x" % self.xid) |
| 2017 | else: |
| 2018 | q.text('None') |
| 2019 | q.text(","); q.breakable() |
| 2020 | q.text("hybrid_enable = "); |
| 2021 | q.text("%#x" % self.hybrid_enable) |
| 2022 | q.text(","); q.breakable() |
| 2023 | q.text("hybrid_version = "); |
| 2024 | q.text("%#x" % self.hybrid_version) |
| 2025 | q.breakable() |
| 2026 | q.text('}') |
| 2027 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2028 | bsn_header.subtypes[28] = bsn_hybrid_get_reply |
| 2029 | |
| 2030 | class bsn_hybrid_get_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2031 | version = 1 |
| 2032 | type = 4 |
| 2033 | experimenter = 6035143 |
| 2034 | subtype = 27 |
| 2035 | |
| 2036 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2037 | if xid != None: |
| 2038 | self.xid = xid |
| 2039 | else: |
| 2040 | self.xid = None |
| 2041 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2042 | |
| 2043 | def pack(self): |
| 2044 | packed = [] |
| 2045 | packed.append(struct.pack("!B", self.version)) |
| 2046 | packed.append(struct.pack("!B", self.type)) |
| 2047 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2048 | packed.append(struct.pack("!L", self.xid)) |
| 2049 | packed.append(struct.pack("!L", self.experimenter)) |
| 2050 | packed.append(struct.pack("!L", self.subtype)) |
| 2051 | length = sum([len(x) for x in packed]) |
| 2052 | packed[2] = struct.pack("!H", length) |
| 2053 | return ''.join(packed) |
| 2054 | |
| 2055 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2056 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2057 | obj = bsn_hybrid_get_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2058 | _version = reader.read("!B")[0] |
| 2059 | assert(_version == 1) |
| 2060 | _type = reader.read("!B")[0] |
| 2061 | assert(_type == 4) |
| 2062 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2063 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2064 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2065 | obj.xid = reader.read("!L")[0] |
| 2066 | _experimenter = reader.read("!L")[0] |
| 2067 | assert(_experimenter == 6035143) |
| 2068 | _subtype = reader.read("!L")[0] |
| 2069 | assert(_subtype == 27) |
| 2070 | return obj |
| 2071 | |
| 2072 | def __eq__(self, other): |
| 2073 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2074 | if self.xid != other.xid: return False |
| 2075 | return True |
| 2076 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2077 | def pretty_print(self, q): |
| 2078 | q.text("bsn_hybrid_get_request {") |
| 2079 | with q.group(): |
| 2080 | with q.indent(2): |
| 2081 | q.breakable() |
| 2082 | q.text("xid = "); |
| 2083 | if self.xid != None: |
| 2084 | q.text("%#x" % self.xid) |
| 2085 | else: |
| 2086 | q.text('None') |
| 2087 | q.breakable() |
| 2088 | q.text('}') |
| 2089 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2090 | bsn_header.subtypes[27] = bsn_hybrid_get_request |
| 2091 | |
| 2092 | class bsn_pdu_rx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2093 | version = 1 |
| 2094 | type = 4 |
| 2095 | experimenter = 6035143 |
| 2096 | subtype = 34 |
| 2097 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2098 | 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] | 2099 | if xid != None: |
| 2100 | self.xid = xid |
| 2101 | else: |
| 2102 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2103 | if status != None: |
| 2104 | self.status = status |
| 2105 | else: |
| 2106 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2107 | if port_no != None: |
| 2108 | self.port_no = port_no |
| 2109 | else: |
| 2110 | self.port_no = 0 |
| 2111 | if slot_num != None: |
| 2112 | self.slot_num = slot_num |
| 2113 | else: |
| 2114 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2115 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2116 | |
| 2117 | def pack(self): |
| 2118 | packed = [] |
| 2119 | packed.append(struct.pack("!B", self.version)) |
| 2120 | packed.append(struct.pack("!B", self.type)) |
| 2121 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2122 | packed.append(struct.pack("!L", self.xid)) |
| 2123 | packed.append(struct.pack("!L", self.experimenter)) |
| 2124 | packed.append(struct.pack("!L", self.subtype)) |
| 2125 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2126 | packed.append(util.pack_port_no(self.port_no)) |
| 2127 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2128 | length = sum([len(x) for x in packed]) |
| 2129 | packed[2] = struct.pack("!H", length) |
| 2130 | return ''.join(packed) |
| 2131 | |
| 2132 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2133 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2134 | obj = bsn_pdu_rx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2135 | _version = reader.read("!B")[0] |
| 2136 | assert(_version == 1) |
| 2137 | _type = reader.read("!B")[0] |
| 2138 | assert(_type == 4) |
| 2139 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2140 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2141 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2142 | obj.xid = reader.read("!L")[0] |
| 2143 | _experimenter = reader.read("!L")[0] |
| 2144 | assert(_experimenter == 6035143) |
| 2145 | _subtype = reader.read("!L")[0] |
| 2146 | assert(_subtype == 34) |
| 2147 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2148 | obj.port_no = util.unpack_port_no(reader) |
| 2149 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2150 | return obj |
| 2151 | |
| 2152 | def __eq__(self, other): |
| 2153 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2154 | if self.xid != other.xid: return False |
| 2155 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2156 | if self.port_no != other.port_no: return False |
| 2157 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2158 | return True |
| 2159 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2160 | def pretty_print(self, q): |
| 2161 | q.text("bsn_pdu_rx_reply {") |
| 2162 | with q.group(): |
| 2163 | with q.indent(2): |
| 2164 | q.breakable() |
| 2165 | q.text("xid = "); |
| 2166 | if self.xid != None: |
| 2167 | q.text("%#x" % self.xid) |
| 2168 | else: |
| 2169 | q.text('None') |
| 2170 | q.text(","); q.breakable() |
| 2171 | q.text("status = "); |
| 2172 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2173 | q.text(","); q.breakable() |
| 2174 | q.text("port_no = "); |
| 2175 | q.text(util.pretty_port(self.port_no)) |
| 2176 | q.text(","); q.breakable() |
| 2177 | q.text("slot_num = "); |
| 2178 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2179 | q.breakable() |
| 2180 | q.text('}') |
| 2181 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2182 | bsn_header.subtypes[34] = bsn_pdu_rx_reply |
| 2183 | |
| 2184 | class bsn_pdu_rx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2185 | version = 1 |
| 2186 | type = 4 |
| 2187 | experimenter = 6035143 |
| 2188 | subtype = 33 |
| 2189 | |
| 2190 | 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] | 2191 | if xid != None: |
| 2192 | self.xid = xid |
| 2193 | else: |
| 2194 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2195 | if timeout_ms != None: |
| 2196 | self.timeout_ms = timeout_ms |
| 2197 | else: |
| 2198 | self.timeout_ms = 0 |
| 2199 | if port_no != None: |
| 2200 | self.port_no = port_no |
| 2201 | else: |
| 2202 | self.port_no = 0 |
| 2203 | if slot_num != None: |
| 2204 | self.slot_num = slot_num |
| 2205 | else: |
| 2206 | self.slot_num = 0 |
| 2207 | if data != None: |
| 2208 | self.data = data |
| 2209 | else: |
| 2210 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2211 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2212 | |
| 2213 | def pack(self): |
| 2214 | packed = [] |
| 2215 | packed.append(struct.pack("!B", self.version)) |
| 2216 | packed.append(struct.pack("!B", self.type)) |
| 2217 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2218 | packed.append(struct.pack("!L", self.xid)) |
| 2219 | packed.append(struct.pack("!L", self.experimenter)) |
| 2220 | packed.append(struct.pack("!L", self.subtype)) |
| 2221 | packed.append(struct.pack("!L", self.timeout_ms)) |
| 2222 | packed.append(util.pack_port_no(self.port_no)) |
| 2223 | packed.append(struct.pack("!B", self.slot_num)) |
| 2224 | packed.append('\x00' * 3) |
| 2225 | packed.append(self.data) |
| 2226 | length = sum([len(x) for x in packed]) |
| 2227 | packed[2] = struct.pack("!H", length) |
| 2228 | return ''.join(packed) |
| 2229 | |
| 2230 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2231 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2232 | obj = bsn_pdu_rx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2233 | _version = reader.read("!B")[0] |
| 2234 | assert(_version == 1) |
| 2235 | _type = reader.read("!B")[0] |
| 2236 | assert(_type == 4) |
| 2237 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2238 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2239 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2240 | obj.xid = reader.read("!L")[0] |
| 2241 | _experimenter = reader.read("!L")[0] |
| 2242 | assert(_experimenter == 6035143) |
| 2243 | _subtype = reader.read("!L")[0] |
| 2244 | assert(_subtype == 33) |
| 2245 | obj.timeout_ms = reader.read("!L")[0] |
| 2246 | obj.port_no = util.unpack_port_no(reader) |
| 2247 | obj.slot_num = reader.read("!B")[0] |
| 2248 | reader.skip(3) |
| 2249 | obj.data = str(reader.read_all()) |
| 2250 | return obj |
| 2251 | |
| 2252 | def __eq__(self, other): |
| 2253 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2254 | if self.xid != other.xid: return False |
| 2255 | if self.timeout_ms != other.timeout_ms: return False |
| 2256 | if self.port_no != other.port_no: return False |
| 2257 | if self.slot_num != other.slot_num: return False |
| 2258 | if self.data != other.data: return False |
| 2259 | return True |
| 2260 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2261 | def pretty_print(self, q): |
| 2262 | q.text("bsn_pdu_rx_request {") |
| 2263 | with q.group(): |
| 2264 | with q.indent(2): |
| 2265 | q.breakable() |
| 2266 | q.text("xid = "); |
| 2267 | if self.xid != None: |
| 2268 | q.text("%#x" % self.xid) |
| 2269 | else: |
| 2270 | q.text('None') |
| 2271 | q.text(","); q.breakable() |
| 2272 | q.text("timeout_ms = "); |
| 2273 | q.text("%#x" % self.timeout_ms) |
| 2274 | q.text(","); q.breakable() |
| 2275 | q.text("port_no = "); |
| 2276 | q.text(util.pretty_port(self.port_no)) |
| 2277 | q.text(","); q.breakable() |
| 2278 | q.text("slot_num = "); |
| 2279 | q.text("%#x" % self.slot_num) |
| 2280 | q.text(","); q.breakable() |
| 2281 | q.text("data = "); |
| 2282 | q.pp(self.data) |
| 2283 | q.breakable() |
| 2284 | q.text('}') |
| 2285 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2286 | bsn_header.subtypes[33] = bsn_pdu_rx_request |
| 2287 | |
| 2288 | class bsn_pdu_rx_timeout(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2289 | version = 1 |
| 2290 | type = 4 |
| 2291 | experimenter = 6035143 |
| 2292 | subtype = 35 |
| 2293 | |
| 2294 | def __init__(self, xid=None, port_no=None, slot_num=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2295 | if xid != None: |
| 2296 | self.xid = xid |
| 2297 | else: |
| 2298 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2299 | if port_no != None: |
| 2300 | self.port_no = port_no |
| 2301 | else: |
| 2302 | self.port_no = 0 |
| 2303 | if slot_num != None: |
| 2304 | self.slot_num = slot_num |
| 2305 | else: |
| 2306 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2307 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2308 | |
| 2309 | def pack(self): |
| 2310 | packed = [] |
| 2311 | packed.append(struct.pack("!B", self.version)) |
| 2312 | packed.append(struct.pack("!B", self.type)) |
| 2313 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2314 | packed.append(struct.pack("!L", self.xid)) |
| 2315 | packed.append(struct.pack("!L", self.experimenter)) |
| 2316 | packed.append(struct.pack("!L", self.subtype)) |
| 2317 | packed.append(util.pack_port_no(self.port_no)) |
| 2318 | packed.append(struct.pack("!B", self.slot_num)) |
| 2319 | length = sum([len(x) for x in packed]) |
| 2320 | packed[2] = struct.pack("!H", length) |
| 2321 | return ''.join(packed) |
| 2322 | |
| 2323 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2324 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2325 | obj = bsn_pdu_rx_timeout() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2326 | _version = reader.read("!B")[0] |
| 2327 | assert(_version == 1) |
| 2328 | _type = reader.read("!B")[0] |
| 2329 | assert(_type == 4) |
| 2330 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2331 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2332 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2333 | obj.xid = reader.read("!L")[0] |
| 2334 | _experimenter = reader.read("!L")[0] |
| 2335 | assert(_experimenter == 6035143) |
| 2336 | _subtype = reader.read("!L")[0] |
| 2337 | assert(_subtype == 35) |
| 2338 | obj.port_no = util.unpack_port_no(reader) |
| 2339 | obj.slot_num = reader.read("!B")[0] |
| 2340 | return obj |
| 2341 | |
| 2342 | def __eq__(self, other): |
| 2343 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2344 | if self.xid != other.xid: return False |
| 2345 | if self.port_no != other.port_no: return False |
| 2346 | if self.slot_num != other.slot_num: return False |
| 2347 | return True |
| 2348 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2349 | def pretty_print(self, q): |
| 2350 | q.text("bsn_pdu_rx_timeout {") |
| 2351 | with q.group(): |
| 2352 | with q.indent(2): |
| 2353 | q.breakable() |
| 2354 | q.text("xid = "); |
| 2355 | if self.xid != None: |
| 2356 | q.text("%#x" % self.xid) |
| 2357 | else: |
| 2358 | q.text('None') |
| 2359 | q.text(","); q.breakable() |
| 2360 | q.text("port_no = "); |
| 2361 | q.text(util.pretty_port(self.port_no)) |
| 2362 | q.text(","); q.breakable() |
| 2363 | q.text("slot_num = "); |
| 2364 | q.text("%#x" % self.slot_num) |
| 2365 | q.breakable() |
| 2366 | q.text('}') |
| 2367 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2368 | bsn_header.subtypes[35] = bsn_pdu_rx_timeout |
| 2369 | |
| 2370 | class bsn_pdu_tx_reply(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2371 | version = 1 |
| 2372 | type = 4 |
| 2373 | experimenter = 6035143 |
| 2374 | subtype = 32 |
| 2375 | |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2376 | 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] | 2377 | if xid != None: |
| 2378 | self.xid = xid |
| 2379 | else: |
| 2380 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2381 | if status != None: |
| 2382 | self.status = status |
| 2383 | else: |
| 2384 | self.status = 0 |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2385 | if port_no != None: |
| 2386 | self.port_no = port_no |
| 2387 | else: |
| 2388 | self.port_no = 0 |
| 2389 | if slot_num != None: |
| 2390 | self.slot_num = slot_num |
| 2391 | else: |
| 2392 | self.slot_num = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2393 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2394 | |
| 2395 | def pack(self): |
| 2396 | packed = [] |
| 2397 | packed.append(struct.pack("!B", self.version)) |
| 2398 | packed.append(struct.pack("!B", self.type)) |
| 2399 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2400 | packed.append(struct.pack("!L", self.xid)) |
| 2401 | packed.append(struct.pack("!L", self.experimenter)) |
| 2402 | packed.append(struct.pack("!L", self.subtype)) |
| 2403 | packed.append(struct.pack("!L", self.status)) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2404 | packed.append(util.pack_port_no(self.port_no)) |
| 2405 | packed.append(struct.pack("!B", self.slot_num)) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2406 | length = sum([len(x) for x in packed]) |
| 2407 | packed[2] = struct.pack("!H", length) |
| 2408 | return ''.join(packed) |
| 2409 | |
| 2410 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2411 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2412 | obj = bsn_pdu_tx_reply() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2413 | _version = reader.read("!B")[0] |
| 2414 | assert(_version == 1) |
| 2415 | _type = reader.read("!B")[0] |
| 2416 | assert(_type == 4) |
| 2417 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2418 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2419 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2420 | obj.xid = reader.read("!L")[0] |
| 2421 | _experimenter = reader.read("!L")[0] |
| 2422 | assert(_experimenter == 6035143) |
| 2423 | _subtype = reader.read("!L")[0] |
| 2424 | assert(_subtype == 32) |
| 2425 | obj.status = reader.read("!L")[0] |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2426 | obj.port_no = util.unpack_port_no(reader) |
| 2427 | obj.slot_num = reader.read("!B")[0] |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2428 | return obj |
| 2429 | |
| 2430 | def __eq__(self, other): |
| 2431 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2432 | if self.xid != other.xid: return False |
| 2433 | if self.status != other.status: return False |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2434 | if self.port_no != other.port_no: return False |
| 2435 | if self.slot_num != other.slot_num: return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2436 | return True |
| 2437 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2438 | def pretty_print(self, q): |
| 2439 | q.text("bsn_pdu_tx_reply {") |
| 2440 | with q.group(): |
| 2441 | with q.indent(2): |
| 2442 | q.breakable() |
| 2443 | q.text("xid = "); |
| 2444 | if self.xid != None: |
| 2445 | q.text("%#x" % self.xid) |
| 2446 | else: |
| 2447 | q.text('None') |
| 2448 | q.text(","); q.breakable() |
| 2449 | q.text("status = "); |
| 2450 | q.text("%#x" % self.status) |
Rich Lane | 7b0f201 | 2013-11-22 14:15:26 -0800 | [diff] [blame] | 2451 | q.text(","); q.breakable() |
| 2452 | q.text("port_no = "); |
| 2453 | q.text(util.pretty_port(self.port_no)) |
| 2454 | q.text(","); q.breakable() |
| 2455 | q.text("slot_num = "); |
| 2456 | q.text("%#x" % self.slot_num) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2457 | q.breakable() |
| 2458 | q.text('}') |
| 2459 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2460 | bsn_header.subtypes[32] = bsn_pdu_tx_reply |
| 2461 | |
| 2462 | class bsn_pdu_tx_request(bsn_header): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2463 | version = 1 |
| 2464 | type = 4 |
| 2465 | experimenter = 6035143 |
| 2466 | subtype = 31 |
| 2467 | |
| 2468 | 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] | 2469 | if xid != None: |
| 2470 | self.xid = xid |
| 2471 | else: |
| 2472 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2473 | if tx_interval_ms != None: |
| 2474 | self.tx_interval_ms = tx_interval_ms |
| 2475 | else: |
| 2476 | self.tx_interval_ms = 0 |
| 2477 | if port_no != None: |
| 2478 | self.port_no = port_no |
| 2479 | else: |
| 2480 | self.port_no = 0 |
| 2481 | if slot_num != None: |
| 2482 | self.slot_num = slot_num |
| 2483 | else: |
| 2484 | self.slot_num = 0 |
| 2485 | if data != None: |
| 2486 | self.data = data |
| 2487 | else: |
| 2488 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2489 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2490 | |
| 2491 | def pack(self): |
| 2492 | packed = [] |
| 2493 | packed.append(struct.pack("!B", self.version)) |
| 2494 | packed.append(struct.pack("!B", self.type)) |
| 2495 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2496 | packed.append(struct.pack("!L", self.xid)) |
| 2497 | packed.append(struct.pack("!L", self.experimenter)) |
| 2498 | packed.append(struct.pack("!L", self.subtype)) |
| 2499 | packed.append(struct.pack("!L", self.tx_interval_ms)) |
| 2500 | packed.append(util.pack_port_no(self.port_no)) |
| 2501 | packed.append(struct.pack("!B", self.slot_num)) |
| 2502 | packed.append('\x00' * 3) |
| 2503 | packed.append(self.data) |
| 2504 | length = sum([len(x) for x in packed]) |
| 2505 | packed[2] = struct.pack("!H", length) |
| 2506 | return ''.join(packed) |
| 2507 | |
| 2508 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2509 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2510 | obj = bsn_pdu_tx_request() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2511 | _version = reader.read("!B")[0] |
| 2512 | assert(_version == 1) |
| 2513 | _type = reader.read("!B")[0] |
| 2514 | assert(_type == 4) |
| 2515 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2516 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2517 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2518 | obj.xid = reader.read("!L")[0] |
| 2519 | _experimenter = reader.read("!L")[0] |
| 2520 | assert(_experimenter == 6035143) |
| 2521 | _subtype = reader.read("!L")[0] |
| 2522 | assert(_subtype == 31) |
| 2523 | obj.tx_interval_ms = reader.read("!L")[0] |
| 2524 | obj.port_no = util.unpack_port_no(reader) |
| 2525 | obj.slot_num = reader.read("!B")[0] |
| 2526 | reader.skip(3) |
| 2527 | obj.data = str(reader.read_all()) |
| 2528 | return obj |
| 2529 | |
| 2530 | def __eq__(self, other): |
| 2531 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2532 | if self.xid != other.xid: return False |
| 2533 | if self.tx_interval_ms != other.tx_interval_ms: return False |
| 2534 | if self.port_no != other.port_no: return False |
| 2535 | if self.slot_num != other.slot_num: return False |
| 2536 | if self.data != other.data: return False |
| 2537 | return True |
| 2538 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 2539 | def pretty_print(self, q): |
| 2540 | q.text("bsn_pdu_tx_request {") |
| 2541 | with q.group(): |
| 2542 | with q.indent(2): |
| 2543 | q.breakable() |
| 2544 | q.text("xid = "); |
| 2545 | if self.xid != None: |
| 2546 | q.text("%#x" % self.xid) |
| 2547 | else: |
| 2548 | q.text('None') |
| 2549 | q.text(","); q.breakable() |
| 2550 | q.text("tx_interval_ms = "); |
| 2551 | q.text("%#x" % self.tx_interval_ms) |
| 2552 | q.text(","); q.breakable() |
| 2553 | q.text("port_no = "); |
| 2554 | q.text(util.pretty_port(self.port_no)) |
| 2555 | q.text(","); q.breakable() |
| 2556 | q.text("slot_num = "); |
| 2557 | q.text("%#x" % self.slot_num) |
| 2558 | q.text(","); q.breakable() |
| 2559 | q.text("data = "); |
| 2560 | q.pp(self.data) |
| 2561 | q.breakable() |
| 2562 | q.text('}') |
| 2563 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2564 | bsn_header.subtypes[31] = bsn_pdu_tx_request |
| 2565 | |
| 2566 | class bsn_set_ip_mask(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2567 | version = 1 |
| 2568 | type = 4 |
| 2569 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2570 | subtype = 0 |
| 2571 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2572 | def __init__(self, xid=None, index=None, mask=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2573 | if xid != None: |
| 2574 | self.xid = xid |
| 2575 | else: |
| 2576 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2577 | if index != None: |
| 2578 | self.index = index |
| 2579 | else: |
| 2580 | self.index = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2581 | if mask != None: |
| 2582 | self.mask = mask |
| 2583 | else: |
| 2584 | self.mask = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2585 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2586 | |
| 2587 | def pack(self): |
| 2588 | packed = [] |
| 2589 | packed.append(struct.pack("!B", self.version)) |
| 2590 | packed.append(struct.pack("!B", self.type)) |
| 2591 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2592 | packed.append(struct.pack("!L", self.xid)) |
| 2593 | packed.append(struct.pack("!L", self.experimenter)) |
| 2594 | packed.append(struct.pack("!L", self.subtype)) |
| 2595 | packed.append(struct.pack("!B", self.index)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2596 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2597 | packed.append(struct.pack("!L", self.mask)) |
| 2598 | length = sum([len(x) for x in packed]) |
| 2599 | packed[2] = struct.pack("!H", length) |
| 2600 | return ''.join(packed) |
| 2601 | |
| 2602 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2603 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2604 | obj = bsn_set_ip_mask() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2605 | _version = reader.read("!B")[0] |
| 2606 | assert(_version == 1) |
| 2607 | _type = reader.read("!B")[0] |
| 2608 | assert(_type == 4) |
| 2609 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2610 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2611 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2612 | obj.xid = reader.read("!L")[0] |
| 2613 | _experimenter = reader.read("!L")[0] |
| 2614 | assert(_experimenter == 6035143) |
| 2615 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2616 | assert(_subtype == 0) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2617 | obj.index = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2618 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2619 | obj.mask = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2620 | return obj |
| 2621 | |
| 2622 | def __eq__(self, other): |
| 2623 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2624 | if self.xid != other.xid: return False |
| 2625 | if self.index != other.index: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2626 | if self.mask != other.mask: return False |
| 2627 | return True |
| 2628 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2629 | def pretty_print(self, q): |
| 2630 | q.text("bsn_set_ip_mask {") |
| 2631 | with q.group(): |
| 2632 | with q.indent(2): |
| 2633 | q.breakable() |
| 2634 | q.text("xid = "); |
| 2635 | if self.xid != None: |
| 2636 | q.text("%#x" % self.xid) |
| 2637 | else: |
| 2638 | q.text('None') |
| 2639 | q.text(","); q.breakable() |
| 2640 | q.text("index = "); |
| 2641 | q.text("%#x" % self.index) |
| 2642 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2643 | q.text("mask = "); |
| 2644 | q.text("%#x" % self.mask) |
| 2645 | q.breakable() |
| 2646 | q.text('}') |
| 2647 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2648 | bsn_header.subtypes[0] = bsn_set_ip_mask |
| 2649 | |
| 2650 | class bsn_set_l2_table_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2651 | version = 1 |
| 2652 | type = 4 |
| 2653 | experimenter = 6035143 |
| 2654 | subtype = 24 |
| 2655 | |
| 2656 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2657 | if xid != None: |
| 2658 | self.xid = xid |
| 2659 | else: |
| 2660 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2661 | if l2_table_enable != None: |
| 2662 | self.l2_table_enable = l2_table_enable |
| 2663 | else: |
| 2664 | self.l2_table_enable = 0 |
| 2665 | if l2_table_priority != None: |
| 2666 | self.l2_table_priority = l2_table_priority |
| 2667 | else: |
| 2668 | self.l2_table_priority = 0 |
| 2669 | if status != None: |
| 2670 | self.status = status |
| 2671 | else: |
| 2672 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2673 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2674 | |
| 2675 | def pack(self): |
| 2676 | packed = [] |
| 2677 | packed.append(struct.pack("!B", self.version)) |
| 2678 | packed.append(struct.pack("!B", self.type)) |
| 2679 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2680 | packed.append(struct.pack("!L", self.xid)) |
| 2681 | packed.append(struct.pack("!L", self.experimenter)) |
| 2682 | packed.append(struct.pack("!L", self.subtype)) |
| 2683 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2684 | packed.append('\x00' * 1) |
| 2685 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2686 | packed.append(struct.pack("!L", self.status)) |
| 2687 | length = sum([len(x) for x in packed]) |
| 2688 | packed[2] = struct.pack("!H", length) |
| 2689 | return ''.join(packed) |
| 2690 | |
| 2691 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2692 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2693 | obj = bsn_set_l2_table_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2694 | _version = reader.read("!B")[0] |
| 2695 | assert(_version == 1) |
| 2696 | _type = reader.read("!B")[0] |
| 2697 | assert(_type == 4) |
| 2698 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2699 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2700 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2701 | obj.xid = reader.read("!L")[0] |
| 2702 | _experimenter = reader.read("!L")[0] |
| 2703 | assert(_experimenter == 6035143) |
| 2704 | _subtype = reader.read("!L")[0] |
| 2705 | assert(_subtype == 24) |
| 2706 | obj.l2_table_enable = reader.read("!B")[0] |
| 2707 | reader.skip(1) |
| 2708 | obj.l2_table_priority = reader.read("!H")[0] |
| 2709 | obj.status = reader.read("!L")[0] |
| 2710 | return obj |
| 2711 | |
| 2712 | def __eq__(self, other): |
| 2713 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2714 | if self.xid != other.xid: return False |
| 2715 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2716 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2717 | if self.status != other.status: return False |
| 2718 | return True |
| 2719 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2720 | def pretty_print(self, q): |
| 2721 | q.text("bsn_set_l2_table_reply {") |
| 2722 | with q.group(): |
| 2723 | with q.indent(2): |
| 2724 | q.breakable() |
| 2725 | q.text("xid = "); |
| 2726 | if self.xid != None: |
| 2727 | q.text("%#x" % self.xid) |
| 2728 | else: |
| 2729 | q.text('None') |
| 2730 | q.text(","); q.breakable() |
| 2731 | q.text("l2_table_enable = "); |
| 2732 | q.text("%#x" % self.l2_table_enable) |
| 2733 | q.text(","); q.breakable() |
| 2734 | q.text("l2_table_priority = "); |
| 2735 | q.text("%#x" % self.l2_table_priority) |
| 2736 | q.text(","); q.breakable() |
| 2737 | q.text("status = "); |
| 2738 | q.text("%#x" % self.status) |
| 2739 | q.breakable() |
| 2740 | q.text('}') |
| 2741 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2742 | bsn_header.subtypes[24] = bsn_set_l2_table_reply |
| 2743 | |
| 2744 | class bsn_set_l2_table_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2745 | version = 1 |
| 2746 | type = 4 |
| 2747 | experimenter = 6035143 |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2748 | subtype = 12 |
| 2749 | |
| 2750 | def __init__(self, xid=None, l2_table_enable=None, l2_table_priority=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2751 | if xid != None: |
| 2752 | self.xid = xid |
| 2753 | else: |
| 2754 | self.xid = None |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2755 | if l2_table_enable != None: |
| 2756 | self.l2_table_enable = l2_table_enable |
| 2757 | else: |
| 2758 | self.l2_table_enable = 0 |
| 2759 | if l2_table_priority != None: |
| 2760 | self.l2_table_priority = l2_table_priority |
| 2761 | else: |
| 2762 | self.l2_table_priority = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2763 | return |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2764 | |
| 2765 | def pack(self): |
| 2766 | packed = [] |
| 2767 | packed.append(struct.pack("!B", self.version)) |
| 2768 | packed.append(struct.pack("!B", self.type)) |
| 2769 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2770 | packed.append(struct.pack("!L", self.xid)) |
| 2771 | packed.append(struct.pack("!L", self.experimenter)) |
| 2772 | packed.append(struct.pack("!L", self.subtype)) |
| 2773 | packed.append(struct.pack("!B", self.l2_table_enable)) |
| 2774 | packed.append('\x00' * 1) |
| 2775 | packed.append(struct.pack("!H", self.l2_table_priority)) |
| 2776 | packed.append('\x00' * 4) |
| 2777 | length = sum([len(x) for x in packed]) |
| 2778 | packed[2] = struct.pack("!H", length) |
| 2779 | return ''.join(packed) |
| 2780 | |
| 2781 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2782 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2783 | obj = bsn_set_l2_table_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2784 | _version = reader.read("!B")[0] |
| 2785 | assert(_version == 1) |
| 2786 | _type = reader.read("!B")[0] |
| 2787 | assert(_type == 4) |
| 2788 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2789 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2790 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2791 | obj.xid = reader.read("!L")[0] |
| 2792 | _experimenter = reader.read("!L")[0] |
| 2793 | assert(_experimenter == 6035143) |
| 2794 | _subtype = reader.read("!L")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2795 | assert(_subtype == 12) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2796 | obj.l2_table_enable = reader.read("!B")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2797 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2798 | obj.l2_table_priority = reader.read("!H")[0] |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2799 | reader.skip(4) |
| 2800 | return obj |
| 2801 | |
| 2802 | def __eq__(self, other): |
| 2803 | if type(self) != type(other): return False |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2804 | if self.xid != other.xid: return False |
| 2805 | if self.l2_table_enable != other.l2_table_enable: return False |
| 2806 | if self.l2_table_priority != other.l2_table_priority: return False |
| 2807 | return True |
| 2808 | |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2809 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2810 | q.text("bsn_set_l2_table_request {") |
Rich Lane | 90c961c | 2013-05-14 09:26:50 -0700 | [diff] [blame] | 2811 | with q.group(): |
| 2812 | with q.indent(2): |
| 2813 | q.breakable() |
| 2814 | q.text("xid = "); |
| 2815 | if self.xid != None: |
| 2816 | q.text("%#x" % self.xid) |
| 2817 | else: |
| 2818 | q.text('None') |
| 2819 | q.text(","); q.breakable() |
| 2820 | q.text("l2_table_enable = "); |
| 2821 | q.text("%#x" % self.l2_table_enable) |
| 2822 | q.text(","); q.breakable() |
| 2823 | q.text("l2_table_priority = "); |
| 2824 | q.text("%#x" % self.l2_table_priority) |
| 2825 | q.breakable() |
| 2826 | q.text('}') |
| 2827 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2828 | bsn_header.subtypes[12] = bsn_set_l2_table_request |
| 2829 | |
| 2830 | class bsn_set_mirroring(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2831 | version = 1 |
| 2832 | type = 4 |
| 2833 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2834 | subtype = 3 |
| 2835 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2836 | def __init__(self, xid=None, report_mirror_ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2837 | if xid != None: |
| 2838 | self.xid = xid |
| 2839 | else: |
| 2840 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2841 | if report_mirror_ports != None: |
| 2842 | self.report_mirror_ports = report_mirror_ports |
| 2843 | else: |
| 2844 | self.report_mirror_ports = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2845 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2846 | |
| 2847 | def pack(self): |
| 2848 | packed = [] |
| 2849 | packed.append(struct.pack("!B", self.version)) |
| 2850 | packed.append(struct.pack("!B", self.type)) |
| 2851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2852 | packed.append(struct.pack("!L", self.xid)) |
| 2853 | packed.append(struct.pack("!L", self.experimenter)) |
| 2854 | packed.append(struct.pack("!L", self.subtype)) |
| 2855 | packed.append(struct.pack("!B", self.report_mirror_ports)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2856 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2857 | length = sum([len(x) for x in packed]) |
| 2858 | packed[2] = struct.pack("!H", length) |
| 2859 | return ''.join(packed) |
| 2860 | |
| 2861 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2862 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2863 | obj = bsn_set_mirroring() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2864 | _version = reader.read("!B")[0] |
| 2865 | assert(_version == 1) |
| 2866 | _type = reader.read("!B")[0] |
| 2867 | assert(_type == 4) |
| 2868 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2869 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2870 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2871 | obj.xid = reader.read("!L")[0] |
| 2872 | _experimenter = reader.read("!L")[0] |
| 2873 | assert(_experimenter == 6035143) |
| 2874 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2875 | assert(_subtype == 3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2876 | obj.report_mirror_ports = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2877 | reader.skip(3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2878 | return obj |
| 2879 | |
| 2880 | def __eq__(self, other): |
| 2881 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2882 | if self.xid != other.xid: return False |
| 2883 | if self.report_mirror_ports != other.report_mirror_ports: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2884 | return True |
| 2885 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 2886 | def pretty_print(self, q): |
| 2887 | q.text("bsn_set_mirroring {") |
| 2888 | with q.group(): |
| 2889 | with q.indent(2): |
| 2890 | q.breakable() |
| 2891 | q.text("xid = "); |
| 2892 | if self.xid != None: |
| 2893 | q.text("%#x" % self.xid) |
| 2894 | else: |
| 2895 | q.text('None') |
| 2896 | q.text(","); q.breakable() |
| 2897 | q.text("report_mirror_ports = "); |
| 2898 | q.text("%#x" % self.report_mirror_ports) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2899 | q.breakable() |
| 2900 | q.text('}') |
| 2901 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2902 | bsn_header.subtypes[3] = bsn_set_mirroring |
| 2903 | |
| 2904 | class bsn_set_pktin_suppression_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2905 | version = 1 |
| 2906 | type = 4 |
| 2907 | experimenter = 6035143 |
| 2908 | subtype = 25 |
| 2909 | |
| 2910 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2911 | if xid != None: |
| 2912 | self.xid = xid |
| 2913 | else: |
| 2914 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2915 | if status != None: |
| 2916 | self.status = status |
| 2917 | else: |
| 2918 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2919 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2920 | |
| 2921 | def pack(self): |
| 2922 | packed = [] |
| 2923 | packed.append(struct.pack("!B", self.version)) |
| 2924 | packed.append(struct.pack("!B", self.type)) |
| 2925 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 2926 | packed.append(struct.pack("!L", self.xid)) |
| 2927 | packed.append(struct.pack("!L", self.experimenter)) |
| 2928 | packed.append(struct.pack("!L", self.subtype)) |
| 2929 | packed.append(struct.pack("!L", self.status)) |
| 2930 | length = sum([len(x) for x in packed]) |
| 2931 | packed[2] = struct.pack("!H", length) |
| 2932 | return ''.join(packed) |
| 2933 | |
| 2934 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2935 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2936 | obj = bsn_set_pktin_suppression_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2937 | _version = reader.read("!B")[0] |
| 2938 | assert(_version == 1) |
| 2939 | _type = reader.read("!B")[0] |
| 2940 | assert(_type == 4) |
| 2941 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2942 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 2943 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2944 | obj.xid = reader.read("!L")[0] |
| 2945 | _experimenter = reader.read("!L")[0] |
| 2946 | assert(_experimenter == 6035143) |
| 2947 | _subtype = reader.read("!L")[0] |
| 2948 | assert(_subtype == 25) |
| 2949 | obj.status = reader.read("!L")[0] |
| 2950 | return obj |
| 2951 | |
| 2952 | def __eq__(self, other): |
| 2953 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2954 | if self.xid != other.xid: return False |
| 2955 | if self.status != other.status: return False |
| 2956 | return True |
| 2957 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2958 | def pretty_print(self, q): |
| 2959 | q.text("bsn_set_pktin_suppression_reply {") |
| 2960 | with q.group(): |
| 2961 | with q.indent(2): |
| 2962 | q.breakable() |
| 2963 | q.text("xid = "); |
| 2964 | if self.xid != None: |
| 2965 | q.text("%#x" % self.xid) |
| 2966 | else: |
| 2967 | q.text('None') |
| 2968 | q.text(","); q.breakable() |
| 2969 | q.text("status = "); |
| 2970 | q.text("%#x" % self.status) |
| 2971 | q.breakable() |
| 2972 | q.text('}') |
| 2973 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 2974 | bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply |
| 2975 | |
| 2976 | class bsn_set_pktin_suppression_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 2977 | version = 1 |
| 2978 | type = 4 |
| 2979 | experimenter = 6035143 |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2980 | subtype = 11 |
| 2981 | |
| 2982 | 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] | 2983 | if xid != None: |
| 2984 | self.xid = xid |
| 2985 | else: |
| 2986 | self.xid = None |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 2987 | if enabled != None: |
| 2988 | self.enabled = enabled |
| 2989 | else: |
| 2990 | self.enabled = 0 |
| 2991 | if idle_timeout != None: |
| 2992 | self.idle_timeout = idle_timeout |
| 2993 | else: |
| 2994 | self.idle_timeout = 0 |
| 2995 | if hard_timeout != None: |
| 2996 | self.hard_timeout = hard_timeout |
| 2997 | else: |
| 2998 | self.hard_timeout = 0 |
| 2999 | if priority != None: |
| 3000 | self.priority = priority |
| 3001 | else: |
| 3002 | self.priority = 0 |
| 3003 | if cookie != None: |
| 3004 | self.cookie = cookie |
| 3005 | else: |
| 3006 | self.cookie = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3007 | return |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3008 | |
| 3009 | def pack(self): |
| 3010 | packed = [] |
| 3011 | packed.append(struct.pack("!B", self.version)) |
| 3012 | packed.append(struct.pack("!B", self.type)) |
| 3013 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3014 | packed.append(struct.pack("!L", self.xid)) |
| 3015 | packed.append(struct.pack("!L", self.experimenter)) |
| 3016 | packed.append(struct.pack("!L", self.subtype)) |
| 3017 | packed.append(struct.pack("!B", self.enabled)) |
| 3018 | packed.append('\x00' * 1) |
| 3019 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 3020 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 3021 | packed.append(struct.pack("!H", self.priority)) |
| 3022 | packed.append(struct.pack("!Q", self.cookie)) |
| 3023 | length = sum([len(x) for x in packed]) |
| 3024 | packed[2] = struct.pack("!H", length) |
| 3025 | return ''.join(packed) |
| 3026 | |
| 3027 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3028 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3029 | obj = bsn_set_pktin_suppression_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3030 | _version = reader.read("!B")[0] |
| 3031 | assert(_version == 1) |
| 3032 | _type = reader.read("!B")[0] |
| 3033 | assert(_type == 4) |
| 3034 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3035 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3036 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3037 | obj.xid = reader.read("!L")[0] |
| 3038 | _experimenter = reader.read("!L")[0] |
| 3039 | assert(_experimenter == 6035143) |
| 3040 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3041 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3042 | obj.enabled = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3043 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3044 | obj.idle_timeout = reader.read("!H")[0] |
| 3045 | obj.hard_timeout = reader.read("!H")[0] |
| 3046 | obj.priority = reader.read("!H")[0] |
| 3047 | obj.cookie = reader.read("!Q")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3048 | return obj |
| 3049 | |
| 3050 | def __eq__(self, other): |
| 3051 | if type(self) != type(other): return False |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3052 | if self.xid != other.xid: return False |
| 3053 | if self.enabled != other.enabled: return False |
| 3054 | if self.idle_timeout != other.idle_timeout: return False |
| 3055 | if self.hard_timeout != other.hard_timeout: return False |
| 3056 | if self.priority != other.priority: return False |
| 3057 | if self.cookie != other.cookie: return False |
| 3058 | return True |
| 3059 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3060 | def pretty_print(self, q): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3061 | q.text("bsn_set_pktin_suppression_request {") |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3062 | with q.group(): |
| 3063 | with q.indent(2): |
| 3064 | q.breakable() |
| 3065 | q.text("xid = "); |
| 3066 | if self.xid != None: |
| 3067 | q.text("%#x" % self.xid) |
| 3068 | else: |
| 3069 | q.text('None') |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3070 | q.text(","); q.breakable() |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3071 | q.text("enabled = "); |
| 3072 | q.text("%#x" % self.enabled) |
| 3073 | q.text(","); q.breakable() |
| 3074 | q.text("idle_timeout = "); |
| 3075 | q.text("%#x" % self.idle_timeout) |
| 3076 | q.text(","); q.breakable() |
| 3077 | q.text("hard_timeout = "); |
| 3078 | q.text("%#x" % self.hard_timeout) |
| 3079 | q.text(","); q.breakable() |
| 3080 | q.text("priority = "); |
| 3081 | q.text("%#x" % self.priority) |
| 3082 | q.text(","); q.breakable() |
| 3083 | q.text("cookie = "); |
| 3084 | q.text("%#x" % self.cookie) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3085 | q.breakable() |
| 3086 | q.text('}') |
| 3087 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3088 | bsn_header.subtypes[11] = bsn_set_pktin_suppression_request |
| 3089 | |
| 3090 | class bsn_shell_command(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3091 | version = 1 |
| 3092 | type = 4 |
| 3093 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3094 | subtype = 6 |
| 3095 | |
| 3096 | def __init__(self, xid=None, service=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3097 | if xid != None: |
| 3098 | self.xid = xid |
| 3099 | else: |
| 3100 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3101 | if service != None: |
| 3102 | self.service = service |
| 3103 | else: |
| 3104 | self.service = 0 |
| 3105 | if data != None: |
| 3106 | self.data = data |
| 3107 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3108 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3109 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3110 | |
| 3111 | def pack(self): |
| 3112 | packed = [] |
| 3113 | packed.append(struct.pack("!B", self.version)) |
| 3114 | packed.append(struct.pack("!B", self.type)) |
| 3115 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3116 | packed.append(struct.pack("!L", self.xid)) |
| 3117 | packed.append(struct.pack("!L", self.experimenter)) |
| 3118 | packed.append(struct.pack("!L", self.subtype)) |
| 3119 | packed.append(struct.pack("!L", self.service)) |
| 3120 | packed.append(self.data) |
| 3121 | length = sum([len(x) for x in packed]) |
| 3122 | packed[2] = struct.pack("!H", length) |
| 3123 | return ''.join(packed) |
| 3124 | |
| 3125 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3126 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3127 | obj = bsn_shell_command() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3128 | _version = reader.read("!B")[0] |
| 3129 | assert(_version == 1) |
| 3130 | _type = reader.read("!B")[0] |
| 3131 | assert(_type == 4) |
| 3132 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3133 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3134 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3135 | obj.xid = reader.read("!L")[0] |
| 3136 | _experimenter = reader.read("!L")[0] |
| 3137 | assert(_experimenter == 6035143) |
| 3138 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3139 | assert(_subtype == 6) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3140 | obj.service = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3141 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3142 | return obj |
| 3143 | |
| 3144 | def __eq__(self, other): |
| 3145 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3146 | if self.xid != other.xid: return False |
| 3147 | if self.service != other.service: return False |
| 3148 | if self.data != other.data: return False |
| 3149 | return True |
| 3150 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3151 | def pretty_print(self, q): |
| 3152 | q.text("bsn_shell_command {") |
| 3153 | with q.group(): |
| 3154 | with q.indent(2): |
| 3155 | q.breakable() |
| 3156 | q.text("xid = "); |
| 3157 | if self.xid != None: |
| 3158 | q.text("%#x" % self.xid) |
| 3159 | else: |
| 3160 | q.text('None') |
| 3161 | q.text(","); q.breakable() |
| 3162 | q.text("service = "); |
| 3163 | q.text("%#x" % self.service) |
| 3164 | q.text(","); q.breakable() |
| 3165 | q.text("data = "); |
| 3166 | q.pp(self.data) |
| 3167 | q.breakable() |
| 3168 | q.text('}') |
| 3169 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3170 | bsn_header.subtypes[6] = bsn_shell_command |
| 3171 | |
| 3172 | class bsn_shell_output(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3173 | version = 1 |
| 3174 | type = 4 |
| 3175 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3176 | subtype = 7 |
| 3177 | |
| 3178 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3179 | if xid != None: |
| 3180 | self.xid = xid |
| 3181 | else: |
| 3182 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3183 | if data != None: |
| 3184 | self.data = data |
| 3185 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3186 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3187 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3188 | |
| 3189 | def pack(self): |
| 3190 | packed = [] |
| 3191 | packed.append(struct.pack("!B", self.version)) |
| 3192 | packed.append(struct.pack("!B", self.type)) |
| 3193 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3194 | packed.append(struct.pack("!L", self.xid)) |
| 3195 | packed.append(struct.pack("!L", self.experimenter)) |
| 3196 | packed.append(struct.pack("!L", self.subtype)) |
| 3197 | packed.append(self.data) |
| 3198 | length = sum([len(x) for x in packed]) |
| 3199 | packed[2] = struct.pack("!H", length) |
| 3200 | return ''.join(packed) |
| 3201 | |
| 3202 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3203 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3204 | obj = bsn_shell_output() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3205 | _version = reader.read("!B")[0] |
| 3206 | assert(_version == 1) |
| 3207 | _type = reader.read("!B")[0] |
| 3208 | assert(_type == 4) |
| 3209 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3210 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3211 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3212 | obj.xid = reader.read("!L")[0] |
| 3213 | _experimenter = reader.read("!L")[0] |
| 3214 | assert(_experimenter == 6035143) |
| 3215 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3216 | assert(_subtype == 7) |
| 3217 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3218 | return obj |
| 3219 | |
| 3220 | def __eq__(self, other): |
| 3221 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3222 | if self.xid != other.xid: return False |
| 3223 | if self.data != other.data: return False |
| 3224 | return True |
| 3225 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3226 | def pretty_print(self, q): |
| 3227 | q.text("bsn_shell_output {") |
| 3228 | with q.group(): |
| 3229 | with q.indent(2): |
| 3230 | q.breakable() |
| 3231 | q.text("xid = "); |
| 3232 | if self.xid != None: |
| 3233 | q.text("%#x" % self.xid) |
| 3234 | else: |
| 3235 | q.text('None') |
| 3236 | q.text(","); q.breakable() |
| 3237 | q.text("data = "); |
| 3238 | q.pp(self.data) |
| 3239 | q.breakable() |
| 3240 | q.text('}') |
| 3241 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3242 | bsn_header.subtypes[7] = bsn_shell_output |
| 3243 | |
| 3244 | class bsn_shell_status(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3245 | version = 1 |
| 3246 | type = 4 |
| 3247 | experimenter = 6035143 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3248 | subtype = 8 |
| 3249 | |
| 3250 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3251 | if xid != None: |
| 3252 | self.xid = xid |
| 3253 | else: |
| 3254 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3255 | if status != None: |
| 3256 | self.status = status |
| 3257 | else: |
| 3258 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3259 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3260 | |
| 3261 | def pack(self): |
| 3262 | packed = [] |
| 3263 | packed.append(struct.pack("!B", self.version)) |
| 3264 | packed.append(struct.pack("!B", self.type)) |
| 3265 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3266 | packed.append(struct.pack("!L", self.xid)) |
| 3267 | packed.append(struct.pack("!L", self.experimenter)) |
| 3268 | packed.append(struct.pack("!L", self.subtype)) |
| 3269 | packed.append(struct.pack("!L", self.status)) |
| 3270 | length = sum([len(x) for x in packed]) |
| 3271 | packed[2] = struct.pack("!H", length) |
| 3272 | return ''.join(packed) |
| 3273 | |
| 3274 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3275 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3276 | obj = bsn_shell_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3277 | _version = reader.read("!B")[0] |
| 3278 | assert(_version == 1) |
| 3279 | _type = reader.read("!B")[0] |
| 3280 | assert(_type == 4) |
| 3281 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3282 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3283 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3284 | obj.xid = reader.read("!L")[0] |
| 3285 | _experimenter = reader.read("!L")[0] |
| 3286 | assert(_experimenter == 6035143) |
| 3287 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 3288 | assert(_subtype == 8) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3289 | obj.status = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3290 | return obj |
| 3291 | |
| 3292 | def __eq__(self, other): |
| 3293 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3294 | if self.xid != other.xid: return False |
| 3295 | if self.status != other.status: return False |
| 3296 | return True |
| 3297 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3298 | def pretty_print(self, q): |
| 3299 | q.text("bsn_shell_status {") |
| 3300 | with q.group(): |
| 3301 | with q.indent(2): |
| 3302 | q.breakable() |
| 3303 | q.text("xid = "); |
| 3304 | if self.xid != None: |
| 3305 | q.text("%#x" % self.xid) |
| 3306 | else: |
| 3307 | q.text('None') |
| 3308 | q.text(","); q.breakable() |
| 3309 | q.text("status = "); |
| 3310 | q.text("%#x" % self.status) |
| 3311 | q.breakable() |
| 3312 | q.text('}') |
| 3313 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3314 | bsn_header.subtypes[8] = bsn_shell_status |
| 3315 | |
| 3316 | class experimenter_stats_reply(stats_reply): |
| 3317 | subtypes = {} |
| 3318 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3319 | version = 1 |
| 3320 | type = 17 |
| 3321 | stats_type = 65535 |
| 3322 | |
| 3323 | def __init__(self, xid=None, flags=None, experimenter=None, data=None): |
| 3324 | if xid != None: |
| 3325 | self.xid = xid |
| 3326 | else: |
| 3327 | self.xid = None |
| 3328 | if flags != None: |
| 3329 | self.flags = flags |
| 3330 | else: |
| 3331 | self.flags = 0 |
| 3332 | if experimenter != None: |
| 3333 | self.experimenter = experimenter |
| 3334 | else: |
| 3335 | self.experimenter = 0 |
| 3336 | if data != None: |
| 3337 | self.data = data |
| 3338 | else: |
| 3339 | self.data = '' |
| 3340 | return |
| 3341 | |
| 3342 | def pack(self): |
| 3343 | packed = [] |
| 3344 | packed.append(struct.pack("!B", self.version)) |
| 3345 | packed.append(struct.pack("!B", self.type)) |
| 3346 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3347 | packed.append(struct.pack("!L", self.xid)) |
| 3348 | packed.append(struct.pack("!H", self.stats_type)) |
| 3349 | packed.append(struct.pack("!H", self.flags)) |
| 3350 | packed.append(struct.pack("!L", self.experimenter)) |
| 3351 | packed.append(self.data) |
| 3352 | length = sum([len(x) for x in packed]) |
| 3353 | packed[2] = struct.pack("!H", length) |
| 3354 | return ''.join(packed) |
| 3355 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3356 | @staticmethod |
| 3357 | def unpack(reader): |
| 3358 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3359 | subclass = experimenter_stats_reply.subtypes.get(subtype) |
| 3360 | if subclass: |
| 3361 | return subclass.unpack(reader) |
| 3362 | |
| 3363 | obj = experimenter_stats_reply() |
| 3364 | _version = reader.read("!B")[0] |
| 3365 | assert(_version == 1) |
| 3366 | _type = reader.read("!B")[0] |
| 3367 | assert(_type == 17) |
| 3368 | _length = reader.read("!H")[0] |
| 3369 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3370 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3371 | obj.xid = reader.read("!L")[0] |
| 3372 | _stats_type = reader.read("!H")[0] |
| 3373 | assert(_stats_type == 65535) |
| 3374 | obj.flags = reader.read("!H")[0] |
| 3375 | obj.experimenter = reader.read("!L")[0] |
| 3376 | obj.data = str(reader.read_all()) |
| 3377 | return obj |
| 3378 | |
| 3379 | def __eq__(self, other): |
| 3380 | if type(self) != type(other): return False |
| 3381 | if self.xid != other.xid: return False |
| 3382 | if self.flags != other.flags: return False |
| 3383 | if self.experimenter != other.experimenter: return False |
| 3384 | if self.data != other.data: return False |
| 3385 | return True |
| 3386 | |
| 3387 | def pretty_print(self, q): |
| 3388 | q.text("experimenter_stats_reply {") |
| 3389 | with q.group(): |
| 3390 | with q.indent(2): |
| 3391 | q.breakable() |
| 3392 | q.text("xid = "); |
| 3393 | if self.xid != None: |
| 3394 | q.text("%#x" % self.xid) |
| 3395 | else: |
| 3396 | q.text('None') |
| 3397 | q.text(","); q.breakable() |
| 3398 | q.text("flags = "); |
| 3399 | q.text("%#x" % self.flags) |
| 3400 | q.text(","); q.breakable() |
| 3401 | q.text("data = "); |
| 3402 | q.pp(self.data) |
| 3403 | q.breakable() |
| 3404 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3405 | |
| 3406 | stats_reply.subtypes[65535] = experimenter_stats_reply |
| 3407 | |
| 3408 | class bsn_stats_reply(experimenter_stats_reply): |
| 3409 | subtypes = {} |
| 3410 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3411 | version = 1 |
| 3412 | type = 19 |
| 3413 | stats_type = 65535 |
| 3414 | experimenter = 6035143 |
| 3415 | |
| 3416 | def __init__(self, xid=None, flags=None, subtype=None): |
| 3417 | if xid != None: |
| 3418 | self.xid = xid |
| 3419 | else: |
| 3420 | self.xid = None |
| 3421 | if flags != None: |
| 3422 | self.flags = flags |
| 3423 | else: |
| 3424 | self.flags = 0 |
| 3425 | if subtype != None: |
| 3426 | self.subtype = subtype |
| 3427 | else: |
| 3428 | self.subtype = 0 |
| 3429 | return |
| 3430 | |
| 3431 | def pack(self): |
| 3432 | packed = [] |
| 3433 | packed.append(struct.pack("!B", self.version)) |
| 3434 | packed.append(struct.pack("!B", self.type)) |
| 3435 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3436 | packed.append(struct.pack("!L", self.xid)) |
| 3437 | packed.append(struct.pack("!H", self.stats_type)) |
| 3438 | packed.append(struct.pack("!H", self.flags)) |
| 3439 | packed.append('\x00' * 4) |
| 3440 | packed.append(struct.pack("!L", self.experimenter)) |
| 3441 | packed.append(struct.pack("!L", self.subtype)) |
| 3442 | length = sum([len(x) for x in packed]) |
| 3443 | packed[2] = struct.pack("!H", length) |
| 3444 | return ''.join(packed) |
| 3445 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3446 | @staticmethod |
| 3447 | def unpack(reader): |
| 3448 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3449 | subclass = bsn_stats_reply.subtypes.get(subtype) |
| 3450 | if subclass: |
| 3451 | return subclass.unpack(reader) |
| 3452 | |
| 3453 | obj = bsn_stats_reply() |
| 3454 | _version = reader.read("!B")[0] |
| 3455 | assert(_version == 1) |
| 3456 | _type = reader.read("!B")[0] |
| 3457 | assert(_type == 19) |
| 3458 | _length = reader.read("!H")[0] |
| 3459 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3460 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3461 | obj.xid = reader.read("!L")[0] |
| 3462 | _stats_type = reader.read("!H")[0] |
| 3463 | assert(_stats_type == 65535) |
| 3464 | obj.flags = reader.read("!H")[0] |
| 3465 | reader.skip(4) |
| 3466 | _experimenter = reader.read("!L")[0] |
| 3467 | assert(_experimenter == 6035143) |
| 3468 | obj.subtype = reader.read("!L")[0] |
| 3469 | return obj |
| 3470 | |
| 3471 | def __eq__(self, other): |
| 3472 | if type(self) != type(other): return False |
| 3473 | if self.xid != other.xid: return False |
| 3474 | if self.flags != other.flags: return False |
| 3475 | if self.subtype != other.subtype: return False |
| 3476 | return True |
| 3477 | |
| 3478 | def pretty_print(self, q): |
| 3479 | q.text("bsn_stats_reply {") |
| 3480 | with q.group(): |
| 3481 | with q.indent(2): |
| 3482 | q.breakable() |
| 3483 | q.text("xid = "); |
| 3484 | if self.xid != None: |
| 3485 | q.text("%#x" % self.xid) |
| 3486 | else: |
| 3487 | q.text('None') |
| 3488 | q.text(","); q.breakable() |
| 3489 | q.text("flags = "); |
| 3490 | q.text("%#x" % self.flags) |
| 3491 | q.breakable() |
| 3492 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3493 | |
| 3494 | experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply |
| 3495 | |
| 3496 | class experimenter_stats_request(stats_request): |
| 3497 | subtypes = {} |
| 3498 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3499 | version = 1 |
| 3500 | type = 16 |
| 3501 | stats_type = 65535 |
| 3502 | |
| 3503 | def __init__(self, xid=None, flags=None, experimenter=None, data=None): |
| 3504 | if xid != None: |
| 3505 | self.xid = xid |
| 3506 | else: |
| 3507 | self.xid = None |
| 3508 | if flags != None: |
| 3509 | self.flags = flags |
| 3510 | else: |
| 3511 | self.flags = 0 |
| 3512 | if experimenter != None: |
| 3513 | self.experimenter = experimenter |
| 3514 | else: |
| 3515 | self.experimenter = 0 |
| 3516 | if data != None: |
| 3517 | self.data = data |
| 3518 | else: |
| 3519 | self.data = '' |
| 3520 | return |
| 3521 | |
| 3522 | def pack(self): |
| 3523 | packed = [] |
| 3524 | packed.append(struct.pack("!B", self.version)) |
| 3525 | packed.append(struct.pack("!B", self.type)) |
| 3526 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3527 | packed.append(struct.pack("!L", self.xid)) |
| 3528 | packed.append(struct.pack("!H", self.stats_type)) |
| 3529 | packed.append(struct.pack("!H", self.flags)) |
| 3530 | packed.append(struct.pack("!L", self.experimenter)) |
| 3531 | packed.append(self.data) |
| 3532 | length = sum([len(x) for x in packed]) |
| 3533 | packed[2] = struct.pack("!H", length) |
| 3534 | return ''.join(packed) |
| 3535 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3536 | @staticmethod |
| 3537 | def unpack(reader): |
| 3538 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3539 | subclass = experimenter_stats_request.subtypes.get(subtype) |
| 3540 | if subclass: |
| 3541 | return subclass.unpack(reader) |
| 3542 | |
| 3543 | obj = experimenter_stats_request() |
| 3544 | _version = reader.read("!B")[0] |
| 3545 | assert(_version == 1) |
| 3546 | _type = reader.read("!B")[0] |
| 3547 | assert(_type == 16) |
| 3548 | _length = reader.read("!H")[0] |
| 3549 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3550 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3551 | obj.xid = reader.read("!L")[0] |
| 3552 | _stats_type = reader.read("!H")[0] |
| 3553 | assert(_stats_type == 65535) |
| 3554 | obj.flags = reader.read("!H")[0] |
| 3555 | obj.experimenter = reader.read("!L")[0] |
| 3556 | obj.data = str(reader.read_all()) |
| 3557 | return obj |
| 3558 | |
| 3559 | def __eq__(self, other): |
| 3560 | if type(self) != type(other): return False |
| 3561 | if self.xid != other.xid: return False |
| 3562 | if self.flags != other.flags: return False |
| 3563 | if self.experimenter != other.experimenter: return False |
| 3564 | if self.data != other.data: return False |
| 3565 | return True |
| 3566 | |
| 3567 | def pretty_print(self, q): |
| 3568 | q.text("experimenter_stats_request {") |
| 3569 | with q.group(): |
| 3570 | with q.indent(2): |
| 3571 | q.breakable() |
| 3572 | q.text("xid = "); |
| 3573 | if self.xid != None: |
| 3574 | q.text("%#x" % self.xid) |
| 3575 | else: |
| 3576 | q.text('None') |
| 3577 | q.text(","); q.breakable() |
| 3578 | q.text("flags = "); |
| 3579 | q.text("%#x" % self.flags) |
| 3580 | q.text(","); q.breakable() |
| 3581 | q.text("data = "); |
| 3582 | q.pp(self.data) |
| 3583 | q.breakable() |
| 3584 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3585 | |
| 3586 | stats_request.subtypes[65535] = experimenter_stats_request |
| 3587 | |
| 3588 | class bsn_stats_request(experimenter_stats_request): |
| 3589 | subtypes = {} |
| 3590 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3591 | version = 1 |
| 3592 | type = 18 |
| 3593 | stats_type = 65535 |
| 3594 | experimenter = 6035143 |
| 3595 | |
| 3596 | def __init__(self, xid=None, flags=None, subtype=None): |
| 3597 | if xid != None: |
| 3598 | self.xid = xid |
| 3599 | else: |
| 3600 | self.xid = None |
| 3601 | if flags != None: |
| 3602 | self.flags = flags |
| 3603 | else: |
| 3604 | self.flags = 0 |
| 3605 | if subtype != None: |
| 3606 | self.subtype = subtype |
| 3607 | else: |
| 3608 | self.subtype = 0 |
| 3609 | return |
| 3610 | |
| 3611 | def pack(self): |
| 3612 | packed = [] |
| 3613 | packed.append(struct.pack("!B", self.version)) |
| 3614 | packed.append(struct.pack("!B", self.type)) |
| 3615 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3616 | packed.append(struct.pack("!L", self.xid)) |
| 3617 | packed.append(struct.pack("!H", self.stats_type)) |
| 3618 | packed.append(struct.pack("!H", self.flags)) |
| 3619 | packed.append('\x00' * 4) |
| 3620 | packed.append(struct.pack("!L", self.experimenter)) |
| 3621 | packed.append(struct.pack("!L", self.subtype)) |
| 3622 | length = sum([len(x) for x in packed]) |
| 3623 | packed[2] = struct.pack("!H", length) |
| 3624 | return ''.join(packed) |
| 3625 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3626 | @staticmethod |
| 3627 | def unpack(reader): |
| 3628 | subtype, = reader.peek('!L', 20) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3629 | subclass = bsn_stats_request.subtypes.get(subtype) |
| 3630 | if subclass: |
| 3631 | return subclass.unpack(reader) |
| 3632 | |
| 3633 | obj = bsn_stats_request() |
| 3634 | _version = reader.read("!B")[0] |
| 3635 | assert(_version == 1) |
| 3636 | _type = reader.read("!B")[0] |
| 3637 | assert(_type == 18) |
| 3638 | _length = reader.read("!H")[0] |
| 3639 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3640 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 3641 | obj.xid = reader.read("!L")[0] |
| 3642 | _stats_type = reader.read("!H")[0] |
| 3643 | assert(_stats_type == 65535) |
| 3644 | obj.flags = reader.read("!H")[0] |
| 3645 | reader.skip(4) |
| 3646 | _experimenter = reader.read("!L")[0] |
| 3647 | assert(_experimenter == 6035143) |
| 3648 | obj.subtype = reader.read("!L")[0] |
| 3649 | return obj |
| 3650 | |
| 3651 | def __eq__(self, other): |
| 3652 | if type(self) != type(other): return False |
| 3653 | if self.xid != other.xid: return False |
| 3654 | if self.flags != other.flags: return False |
| 3655 | if self.subtype != other.subtype: return False |
| 3656 | return True |
| 3657 | |
| 3658 | def pretty_print(self, q): |
| 3659 | q.text("bsn_stats_request {") |
| 3660 | with q.group(): |
| 3661 | with q.indent(2): |
| 3662 | q.breakable() |
| 3663 | q.text("xid = "); |
| 3664 | if self.xid != None: |
| 3665 | q.text("%#x" % self.xid) |
| 3666 | else: |
| 3667 | q.text('None') |
| 3668 | q.text(","); q.breakable() |
| 3669 | q.text("flags = "); |
| 3670 | q.text("%#x" % self.flags) |
| 3671 | q.breakable() |
| 3672 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3673 | |
| 3674 | experimenter_stats_request.subtypes[6035143] = bsn_stats_request |
| 3675 | |
| 3676 | class bsn_virtual_port_create_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3677 | version = 1 |
| 3678 | type = 4 |
| 3679 | experimenter = 6035143 |
| 3680 | subtype = 16 |
| 3681 | |
| 3682 | def __init__(self, xid=None, status=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3683 | if xid != None: |
| 3684 | self.xid = xid |
| 3685 | else: |
| 3686 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3687 | if status != None: |
| 3688 | self.status = status |
| 3689 | else: |
| 3690 | self.status = 0 |
| 3691 | if vport_no != None: |
| 3692 | self.vport_no = vport_no |
| 3693 | else: |
| 3694 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3695 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3696 | |
| 3697 | def pack(self): |
| 3698 | packed = [] |
| 3699 | packed.append(struct.pack("!B", self.version)) |
| 3700 | packed.append(struct.pack("!B", self.type)) |
| 3701 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3702 | packed.append(struct.pack("!L", self.xid)) |
| 3703 | packed.append(struct.pack("!L", self.experimenter)) |
| 3704 | packed.append(struct.pack("!L", self.subtype)) |
| 3705 | packed.append(struct.pack("!L", self.status)) |
| 3706 | packed.append(struct.pack("!L", self.vport_no)) |
| 3707 | length = sum([len(x) for x in packed]) |
| 3708 | packed[2] = struct.pack("!H", length) |
| 3709 | return ''.join(packed) |
| 3710 | |
| 3711 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3712 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3713 | obj = bsn_virtual_port_create_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3714 | _version = reader.read("!B")[0] |
| 3715 | assert(_version == 1) |
| 3716 | _type = reader.read("!B")[0] |
| 3717 | assert(_type == 4) |
| 3718 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3719 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3720 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3721 | obj.xid = reader.read("!L")[0] |
| 3722 | _experimenter = reader.read("!L")[0] |
| 3723 | assert(_experimenter == 6035143) |
| 3724 | _subtype = reader.read("!L")[0] |
| 3725 | assert(_subtype == 16) |
| 3726 | obj.status = reader.read("!L")[0] |
| 3727 | obj.vport_no = reader.read("!L")[0] |
| 3728 | return obj |
| 3729 | |
| 3730 | def __eq__(self, other): |
| 3731 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3732 | if self.xid != other.xid: return False |
| 3733 | if self.status != other.status: return False |
| 3734 | if self.vport_no != other.vport_no: return False |
| 3735 | return True |
| 3736 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3737 | def pretty_print(self, q): |
| 3738 | q.text("bsn_virtual_port_create_reply {") |
| 3739 | with q.group(): |
| 3740 | with q.indent(2): |
| 3741 | q.breakable() |
| 3742 | q.text("xid = "); |
| 3743 | if self.xid != None: |
| 3744 | q.text("%#x" % self.xid) |
| 3745 | else: |
| 3746 | q.text('None') |
| 3747 | q.text(","); q.breakable() |
| 3748 | q.text("status = "); |
| 3749 | q.text("%#x" % self.status) |
| 3750 | q.text(","); q.breakable() |
| 3751 | q.text("vport_no = "); |
| 3752 | q.text("%#x" % self.vport_no) |
| 3753 | q.breakable() |
| 3754 | q.text('}') |
| 3755 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3756 | bsn_header.subtypes[16] = bsn_virtual_port_create_reply |
| 3757 | |
| 3758 | class bsn_virtual_port_create_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3759 | version = 1 |
| 3760 | type = 4 |
| 3761 | experimenter = 6035143 |
| 3762 | subtype = 15 |
| 3763 | |
| 3764 | def __init__(self, xid=None, vport=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3765 | if xid != None: |
| 3766 | self.xid = xid |
| 3767 | else: |
| 3768 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3769 | if vport != None: |
| 3770 | self.vport = vport |
| 3771 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3772 | self.vport = ofp.bsn_vport() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3773 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3774 | |
| 3775 | def pack(self): |
| 3776 | packed = [] |
| 3777 | packed.append(struct.pack("!B", self.version)) |
| 3778 | packed.append(struct.pack("!B", self.type)) |
| 3779 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3780 | packed.append(struct.pack("!L", self.xid)) |
| 3781 | packed.append(struct.pack("!L", self.experimenter)) |
| 3782 | packed.append(struct.pack("!L", self.subtype)) |
| 3783 | packed.append(self.vport.pack()) |
| 3784 | length = sum([len(x) for x in packed]) |
| 3785 | packed[2] = struct.pack("!H", length) |
| 3786 | return ''.join(packed) |
| 3787 | |
| 3788 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3789 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3790 | obj = bsn_virtual_port_create_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3791 | _version = reader.read("!B")[0] |
| 3792 | assert(_version == 1) |
| 3793 | _type = reader.read("!B")[0] |
| 3794 | assert(_type == 4) |
| 3795 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3796 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3797 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3798 | obj.xid = reader.read("!L")[0] |
| 3799 | _experimenter = reader.read("!L")[0] |
| 3800 | assert(_experimenter == 6035143) |
| 3801 | _subtype = reader.read("!L")[0] |
| 3802 | assert(_subtype == 15) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 3803 | obj.vport = ofp.bsn_vport.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3804 | return obj |
| 3805 | |
| 3806 | def __eq__(self, other): |
| 3807 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3808 | if self.xid != other.xid: return False |
| 3809 | if self.vport != other.vport: return False |
| 3810 | return True |
| 3811 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3812 | def pretty_print(self, q): |
| 3813 | q.text("bsn_virtual_port_create_request {") |
| 3814 | with q.group(): |
| 3815 | with q.indent(2): |
| 3816 | q.breakable() |
| 3817 | q.text("xid = "); |
| 3818 | if self.xid != None: |
| 3819 | q.text("%#x" % self.xid) |
| 3820 | else: |
| 3821 | q.text('None') |
| 3822 | q.text(","); q.breakable() |
| 3823 | q.text("vport = "); |
| 3824 | q.pp(self.vport) |
| 3825 | q.breakable() |
| 3826 | q.text('}') |
| 3827 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3828 | bsn_header.subtypes[15] = bsn_virtual_port_create_request |
| 3829 | |
| 3830 | class bsn_virtual_port_remove_reply(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3831 | version = 1 |
| 3832 | type = 4 |
| 3833 | experimenter = 6035143 |
| 3834 | subtype = 26 |
| 3835 | |
| 3836 | def __init__(self, xid=None, status=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3837 | if xid != None: |
| 3838 | self.xid = xid |
| 3839 | else: |
| 3840 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3841 | if status != None: |
| 3842 | self.status = status |
| 3843 | else: |
| 3844 | self.status = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3845 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3846 | |
| 3847 | def pack(self): |
| 3848 | packed = [] |
| 3849 | packed.append(struct.pack("!B", self.version)) |
| 3850 | packed.append(struct.pack("!B", self.type)) |
| 3851 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3852 | packed.append(struct.pack("!L", self.xid)) |
| 3853 | packed.append(struct.pack("!L", self.experimenter)) |
| 3854 | packed.append(struct.pack("!L", self.subtype)) |
| 3855 | packed.append(struct.pack("!L", self.status)) |
| 3856 | length = sum([len(x) for x in packed]) |
| 3857 | packed[2] = struct.pack("!H", length) |
| 3858 | return ''.join(packed) |
| 3859 | |
| 3860 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3861 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3862 | obj = bsn_virtual_port_remove_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3863 | _version = reader.read("!B")[0] |
| 3864 | assert(_version == 1) |
| 3865 | _type = reader.read("!B")[0] |
| 3866 | assert(_type == 4) |
| 3867 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3868 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3869 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3870 | obj.xid = reader.read("!L")[0] |
| 3871 | _experimenter = reader.read("!L")[0] |
| 3872 | assert(_experimenter == 6035143) |
| 3873 | _subtype = reader.read("!L")[0] |
| 3874 | assert(_subtype == 26) |
| 3875 | obj.status = reader.read("!L")[0] |
| 3876 | return obj |
| 3877 | |
| 3878 | def __eq__(self, other): |
| 3879 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3880 | if self.xid != other.xid: return False |
| 3881 | if self.status != other.status: return False |
| 3882 | return True |
| 3883 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3884 | def pretty_print(self, q): |
| 3885 | q.text("bsn_virtual_port_remove_reply {") |
| 3886 | with q.group(): |
| 3887 | with q.indent(2): |
| 3888 | q.breakable() |
| 3889 | q.text("xid = "); |
| 3890 | if self.xid != None: |
| 3891 | q.text("%#x" % self.xid) |
| 3892 | else: |
| 3893 | q.text('None') |
| 3894 | q.text(","); q.breakable() |
| 3895 | q.text("status = "); |
| 3896 | q.text("%#x" % self.status) |
| 3897 | q.breakable() |
| 3898 | q.text('}') |
| 3899 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3900 | bsn_header.subtypes[26] = bsn_virtual_port_remove_reply |
| 3901 | |
| 3902 | class bsn_virtual_port_remove_request(bsn_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3903 | version = 1 |
| 3904 | type = 4 |
| 3905 | experimenter = 6035143 |
| 3906 | subtype = 17 |
| 3907 | |
| 3908 | def __init__(self, xid=None, vport_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3909 | if xid != None: |
| 3910 | self.xid = xid |
| 3911 | else: |
| 3912 | self.xid = None |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3913 | if vport_no != None: |
| 3914 | self.vport_no = vport_no |
| 3915 | else: |
| 3916 | self.vport_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3917 | return |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3918 | |
| 3919 | def pack(self): |
| 3920 | packed = [] |
| 3921 | packed.append(struct.pack("!B", self.version)) |
| 3922 | packed.append(struct.pack("!B", self.type)) |
| 3923 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 3924 | packed.append(struct.pack("!L", self.xid)) |
| 3925 | packed.append(struct.pack("!L", self.experimenter)) |
| 3926 | packed.append(struct.pack("!L", self.subtype)) |
| 3927 | packed.append(struct.pack("!L", self.vport_no)) |
| 3928 | length = sum([len(x) for x in packed]) |
| 3929 | packed[2] = struct.pack("!H", length) |
| 3930 | return ''.join(packed) |
| 3931 | |
| 3932 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3933 | def unpack(reader): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3934 | obj = bsn_virtual_port_remove_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3935 | _version = reader.read("!B")[0] |
| 3936 | assert(_version == 1) |
| 3937 | _type = reader.read("!B")[0] |
| 3938 | assert(_type == 4) |
| 3939 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3940 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 3941 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3942 | obj.xid = reader.read("!L")[0] |
| 3943 | _experimenter = reader.read("!L")[0] |
| 3944 | assert(_experimenter == 6035143) |
| 3945 | _subtype = reader.read("!L")[0] |
| 3946 | assert(_subtype == 17) |
| 3947 | obj.vport_no = reader.read("!L")[0] |
| 3948 | return obj |
| 3949 | |
| 3950 | def __eq__(self, other): |
| 3951 | if type(self) != type(other): return False |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3952 | if self.xid != other.xid: return False |
| 3953 | if self.vport_no != other.vport_no: return False |
| 3954 | return True |
| 3955 | |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3956 | def pretty_print(self, q): |
| 3957 | q.text("bsn_virtual_port_remove_request {") |
| 3958 | with q.group(): |
| 3959 | with q.indent(2): |
| 3960 | q.breakable() |
| 3961 | q.text("xid = "); |
| 3962 | if self.xid != None: |
| 3963 | q.text("%#x" % self.xid) |
| 3964 | else: |
| 3965 | q.text('None') |
| 3966 | q.text(","); q.breakable() |
| 3967 | q.text("vport_no = "); |
| 3968 | q.text("%#x" % self.vport_no) |
| 3969 | q.breakable() |
| 3970 | q.text('}') |
| 3971 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 3972 | bsn_header.subtypes[17] = bsn_virtual_port_remove_request |
| 3973 | |
| 3974 | class desc_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 3975 | version = 1 |
| 3976 | type = 17 |
| 3977 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3978 | |
| 3979 | 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] | 3980 | if xid != None: |
| 3981 | self.xid = xid |
| 3982 | else: |
| 3983 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 3984 | if flags != None: |
| 3985 | self.flags = flags |
| 3986 | else: |
| 3987 | self.flags = 0 |
| 3988 | if mfr_desc != None: |
| 3989 | self.mfr_desc = mfr_desc |
| 3990 | else: |
| 3991 | self.mfr_desc = "" |
| 3992 | if hw_desc != None: |
| 3993 | self.hw_desc = hw_desc |
| 3994 | else: |
| 3995 | self.hw_desc = "" |
| 3996 | if sw_desc != None: |
| 3997 | self.sw_desc = sw_desc |
| 3998 | else: |
| 3999 | self.sw_desc = "" |
| 4000 | if serial_num != None: |
| 4001 | self.serial_num = serial_num |
| 4002 | else: |
| 4003 | self.serial_num = "" |
| 4004 | if dp_desc != None: |
| 4005 | self.dp_desc = dp_desc |
| 4006 | else: |
| 4007 | self.dp_desc = "" |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4008 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4009 | |
| 4010 | def pack(self): |
| 4011 | packed = [] |
| 4012 | packed.append(struct.pack("!B", self.version)) |
| 4013 | packed.append(struct.pack("!B", self.type)) |
| 4014 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4015 | packed.append(struct.pack("!L", self.xid)) |
| 4016 | packed.append(struct.pack("!H", self.stats_type)) |
| 4017 | packed.append(struct.pack("!H", self.flags)) |
| 4018 | packed.append(struct.pack("!256s", self.mfr_desc)) |
| 4019 | packed.append(struct.pack("!256s", self.hw_desc)) |
| 4020 | packed.append(struct.pack("!256s", self.sw_desc)) |
| 4021 | packed.append(struct.pack("!32s", self.serial_num)) |
| 4022 | packed.append(struct.pack("!256s", self.dp_desc)) |
| 4023 | length = sum([len(x) for x in packed]) |
| 4024 | packed[2] = struct.pack("!H", length) |
| 4025 | return ''.join(packed) |
| 4026 | |
| 4027 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4028 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4029 | obj = desc_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4030 | _version = reader.read("!B")[0] |
| 4031 | assert(_version == 1) |
| 4032 | _type = reader.read("!B")[0] |
| 4033 | assert(_type == 17) |
| 4034 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4035 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4036 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4037 | obj.xid = reader.read("!L")[0] |
| 4038 | _stats_type = reader.read("!H")[0] |
| 4039 | assert(_stats_type == 0) |
| 4040 | obj.flags = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4041 | obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4042 | obj.hw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4043 | obj.sw_desc = reader.read("!256s")[0].rstrip("\x00") |
| 4044 | obj.serial_num = reader.read("!32s")[0].rstrip("\x00") |
| 4045 | obj.dp_desc = reader.read("!256s")[0].rstrip("\x00") |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4046 | return obj |
| 4047 | |
| 4048 | def __eq__(self, other): |
| 4049 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4050 | if self.xid != other.xid: return False |
| 4051 | if self.flags != other.flags: return False |
| 4052 | if self.mfr_desc != other.mfr_desc: return False |
| 4053 | if self.hw_desc != other.hw_desc: return False |
| 4054 | if self.sw_desc != other.sw_desc: return False |
| 4055 | if self.serial_num != other.serial_num: return False |
| 4056 | if self.dp_desc != other.dp_desc: return False |
| 4057 | return True |
| 4058 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4059 | def pretty_print(self, q): |
| 4060 | q.text("desc_stats_reply {") |
| 4061 | with q.group(): |
| 4062 | with q.indent(2): |
| 4063 | q.breakable() |
| 4064 | q.text("xid = "); |
| 4065 | if self.xid != None: |
| 4066 | q.text("%#x" % self.xid) |
| 4067 | else: |
| 4068 | q.text('None') |
| 4069 | q.text(","); q.breakable() |
| 4070 | q.text("flags = "); |
| 4071 | q.text("%#x" % self.flags) |
| 4072 | q.text(","); q.breakable() |
| 4073 | q.text("mfr_desc = "); |
| 4074 | q.pp(self.mfr_desc) |
| 4075 | q.text(","); q.breakable() |
| 4076 | q.text("hw_desc = "); |
| 4077 | q.pp(self.hw_desc) |
| 4078 | q.text(","); q.breakable() |
| 4079 | q.text("sw_desc = "); |
| 4080 | q.pp(self.sw_desc) |
| 4081 | q.text(","); q.breakable() |
| 4082 | q.text("serial_num = "); |
| 4083 | q.pp(self.serial_num) |
| 4084 | q.text(","); q.breakable() |
| 4085 | q.text("dp_desc = "); |
| 4086 | q.pp(self.dp_desc) |
| 4087 | q.breakable() |
| 4088 | q.text('}') |
| 4089 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4090 | stats_reply.subtypes[0] = desc_stats_reply |
| 4091 | |
| 4092 | class desc_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4093 | version = 1 |
| 4094 | type = 16 |
| 4095 | stats_type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4096 | |
| 4097 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4098 | if xid != None: |
| 4099 | self.xid = xid |
| 4100 | else: |
| 4101 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4102 | if flags != None: |
| 4103 | self.flags = flags |
| 4104 | else: |
| 4105 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4106 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4107 | |
| 4108 | def pack(self): |
| 4109 | packed = [] |
| 4110 | packed.append(struct.pack("!B", self.version)) |
| 4111 | packed.append(struct.pack("!B", self.type)) |
| 4112 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4113 | packed.append(struct.pack("!L", self.xid)) |
| 4114 | packed.append(struct.pack("!H", self.stats_type)) |
| 4115 | packed.append(struct.pack("!H", self.flags)) |
| 4116 | length = sum([len(x) for x in packed]) |
| 4117 | packed[2] = struct.pack("!H", length) |
| 4118 | return ''.join(packed) |
| 4119 | |
| 4120 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4121 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4122 | obj = desc_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4123 | _version = reader.read("!B")[0] |
| 4124 | assert(_version == 1) |
| 4125 | _type = reader.read("!B")[0] |
| 4126 | assert(_type == 16) |
| 4127 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4128 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4129 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4130 | obj.xid = reader.read("!L")[0] |
| 4131 | _stats_type = reader.read("!H")[0] |
| 4132 | assert(_stats_type == 0) |
| 4133 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4134 | return obj |
| 4135 | |
| 4136 | def __eq__(self, other): |
| 4137 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4138 | if self.xid != other.xid: return False |
| 4139 | if self.flags != other.flags: return False |
| 4140 | return True |
| 4141 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4142 | def pretty_print(self, q): |
| 4143 | q.text("desc_stats_request {") |
| 4144 | with q.group(): |
| 4145 | with q.indent(2): |
| 4146 | q.breakable() |
| 4147 | q.text("xid = "); |
| 4148 | if self.xid != None: |
| 4149 | q.text("%#x" % self.xid) |
| 4150 | else: |
| 4151 | q.text('None') |
| 4152 | q.text(","); q.breakable() |
| 4153 | q.text("flags = "); |
| 4154 | q.text("%#x" % self.flags) |
| 4155 | q.breakable() |
| 4156 | q.text('}') |
| 4157 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4158 | stats_request.subtypes[0] = desc_stats_request |
| 4159 | |
| 4160 | class echo_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4161 | version = 1 |
| 4162 | type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4163 | |
| 4164 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4165 | if xid != None: |
| 4166 | self.xid = xid |
| 4167 | else: |
| 4168 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4169 | if data != None: |
| 4170 | self.data = data |
| 4171 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4172 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4173 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4174 | |
| 4175 | def pack(self): |
| 4176 | packed = [] |
| 4177 | packed.append(struct.pack("!B", self.version)) |
| 4178 | packed.append(struct.pack("!B", self.type)) |
| 4179 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4180 | packed.append(struct.pack("!L", self.xid)) |
| 4181 | packed.append(self.data) |
| 4182 | length = sum([len(x) for x in packed]) |
| 4183 | packed[2] = struct.pack("!H", length) |
| 4184 | return ''.join(packed) |
| 4185 | |
| 4186 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4187 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4188 | obj = echo_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4189 | _version = reader.read("!B")[0] |
| 4190 | assert(_version == 1) |
| 4191 | _type = reader.read("!B")[0] |
| 4192 | assert(_type == 3) |
| 4193 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4194 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4195 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4196 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4197 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4198 | return obj |
| 4199 | |
| 4200 | def __eq__(self, other): |
| 4201 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4202 | if self.xid != other.xid: return False |
| 4203 | if self.data != other.data: return False |
| 4204 | return True |
| 4205 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4206 | def pretty_print(self, q): |
| 4207 | q.text("echo_reply {") |
| 4208 | with q.group(): |
| 4209 | with q.indent(2): |
| 4210 | q.breakable() |
| 4211 | q.text("xid = "); |
| 4212 | if self.xid != None: |
| 4213 | q.text("%#x" % self.xid) |
| 4214 | else: |
| 4215 | q.text('None') |
| 4216 | q.text(","); q.breakable() |
| 4217 | q.text("data = "); |
| 4218 | q.pp(self.data) |
| 4219 | q.breakable() |
| 4220 | q.text('}') |
| 4221 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4222 | message.subtypes[3] = echo_reply |
| 4223 | |
| 4224 | class echo_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4225 | version = 1 |
| 4226 | type = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4227 | |
| 4228 | def __init__(self, xid=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4229 | if xid != None: |
| 4230 | self.xid = xid |
| 4231 | else: |
| 4232 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4233 | if data != None: |
| 4234 | self.data = data |
| 4235 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4236 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4237 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4238 | |
| 4239 | def pack(self): |
| 4240 | packed = [] |
| 4241 | packed.append(struct.pack("!B", self.version)) |
| 4242 | packed.append(struct.pack("!B", self.type)) |
| 4243 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4244 | packed.append(struct.pack("!L", self.xid)) |
| 4245 | packed.append(self.data) |
| 4246 | length = sum([len(x) for x in packed]) |
| 4247 | packed[2] = struct.pack("!H", length) |
| 4248 | return ''.join(packed) |
| 4249 | |
| 4250 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4251 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4252 | obj = echo_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4253 | _version = reader.read("!B")[0] |
| 4254 | assert(_version == 1) |
| 4255 | _type = reader.read("!B")[0] |
| 4256 | assert(_type == 2) |
| 4257 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4258 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4259 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4260 | obj.xid = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4261 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4262 | return obj |
| 4263 | |
| 4264 | def __eq__(self, other): |
| 4265 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4266 | if self.xid != other.xid: return False |
| 4267 | if self.data != other.data: return False |
| 4268 | return True |
| 4269 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4270 | def pretty_print(self, q): |
| 4271 | q.text("echo_request {") |
| 4272 | with q.group(): |
| 4273 | with q.indent(2): |
| 4274 | q.breakable() |
| 4275 | q.text("xid = "); |
| 4276 | if self.xid != None: |
| 4277 | q.text("%#x" % self.xid) |
| 4278 | else: |
| 4279 | q.text('None') |
| 4280 | q.text(","); q.breakable() |
| 4281 | q.text("data = "); |
| 4282 | q.pp(self.data) |
| 4283 | q.breakable() |
| 4284 | q.text('}') |
| 4285 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4286 | message.subtypes[2] = echo_request |
| 4287 | |
| 4288 | class features_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4289 | version = 1 |
| 4290 | type = 6 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4291 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4292 | def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, capabilities=None, actions=None, ports=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4293 | if xid != None: |
| 4294 | self.xid = xid |
| 4295 | else: |
| 4296 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4297 | if datapath_id != None: |
| 4298 | self.datapath_id = datapath_id |
| 4299 | else: |
| 4300 | self.datapath_id = 0 |
| 4301 | if n_buffers != None: |
| 4302 | self.n_buffers = n_buffers |
| 4303 | else: |
| 4304 | self.n_buffers = 0 |
| 4305 | if n_tables != None: |
| 4306 | self.n_tables = n_tables |
| 4307 | else: |
| 4308 | self.n_tables = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4309 | if capabilities != None: |
| 4310 | self.capabilities = capabilities |
| 4311 | else: |
| 4312 | self.capabilities = 0 |
| 4313 | if actions != None: |
| 4314 | self.actions = actions |
| 4315 | else: |
| 4316 | self.actions = 0 |
| 4317 | if ports != None: |
| 4318 | self.ports = ports |
| 4319 | else: |
| 4320 | self.ports = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4321 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4322 | |
| 4323 | def pack(self): |
| 4324 | packed = [] |
| 4325 | packed.append(struct.pack("!B", self.version)) |
| 4326 | packed.append(struct.pack("!B", self.type)) |
| 4327 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4328 | packed.append(struct.pack("!L", self.xid)) |
| 4329 | packed.append(struct.pack("!Q", self.datapath_id)) |
| 4330 | packed.append(struct.pack("!L", self.n_buffers)) |
| 4331 | packed.append(struct.pack("!B", self.n_tables)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4332 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4333 | packed.append(struct.pack("!L", self.capabilities)) |
| 4334 | packed.append(struct.pack("!L", self.actions)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4335 | packed.append(loxi.generic_util.pack_list(self.ports)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4336 | length = sum([len(x) for x in packed]) |
| 4337 | packed[2] = struct.pack("!H", length) |
| 4338 | return ''.join(packed) |
| 4339 | |
| 4340 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4341 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4342 | obj = features_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4343 | _version = reader.read("!B")[0] |
| 4344 | assert(_version == 1) |
| 4345 | _type = reader.read("!B")[0] |
| 4346 | assert(_type == 6) |
| 4347 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4348 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4349 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4350 | obj.xid = reader.read("!L")[0] |
| 4351 | obj.datapath_id = reader.read("!Q")[0] |
| 4352 | obj.n_buffers = reader.read("!L")[0] |
| 4353 | obj.n_tables = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 4354 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4355 | obj.capabilities = reader.read("!L")[0] |
| 4356 | obj.actions = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4357 | obj.ports = loxi.generic_util.unpack_list(reader, ofp.common.port_desc.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4358 | return obj |
| 4359 | |
| 4360 | def __eq__(self, other): |
| 4361 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4362 | if self.xid != other.xid: return False |
| 4363 | if self.datapath_id != other.datapath_id: return False |
| 4364 | if self.n_buffers != other.n_buffers: return False |
| 4365 | if self.n_tables != other.n_tables: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4366 | if self.capabilities != other.capabilities: return False |
| 4367 | if self.actions != other.actions: return False |
| 4368 | if self.ports != other.ports: return False |
| 4369 | return True |
| 4370 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4371 | def pretty_print(self, q): |
| 4372 | q.text("features_reply {") |
| 4373 | with q.group(): |
| 4374 | with q.indent(2): |
| 4375 | q.breakable() |
| 4376 | q.text("xid = "); |
| 4377 | if self.xid != None: |
| 4378 | q.text("%#x" % self.xid) |
| 4379 | else: |
| 4380 | q.text('None') |
| 4381 | q.text(","); q.breakable() |
| 4382 | q.text("datapath_id = "); |
| 4383 | q.text("%#x" % self.datapath_id) |
| 4384 | q.text(","); q.breakable() |
| 4385 | q.text("n_buffers = "); |
| 4386 | q.text("%#x" % self.n_buffers) |
| 4387 | q.text(","); q.breakable() |
| 4388 | q.text("n_tables = "); |
| 4389 | q.text("%#x" % self.n_tables) |
| 4390 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4391 | q.text("capabilities = "); |
| 4392 | q.text("%#x" % self.capabilities) |
| 4393 | q.text(","); q.breakable() |
| 4394 | q.text("actions = "); |
| 4395 | q.text("%#x" % self.actions) |
| 4396 | q.text(","); q.breakable() |
| 4397 | q.text("ports = "); |
| 4398 | q.pp(self.ports) |
| 4399 | q.breakable() |
| 4400 | q.text('}') |
| 4401 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4402 | message.subtypes[6] = features_reply |
| 4403 | |
| 4404 | class features_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4405 | version = 1 |
| 4406 | type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4407 | |
| 4408 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4409 | if xid != None: |
| 4410 | self.xid = xid |
| 4411 | else: |
| 4412 | self.xid = None |
| 4413 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4414 | |
| 4415 | def pack(self): |
| 4416 | packed = [] |
| 4417 | packed.append(struct.pack("!B", self.version)) |
| 4418 | packed.append(struct.pack("!B", self.type)) |
| 4419 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4420 | packed.append(struct.pack("!L", self.xid)) |
| 4421 | length = sum([len(x) for x in packed]) |
| 4422 | packed[2] = struct.pack("!H", length) |
| 4423 | return ''.join(packed) |
| 4424 | |
| 4425 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4426 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4427 | obj = features_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4428 | _version = reader.read("!B")[0] |
| 4429 | assert(_version == 1) |
| 4430 | _type = reader.read("!B")[0] |
| 4431 | assert(_type == 5) |
| 4432 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4433 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4434 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4435 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4436 | return obj |
| 4437 | |
| 4438 | def __eq__(self, other): |
| 4439 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4440 | if self.xid != other.xid: return False |
| 4441 | return True |
| 4442 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4443 | def pretty_print(self, q): |
| 4444 | q.text("features_request {") |
| 4445 | with q.group(): |
| 4446 | with q.indent(2): |
| 4447 | q.breakable() |
| 4448 | q.text("xid = "); |
| 4449 | if self.xid != None: |
| 4450 | q.text("%#x" % self.xid) |
| 4451 | else: |
| 4452 | q.text('None') |
| 4453 | q.breakable() |
| 4454 | q.text('}') |
| 4455 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4456 | message.subtypes[5] = features_request |
| 4457 | |
| 4458 | class flow_mod(message): |
| 4459 | subtypes = {} |
| 4460 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4461 | version = 1 |
| 4462 | type = 14 |
| 4463 | |
| 4464 | def __init__(self, xid=None, match=None, cookie=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
| 4465 | if xid != None: |
| 4466 | self.xid = xid |
| 4467 | else: |
| 4468 | self.xid = None |
| 4469 | if match != None: |
| 4470 | self.match = match |
| 4471 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4472 | self.match = ofp.match() |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4473 | if cookie != None: |
| 4474 | self.cookie = cookie |
| 4475 | else: |
| 4476 | self.cookie = 0 |
| 4477 | if _command != None: |
| 4478 | self._command = _command |
| 4479 | else: |
| 4480 | self._command = 0 |
| 4481 | if idle_timeout != None: |
| 4482 | self.idle_timeout = idle_timeout |
| 4483 | else: |
| 4484 | self.idle_timeout = 0 |
| 4485 | if hard_timeout != None: |
| 4486 | self.hard_timeout = hard_timeout |
| 4487 | else: |
| 4488 | self.hard_timeout = 0 |
| 4489 | if priority != None: |
| 4490 | self.priority = priority |
| 4491 | else: |
| 4492 | self.priority = 0 |
| 4493 | if buffer_id != None: |
| 4494 | self.buffer_id = buffer_id |
| 4495 | else: |
| 4496 | self.buffer_id = 0 |
| 4497 | if out_port != None: |
| 4498 | self.out_port = out_port |
| 4499 | else: |
| 4500 | self.out_port = 0 |
| 4501 | if flags != None: |
| 4502 | self.flags = flags |
| 4503 | else: |
| 4504 | self.flags = 0 |
| 4505 | if actions != None: |
| 4506 | self.actions = actions |
| 4507 | else: |
| 4508 | self.actions = [] |
| 4509 | return |
| 4510 | |
| 4511 | def pack(self): |
| 4512 | packed = [] |
| 4513 | packed.append(struct.pack("!B", self.version)) |
| 4514 | packed.append(struct.pack("!B", self.type)) |
| 4515 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4516 | packed.append(struct.pack("!L", self.xid)) |
| 4517 | packed.append(self.match.pack()) |
| 4518 | packed.append(struct.pack("!Q", self.cookie)) |
| 4519 | packed.append(util.pack_fm_cmd(self._command)) |
| 4520 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4521 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4522 | packed.append(struct.pack("!H", self.priority)) |
| 4523 | packed.append(struct.pack("!L", self.buffer_id)) |
| 4524 | packed.append(util.pack_port_no(self.out_port)) |
| 4525 | packed.append(struct.pack("!H", self.flags)) |
| 4526 | packed.append(loxi.generic_util.pack_list(self.actions)) |
| 4527 | length = sum([len(x) for x in packed]) |
| 4528 | packed[2] = struct.pack("!H", length) |
| 4529 | return ''.join(packed) |
| 4530 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4531 | @staticmethod |
| 4532 | def unpack(reader): |
| 4533 | subtype, = reader.peek('!H', 56) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4534 | subclass = flow_mod.subtypes.get(subtype) |
| 4535 | if subclass: |
| 4536 | return subclass.unpack(reader) |
| 4537 | |
| 4538 | obj = flow_mod() |
| 4539 | _version = reader.read("!B")[0] |
| 4540 | assert(_version == 1) |
| 4541 | _type = reader.read("!B")[0] |
| 4542 | assert(_type == 14) |
| 4543 | _length = reader.read("!H")[0] |
| 4544 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4545 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4546 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4547 | obj.match = ofp.match.unpack(reader) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4548 | obj.cookie = reader.read("!Q")[0] |
| 4549 | obj._command = util.unpack_fm_cmd(reader) |
| 4550 | obj.idle_timeout = reader.read("!H")[0] |
| 4551 | obj.hard_timeout = reader.read("!H")[0] |
| 4552 | obj.priority = reader.read("!H")[0] |
| 4553 | obj.buffer_id = reader.read("!L")[0] |
| 4554 | obj.out_port = util.unpack_port_no(reader) |
| 4555 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4556 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 4557 | return obj |
| 4558 | |
| 4559 | def __eq__(self, other): |
| 4560 | if type(self) != type(other): return False |
| 4561 | if self.xid != other.xid: return False |
| 4562 | if self.match != other.match: return False |
| 4563 | if self.cookie != other.cookie: return False |
| 4564 | if self._command != other._command: return False |
| 4565 | if self.idle_timeout != other.idle_timeout: return False |
| 4566 | if self.hard_timeout != other.hard_timeout: return False |
| 4567 | if self.priority != other.priority: return False |
| 4568 | if self.buffer_id != other.buffer_id: return False |
| 4569 | if self.out_port != other.out_port: return False |
| 4570 | if self.flags != other.flags: return False |
| 4571 | if self.actions != other.actions: return False |
| 4572 | return True |
| 4573 | |
| 4574 | def pretty_print(self, q): |
| 4575 | q.text("flow_mod {") |
| 4576 | with q.group(): |
| 4577 | with q.indent(2): |
| 4578 | q.breakable() |
| 4579 | q.text("xid = "); |
| 4580 | if self.xid != None: |
| 4581 | q.text("%#x" % self.xid) |
| 4582 | else: |
| 4583 | q.text('None') |
| 4584 | q.text(","); q.breakable() |
| 4585 | q.text("match = "); |
| 4586 | q.pp(self.match) |
| 4587 | q.text(","); q.breakable() |
| 4588 | q.text("cookie = "); |
| 4589 | q.text("%#x" % self.cookie) |
| 4590 | q.text(","); q.breakable() |
| 4591 | q.text("idle_timeout = "); |
| 4592 | q.text("%#x" % self.idle_timeout) |
| 4593 | q.text(","); q.breakable() |
| 4594 | q.text("hard_timeout = "); |
| 4595 | q.text("%#x" % self.hard_timeout) |
| 4596 | q.text(","); q.breakable() |
| 4597 | q.text("priority = "); |
| 4598 | q.text("%#x" % self.priority) |
| 4599 | q.text(","); q.breakable() |
| 4600 | q.text("buffer_id = "); |
| 4601 | q.text("%#x" % self.buffer_id) |
| 4602 | q.text(","); q.breakable() |
| 4603 | q.text("out_port = "); |
| 4604 | q.text(util.pretty_port(self.out_port)) |
| 4605 | q.text(","); q.breakable() |
| 4606 | q.text("flags = "); |
| 4607 | q.text("%#x" % self.flags) |
| 4608 | q.text(","); q.breakable() |
| 4609 | q.text("actions = "); |
| 4610 | q.pp(self.actions) |
| 4611 | q.breakable() |
| 4612 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4613 | |
| 4614 | message.subtypes[14] = flow_mod |
| 4615 | |
| 4616 | class flow_add(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4617 | version = 1 |
| 4618 | type = 14 |
| 4619 | _command = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4620 | |
| 4621 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4622 | if xid != None: |
| 4623 | self.xid = xid |
| 4624 | else: |
| 4625 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4626 | if match != None: |
| 4627 | self.match = match |
| 4628 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4629 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4630 | if cookie != None: |
| 4631 | self.cookie = cookie |
| 4632 | else: |
| 4633 | self.cookie = 0 |
| 4634 | if idle_timeout != None: |
| 4635 | self.idle_timeout = idle_timeout |
| 4636 | else: |
| 4637 | self.idle_timeout = 0 |
| 4638 | if hard_timeout != None: |
| 4639 | self.hard_timeout = hard_timeout |
| 4640 | else: |
| 4641 | self.hard_timeout = 0 |
| 4642 | if priority != None: |
| 4643 | self.priority = priority |
| 4644 | else: |
| 4645 | self.priority = 0 |
| 4646 | if buffer_id != None: |
| 4647 | self.buffer_id = buffer_id |
| 4648 | else: |
| 4649 | self.buffer_id = 0 |
| 4650 | if out_port != None: |
| 4651 | self.out_port = out_port |
| 4652 | else: |
| 4653 | self.out_port = 0 |
| 4654 | if flags != None: |
| 4655 | self.flags = flags |
| 4656 | else: |
| 4657 | self.flags = 0 |
| 4658 | if actions != None: |
| 4659 | self.actions = actions |
| 4660 | else: |
| 4661 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4662 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4663 | |
| 4664 | def pack(self): |
| 4665 | packed = [] |
| 4666 | packed.append(struct.pack("!B", self.version)) |
| 4667 | packed.append(struct.pack("!B", self.type)) |
| 4668 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4669 | packed.append(struct.pack("!L", self.xid)) |
| 4670 | packed.append(self.match.pack()) |
| 4671 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4672 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4673 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4674 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4675 | packed.append(struct.pack("!H", self.priority)) |
| 4676 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4677 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4678 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4679 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4680 | length = sum([len(x) for x in packed]) |
| 4681 | packed[2] = struct.pack("!H", length) |
| 4682 | return ''.join(packed) |
| 4683 | |
| 4684 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4685 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4686 | obj = flow_add() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4687 | _version = reader.read("!B")[0] |
| 4688 | assert(_version == 1) |
| 4689 | _type = reader.read("!B")[0] |
| 4690 | assert(_type == 14) |
| 4691 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4692 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4693 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4694 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4695 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4696 | obj.cookie = reader.read("!Q")[0] |
| 4697 | __command = util.unpack_fm_cmd(reader) |
| 4698 | assert(__command == 0) |
| 4699 | obj.idle_timeout = reader.read("!H")[0] |
| 4700 | obj.hard_timeout = reader.read("!H")[0] |
| 4701 | obj.priority = reader.read("!H")[0] |
| 4702 | obj.buffer_id = reader.read("!L")[0] |
| 4703 | obj.out_port = util.unpack_port_no(reader) |
| 4704 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4705 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4706 | return obj |
| 4707 | |
| 4708 | def __eq__(self, other): |
| 4709 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4710 | if self.xid != other.xid: return False |
| 4711 | if self.match != other.match: return False |
| 4712 | if self.cookie != other.cookie: return False |
| 4713 | if self.idle_timeout != other.idle_timeout: return False |
| 4714 | if self.hard_timeout != other.hard_timeout: return False |
| 4715 | if self.priority != other.priority: return False |
| 4716 | if self.buffer_id != other.buffer_id: return False |
| 4717 | if self.out_port != other.out_port: return False |
| 4718 | if self.flags != other.flags: return False |
| 4719 | if self.actions != other.actions: return False |
| 4720 | return True |
| 4721 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4722 | def pretty_print(self, q): |
| 4723 | q.text("flow_add {") |
| 4724 | with q.group(): |
| 4725 | with q.indent(2): |
| 4726 | q.breakable() |
| 4727 | q.text("xid = "); |
| 4728 | if self.xid != None: |
| 4729 | q.text("%#x" % self.xid) |
| 4730 | else: |
| 4731 | q.text('None') |
| 4732 | q.text(","); q.breakable() |
| 4733 | q.text("match = "); |
| 4734 | q.pp(self.match) |
| 4735 | q.text(","); q.breakable() |
| 4736 | q.text("cookie = "); |
| 4737 | q.text("%#x" % self.cookie) |
| 4738 | q.text(","); q.breakable() |
| 4739 | q.text("idle_timeout = "); |
| 4740 | q.text("%#x" % self.idle_timeout) |
| 4741 | q.text(","); q.breakable() |
| 4742 | q.text("hard_timeout = "); |
| 4743 | q.text("%#x" % self.hard_timeout) |
| 4744 | q.text(","); q.breakable() |
| 4745 | q.text("priority = "); |
| 4746 | q.text("%#x" % self.priority) |
| 4747 | q.text(","); q.breakable() |
| 4748 | q.text("buffer_id = "); |
| 4749 | q.text("%#x" % self.buffer_id) |
| 4750 | q.text(","); q.breakable() |
| 4751 | q.text("out_port = "); |
| 4752 | q.text(util.pretty_port(self.out_port)) |
| 4753 | q.text(","); q.breakable() |
| 4754 | q.text("flags = "); |
| 4755 | q.text("%#x" % self.flags) |
| 4756 | q.text(","); q.breakable() |
| 4757 | q.text("actions = "); |
| 4758 | q.pp(self.actions) |
| 4759 | q.breakable() |
| 4760 | q.text('}') |
| 4761 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4762 | flow_mod.subtypes[0] = flow_add |
| 4763 | |
| 4764 | class flow_delete(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4765 | version = 1 |
| 4766 | type = 14 |
| 4767 | _command = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4768 | |
| 4769 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4770 | if xid != None: |
| 4771 | self.xid = xid |
| 4772 | else: |
| 4773 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4774 | if match != None: |
| 4775 | self.match = match |
| 4776 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4777 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4778 | if cookie != None: |
| 4779 | self.cookie = cookie |
| 4780 | else: |
| 4781 | self.cookie = 0 |
| 4782 | if idle_timeout != None: |
| 4783 | self.idle_timeout = idle_timeout |
| 4784 | else: |
| 4785 | self.idle_timeout = 0 |
| 4786 | if hard_timeout != None: |
| 4787 | self.hard_timeout = hard_timeout |
| 4788 | else: |
| 4789 | self.hard_timeout = 0 |
| 4790 | if priority != None: |
| 4791 | self.priority = priority |
| 4792 | else: |
| 4793 | self.priority = 0 |
| 4794 | if buffer_id != None: |
| 4795 | self.buffer_id = buffer_id |
| 4796 | else: |
| 4797 | self.buffer_id = 0 |
| 4798 | if out_port != None: |
| 4799 | self.out_port = out_port |
| 4800 | else: |
| 4801 | self.out_port = 0 |
| 4802 | if flags != None: |
| 4803 | self.flags = flags |
| 4804 | else: |
| 4805 | self.flags = 0 |
| 4806 | if actions != None: |
| 4807 | self.actions = actions |
| 4808 | else: |
| 4809 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4810 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4811 | |
| 4812 | def pack(self): |
| 4813 | packed = [] |
| 4814 | packed.append(struct.pack("!B", self.version)) |
| 4815 | packed.append(struct.pack("!B", self.type)) |
| 4816 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4817 | packed.append(struct.pack("!L", self.xid)) |
| 4818 | packed.append(self.match.pack()) |
| 4819 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4820 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4821 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4822 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4823 | packed.append(struct.pack("!H", self.priority)) |
| 4824 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4825 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4826 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4827 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4828 | length = sum([len(x) for x in packed]) |
| 4829 | packed[2] = struct.pack("!H", length) |
| 4830 | return ''.join(packed) |
| 4831 | |
| 4832 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4833 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4834 | obj = flow_delete() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4835 | _version = reader.read("!B")[0] |
| 4836 | assert(_version == 1) |
| 4837 | _type = reader.read("!B")[0] |
| 4838 | assert(_type == 14) |
| 4839 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4840 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4841 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4842 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4843 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4844 | obj.cookie = reader.read("!Q")[0] |
| 4845 | __command = util.unpack_fm_cmd(reader) |
| 4846 | assert(__command == 3) |
| 4847 | obj.idle_timeout = reader.read("!H")[0] |
| 4848 | obj.hard_timeout = reader.read("!H")[0] |
| 4849 | obj.priority = reader.read("!H")[0] |
| 4850 | obj.buffer_id = reader.read("!L")[0] |
| 4851 | obj.out_port = util.unpack_port_no(reader) |
| 4852 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4853 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4854 | return obj |
| 4855 | |
| 4856 | def __eq__(self, other): |
| 4857 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4858 | if self.xid != other.xid: return False |
| 4859 | if self.match != other.match: return False |
| 4860 | if self.cookie != other.cookie: return False |
| 4861 | if self.idle_timeout != other.idle_timeout: return False |
| 4862 | if self.hard_timeout != other.hard_timeout: return False |
| 4863 | if self.priority != other.priority: return False |
| 4864 | if self.buffer_id != other.buffer_id: return False |
| 4865 | if self.out_port != other.out_port: return False |
| 4866 | if self.flags != other.flags: return False |
| 4867 | if self.actions != other.actions: return False |
| 4868 | return True |
| 4869 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4870 | def pretty_print(self, q): |
| 4871 | q.text("flow_delete {") |
| 4872 | with q.group(): |
| 4873 | with q.indent(2): |
| 4874 | q.breakable() |
| 4875 | q.text("xid = "); |
| 4876 | if self.xid != None: |
| 4877 | q.text("%#x" % self.xid) |
| 4878 | else: |
| 4879 | q.text('None') |
| 4880 | q.text(","); q.breakable() |
| 4881 | q.text("match = "); |
| 4882 | q.pp(self.match) |
| 4883 | q.text(","); q.breakable() |
| 4884 | q.text("cookie = "); |
| 4885 | q.text("%#x" % self.cookie) |
| 4886 | q.text(","); q.breakable() |
| 4887 | q.text("idle_timeout = "); |
| 4888 | q.text("%#x" % self.idle_timeout) |
| 4889 | q.text(","); q.breakable() |
| 4890 | q.text("hard_timeout = "); |
| 4891 | q.text("%#x" % self.hard_timeout) |
| 4892 | q.text(","); q.breakable() |
| 4893 | q.text("priority = "); |
| 4894 | q.text("%#x" % self.priority) |
| 4895 | q.text(","); q.breakable() |
| 4896 | q.text("buffer_id = "); |
| 4897 | q.text("%#x" % self.buffer_id) |
| 4898 | q.text(","); q.breakable() |
| 4899 | q.text("out_port = "); |
| 4900 | q.text(util.pretty_port(self.out_port)) |
| 4901 | q.text(","); q.breakable() |
| 4902 | q.text("flags = "); |
| 4903 | q.text("%#x" % self.flags) |
| 4904 | q.text(","); q.breakable() |
| 4905 | q.text("actions = "); |
| 4906 | q.pp(self.actions) |
| 4907 | q.breakable() |
| 4908 | q.text('}') |
| 4909 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4910 | flow_mod.subtypes[3] = flow_delete |
| 4911 | |
| 4912 | class flow_delete_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4913 | version = 1 |
| 4914 | type = 14 |
| 4915 | _command = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4916 | |
| 4917 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4918 | if xid != None: |
| 4919 | self.xid = xid |
| 4920 | else: |
| 4921 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4922 | if match != None: |
| 4923 | self.match = match |
| 4924 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4925 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4926 | if cookie != None: |
| 4927 | self.cookie = cookie |
| 4928 | else: |
| 4929 | self.cookie = 0 |
| 4930 | if idle_timeout != None: |
| 4931 | self.idle_timeout = idle_timeout |
| 4932 | else: |
| 4933 | self.idle_timeout = 0 |
| 4934 | if hard_timeout != None: |
| 4935 | self.hard_timeout = hard_timeout |
| 4936 | else: |
| 4937 | self.hard_timeout = 0 |
| 4938 | if priority != None: |
| 4939 | self.priority = priority |
| 4940 | else: |
| 4941 | self.priority = 0 |
| 4942 | if buffer_id != None: |
| 4943 | self.buffer_id = buffer_id |
| 4944 | else: |
| 4945 | self.buffer_id = 0 |
| 4946 | if out_port != None: |
| 4947 | self.out_port = out_port |
| 4948 | else: |
| 4949 | self.out_port = 0 |
| 4950 | if flags != None: |
| 4951 | self.flags = flags |
| 4952 | else: |
| 4953 | self.flags = 0 |
| 4954 | if actions != None: |
| 4955 | self.actions = actions |
| 4956 | else: |
| 4957 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4958 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4959 | |
| 4960 | def pack(self): |
| 4961 | packed = [] |
| 4962 | packed.append(struct.pack("!B", self.version)) |
| 4963 | packed.append(struct.pack("!B", self.type)) |
| 4964 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 4965 | packed.append(struct.pack("!L", self.xid)) |
| 4966 | packed.append(self.match.pack()) |
| 4967 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4968 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4969 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 4970 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 4971 | packed.append(struct.pack("!H", self.priority)) |
| 4972 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4973 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4974 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4975 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4976 | length = sum([len(x) for x in packed]) |
| 4977 | packed[2] = struct.pack("!H", length) |
| 4978 | return ''.join(packed) |
| 4979 | |
| 4980 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4981 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 4982 | obj = flow_delete_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4983 | _version = reader.read("!B")[0] |
| 4984 | assert(_version == 1) |
| 4985 | _type = reader.read("!B")[0] |
| 4986 | assert(_type == 14) |
| 4987 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 4988 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 4989 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4990 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 4991 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 4992 | obj.cookie = reader.read("!Q")[0] |
| 4993 | __command = util.unpack_fm_cmd(reader) |
| 4994 | assert(__command == 4) |
| 4995 | obj.idle_timeout = reader.read("!H")[0] |
| 4996 | obj.hard_timeout = reader.read("!H")[0] |
| 4997 | obj.priority = reader.read("!H")[0] |
| 4998 | obj.buffer_id = reader.read("!L")[0] |
| 4999 | obj.out_port = util.unpack_port_no(reader) |
| 5000 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5001 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5002 | return obj |
| 5003 | |
| 5004 | def __eq__(self, other): |
| 5005 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5006 | if self.xid != other.xid: return False |
| 5007 | if self.match != other.match: return False |
| 5008 | if self.cookie != other.cookie: return False |
| 5009 | if self.idle_timeout != other.idle_timeout: return False |
| 5010 | if self.hard_timeout != other.hard_timeout: return False |
| 5011 | if self.priority != other.priority: return False |
| 5012 | if self.buffer_id != other.buffer_id: return False |
| 5013 | if self.out_port != other.out_port: return False |
| 5014 | if self.flags != other.flags: return False |
| 5015 | if self.actions != other.actions: return False |
| 5016 | return True |
| 5017 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5018 | def pretty_print(self, q): |
| 5019 | q.text("flow_delete_strict {") |
| 5020 | with q.group(): |
| 5021 | with q.indent(2): |
| 5022 | q.breakable() |
| 5023 | q.text("xid = "); |
| 5024 | if self.xid != None: |
| 5025 | q.text("%#x" % self.xid) |
| 5026 | else: |
| 5027 | q.text('None') |
| 5028 | q.text(","); q.breakable() |
| 5029 | q.text("match = "); |
| 5030 | q.pp(self.match) |
| 5031 | q.text(","); q.breakable() |
| 5032 | q.text("cookie = "); |
| 5033 | q.text("%#x" % self.cookie) |
| 5034 | q.text(","); q.breakable() |
| 5035 | q.text("idle_timeout = "); |
| 5036 | q.text("%#x" % self.idle_timeout) |
| 5037 | q.text(","); q.breakable() |
| 5038 | q.text("hard_timeout = "); |
| 5039 | q.text("%#x" % self.hard_timeout) |
| 5040 | q.text(","); q.breakable() |
| 5041 | q.text("priority = "); |
| 5042 | q.text("%#x" % self.priority) |
| 5043 | q.text(","); q.breakable() |
| 5044 | q.text("buffer_id = "); |
| 5045 | q.text("%#x" % self.buffer_id) |
| 5046 | q.text(","); q.breakable() |
| 5047 | q.text("out_port = "); |
| 5048 | q.text(util.pretty_port(self.out_port)) |
| 5049 | q.text(","); q.breakable() |
| 5050 | q.text("flags = "); |
| 5051 | q.text("%#x" % self.flags) |
| 5052 | q.text(","); q.breakable() |
| 5053 | q.text("actions = "); |
| 5054 | q.pp(self.actions) |
| 5055 | q.breakable() |
| 5056 | q.text('}') |
| 5057 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5058 | flow_mod.subtypes[4] = flow_delete_strict |
| 5059 | |
| 5060 | class flow_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5061 | version = 1 |
| 5062 | type = 1 |
| 5063 | err_type = 3 |
| 5064 | |
| 5065 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5066 | if xid != None: |
| 5067 | self.xid = xid |
| 5068 | else: |
| 5069 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5070 | if code != None: |
| 5071 | self.code = code |
| 5072 | else: |
| 5073 | self.code = 0 |
| 5074 | if data != None: |
| 5075 | self.data = data |
| 5076 | else: |
| 5077 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5078 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5079 | |
| 5080 | def pack(self): |
| 5081 | packed = [] |
| 5082 | packed.append(struct.pack("!B", self.version)) |
| 5083 | packed.append(struct.pack("!B", self.type)) |
| 5084 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5085 | packed.append(struct.pack("!L", self.xid)) |
| 5086 | packed.append(struct.pack("!H", self.err_type)) |
| 5087 | packed.append(struct.pack("!H", self.code)) |
| 5088 | packed.append(self.data) |
| 5089 | length = sum([len(x) for x in packed]) |
| 5090 | packed[2] = struct.pack("!H", length) |
| 5091 | return ''.join(packed) |
| 5092 | |
| 5093 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5094 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5095 | obj = flow_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5096 | _version = reader.read("!B")[0] |
| 5097 | assert(_version == 1) |
| 5098 | _type = reader.read("!B")[0] |
| 5099 | assert(_type == 1) |
| 5100 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5101 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5102 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5103 | obj.xid = reader.read("!L")[0] |
| 5104 | _err_type = reader.read("!H")[0] |
| 5105 | assert(_err_type == 3) |
| 5106 | obj.code = reader.read("!H")[0] |
| 5107 | obj.data = str(reader.read_all()) |
| 5108 | return obj |
| 5109 | |
| 5110 | def __eq__(self, other): |
| 5111 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5112 | if self.xid != other.xid: return False |
| 5113 | if self.code != other.code: return False |
| 5114 | if self.data != other.data: return False |
| 5115 | return True |
| 5116 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5117 | def pretty_print(self, q): |
| 5118 | q.text("flow_mod_failed_error_msg {") |
| 5119 | with q.group(): |
| 5120 | with q.indent(2): |
| 5121 | q.breakable() |
| 5122 | q.text("xid = "); |
| 5123 | if self.xid != None: |
| 5124 | q.text("%#x" % self.xid) |
| 5125 | else: |
| 5126 | q.text('None') |
| 5127 | q.text(","); q.breakable() |
| 5128 | q.text("code = "); |
| 5129 | q.text("%#x" % self.code) |
| 5130 | q.text(","); q.breakable() |
| 5131 | q.text("data = "); |
| 5132 | q.pp(self.data) |
| 5133 | q.breakable() |
| 5134 | q.text('}') |
| 5135 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5136 | error_msg.subtypes[3] = flow_mod_failed_error_msg |
| 5137 | |
| 5138 | class flow_modify(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5139 | version = 1 |
| 5140 | type = 14 |
| 5141 | _command = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5142 | |
| 5143 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5144 | if xid != None: |
| 5145 | self.xid = xid |
| 5146 | else: |
| 5147 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5148 | if match != None: |
| 5149 | self.match = match |
| 5150 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5151 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5152 | if cookie != None: |
| 5153 | self.cookie = cookie |
| 5154 | else: |
| 5155 | self.cookie = 0 |
| 5156 | if idle_timeout != None: |
| 5157 | self.idle_timeout = idle_timeout |
| 5158 | else: |
| 5159 | self.idle_timeout = 0 |
| 5160 | if hard_timeout != None: |
| 5161 | self.hard_timeout = hard_timeout |
| 5162 | else: |
| 5163 | self.hard_timeout = 0 |
| 5164 | if priority != None: |
| 5165 | self.priority = priority |
| 5166 | else: |
| 5167 | self.priority = 0 |
| 5168 | if buffer_id != None: |
| 5169 | self.buffer_id = buffer_id |
| 5170 | else: |
| 5171 | self.buffer_id = 0 |
| 5172 | if out_port != None: |
| 5173 | self.out_port = out_port |
| 5174 | else: |
| 5175 | self.out_port = 0 |
| 5176 | if flags != None: |
| 5177 | self.flags = flags |
| 5178 | else: |
| 5179 | self.flags = 0 |
| 5180 | if actions != None: |
| 5181 | self.actions = actions |
| 5182 | else: |
| 5183 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5184 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5185 | |
| 5186 | def pack(self): |
| 5187 | packed = [] |
| 5188 | packed.append(struct.pack("!B", self.version)) |
| 5189 | packed.append(struct.pack("!B", self.type)) |
| 5190 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5191 | packed.append(struct.pack("!L", self.xid)) |
| 5192 | packed.append(self.match.pack()) |
| 5193 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5194 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5195 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5196 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5197 | packed.append(struct.pack("!H", self.priority)) |
| 5198 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5199 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5200 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5201 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5202 | length = sum([len(x) for x in packed]) |
| 5203 | packed[2] = struct.pack("!H", length) |
| 5204 | return ''.join(packed) |
| 5205 | |
| 5206 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5207 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5208 | obj = flow_modify() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5209 | _version = reader.read("!B")[0] |
| 5210 | assert(_version == 1) |
| 5211 | _type = reader.read("!B")[0] |
| 5212 | assert(_type == 14) |
| 5213 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5214 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5215 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5216 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5217 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5218 | obj.cookie = reader.read("!Q")[0] |
| 5219 | __command = util.unpack_fm_cmd(reader) |
| 5220 | assert(__command == 1) |
| 5221 | obj.idle_timeout = reader.read("!H")[0] |
| 5222 | obj.hard_timeout = reader.read("!H")[0] |
| 5223 | obj.priority = reader.read("!H")[0] |
| 5224 | obj.buffer_id = reader.read("!L")[0] |
| 5225 | obj.out_port = util.unpack_port_no(reader) |
| 5226 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5227 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5228 | return obj |
| 5229 | |
| 5230 | def __eq__(self, other): |
| 5231 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5232 | if self.xid != other.xid: return False |
| 5233 | if self.match != other.match: return False |
| 5234 | if self.cookie != other.cookie: return False |
| 5235 | if self.idle_timeout != other.idle_timeout: return False |
| 5236 | if self.hard_timeout != other.hard_timeout: return False |
| 5237 | if self.priority != other.priority: return False |
| 5238 | if self.buffer_id != other.buffer_id: return False |
| 5239 | if self.out_port != other.out_port: return False |
| 5240 | if self.flags != other.flags: return False |
| 5241 | if self.actions != other.actions: return False |
| 5242 | return True |
| 5243 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5244 | def pretty_print(self, q): |
| 5245 | q.text("flow_modify {") |
| 5246 | with q.group(): |
| 5247 | with q.indent(2): |
| 5248 | q.breakable() |
| 5249 | q.text("xid = "); |
| 5250 | if self.xid != None: |
| 5251 | q.text("%#x" % self.xid) |
| 5252 | else: |
| 5253 | q.text('None') |
| 5254 | q.text(","); q.breakable() |
| 5255 | q.text("match = "); |
| 5256 | q.pp(self.match) |
| 5257 | q.text(","); q.breakable() |
| 5258 | q.text("cookie = "); |
| 5259 | q.text("%#x" % self.cookie) |
| 5260 | q.text(","); q.breakable() |
| 5261 | q.text("idle_timeout = "); |
| 5262 | q.text("%#x" % self.idle_timeout) |
| 5263 | q.text(","); q.breakable() |
| 5264 | q.text("hard_timeout = "); |
| 5265 | q.text("%#x" % self.hard_timeout) |
| 5266 | q.text(","); q.breakable() |
| 5267 | q.text("priority = "); |
| 5268 | q.text("%#x" % self.priority) |
| 5269 | q.text(","); q.breakable() |
| 5270 | q.text("buffer_id = "); |
| 5271 | q.text("%#x" % self.buffer_id) |
| 5272 | q.text(","); q.breakable() |
| 5273 | q.text("out_port = "); |
| 5274 | q.text(util.pretty_port(self.out_port)) |
| 5275 | q.text(","); q.breakable() |
| 5276 | q.text("flags = "); |
| 5277 | q.text("%#x" % self.flags) |
| 5278 | q.text(","); q.breakable() |
| 5279 | q.text("actions = "); |
| 5280 | q.pp(self.actions) |
| 5281 | q.breakable() |
| 5282 | q.text('}') |
| 5283 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5284 | flow_mod.subtypes[1] = flow_modify |
| 5285 | |
| 5286 | class flow_modify_strict(flow_mod): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5287 | version = 1 |
| 5288 | type = 14 |
| 5289 | _command = 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5290 | |
| 5291 | def __init__(self, xid=None, match=None, cookie=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, flags=None, actions=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5292 | if xid != None: |
| 5293 | self.xid = xid |
| 5294 | else: |
| 5295 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5296 | if match != None: |
| 5297 | self.match = match |
| 5298 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5299 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5300 | if cookie != None: |
| 5301 | self.cookie = cookie |
| 5302 | else: |
| 5303 | self.cookie = 0 |
| 5304 | if idle_timeout != None: |
| 5305 | self.idle_timeout = idle_timeout |
| 5306 | else: |
| 5307 | self.idle_timeout = 0 |
| 5308 | if hard_timeout != None: |
| 5309 | self.hard_timeout = hard_timeout |
| 5310 | else: |
| 5311 | self.hard_timeout = 0 |
| 5312 | if priority != None: |
| 5313 | self.priority = priority |
| 5314 | else: |
| 5315 | self.priority = 0 |
| 5316 | if buffer_id != None: |
| 5317 | self.buffer_id = buffer_id |
| 5318 | else: |
| 5319 | self.buffer_id = 0 |
| 5320 | if out_port != None: |
| 5321 | self.out_port = out_port |
| 5322 | else: |
| 5323 | self.out_port = 0 |
| 5324 | if flags != None: |
| 5325 | self.flags = flags |
| 5326 | else: |
| 5327 | self.flags = 0 |
| 5328 | if actions != None: |
| 5329 | self.actions = actions |
| 5330 | else: |
| 5331 | self.actions = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5332 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5333 | |
| 5334 | def pack(self): |
| 5335 | packed = [] |
| 5336 | packed.append(struct.pack("!B", self.version)) |
| 5337 | packed.append(struct.pack("!B", self.type)) |
| 5338 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5339 | packed.append(struct.pack("!L", self.xid)) |
| 5340 | packed.append(self.match.pack()) |
| 5341 | packed.append(struct.pack("!Q", self.cookie)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5342 | packed.append(util.pack_fm_cmd(self._command)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5343 | packed.append(struct.pack("!H", self.idle_timeout)) |
| 5344 | packed.append(struct.pack("!H", self.hard_timeout)) |
| 5345 | packed.append(struct.pack("!H", self.priority)) |
| 5346 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5347 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5348 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5349 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5350 | length = sum([len(x) for x in packed]) |
| 5351 | packed[2] = struct.pack("!H", length) |
| 5352 | return ''.join(packed) |
| 5353 | |
| 5354 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5355 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5356 | obj = flow_modify_strict() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5357 | _version = reader.read("!B")[0] |
| 5358 | assert(_version == 1) |
| 5359 | _type = reader.read("!B")[0] |
| 5360 | assert(_type == 14) |
| 5361 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5362 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5363 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5364 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5365 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5366 | obj.cookie = reader.read("!Q")[0] |
| 5367 | __command = util.unpack_fm_cmd(reader) |
| 5368 | assert(__command == 2) |
| 5369 | obj.idle_timeout = reader.read("!H")[0] |
| 5370 | obj.hard_timeout = reader.read("!H")[0] |
| 5371 | obj.priority = reader.read("!H")[0] |
| 5372 | obj.buffer_id = reader.read("!L")[0] |
| 5373 | obj.out_port = util.unpack_port_no(reader) |
| 5374 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5375 | obj.actions = loxi.generic_util.unpack_list(reader, ofp.action.action.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5376 | return obj |
| 5377 | |
| 5378 | def __eq__(self, other): |
| 5379 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5380 | if self.xid != other.xid: return False |
| 5381 | if self.match != other.match: return False |
| 5382 | if self.cookie != other.cookie: return False |
| 5383 | if self.idle_timeout != other.idle_timeout: return False |
| 5384 | if self.hard_timeout != other.hard_timeout: return False |
| 5385 | if self.priority != other.priority: return False |
| 5386 | if self.buffer_id != other.buffer_id: return False |
| 5387 | if self.out_port != other.out_port: return False |
| 5388 | if self.flags != other.flags: return False |
| 5389 | if self.actions != other.actions: return False |
| 5390 | return True |
| 5391 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5392 | def pretty_print(self, q): |
| 5393 | q.text("flow_modify_strict {") |
| 5394 | with q.group(): |
| 5395 | with q.indent(2): |
| 5396 | q.breakable() |
| 5397 | q.text("xid = "); |
| 5398 | if self.xid != None: |
| 5399 | q.text("%#x" % self.xid) |
| 5400 | else: |
| 5401 | q.text('None') |
| 5402 | q.text(","); q.breakable() |
| 5403 | q.text("match = "); |
| 5404 | q.pp(self.match) |
| 5405 | q.text(","); q.breakable() |
| 5406 | q.text("cookie = "); |
| 5407 | q.text("%#x" % self.cookie) |
| 5408 | q.text(","); q.breakable() |
| 5409 | q.text("idle_timeout = "); |
| 5410 | q.text("%#x" % self.idle_timeout) |
| 5411 | q.text(","); q.breakable() |
| 5412 | q.text("hard_timeout = "); |
| 5413 | q.text("%#x" % self.hard_timeout) |
| 5414 | q.text(","); q.breakable() |
| 5415 | q.text("priority = "); |
| 5416 | q.text("%#x" % self.priority) |
| 5417 | q.text(","); q.breakable() |
| 5418 | q.text("buffer_id = "); |
| 5419 | q.text("%#x" % self.buffer_id) |
| 5420 | q.text(","); q.breakable() |
| 5421 | q.text("out_port = "); |
| 5422 | q.text(util.pretty_port(self.out_port)) |
| 5423 | q.text(","); q.breakable() |
| 5424 | q.text("flags = "); |
| 5425 | q.text("%#x" % self.flags) |
| 5426 | q.text(","); q.breakable() |
| 5427 | q.text("actions = "); |
| 5428 | q.pp(self.actions) |
| 5429 | q.breakable() |
| 5430 | q.text('}') |
| 5431 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5432 | flow_mod.subtypes[2] = flow_modify_strict |
| 5433 | |
| 5434 | class flow_removed(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5435 | version = 1 |
| 5436 | type = 11 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5437 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5438 | def __init__(self, xid=None, match=None, cookie=None, priority=None, reason=None, duration_sec=None, duration_nsec=None, idle_timeout=None, packet_count=None, byte_count=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5439 | if xid != None: |
| 5440 | self.xid = xid |
| 5441 | else: |
| 5442 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5443 | if match != None: |
| 5444 | self.match = match |
| 5445 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5446 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5447 | if cookie != None: |
| 5448 | self.cookie = cookie |
| 5449 | else: |
| 5450 | self.cookie = 0 |
| 5451 | if priority != None: |
| 5452 | self.priority = priority |
| 5453 | else: |
| 5454 | self.priority = 0 |
| 5455 | if reason != None: |
| 5456 | self.reason = reason |
| 5457 | else: |
| 5458 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5459 | if duration_sec != None: |
| 5460 | self.duration_sec = duration_sec |
| 5461 | else: |
| 5462 | self.duration_sec = 0 |
| 5463 | if duration_nsec != None: |
| 5464 | self.duration_nsec = duration_nsec |
| 5465 | else: |
| 5466 | self.duration_nsec = 0 |
| 5467 | if idle_timeout != None: |
| 5468 | self.idle_timeout = idle_timeout |
| 5469 | else: |
| 5470 | self.idle_timeout = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5471 | if packet_count != None: |
| 5472 | self.packet_count = packet_count |
| 5473 | else: |
| 5474 | self.packet_count = 0 |
| 5475 | if byte_count != None: |
| 5476 | self.byte_count = byte_count |
| 5477 | else: |
| 5478 | self.byte_count = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5479 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5480 | |
| 5481 | def pack(self): |
| 5482 | packed = [] |
| 5483 | packed.append(struct.pack("!B", self.version)) |
| 5484 | packed.append(struct.pack("!B", self.type)) |
| 5485 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5486 | packed.append(struct.pack("!L", self.xid)) |
| 5487 | packed.append(self.match.pack()) |
| 5488 | packed.append(struct.pack("!Q", self.cookie)) |
| 5489 | packed.append(struct.pack("!H", self.priority)) |
| 5490 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5491 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5492 | packed.append(struct.pack("!L", self.duration_sec)) |
| 5493 | packed.append(struct.pack("!L", self.duration_nsec)) |
| 5494 | packed.append(struct.pack("!H", self.idle_timeout)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5495 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5496 | packed.append(struct.pack("!Q", self.packet_count)) |
| 5497 | packed.append(struct.pack("!Q", self.byte_count)) |
| 5498 | length = sum([len(x) for x in packed]) |
| 5499 | packed[2] = struct.pack("!H", length) |
| 5500 | return ''.join(packed) |
| 5501 | |
| 5502 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5503 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5504 | obj = flow_removed() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5505 | _version = reader.read("!B")[0] |
| 5506 | assert(_version == 1) |
| 5507 | _type = reader.read("!B")[0] |
| 5508 | assert(_type == 11) |
| 5509 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5510 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5511 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5512 | obj.xid = reader.read("!L")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5513 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5514 | obj.cookie = reader.read("!Q")[0] |
| 5515 | obj.priority = reader.read("!H")[0] |
| 5516 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5517 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5518 | obj.duration_sec = reader.read("!L")[0] |
| 5519 | obj.duration_nsec = reader.read("!L")[0] |
| 5520 | obj.idle_timeout = reader.read("!H")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5521 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5522 | obj.packet_count = reader.read("!Q")[0] |
| 5523 | obj.byte_count = reader.read("!Q")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5524 | return obj |
| 5525 | |
| 5526 | def __eq__(self, other): |
| 5527 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5528 | if self.xid != other.xid: return False |
| 5529 | if self.match != other.match: return False |
| 5530 | if self.cookie != other.cookie: return False |
| 5531 | if self.priority != other.priority: return False |
| 5532 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5533 | if self.duration_sec != other.duration_sec: return False |
| 5534 | if self.duration_nsec != other.duration_nsec: return False |
| 5535 | if self.idle_timeout != other.idle_timeout: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5536 | if self.packet_count != other.packet_count: return False |
| 5537 | if self.byte_count != other.byte_count: return False |
| 5538 | return True |
| 5539 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5540 | def pretty_print(self, q): |
| 5541 | q.text("flow_removed {") |
| 5542 | with q.group(): |
| 5543 | with q.indent(2): |
| 5544 | q.breakable() |
| 5545 | q.text("xid = "); |
| 5546 | if self.xid != None: |
| 5547 | q.text("%#x" % self.xid) |
| 5548 | else: |
| 5549 | q.text('None') |
| 5550 | q.text(","); q.breakable() |
| 5551 | q.text("match = "); |
| 5552 | q.pp(self.match) |
| 5553 | q.text(","); q.breakable() |
| 5554 | q.text("cookie = "); |
| 5555 | q.text("%#x" % self.cookie) |
| 5556 | q.text(","); q.breakable() |
| 5557 | q.text("priority = "); |
| 5558 | q.text("%#x" % self.priority) |
| 5559 | q.text(","); q.breakable() |
| 5560 | q.text("reason = "); |
| 5561 | q.text("%#x" % self.reason) |
| 5562 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5563 | q.text("duration_sec = "); |
| 5564 | q.text("%#x" % self.duration_sec) |
| 5565 | q.text(","); q.breakable() |
| 5566 | q.text("duration_nsec = "); |
| 5567 | q.text("%#x" % self.duration_nsec) |
| 5568 | q.text(","); q.breakable() |
| 5569 | q.text("idle_timeout = "); |
| 5570 | q.text("%#x" % self.idle_timeout) |
| 5571 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5572 | q.text("packet_count = "); |
| 5573 | q.text("%#x" % self.packet_count) |
| 5574 | q.text(","); q.breakable() |
| 5575 | q.text("byte_count = "); |
| 5576 | q.text("%#x" % self.byte_count) |
| 5577 | q.breakable() |
| 5578 | q.text('}') |
| 5579 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5580 | message.subtypes[11] = flow_removed |
| 5581 | |
| 5582 | class flow_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5583 | version = 1 |
| 5584 | type = 17 |
| 5585 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5586 | |
| 5587 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5588 | if xid != None: |
| 5589 | self.xid = xid |
| 5590 | else: |
| 5591 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5592 | if flags != None: |
| 5593 | self.flags = flags |
| 5594 | else: |
| 5595 | self.flags = 0 |
| 5596 | if entries != None: |
| 5597 | self.entries = entries |
| 5598 | else: |
| 5599 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5600 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5601 | |
| 5602 | def pack(self): |
| 5603 | packed = [] |
| 5604 | packed.append(struct.pack("!B", self.version)) |
| 5605 | packed.append(struct.pack("!B", self.type)) |
| 5606 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5607 | packed.append(struct.pack("!L", self.xid)) |
| 5608 | packed.append(struct.pack("!H", self.stats_type)) |
| 5609 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5610 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5611 | length = sum([len(x) for x in packed]) |
| 5612 | packed[2] = struct.pack("!H", length) |
| 5613 | return ''.join(packed) |
| 5614 | |
| 5615 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5616 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5617 | obj = flow_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5618 | _version = reader.read("!B")[0] |
| 5619 | assert(_version == 1) |
| 5620 | _type = reader.read("!B")[0] |
| 5621 | assert(_type == 17) |
| 5622 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5623 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5624 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5625 | obj.xid = reader.read("!L")[0] |
| 5626 | _stats_type = reader.read("!H")[0] |
| 5627 | assert(_stats_type == 1) |
| 5628 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5629 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.flow_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5630 | return obj |
| 5631 | |
| 5632 | def __eq__(self, other): |
| 5633 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5634 | if self.xid != other.xid: return False |
| 5635 | if self.flags != other.flags: return False |
| 5636 | if self.entries != other.entries: return False |
| 5637 | return True |
| 5638 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5639 | def pretty_print(self, q): |
| 5640 | q.text("flow_stats_reply {") |
| 5641 | with q.group(): |
| 5642 | with q.indent(2): |
| 5643 | q.breakable() |
| 5644 | q.text("xid = "); |
| 5645 | if self.xid != None: |
| 5646 | q.text("%#x" % self.xid) |
| 5647 | else: |
| 5648 | q.text('None') |
| 5649 | q.text(","); q.breakable() |
| 5650 | q.text("flags = "); |
| 5651 | q.text("%#x" % self.flags) |
| 5652 | q.text(","); q.breakable() |
| 5653 | q.text("entries = "); |
| 5654 | q.pp(self.entries) |
| 5655 | q.breakable() |
| 5656 | q.text('}') |
| 5657 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5658 | stats_reply.subtypes[1] = flow_stats_reply |
| 5659 | |
| 5660 | class flow_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5661 | version = 1 |
| 5662 | type = 16 |
| 5663 | stats_type = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5664 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5665 | def __init__(self, xid=None, flags=None, match=None, table_id=None, out_port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5666 | if xid != None: |
| 5667 | self.xid = xid |
| 5668 | else: |
| 5669 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5670 | if flags != None: |
| 5671 | self.flags = flags |
| 5672 | else: |
| 5673 | self.flags = 0 |
| 5674 | if match != None: |
| 5675 | self.match = match |
| 5676 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5677 | self.match = ofp.match() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5678 | if table_id != None: |
| 5679 | self.table_id = table_id |
| 5680 | else: |
| 5681 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5682 | if out_port != None: |
| 5683 | self.out_port = out_port |
| 5684 | else: |
| 5685 | self.out_port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5686 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5687 | |
| 5688 | def pack(self): |
| 5689 | packed = [] |
| 5690 | packed.append(struct.pack("!B", self.version)) |
| 5691 | packed.append(struct.pack("!B", self.type)) |
| 5692 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5693 | packed.append(struct.pack("!L", self.xid)) |
| 5694 | packed.append(struct.pack("!H", self.stats_type)) |
| 5695 | packed.append(struct.pack("!H", self.flags)) |
| 5696 | packed.append(self.match.pack()) |
| 5697 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5698 | packed.append('\x00' * 1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5699 | packed.append(util.pack_port_no(self.out_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5700 | length = sum([len(x) for x in packed]) |
| 5701 | packed[2] = struct.pack("!H", length) |
| 5702 | return ''.join(packed) |
| 5703 | |
| 5704 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5705 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5706 | obj = flow_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5707 | _version = reader.read("!B")[0] |
| 5708 | assert(_version == 1) |
| 5709 | _type = reader.read("!B")[0] |
| 5710 | assert(_type == 16) |
| 5711 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5712 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5713 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5714 | obj.xid = reader.read("!L")[0] |
| 5715 | _stats_type = reader.read("!H")[0] |
| 5716 | assert(_stats_type == 1) |
| 5717 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 5718 | obj.match = ofp.match.unpack(reader) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5719 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 5720 | reader.skip(1) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5721 | obj.out_port = util.unpack_port_no(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5722 | return obj |
| 5723 | |
| 5724 | def __eq__(self, other): |
| 5725 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5726 | if self.xid != other.xid: return False |
| 5727 | if self.flags != other.flags: return False |
| 5728 | if self.match != other.match: return False |
| 5729 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5730 | if self.out_port != other.out_port: return False |
| 5731 | return True |
| 5732 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5733 | def pretty_print(self, q): |
| 5734 | q.text("flow_stats_request {") |
| 5735 | with q.group(): |
| 5736 | with q.indent(2): |
| 5737 | q.breakable() |
| 5738 | q.text("xid = "); |
| 5739 | if self.xid != None: |
| 5740 | q.text("%#x" % self.xid) |
| 5741 | else: |
| 5742 | q.text('None') |
| 5743 | q.text(","); q.breakable() |
| 5744 | q.text("flags = "); |
| 5745 | q.text("%#x" % self.flags) |
| 5746 | q.text(","); q.breakable() |
| 5747 | q.text("match = "); |
| 5748 | q.pp(self.match) |
| 5749 | q.text(","); q.breakable() |
| 5750 | q.text("table_id = "); |
| 5751 | q.text("%#x" % self.table_id) |
| 5752 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5753 | q.text("out_port = "); |
| 5754 | q.text(util.pretty_port(self.out_port)) |
| 5755 | q.breakable() |
| 5756 | q.text('}') |
| 5757 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5758 | stats_request.subtypes[1] = flow_stats_request |
| 5759 | |
| 5760 | class get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5761 | version = 1 |
| 5762 | type = 8 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5763 | |
| 5764 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5765 | if xid != None: |
| 5766 | self.xid = xid |
| 5767 | else: |
| 5768 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5769 | if flags != None: |
| 5770 | self.flags = flags |
| 5771 | else: |
| 5772 | self.flags = 0 |
| 5773 | if miss_send_len != None: |
| 5774 | self.miss_send_len = miss_send_len |
| 5775 | else: |
| 5776 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5777 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5778 | |
| 5779 | def pack(self): |
| 5780 | packed = [] |
| 5781 | packed.append(struct.pack("!B", self.version)) |
| 5782 | packed.append(struct.pack("!B", self.type)) |
| 5783 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5784 | packed.append(struct.pack("!L", self.xid)) |
| 5785 | packed.append(struct.pack("!H", self.flags)) |
| 5786 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 5787 | length = sum([len(x) for x in packed]) |
| 5788 | packed[2] = struct.pack("!H", length) |
| 5789 | return ''.join(packed) |
| 5790 | |
| 5791 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5792 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5793 | obj = get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5794 | _version = reader.read("!B")[0] |
| 5795 | assert(_version == 1) |
| 5796 | _type = reader.read("!B")[0] |
| 5797 | assert(_type == 8) |
| 5798 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5799 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5800 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5801 | obj.xid = reader.read("!L")[0] |
| 5802 | obj.flags = reader.read("!H")[0] |
| 5803 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5804 | return obj |
| 5805 | |
| 5806 | def __eq__(self, other): |
| 5807 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5808 | if self.xid != other.xid: return False |
| 5809 | if self.flags != other.flags: return False |
| 5810 | if self.miss_send_len != other.miss_send_len: return False |
| 5811 | return True |
| 5812 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5813 | def pretty_print(self, q): |
| 5814 | q.text("get_config_reply {") |
| 5815 | with q.group(): |
| 5816 | with q.indent(2): |
| 5817 | q.breakable() |
| 5818 | q.text("xid = "); |
| 5819 | if self.xid != None: |
| 5820 | q.text("%#x" % self.xid) |
| 5821 | else: |
| 5822 | q.text('None') |
| 5823 | q.text(","); q.breakable() |
| 5824 | q.text("flags = "); |
| 5825 | q.text("%#x" % self.flags) |
| 5826 | q.text(","); q.breakable() |
| 5827 | q.text("miss_send_len = "); |
| 5828 | q.text("%#x" % self.miss_send_len) |
| 5829 | q.breakable() |
| 5830 | q.text('}') |
| 5831 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5832 | message.subtypes[8] = get_config_reply |
| 5833 | |
| 5834 | class get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5835 | version = 1 |
| 5836 | type = 7 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5837 | |
| 5838 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5839 | if xid != None: |
| 5840 | self.xid = xid |
| 5841 | else: |
| 5842 | self.xid = None |
| 5843 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5844 | |
| 5845 | def pack(self): |
| 5846 | packed = [] |
| 5847 | packed.append(struct.pack("!B", self.version)) |
| 5848 | packed.append(struct.pack("!B", self.type)) |
| 5849 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5850 | packed.append(struct.pack("!L", self.xid)) |
| 5851 | length = sum([len(x) for x in packed]) |
| 5852 | packed[2] = struct.pack("!H", length) |
| 5853 | return ''.join(packed) |
| 5854 | |
| 5855 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5856 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5857 | obj = get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5858 | _version = reader.read("!B")[0] |
| 5859 | assert(_version == 1) |
| 5860 | _type = reader.read("!B")[0] |
| 5861 | assert(_type == 7) |
| 5862 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5863 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5864 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5865 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5866 | return obj |
| 5867 | |
| 5868 | def __eq__(self, other): |
| 5869 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5870 | if self.xid != other.xid: return False |
| 5871 | return True |
| 5872 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5873 | def pretty_print(self, q): |
| 5874 | q.text("get_config_request {") |
| 5875 | with q.group(): |
| 5876 | with q.indent(2): |
| 5877 | q.breakable() |
| 5878 | q.text("xid = "); |
| 5879 | if self.xid != None: |
| 5880 | q.text("%#x" % self.xid) |
| 5881 | else: |
| 5882 | q.text('None') |
| 5883 | q.breakable() |
| 5884 | q.text('}') |
| 5885 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5886 | message.subtypes[7] = get_config_request |
| 5887 | |
| 5888 | class hello(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5889 | version = 1 |
| 5890 | type = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5891 | |
| 5892 | def __init__(self, xid=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5893 | if xid != None: |
| 5894 | self.xid = xid |
| 5895 | else: |
| 5896 | self.xid = None |
| 5897 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5898 | |
| 5899 | def pack(self): |
| 5900 | packed = [] |
| 5901 | packed.append(struct.pack("!B", self.version)) |
| 5902 | packed.append(struct.pack("!B", self.type)) |
| 5903 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5904 | packed.append(struct.pack("!L", self.xid)) |
| 5905 | length = sum([len(x) for x in packed]) |
| 5906 | packed[2] = struct.pack("!H", length) |
| 5907 | return ''.join(packed) |
| 5908 | |
| 5909 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5910 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5911 | obj = hello() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5912 | _version = reader.read("!B")[0] |
| 5913 | assert(_version == 1) |
| 5914 | _type = reader.read("!B")[0] |
| 5915 | assert(_type == 0) |
| 5916 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5917 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5918 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 5919 | obj.xid = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5920 | return obj |
| 5921 | |
| 5922 | def __eq__(self, other): |
| 5923 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5924 | if self.xid != other.xid: return False |
| 5925 | return True |
| 5926 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 5927 | def pretty_print(self, q): |
| 5928 | q.text("hello {") |
| 5929 | with q.group(): |
| 5930 | with q.indent(2): |
| 5931 | q.breakable() |
| 5932 | q.text("xid = "); |
| 5933 | if self.xid != None: |
| 5934 | q.text("%#x" % self.xid) |
| 5935 | else: |
| 5936 | q.text('None') |
| 5937 | q.breakable() |
| 5938 | q.text('}') |
| 5939 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5940 | message.subtypes[0] = hello |
| 5941 | |
| 5942 | class hello_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5943 | version = 1 |
| 5944 | type = 1 |
| 5945 | err_type = 0 |
| 5946 | |
| 5947 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5948 | if xid != None: |
| 5949 | self.xid = xid |
| 5950 | else: |
| 5951 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5952 | if code != None: |
| 5953 | self.code = code |
| 5954 | else: |
| 5955 | self.code = 0 |
| 5956 | if data != None: |
| 5957 | self.data = data |
| 5958 | else: |
| 5959 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5960 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5961 | |
| 5962 | def pack(self): |
| 5963 | packed = [] |
| 5964 | packed.append(struct.pack("!B", self.version)) |
| 5965 | packed.append(struct.pack("!B", self.type)) |
| 5966 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 5967 | packed.append(struct.pack("!L", self.xid)) |
| 5968 | packed.append(struct.pack("!H", self.err_type)) |
| 5969 | packed.append(struct.pack("!H", self.code)) |
| 5970 | packed.append(self.data) |
| 5971 | length = sum([len(x) for x in packed]) |
| 5972 | packed[2] = struct.pack("!H", length) |
| 5973 | return ''.join(packed) |
| 5974 | |
| 5975 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5976 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5977 | obj = hello_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5978 | _version = reader.read("!B")[0] |
| 5979 | assert(_version == 1) |
| 5980 | _type = reader.read("!B")[0] |
| 5981 | assert(_type == 1) |
| 5982 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 5983 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 5984 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5985 | obj.xid = reader.read("!L")[0] |
| 5986 | _err_type = reader.read("!H")[0] |
| 5987 | assert(_err_type == 0) |
| 5988 | obj.code = reader.read("!H")[0] |
| 5989 | obj.data = str(reader.read_all()) |
| 5990 | return obj |
| 5991 | |
| 5992 | def __eq__(self, other): |
| 5993 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5994 | if self.xid != other.xid: return False |
| 5995 | if self.code != other.code: return False |
| 5996 | if self.data != other.data: return False |
| 5997 | return True |
| 5998 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 5999 | def pretty_print(self, q): |
| 6000 | q.text("hello_failed_error_msg {") |
| 6001 | with q.group(): |
| 6002 | with q.indent(2): |
| 6003 | q.breakable() |
| 6004 | q.text("xid = "); |
| 6005 | if self.xid != None: |
| 6006 | q.text("%#x" % self.xid) |
| 6007 | else: |
| 6008 | q.text('None') |
| 6009 | q.text(","); q.breakable() |
| 6010 | q.text("code = "); |
| 6011 | q.text("%#x" % self.code) |
| 6012 | q.text(","); q.breakable() |
| 6013 | q.text("data = "); |
| 6014 | q.pp(self.data) |
| 6015 | q.breakable() |
| 6016 | q.text('}') |
| 6017 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6018 | error_msg.subtypes[0] = hello_failed_error_msg |
| 6019 | |
| 6020 | class nicira_header(experimenter): |
| 6021 | subtypes = {} |
| 6022 | |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6023 | version = 1 |
| 6024 | type = 4 |
| 6025 | experimenter = 8992 |
| 6026 | |
| 6027 | def __init__(self, xid=None, subtype=None): |
| 6028 | if xid != None: |
| 6029 | self.xid = xid |
| 6030 | else: |
| 6031 | self.xid = None |
| 6032 | if subtype != None: |
| 6033 | self.subtype = subtype |
| 6034 | else: |
| 6035 | self.subtype = 0 |
| 6036 | return |
| 6037 | |
| 6038 | def pack(self): |
| 6039 | packed = [] |
| 6040 | packed.append(struct.pack("!B", self.version)) |
| 6041 | packed.append(struct.pack("!B", self.type)) |
| 6042 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6043 | packed.append(struct.pack("!L", self.xid)) |
| 6044 | packed.append(struct.pack("!L", self.experimenter)) |
| 6045 | packed.append(struct.pack("!L", self.subtype)) |
| 6046 | length = sum([len(x) for x in packed]) |
| 6047 | packed[2] = struct.pack("!H", length) |
| 6048 | return ''.join(packed) |
| 6049 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6050 | @staticmethod |
| 6051 | def unpack(reader): |
| 6052 | subtype, = reader.peek('!L', 12) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6053 | subclass = nicira_header.subtypes.get(subtype) |
| 6054 | if subclass: |
| 6055 | return subclass.unpack(reader) |
| 6056 | |
| 6057 | obj = nicira_header() |
| 6058 | _version = reader.read("!B")[0] |
| 6059 | assert(_version == 1) |
| 6060 | _type = reader.read("!B")[0] |
| 6061 | assert(_type == 4) |
| 6062 | _length = reader.read("!H")[0] |
| 6063 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6064 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 95f7fc9 | 2014-01-27 17:08:16 -0800 | [diff] [blame] | 6065 | obj.xid = reader.read("!L")[0] |
| 6066 | _experimenter = reader.read("!L")[0] |
| 6067 | assert(_experimenter == 8992) |
| 6068 | obj.subtype = reader.read("!L")[0] |
| 6069 | return obj |
| 6070 | |
| 6071 | def __eq__(self, other): |
| 6072 | if type(self) != type(other): return False |
| 6073 | if self.xid != other.xid: return False |
| 6074 | if self.subtype != other.subtype: return False |
| 6075 | return True |
| 6076 | |
| 6077 | def pretty_print(self, q): |
| 6078 | q.text("nicira_header {") |
| 6079 | with q.group(): |
| 6080 | with q.indent(2): |
| 6081 | q.breakable() |
| 6082 | q.text("xid = "); |
| 6083 | if self.xid != None: |
| 6084 | q.text("%#x" % self.xid) |
| 6085 | else: |
| 6086 | q.text('None') |
| 6087 | q.breakable() |
| 6088 | q.text('}') |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6089 | |
| 6090 | experimenter.subtypes[8992] = nicira_header |
| 6091 | |
| 6092 | class nicira_controller_role_reply(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6093 | version = 1 |
| 6094 | type = 4 |
| 6095 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6096 | subtype = 11 |
| 6097 | |
| 6098 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6099 | if xid != None: |
| 6100 | self.xid = xid |
| 6101 | else: |
| 6102 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6103 | if role != None: |
| 6104 | self.role = role |
| 6105 | else: |
| 6106 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6107 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6108 | |
| 6109 | def pack(self): |
| 6110 | packed = [] |
| 6111 | packed.append(struct.pack("!B", self.version)) |
| 6112 | packed.append(struct.pack("!B", self.type)) |
| 6113 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6114 | packed.append(struct.pack("!L", self.xid)) |
| 6115 | packed.append(struct.pack("!L", self.experimenter)) |
| 6116 | packed.append(struct.pack("!L", self.subtype)) |
| 6117 | packed.append(struct.pack("!L", self.role)) |
| 6118 | length = sum([len(x) for x in packed]) |
| 6119 | packed[2] = struct.pack("!H", length) |
| 6120 | return ''.join(packed) |
| 6121 | |
| 6122 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6123 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6124 | obj = nicira_controller_role_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6125 | _version = reader.read("!B")[0] |
| 6126 | assert(_version == 1) |
| 6127 | _type = reader.read("!B")[0] |
| 6128 | assert(_type == 4) |
| 6129 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6130 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6131 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6132 | obj.xid = reader.read("!L")[0] |
| 6133 | _experimenter = reader.read("!L")[0] |
| 6134 | assert(_experimenter == 8992) |
| 6135 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6136 | assert(_subtype == 11) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6137 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6138 | return obj |
| 6139 | |
| 6140 | def __eq__(self, other): |
| 6141 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6142 | if self.xid != other.xid: return False |
| 6143 | if self.role != other.role: return False |
| 6144 | return True |
| 6145 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6146 | def pretty_print(self, q): |
| 6147 | q.text("nicira_controller_role_reply {") |
| 6148 | with q.group(): |
| 6149 | with q.indent(2): |
| 6150 | q.breakable() |
| 6151 | q.text("xid = "); |
| 6152 | if self.xid != None: |
| 6153 | q.text("%#x" % self.xid) |
| 6154 | else: |
| 6155 | q.text('None') |
| 6156 | q.text(","); q.breakable() |
| 6157 | q.text("role = "); |
| 6158 | q.text("%#x" % self.role) |
| 6159 | q.breakable() |
| 6160 | q.text('}') |
| 6161 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6162 | nicira_header.subtypes[11] = nicira_controller_role_reply |
| 6163 | |
| 6164 | class nicira_controller_role_request(nicira_header): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6165 | version = 1 |
| 6166 | type = 4 |
| 6167 | experimenter = 8992 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6168 | subtype = 10 |
| 6169 | |
| 6170 | def __init__(self, xid=None, role=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6171 | if xid != None: |
| 6172 | self.xid = xid |
| 6173 | else: |
| 6174 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6175 | if role != None: |
| 6176 | self.role = role |
| 6177 | else: |
| 6178 | self.role = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6179 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6180 | |
| 6181 | def pack(self): |
| 6182 | packed = [] |
| 6183 | packed.append(struct.pack("!B", self.version)) |
| 6184 | packed.append(struct.pack("!B", self.type)) |
| 6185 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6186 | packed.append(struct.pack("!L", self.xid)) |
| 6187 | packed.append(struct.pack("!L", self.experimenter)) |
| 6188 | packed.append(struct.pack("!L", self.subtype)) |
| 6189 | packed.append(struct.pack("!L", self.role)) |
| 6190 | length = sum([len(x) for x in packed]) |
| 6191 | packed[2] = struct.pack("!H", length) |
| 6192 | return ''.join(packed) |
| 6193 | |
| 6194 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6195 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6196 | obj = nicira_controller_role_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6197 | _version = reader.read("!B")[0] |
| 6198 | assert(_version == 1) |
| 6199 | _type = reader.read("!B")[0] |
| 6200 | assert(_type == 4) |
| 6201 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6202 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6203 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6204 | obj.xid = reader.read("!L")[0] |
| 6205 | _experimenter = reader.read("!L")[0] |
| 6206 | assert(_experimenter == 8992) |
| 6207 | _subtype = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6208 | assert(_subtype == 10) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6209 | obj.role = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6210 | return obj |
| 6211 | |
| 6212 | def __eq__(self, other): |
| 6213 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6214 | if self.xid != other.xid: return False |
| 6215 | if self.role != other.role: return False |
| 6216 | return True |
| 6217 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6218 | def pretty_print(self, q): |
| 6219 | q.text("nicira_controller_role_request {") |
| 6220 | with q.group(): |
| 6221 | with q.indent(2): |
| 6222 | q.breakable() |
| 6223 | q.text("xid = "); |
| 6224 | if self.xid != None: |
| 6225 | q.text("%#x" % self.xid) |
| 6226 | else: |
| 6227 | q.text('None') |
| 6228 | q.text(","); q.breakable() |
| 6229 | q.text("role = "); |
| 6230 | q.text("%#x" % self.role) |
| 6231 | q.breakable() |
| 6232 | q.text('}') |
| 6233 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6234 | nicira_header.subtypes[10] = nicira_controller_role_request |
| 6235 | |
| 6236 | class packet_in(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6237 | version = 1 |
| 6238 | type = 10 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6239 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6240 | def __init__(self, xid=None, buffer_id=None, total_len=None, in_port=None, reason=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6241 | if xid != None: |
| 6242 | self.xid = xid |
| 6243 | else: |
| 6244 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6245 | if buffer_id != None: |
| 6246 | self.buffer_id = buffer_id |
| 6247 | else: |
| 6248 | self.buffer_id = 0 |
| 6249 | if total_len != None: |
| 6250 | self.total_len = total_len |
| 6251 | else: |
| 6252 | self.total_len = 0 |
| 6253 | if in_port != None: |
| 6254 | self.in_port = in_port |
| 6255 | else: |
| 6256 | self.in_port = 0 |
| 6257 | if reason != None: |
| 6258 | self.reason = reason |
| 6259 | else: |
| 6260 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6261 | if data != None: |
| 6262 | self.data = data |
| 6263 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6264 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6265 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6266 | |
| 6267 | def pack(self): |
| 6268 | packed = [] |
| 6269 | packed.append(struct.pack("!B", self.version)) |
| 6270 | packed.append(struct.pack("!B", self.type)) |
| 6271 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6272 | packed.append(struct.pack("!L", self.xid)) |
| 6273 | packed.append(struct.pack("!L", self.buffer_id)) |
| 6274 | packed.append(struct.pack("!H", self.total_len)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6275 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6276 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6277 | packed.append('\x00' * 1) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6278 | packed.append(self.data) |
| 6279 | length = sum([len(x) for x in packed]) |
| 6280 | packed[2] = struct.pack("!H", length) |
| 6281 | return ''.join(packed) |
| 6282 | |
| 6283 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6284 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6285 | obj = packet_in() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6286 | _version = reader.read("!B")[0] |
| 6287 | assert(_version == 1) |
| 6288 | _type = reader.read("!B")[0] |
| 6289 | assert(_type == 10) |
| 6290 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6291 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6292 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6293 | obj.xid = reader.read("!L")[0] |
| 6294 | obj.buffer_id = reader.read("!L")[0] |
| 6295 | obj.total_len = reader.read("!H")[0] |
| 6296 | obj.in_port = util.unpack_port_no(reader) |
| 6297 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6298 | reader.skip(1) |
| 6299 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6300 | return obj |
| 6301 | |
| 6302 | def __eq__(self, other): |
| 6303 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6304 | if self.xid != other.xid: return False |
| 6305 | if self.buffer_id != other.buffer_id: return False |
| 6306 | if self.total_len != other.total_len: return False |
| 6307 | if self.in_port != other.in_port: return False |
| 6308 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6309 | if self.data != other.data: return False |
| 6310 | return True |
| 6311 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6312 | def pretty_print(self, q): |
| 6313 | q.text("packet_in {") |
| 6314 | with q.group(): |
| 6315 | with q.indent(2): |
| 6316 | q.breakable() |
| 6317 | q.text("xid = "); |
| 6318 | if self.xid != None: |
| 6319 | q.text("%#x" % self.xid) |
| 6320 | else: |
| 6321 | q.text('None') |
| 6322 | q.text(","); q.breakable() |
| 6323 | q.text("buffer_id = "); |
| 6324 | q.text("%#x" % self.buffer_id) |
| 6325 | q.text(","); q.breakable() |
| 6326 | q.text("total_len = "); |
| 6327 | q.text("%#x" % self.total_len) |
| 6328 | q.text(","); q.breakable() |
| 6329 | q.text("in_port = "); |
| 6330 | q.text(util.pretty_port(self.in_port)) |
| 6331 | q.text(","); q.breakable() |
| 6332 | q.text("reason = "); |
| 6333 | q.text("%#x" % self.reason) |
| 6334 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6335 | q.text("data = "); |
| 6336 | q.pp(self.data) |
| 6337 | q.breakable() |
| 6338 | q.text('}') |
| 6339 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6340 | message.subtypes[10] = packet_in |
| 6341 | |
| 6342 | class packet_out(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6343 | version = 1 |
| 6344 | type = 13 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6345 | |
| 6346 | 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] | 6347 | if xid != None: |
| 6348 | self.xid = xid |
| 6349 | else: |
| 6350 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6351 | if buffer_id != None: |
| 6352 | self.buffer_id = buffer_id |
| 6353 | else: |
Rich Lane | ff637c9 | 2013-04-04 13:57:09 -0700 | [diff] [blame] | 6354 | self.buffer_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6355 | if in_port != None: |
| 6356 | self.in_port = in_port |
| 6357 | else: |
| 6358 | self.in_port = 0 |
| 6359 | if actions != None: |
| 6360 | self.actions = actions |
| 6361 | else: |
| 6362 | self.actions = [] |
| 6363 | if data != None: |
| 6364 | self.data = data |
| 6365 | else: |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6366 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6367 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6368 | |
| 6369 | def pack(self): |
| 6370 | packed = [] |
| 6371 | packed.append(struct.pack("!B", self.version)) |
| 6372 | packed.append(struct.pack("!B", self.type)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6373 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6374 | packed.append(struct.pack("!L", self.xid)) |
| 6375 | packed.append(struct.pack("!L", self.buffer_id)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6376 | packed.append(util.pack_port_no(self.in_port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6377 | packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6378 | packed.append(loxi.generic_util.pack_list(self.actions)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6379 | packed[6] = struct.pack("!H", len(packed[-1])) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6380 | packed.append(self.data) |
| 6381 | length = sum([len(x) for x in packed]) |
| 6382 | packed[2] = struct.pack("!H", length) |
| 6383 | return ''.join(packed) |
| 6384 | |
| 6385 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6386 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6387 | obj = packet_out() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6388 | _version = reader.read("!B")[0] |
| 6389 | assert(_version == 1) |
| 6390 | _type = reader.read("!B")[0] |
| 6391 | assert(_type == 13) |
| 6392 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6393 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6394 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6395 | obj.xid = reader.read("!L")[0] |
| 6396 | obj.buffer_id = reader.read("!L")[0] |
| 6397 | obj.in_port = util.unpack_port_no(reader) |
| 6398 | _actions_len = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6399 | 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] | 6400 | obj.data = str(reader.read_all()) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6401 | return obj |
| 6402 | |
| 6403 | def __eq__(self, other): |
| 6404 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6405 | if self.xid != other.xid: return False |
| 6406 | if self.buffer_id != other.buffer_id: return False |
| 6407 | if self.in_port != other.in_port: return False |
| 6408 | if self.actions != other.actions: return False |
| 6409 | if self.data != other.data: return False |
| 6410 | return True |
| 6411 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6412 | def pretty_print(self, q): |
| 6413 | q.text("packet_out {") |
| 6414 | with q.group(): |
| 6415 | with q.indent(2): |
| 6416 | q.breakable() |
| 6417 | q.text("xid = "); |
| 6418 | if self.xid != None: |
| 6419 | q.text("%#x" % self.xid) |
| 6420 | else: |
| 6421 | q.text('None') |
| 6422 | q.text(","); q.breakable() |
| 6423 | q.text("buffer_id = "); |
| 6424 | q.text("%#x" % self.buffer_id) |
| 6425 | q.text(","); q.breakable() |
| 6426 | q.text("in_port = "); |
| 6427 | q.text(util.pretty_port(self.in_port)) |
| 6428 | q.text(","); q.breakable() |
| 6429 | q.text("actions = "); |
| 6430 | q.pp(self.actions) |
| 6431 | q.text(","); q.breakable() |
| 6432 | q.text("data = "); |
| 6433 | q.pp(self.data) |
| 6434 | q.breakable() |
| 6435 | q.text('}') |
| 6436 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6437 | message.subtypes[13] = packet_out |
| 6438 | |
| 6439 | class port_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6440 | version = 1 |
| 6441 | type = 15 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6442 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6443 | 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] | 6444 | if xid != None: |
| 6445 | self.xid = xid |
| 6446 | else: |
| 6447 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6448 | if port_no != None: |
| 6449 | self.port_no = port_no |
| 6450 | else: |
| 6451 | self.port_no = 0 |
| 6452 | if hw_addr != None: |
| 6453 | self.hw_addr = hw_addr |
| 6454 | else: |
| 6455 | self.hw_addr = [0,0,0,0,0,0] |
| 6456 | if config != None: |
| 6457 | self.config = config |
| 6458 | else: |
| 6459 | self.config = 0 |
| 6460 | if mask != None: |
| 6461 | self.mask = mask |
| 6462 | else: |
| 6463 | self.mask = 0 |
| 6464 | if advertise != None: |
| 6465 | self.advertise = advertise |
| 6466 | else: |
| 6467 | self.advertise = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6468 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6469 | |
| 6470 | def pack(self): |
| 6471 | packed = [] |
| 6472 | packed.append(struct.pack("!B", self.version)) |
| 6473 | packed.append(struct.pack("!B", self.type)) |
| 6474 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6475 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6476 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6477 | packed.append(struct.pack("!6B", *self.hw_addr)) |
| 6478 | packed.append(struct.pack("!L", self.config)) |
| 6479 | packed.append(struct.pack("!L", self.mask)) |
| 6480 | packed.append(struct.pack("!L", self.advertise)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6481 | packed.append('\x00' * 4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6482 | length = sum([len(x) for x in packed]) |
| 6483 | packed[2] = struct.pack("!H", length) |
| 6484 | return ''.join(packed) |
| 6485 | |
| 6486 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6487 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6488 | obj = port_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6489 | _version = reader.read("!B")[0] |
| 6490 | assert(_version == 1) |
| 6491 | _type = reader.read("!B")[0] |
| 6492 | assert(_type == 15) |
| 6493 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6494 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6495 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6496 | obj.xid = reader.read("!L")[0] |
| 6497 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6498 | obj.hw_addr = list(reader.read('!6B')) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6499 | obj.config = reader.read("!L")[0] |
| 6500 | obj.mask = reader.read("!L")[0] |
| 6501 | obj.advertise = reader.read("!L")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6502 | reader.skip(4) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6503 | return obj |
| 6504 | |
| 6505 | def __eq__(self, other): |
| 6506 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6507 | if self.xid != other.xid: return False |
| 6508 | if self.port_no != other.port_no: return False |
| 6509 | if self.hw_addr != other.hw_addr: return False |
| 6510 | if self.config != other.config: return False |
| 6511 | if self.mask != other.mask: return False |
| 6512 | if self.advertise != other.advertise: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6513 | return True |
| 6514 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6515 | def pretty_print(self, q): |
| 6516 | q.text("port_mod {") |
| 6517 | with q.group(): |
| 6518 | with q.indent(2): |
| 6519 | q.breakable() |
| 6520 | q.text("xid = "); |
| 6521 | if self.xid != None: |
| 6522 | q.text("%#x" % self.xid) |
| 6523 | else: |
| 6524 | q.text('None') |
| 6525 | q.text(","); q.breakable() |
| 6526 | q.text("port_no = "); |
| 6527 | q.text(util.pretty_port(self.port_no)) |
| 6528 | q.text(","); q.breakable() |
| 6529 | q.text("hw_addr = "); |
| 6530 | q.text(util.pretty_mac(self.hw_addr)) |
| 6531 | q.text(","); q.breakable() |
| 6532 | q.text("config = "); |
| 6533 | q.text("%#x" % self.config) |
| 6534 | q.text(","); q.breakable() |
| 6535 | q.text("mask = "); |
| 6536 | q.text("%#x" % self.mask) |
| 6537 | q.text(","); q.breakable() |
| 6538 | q.text("advertise = "); |
| 6539 | q.text("%#x" % self.advertise) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6540 | q.breakable() |
| 6541 | q.text('}') |
| 6542 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6543 | message.subtypes[15] = port_mod |
| 6544 | |
| 6545 | class port_mod_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6546 | version = 1 |
| 6547 | type = 1 |
| 6548 | err_type = 4 |
| 6549 | |
| 6550 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6551 | if xid != None: |
| 6552 | self.xid = xid |
| 6553 | else: |
| 6554 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6555 | if code != None: |
| 6556 | self.code = code |
| 6557 | else: |
| 6558 | self.code = 0 |
| 6559 | if data != None: |
| 6560 | self.data = data |
| 6561 | else: |
| 6562 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6563 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6564 | |
| 6565 | def pack(self): |
| 6566 | packed = [] |
| 6567 | packed.append(struct.pack("!B", self.version)) |
| 6568 | packed.append(struct.pack("!B", self.type)) |
| 6569 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6570 | packed.append(struct.pack("!L", self.xid)) |
| 6571 | packed.append(struct.pack("!H", self.err_type)) |
| 6572 | packed.append(struct.pack("!H", self.code)) |
| 6573 | packed.append(self.data) |
| 6574 | length = sum([len(x) for x in packed]) |
| 6575 | packed[2] = struct.pack("!H", length) |
| 6576 | return ''.join(packed) |
| 6577 | |
| 6578 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6579 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6580 | obj = port_mod_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6581 | _version = reader.read("!B")[0] |
| 6582 | assert(_version == 1) |
| 6583 | _type = reader.read("!B")[0] |
| 6584 | assert(_type == 1) |
| 6585 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6586 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6587 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6588 | obj.xid = reader.read("!L")[0] |
| 6589 | _err_type = reader.read("!H")[0] |
| 6590 | assert(_err_type == 4) |
| 6591 | obj.code = reader.read("!H")[0] |
| 6592 | obj.data = str(reader.read_all()) |
| 6593 | return obj |
| 6594 | |
| 6595 | def __eq__(self, other): |
| 6596 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6597 | if self.xid != other.xid: return False |
| 6598 | if self.code != other.code: return False |
| 6599 | if self.data != other.data: return False |
| 6600 | return True |
| 6601 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 6602 | def pretty_print(self, q): |
| 6603 | q.text("port_mod_failed_error_msg {") |
| 6604 | with q.group(): |
| 6605 | with q.indent(2): |
| 6606 | q.breakable() |
| 6607 | q.text("xid = "); |
| 6608 | if self.xid != None: |
| 6609 | q.text("%#x" % self.xid) |
| 6610 | else: |
| 6611 | q.text('None') |
| 6612 | q.text(","); q.breakable() |
| 6613 | q.text("code = "); |
| 6614 | q.text("%#x" % self.code) |
| 6615 | q.text(","); q.breakable() |
| 6616 | q.text("data = "); |
| 6617 | q.pp(self.data) |
| 6618 | q.breakable() |
| 6619 | q.text('}') |
| 6620 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6621 | error_msg.subtypes[4] = port_mod_failed_error_msg |
| 6622 | |
| 6623 | class port_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6624 | version = 1 |
| 6625 | type = 17 |
| 6626 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6627 | |
| 6628 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6629 | if xid != None: |
| 6630 | self.xid = xid |
| 6631 | else: |
| 6632 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6633 | if flags != None: |
| 6634 | self.flags = flags |
| 6635 | else: |
| 6636 | self.flags = 0 |
| 6637 | if entries != None: |
| 6638 | self.entries = entries |
| 6639 | else: |
| 6640 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6641 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6642 | |
| 6643 | def pack(self): |
| 6644 | packed = [] |
| 6645 | packed.append(struct.pack("!B", self.version)) |
| 6646 | packed.append(struct.pack("!B", self.type)) |
| 6647 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6648 | packed.append(struct.pack("!L", self.xid)) |
| 6649 | packed.append(struct.pack("!H", self.stats_type)) |
| 6650 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6651 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6652 | length = sum([len(x) for x in packed]) |
| 6653 | packed[2] = struct.pack("!H", length) |
| 6654 | return ''.join(packed) |
| 6655 | |
| 6656 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6657 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6658 | obj = port_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6659 | _version = reader.read("!B")[0] |
| 6660 | assert(_version == 1) |
| 6661 | _type = reader.read("!B")[0] |
| 6662 | assert(_type == 17) |
| 6663 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6664 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6665 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6666 | obj.xid = reader.read("!L")[0] |
| 6667 | _stats_type = reader.read("!H")[0] |
| 6668 | assert(_stats_type == 4) |
| 6669 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6670 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.port_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6671 | return obj |
| 6672 | |
| 6673 | def __eq__(self, other): |
| 6674 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6675 | if self.xid != other.xid: return False |
| 6676 | if self.flags != other.flags: return False |
| 6677 | if self.entries != other.entries: return False |
| 6678 | return True |
| 6679 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6680 | def pretty_print(self, q): |
| 6681 | q.text("port_stats_reply {") |
| 6682 | with q.group(): |
| 6683 | with q.indent(2): |
| 6684 | q.breakable() |
| 6685 | q.text("xid = "); |
| 6686 | if self.xid != None: |
| 6687 | q.text("%#x" % self.xid) |
| 6688 | else: |
| 6689 | q.text('None') |
| 6690 | q.text(","); q.breakable() |
| 6691 | q.text("flags = "); |
| 6692 | q.text("%#x" % self.flags) |
| 6693 | q.text(","); q.breakable() |
| 6694 | q.text("entries = "); |
| 6695 | q.pp(self.entries) |
| 6696 | q.breakable() |
| 6697 | q.text('}') |
| 6698 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6699 | stats_reply.subtypes[4] = port_stats_reply |
| 6700 | |
| 6701 | class port_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6702 | version = 1 |
| 6703 | type = 16 |
| 6704 | stats_type = 4 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6705 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6706 | def __init__(self, xid=None, flags=None, port_no=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6707 | if xid != None: |
| 6708 | self.xid = xid |
| 6709 | else: |
| 6710 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6711 | if flags != None: |
| 6712 | self.flags = flags |
| 6713 | else: |
| 6714 | self.flags = 0 |
| 6715 | if port_no != None: |
| 6716 | self.port_no = port_no |
| 6717 | else: |
| 6718 | self.port_no = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6719 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6720 | |
| 6721 | def pack(self): |
| 6722 | packed = [] |
| 6723 | packed.append(struct.pack("!B", self.version)) |
| 6724 | packed.append(struct.pack("!B", self.type)) |
| 6725 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6726 | packed.append(struct.pack("!L", self.xid)) |
| 6727 | packed.append(struct.pack("!H", self.stats_type)) |
| 6728 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6729 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6730 | packed.append('\x00' * 6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6731 | length = sum([len(x) for x in packed]) |
| 6732 | packed[2] = struct.pack("!H", length) |
| 6733 | return ''.join(packed) |
| 6734 | |
| 6735 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6736 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6737 | obj = port_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6738 | _version = reader.read("!B")[0] |
| 6739 | assert(_version == 1) |
| 6740 | _type = reader.read("!B")[0] |
| 6741 | assert(_type == 16) |
| 6742 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6743 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6744 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6745 | obj.xid = reader.read("!L")[0] |
| 6746 | _stats_type = reader.read("!H")[0] |
| 6747 | assert(_stats_type == 4) |
| 6748 | obj.flags = reader.read("!H")[0] |
| 6749 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6750 | reader.skip(6) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6751 | return obj |
| 6752 | |
| 6753 | def __eq__(self, other): |
| 6754 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6755 | if self.xid != other.xid: return False |
| 6756 | if self.flags != other.flags: return False |
| 6757 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6758 | return True |
| 6759 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6760 | def pretty_print(self, q): |
| 6761 | q.text("port_stats_request {") |
| 6762 | with q.group(): |
| 6763 | with q.indent(2): |
| 6764 | q.breakable() |
| 6765 | q.text("xid = "); |
| 6766 | if self.xid != None: |
| 6767 | q.text("%#x" % self.xid) |
| 6768 | else: |
| 6769 | q.text('None') |
| 6770 | q.text(","); q.breakable() |
| 6771 | q.text("flags = "); |
| 6772 | q.text("%#x" % self.flags) |
| 6773 | q.text(","); q.breakable() |
| 6774 | q.text("port_no = "); |
| 6775 | q.text(util.pretty_port(self.port_no)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6776 | q.breakable() |
| 6777 | q.text('}') |
| 6778 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6779 | stats_request.subtypes[4] = port_stats_request |
| 6780 | |
| 6781 | class port_status(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6782 | version = 1 |
| 6783 | type = 12 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6784 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6785 | def __init__(self, xid=None, reason=None, desc=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6786 | if xid != None: |
| 6787 | self.xid = xid |
| 6788 | else: |
| 6789 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6790 | if reason != None: |
| 6791 | self.reason = reason |
| 6792 | else: |
| 6793 | self.reason = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6794 | if desc != None: |
| 6795 | self.desc = desc |
| 6796 | else: |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6797 | self.desc = ofp.port_desc() |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6798 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6799 | |
| 6800 | def pack(self): |
| 6801 | packed = [] |
| 6802 | packed.append(struct.pack("!B", self.version)) |
| 6803 | packed.append(struct.pack("!B", self.type)) |
| 6804 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6805 | packed.append(struct.pack("!L", self.xid)) |
| 6806 | packed.append(struct.pack("!B", self.reason)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6807 | packed.append('\x00' * 7) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6808 | packed.append(self.desc.pack()) |
| 6809 | length = sum([len(x) for x in packed]) |
| 6810 | packed[2] = struct.pack("!H", length) |
| 6811 | return ''.join(packed) |
| 6812 | |
| 6813 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6814 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6815 | obj = port_status() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6816 | _version = reader.read("!B")[0] |
| 6817 | assert(_version == 1) |
| 6818 | _type = reader.read("!B")[0] |
| 6819 | assert(_type == 12) |
| 6820 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6821 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6822 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6823 | obj.xid = reader.read("!L")[0] |
| 6824 | obj.reason = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6825 | reader.skip(7) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6826 | obj.desc = ofp.port_desc.unpack(reader) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6827 | return obj |
| 6828 | |
| 6829 | def __eq__(self, other): |
| 6830 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6831 | if self.xid != other.xid: return False |
| 6832 | if self.reason != other.reason: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6833 | if self.desc != other.desc: return False |
| 6834 | return True |
| 6835 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6836 | def pretty_print(self, q): |
| 6837 | q.text("port_status {") |
| 6838 | with q.group(): |
| 6839 | with q.indent(2): |
| 6840 | q.breakable() |
| 6841 | q.text("xid = "); |
| 6842 | if self.xid != None: |
| 6843 | q.text("%#x" % self.xid) |
| 6844 | else: |
| 6845 | q.text('None') |
| 6846 | q.text(","); q.breakable() |
| 6847 | q.text("reason = "); |
| 6848 | q.text("%#x" % self.reason) |
| 6849 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6850 | q.text("desc = "); |
| 6851 | q.pp(self.desc) |
| 6852 | q.breakable() |
| 6853 | q.text('}') |
| 6854 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6855 | message.subtypes[12] = port_status |
| 6856 | |
| 6857 | class queue_get_config_reply(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6858 | version = 1 |
| 6859 | type = 21 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6860 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6861 | def __init__(self, xid=None, port=None, queues=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6862 | if xid != None: |
| 6863 | self.xid = xid |
| 6864 | else: |
| 6865 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6866 | if port != None: |
| 6867 | self.port = port |
| 6868 | else: |
| 6869 | self.port = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6870 | if queues != None: |
| 6871 | self.queues = queues |
| 6872 | else: |
| 6873 | self.queues = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6874 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6875 | |
| 6876 | def pack(self): |
| 6877 | packed = [] |
| 6878 | packed.append(struct.pack("!B", self.version)) |
| 6879 | packed.append(struct.pack("!B", self.type)) |
| 6880 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6881 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6882 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6883 | packed.append('\x00' * 6) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6884 | packed.append(loxi.generic_util.pack_list(self.queues)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6885 | length = sum([len(x) for x in packed]) |
| 6886 | packed[2] = struct.pack("!H", length) |
| 6887 | return ''.join(packed) |
| 6888 | |
| 6889 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6890 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6891 | obj = queue_get_config_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6892 | _version = reader.read("!B")[0] |
| 6893 | assert(_version == 1) |
| 6894 | _type = reader.read("!B")[0] |
| 6895 | assert(_type == 21) |
| 6896 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6897 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6898 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6899 | obj.xid = reader.read("!L")[0] |
| 6900 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6901 | reader.skip(6) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 6902 | obj.queues = loxi.generic_util.unpack_list(reader, ofp.common.packet_queue.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6903 | return obj |
| 6904 | |
| 6905 | def __eq__(self, other): |
| 6906 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6907 | if self.xid != other.xid: return False |
| 6908 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6909 | if self.queues != other.queues: return False |
| 6910 | return True |
| 6911 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6912 | def pretty_print(self, q): |
| 6913 | q.text("queue_get_config_reply {") |
| 6914 | with q.group(): |
| 6915 | with q.indent(2): |
| 6916 | q.breakable() |
| 6917 | q.text("xid = "); |
| 6918 | if self.xid != None: |
| 6919 | q.text("%#x" % self.xid) |
| 6920 | else: |
| 6921 | q.text('None') |
| 6922 | q.text(","); q.breakable() |
| 6923 | q.text("port = "); |
| 6924 | q.text(util.pretty_port(self.port)) |
| 6925 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6926 | q.text("queues = "); |
| 6927 | q.pp(self.queues) |
| 6928 | q.breakable() |
| 6929 | q.text('}') |
| 6930 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6931 | message.subtypes[21] = queue_get_config_reply |
| 6932 | |
| 6933 | class queue_get_config_request(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6934 | version = 1 |
| 6935 | type = 20 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6936 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6937 | def __init__(self, xid=None, port=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6938 | if xid != None: |
| 6939 | self.xid = xid |
| 6940 | else: |
| 6941 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6942 | if port != None: |
| 6943 | self.port = port |
| 6944 | else: |
| 6945 | self.port = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6946 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6947 | |
| 6948 | def pack(self): |
| 6949 | packed = [] |
| 6950 | packed.append(struct.pack("!B", self.version)) |
| 6951 | packed.append(struct.pack("!B", self.type)) |
| 6952 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 6953 | packed.append(struct.pack("!L", self.xid)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6954 | packed.append(util.pack_port_no(self.port)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6955 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6956 | length = sum([len(x) for x in packed]) |
| 6957 | packed[2] = struct.pack("!H", length) |
| 6958 | return ''.join(packed) |
| 6959 | |
| 6960 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6961 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6962 | obj = queue_get_config_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6963 | _version = reader.read("!B")[0] |
| 6964 | assert(_version == 1) |
| 6965 | _type = reader.read("!B")[0] |
| 6966 | assert(_type == 20) |
| 6967 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6968 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 6969 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 6970 | obj.xid = reader.read("!L")[0] |
| 6971 | obj.port = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 6972 | reader.skip(2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6973 | return obj |
| 6974 | |
| 6975 | def __eq__(self, other): |
| 6976 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6977 | if self.xid != other.xid: return False |
| 6978 | if self.port != other.port: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6979 | return True |
| 6980 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6981 | def pretty_print(self, q): |
| 6982 | q.text("queue_get_config_request {") |
| 6983 | with q.group(): |
| 6984 | with q.indent(2): |
| 6985 | q.breakable() |
| 6986 | q.text("xid = "); |
| 6987 | if self.xid != None: |
| 6988 | q.text("%#x" % self.xid) |
| 6989 | else: |
| 6990 | q.text('None') |
| 6991 | q.text(","); q.breakable() |
| 6992 | q.text("port = "); |
| 6993 | q.text(util.pretty_port(self.port)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 6994 | q.breakable() |
| 6995 | q.text('}') |
| 6996 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 6997 | message.subtypes[20] = queue_get_config_request |
| 6998 | |
| 6999 | class queue_op_failed_error_msg(error_msg): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7000 | version = 1 |
| 7001 | type = 1 |
| 7002 | err_type = 5 |
| 7003 | |
| 7004 | def __init__(self, xid=None, code=None, data=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7005 | if xid != None: |
| 7006 | self.xid = xid |
| 7007 | else: |
| 7008 | self.xid = None |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7009 | if code != None: |
| 7010 | self.code = code |
| 7011 | else: |
| 7012 | self.code = 0 |
| 7013 | if data != None: |
| 7014 | self.data = data |
| 7015 | else: |
| 7016 | self.data = '' |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7017 | return |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7018 | |
| 7019 | def pack(self): |
| 7020 | packed = [] |
| 7021 | packed.append(struct.pack("!B", self.version)) |
| 7022 | packed.append(struct.pack("!B", self.type)) |
| 7023 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7024 | packed.append(struct.pack("!L", self.xid)) |
| 7025 | packed.append(struct.pack("!H", self.err_type)) |
| 7026 | packed.append(struct.pack("!H", self.code)) |
| 7027 | packed.append(self.data) |
| 7028 | length = sum([len(x) for x in packed]) |
| 7029 | packed[2] = struct.pack("!H", length) |
| 7030 | return ''.join(packed) |
| 7031 | |
| 7032 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7033 | def unpack(reader): |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7034 | obj = queue_op_failed_error_msg() |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7035 | _version = reader.read("!B")[0] |
| 7036 | assert(_version == 1) |
| 7037 | _type = reader.read("!B")[0] |
| 7038 | assert(_type == 1) |
| 7039 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7040 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7041 | reader = orig_reader.slice(_length, 4) |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7042 | obj.xid = reader.read("!L")[0] |
| 7043 | _err_type = reader.read("!H")[0] |
| 7044 | assert(_err_type == 5) |
| 7045 | obj.code = reader.read("!H")[0] |
| 7046 | obj.data = str(reader.read_all()) |
| 7047 | return obj |
| 7048 | |
| 7049 | def __eq__(self, other): |
| 7050 | if type(self) != type(other): return False |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7051 | if self.xid != other.xid: return False |
| 7052 | if self.code != other.code: return False |
| 7053 | if self.data != other.data: return False |
| 7054 | return True |
| 7055 | |
Rich Lane | 6f4978c | 2013-10-20 21:33:52 -0700 | [diff] [blame] | 7056 | def pretty_print(self, q): |
| 7057 | q.text("queue_op_failed_error_msg {") |
| 7058 | with q.group(): |
| 7059 | with q.indent(2): |
| 7060 | q.breakable() |
| 7061 | q.text("xid = "); |
| 7062 | if self.xid != None: |
| 7063 | q.text("%#x" % self.xid) |
| 7064 | else: |
| 7065 | q.text('None') |
| 7066 | q.text(","); q.breakable() |
| 7067 | q.text("code = "); |
| 7068 | q.text("%#x" % self.code) |
| 7069 | q.text(","); q.breakable() |
| 7070 | q.text("data = "); |
| 7071 | q.pp(self.data) |
| 7072 | q.breakable() |
| 7073 | q.text('}') |
| 7074 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7075 | error_msg.subtypes[5] = queue_op_failed_error_msg |
| 7076 | |
| 7077 | class queue_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7078 | version = 1 |
| 7079 | type = 17 |
| 7080 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7081 | |
| 7082 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7083 | if xid != None: |
| 7084 | self.xid = xid |
| 7085 | else: |
| 7086 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7087 | if flags != None: |
| 7088 | self.flags = flags |
| 7089 | else: |
| 7090 | self.flags = 0 |
| 7091 | if entries != None: |
| 7092 | self.entries = entries |
| 7093 | else: |
| 7094 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7095 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7096 | |
| 7097 | def pack(self): |
| 7098 | packed = [] |
| 7099 | packed.append(struct.pack("!B", self.version)) |
| 7100 | packed.append(struct.pack("!B", self.type)) |
| 7101 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7102 | packed.append(struct.pack("!L", self.xid)) |
| 7103 | packed.append(struct.pack("!H", self.stats_type)) |
| 7104 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7105 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7106 | length = sum([len(x) for x in packed]) |
| 7107 | packed[2] = struct.pack("!H", length) |
| 7108 | return ''.join(packed) |
| 7109 | |
| 7110 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7111 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7112 | obj = queue_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7113 | _version = reader.read("!B")[0] |
| 7114 | assert(_version == 1) |
| 7115 | _type = reader.read("!B")[0] |
| 7116 | assert(_type == 17) |
| 7117 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7118 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7119 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7120 | obj.xid = reader.read("!L")[0] |
| 7121 | _stats_type = reader.read("!H")[0] |
| 7122 | assert(_stats_type == 5) |
| 7123 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7124 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.queue_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7125 | return obj |
| 7126 | |
| 7127 | def __eq__(self, other): |
| 7128 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7129 | if self.xid != other.xid: return False |
| 7130 | if self.flags != other.flags: return False |
| 7131 | if self.entries != other.entries: return False |
| 7132 | return True |
| 7133 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7134 | def pretty_print(self, q): |
| 7135 | q.text("queue_stats_reply {") |
| 7136 | with q.group(): |
| 7137 | with q.indent(2): |
| 7138 | q.breakable() |
| 7139 | q.text("xid = "); |
| 7140 | if self.xid != None: |
| 7141 | q.text("%#x" % self.xid) |
| 7142 | else: |
| 7143 | q.text('None') |
| 7144 | q.text(","); q.breakable() |
| 7145 | q.text("flags = "); |
| 7146 | q.text("%#x" % self.flags) |
| 7147 | q.text(","); q.breakable() |
| 7148 | q.text("entries = "); |
| 7149 | q.pp(self.entries) |
| 7150 | q.breakable() |
| 7151 | q.text('}') |
| 7152 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7153 | stats_reply.subtypes[5] = queue_stats_reply |
| 7154 | |
| 7155 | class queue_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7156 | version = 1 |
| 7157 | type = 16 |
| 7158 | stats_type = 5 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7159 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7160 | 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] | 7161 | if xid != None: |
| 7162 | self.xid = xid |
| 7163 | else: |
| 7164 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7165 | if flags != None: |
| 7166 | self.flags = flags |
| 7167 | else: |
| 7168 | self.flags = 0 |
| 7169 | if port_no != None: |
| 7170 | self.port_no = port_no |
| 7171 | else: |
| 7172 | self.port_no = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7173 | if queue_id != None: |
| 7174 | self.queue_id = queue_id |
| 7175 | else: |
| 7176 | self.queue_id = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7177 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7178 | |
| 7179 | def pack(self): |
| 7180 | packed = [] |
| 7181 | packed.append(struct.pack("!B", self.version)) |
| 7182 | packed.append(struct.pack("!B", self.type)) |
| 7183 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7184 | packed.append(struct.pack("!L", self.xid)) |
| 7185 | packed.append(struct.pack("!H", self.stats_type)) |
| 7186 | packed.append(struct.pack("!H", self.flags)) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7187 | packed.append(util.pack_port_no(self.port_no)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7188 | packed.append('\x00' * 2) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7189 | packed.append(struct.pack("!L", self.queue_id)) |
| 7190 | length = sum([len(x) for x in packed]) |
| 7191 | packed[2] = struct.pack("!H", length) |
| 7192 | return ''.join(packed) |
| 7193 | |
| 7194 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7195 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7196 | obj = queue_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7197 | _version = reader.read("!B")[0] |
| 7198 | assert(_version == 1) |
| 7199 | _type = reader.read("!B")[0] |
| 7200 | assert(_type == 16) |
| 7201 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7202 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7203 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7204 | obj.xid = reader.read("!L")[0] |
| 7205 | _stats_type = reader.read("!H")[0] |
| 7206 | assert(_stats_type == 5) |
| 7207 | obj.flags = reader.read("!H")[0] |
| 7208 | obj.port_no = util.unpack_port_no(reader) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7209 | reader.skip(2) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7210 | obj.queue_id = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7211 | return obj |
| 7212 | |
| 7213 | def __eq__(self, other): |
| 7214 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7215 | if self.xid != other.xid: return False |
| 7216 | if self.flags != other.flags: return False |
| 7217 | if self.port_no != other.port_no: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7218 | if self.queue_id != other.queue_id: return False |
| 7219 | return True |
| 7220 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7221 | def pretty_print(self, q): |
| 7222 | q.text("queue_stats_request {") |
| 7223 | with q.group(): |
| 7224 | with q.indent(2): |
| 7225 | q.breakable() |
| 7226 | q.text("xid = "); |
| 7227 | if self.xid != None: |
| 7228 | q.text("%#x" % self.xid) |
| 7229 | else: |
| 7230 | q.text('None') |
| 7231 | q.text(","); q.breakable() |
| 7232 | q.text("flags = "); |
| 7233 | q.text("%#x" % self.flags) |
| 7234 | q.text(","); q.breakable() |
| 7235 | q.text("port_no = "); |
| 7236 | q.text(util.pretty_port(self.port_no)) |
| 7237 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7238 | q.text("queue_id = "); |
| 7239 | q.text("%#x" % self.queue_id) |
| 7240 | q.breakable() |
| 7241 | q.text('}') |
| 7242 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7243 | stats_request.subtypes[5] = queue_stats_request |
| 7244 | |
| 7245 | class set_config(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7246 | version = 1 |
| 7247 | type = 9 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7248 | |
| 7249 | def __init__(self, xid=None, flags=None, miss_send_len=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7250 | if xid != None: |
| 7251 | self.xid = xid |
| 7252 | else: |
| 7253 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7254 | if flags != None: |
| 7255 | self.flags = flags |
| 7256 | else: |
| 7257 | self.flags = 0 |
| 7258 | if miss_send_len != None: |
| 7259 | self.miss_send_len = miss_send_len |
| 7260 | else: |
| 7261 | self.miss_send_len = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7262 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7263 | |
| 7264 | def pack(self): |
| 7265 | packed = [] |
| 7266 | packed.append(struct.pack("!B", self.version)) |
| 7267 | packed.append(struct.pack("!B", self.type)) |
| 7268 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7269 | packed.append(struct.pack("!L", self.xid)) |
| 7270 | packed.append(struct.pack("!H", self.flags)) |
| 7271 | packed.append(struct.pack("!H", self.miss_send_len)) |
| 7272 | length = sum([len(x) for x in packed]) |
| 7273 | packed[2] = struct.pack("!H", length) |
| 7274 | return ''.join(packed) |
| 7275 | |
| 7276 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7277 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7278 | obj = set_config() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7279 | _version = reader.read("!B")[0] |
| 7280 | assert(_version == 1) |
| 7281 | _type = reader.read("!B")[0] |
| 7282 | assert(_type == 9) |
| 7283 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7284 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7285 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7286 | obj.xid = reader.read("!L")[0] |
| 7287 | obj.flags = reader.read("!H")[0] |
| 7288 | obj.miss_send_len = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7289 | return obj |
| 7290 | |
| 7291 | def __eq__(self, other): |
| 7292 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7293 | if self.xid != other.xid: return False |
| 7294 | if self.flags != other.flags: return False |
| 7295 | if self.miss_send_len != other.miss_send_len: return False |
| 7296 | return True |
| 7297 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7298 | def pretty_print(self, q): |
| 7299 | q.text("set_config {") |
| 7300 | with q.group(): |
| 7301 | with q.indent(2): |
| 7302 | q.breakable() |
| 7303 | q.text("xid = "); |
| 7304 | if self.xid != None: |
| 7305 | q.text("%#x" % self.xid) |
| 7306 | else: |
| 7307 | q.text('None') |
| 7308 | q.text(","); q.breakable() |
| 7309 | q.text("flags = "); |
| 7310 | q.text("%#x" % self.flags) |
| 7311 | q.text(","); q.breakable() |
| 7312 | q.text("miss_send_len = "); |
| 7313 | q.text("%#x" % self.miss_send_len) |
| 7314 | q.breakable() |
| 7315 | q.text('}') |
| 7316 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7317 | message.subtypes[9] = set_config |
| 7318 | |
| 7319 | class table_mod(message): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7320 | version = 1 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7321 | type = 22 |
| 7322 | |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7323 | def __init__(self, xid=None, table_id=None, config=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7324 | if xid != None: |
| 7325 | self.xid = xid |
| 7326 | else: |
| 7327 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7328 | if table_id != None: |
| 7329 | self.table_id = table_id |
| 7330 | else: |
| 7331 | self.table_id = 0 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7332 | if config != None: |
| 7333 | self.config = config |
| 7334 | else: |
| 7335 | self.config = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7336 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7337 | |
| 7338 | def pack(self): |
| 7339 | packed = [] |
| 7340 | packed.append(struct.pack("!B", self.version)) |
| 7341 | packed.append(struct.pack("!B", self.type)) |
| 7342 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7343 | packed.append(struct.pack("!L", self.xid)) |
| 7344 | packed.append(struct.pack("!B", self.table_id)) |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7345 | packed.append('\x00' * 3) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7346 | packed.append(struct.pack("!L", self.config)) |
| 7347 | length = sum([len(x) for x in packed]) |
| 7348 | packed[2] = struct.pack("!H", length) |
| 7349 | return ''.join(packed) |
| 7350 | |
| 7351 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7352 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7353 | obj = table_mod() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7354 | _version = reader.read("!B")[0] |
| 7355 | assert(_version == 1) |
| 7356 | _type = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7357 | assert(_type == 22) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7358 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7359 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7360 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7361 | obj.xid = reader.read("!L")[0] |
| 7362 | obj.table_id = reader.read("!B")[0] |
Rich Lane | c2ee4b8 | 2013-04-24 17:12:38 -0700 | [diff] [blame] | 7363 | reader.skip(3) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7364 | obj.config = reader.read("!L")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7365 | return obj |
| 7366 | |
| 7367 | def __eq__(self, other): |
| 7368 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7369 | if self.xid != other.xid: return False |
| 7370 | if self.table_id != other.table_id: return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7371 | if self.config != other.config: return False |
| 7372 | return True |
| 7373 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7374 | def pretty_print(self, q): |
| 7375 | q.text("table_mod {") |
| 7376 | with q.group(): |
| 7377 | with q.indent(2): |
| 7378 | q.breakable() |
| 7379 | q.text("xid = "); |
| 7380 | if self.xid != None: |
| 7381 | q.text("%#x" % self.xid) |
| 7382 | else: |
| 7383 | q.text('None') |
| 7384 | q.text(","); q.breakable() |
| 7385 | q.text("table_id = "); |
| 7386 | q.text("%#x" % self.table_id) |
| 7387 | q.text(","); q.breakable() |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7388 | q.text("config = "); |
| 7389 | q.text("%#x" % self.config) |
| 7390 | q.breakable() |
| 7391 | q.text('}') |
| 7392 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7393 | message.subtypes[22] = table_mod |
| 7394 | |
| 7395 | class table_stats_reply(stats_reply): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7396 | version = 1 |
| 7397 | type = 17 |
| 7398 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7399 | |
| 7400 | def __init__(self, xid=None, flags=None, entries=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7401 | if xid != None: |
| 7402 | self.xid = xid |
| 7403 | else: |
| 7404 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7405 | if flags != None: |
| 7406 | self.flags = flags |
| 7407 | else: |
| 7408 | self.flags = 0 |
| 7409 | if entries != None: |
| 7410 | self.entries = entries |
| 7411 | else: |
| 7412 | self.entries = [] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7413 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7414 | |
| 7415 | def pack(self): |
| 7416 | packed = [] |
| 7417 | packed.append(struct.pack("!B", self.version)) |
| 7418 | packed.append(struct.pack("!B", self.type)) |
| 7419 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7420 | packed.append(struct.pack("!L", self.xid)) |
| 7421 | packed.append(struct.pack("!H", self.stats_type)) |
| 7422 | packed.append(struct.pack("!H", self.flags)) |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7423 | packed.append(loxi.generic_util.pack_list(self.entries)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7424 | length = sum([len(x) for x in packed]) |
| 7425 | packed[2] = struct.pack("!H", length) |
| 7426 | return ''.join(packed) |
| 7427 | |
| 7428 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7429 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7430 | obj = table_stats_reply() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7431 | _version = reader.read("!B")[0] |
| 7432 | assert(_version == 1) |
| 7433 | _type = reader.read("!B")[0] |
| 7434 | assert(_type == 17) |
| 7435 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7436 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7437 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7438 | obj.xid = reader.read("!L")[0] |
| 7439 | _stats_type = reader.read("!H")[0] |
| 7440 | assert(_stats_type == 3) |
| 7441 | obj.flags = reader.read("!H")[0] |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7442 | obj.entries = loxi.generic_util.unpack_list(reader, ofp.common.table_stats_entry.unpack) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7443 | return obj |
| 7444 | |
| 7445 | def __eq__(self, other): |
| 7446 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7447 | if self.xid != other.xid: return False |
| 7448 | if self.flags != other.flags: return False |
| 7449 | if self.entries != other.entries: return False |
| 7450 | return True |
| 7451 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7452 | def pretty_print(self, q): |
| 7453 | q.text("table_stats_reply {") |
| 7454 | with q.group(): |
| 7455 | with q.indent(2): |
| 7456 | q.breakable() |
| 7457 | q.text("xid = "); |
| 7458 | if self.xid != None: |
| 7459 | q.text("%#x" % self.xid) |
| 7460 | else: |
| 7461 | q.text('None') |
| 7462 | q.text(","); q.breakable() |
| 7463 | q.text("flags = "); |
| 7464 | q.text("%#x" % self.flags) |
| 7465 | q.text(","); q.breakable() |
| 7466 | q.text("entries = "); |
| 7467 | q.pp(self.entries) |
| 7468 | q.breakable() |
| 7469 | q.text('}') |
| 7470 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7471 | stats_reply.subtypes[3] = table_stats_reply |
| 7472 | |
| 7473 | class table_stats_request(stats_request): |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7474 | version = 1 |
| 7475 | type = 16 |
| 7476 | stats_type = 3 |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7477 | |
| 7478 | def __init__(self, xid=None, flags=None): |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7479 | if xid != None: |
| 7480 | self.xid = xid |
| 7481 | else: |
| 7482 | self.xid = None |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7483 | if flags != None: |
| 7484 | self.flags = flags |
| 7485 | else: |
| 7486 | self.flags = 0 |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7487 | return |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7488 | |
| 7489 | def pack(self): |
| 7490 | packed = [] |
| 7491 | packed.append(struct.pack("!B", self.version)) |
| 7492 | packed.append(struct.pack("!B", self.type)) |
| 7493 | packed.append(struct.pack("!H", 0)) # placeholder for length at index 2 |
| 7494 | packed.append(struct.pack("!L", self.xid)) |
| 7495 | packed.append(struct.pack("!H", self.stats_type)) |
| 7496 | packed.append(struct.pack("!H", self.flags)) |
| 7497 | length = sum([len(x) for x in packed]) |
| 7498 | packed[2] = struct.pack("!H", length) |
| 7499 | return ''.join(packed) |
| 7500 | |
| 7501 | @staticmethod |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7502 | def unpack(reader): |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7503 | obj = table_stats_request() |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7504 | _version = reader.read("!B")[0] |
| 7505 | assert(_version == 1) |
| 7506 | _type = reader.read("!B")[0] |
| 7507 | assert(_type == 16) |
| 7508 | _length = reader.read("!H")[0] |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7509 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 7510 | reader = orig_reader.slice(_length, 4) |
Dan Talayco | f620225 | 2013-07-02 01:00:29 -0700 | [diff] [blame] | 7511 | obj.xid = reader.read("!L")[0] |
| 7512 | _stats_type = reader.read("!H")[0] |
| 7513 | assert(_stats_type == 3) |
| 7514 | obj.flags = reader.read("!H")[0] |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7515 | return obj |
| 7516 | |
| 7517 | def __eq__(self, other): |
| 7518 | if type(self) != type(other): return False |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7519 | if self.xid != other.xid: return False |
| 7520 | if self.flags != other.flags: return False |
| 7521 | return True |
| 7522 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7523 | def pretty_print(self, q): |
| 7524 | q.text("table_stats_request {") |
| 7525 | with q.group(): |
| 7526 | with q.indent(2): |
| 7527 | q.breakable() |
| 7528 | q.text("xid = "); |
| 7529 | if self.xid != None: |
| 7530 | q.text("%#x" % self.xid) |
| 7531 | else: |
| 7532 | q.text('None') |
| 7533 | q.text(","); q.breakable() |
| 7534 | q.text("flags = "); |
| 7535 | q.text("%#x" % self.flags) |
| 7536 | q.breakable() |
| 7537 | q.text('}') |
| 7538 | |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7539 | stats_request.subtypes[3] = table_stats_request |
| 7540 | |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7541 | |
| 7542 | def parse_header(buf): |
| 7543 | if len(buf) < 8: |
| 7544 | raise loxi.ProtocolError("too short to be an OpenFlow message") |
| 7545 | return struct.unpack_from("!BBHL", buf) |
| 7546 | |
| 7547 | def parse_message(buf): |
| 7548 | msg_ver, msg_type, msg_len, msg_xid = parse_header(buf) |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 7549 | if msg_ver != ofp.OFP_VERSION and msg_type != ofp.OFPT_HELLO: |
| 7550 | raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (ofp.OFP_VERSION, msg_ver)) |
Rich Lane | b658ddd | 2013-03-12 10:15:10 -0700 | [diff] [blame] | 7551 | if len(buf) != msg_len: |
| 7552 | raise loxi.ProtocolError("incorrect message size") |
Rich Lane | 7dcdf02 | 2013-12-11 14:45:27 -0800 | [diff] [blame] | 7553 | return message.unpack(loxi.generic_util.OFReader(buf)) |