Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 1 | # Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | # Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | # Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | # See the file LICENSE.pyloxi which should have been included in the source distribution |
| 5 | |
| 6 | # Automatically generated by LOXI from template module.py |
| 7 | # Do not modify |
| 8 | |
| 9 | import struct |
| 10 | import loxi |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 11 | import util |
| 12 | import loxi.generic_util |
| 13 | |
Rich Lane | e256770 | 2015-01-26 15:04:35 -0800 | [diff] [blame] | 14 | import sys |
| 15 | ofp = sys.modules['loxi.of14'] |
| 16 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 17 | class instruction_id(loxi.OFObject): |
| 18 | subtypes = {} |
| 19 | |
| 20 | |
| 21 | def __init__(self, type=None): |
| 22 | if type != None: |
| 23 | self.type = type |
| 24 | else: |
| 25 | self.type = 0 |
| 26 | return |
| 27 | |
| 28 | def pack(self): |
| 29 | packed = [] |
| 30 | packed.append(struct.pack("!H", self.type)) |
| 31 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 32 | length = sum([len(x) for x in packed]) |
| 33 | packed[1] = struct.pack("!H", length) |
| 34 | return ''.join(packed) |
| 35 | |
| 36 | @staticmethod |
| 37 | def unpack(reader): |
| 38 | subtype, = reader.peek('!H', 0) |
| 39 | subclass = instruction_id.subtypes.get(subtype) |
| 40 | if subclass: |
| 41 | return subclass.unpack(reader) |
| 42 | |
| 43 | obj = instruction_id() |
| 44 | obj.type = reader.read("!H")[0] |
| 45 | _len = reader.read("!H")[0] |
| 46 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 47 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 48 | return obj |
| 49 | |
| 50 | def __eq__(self, other): |
| 51 | if type(self) != type(other): return False |
| 52 | if self.type != other.type: return False |
| 53 | return True |
| 54 | |
| 55 | def pretty_print(self, q): |
| 56 | q.text("instruction_id {") |
| 57 | with q.group(): |
| 58 | with q.indent(2): |
| 59 | q.breakable() |
| 60 | q.breakable() |
| 61 | q.text('}') |
| 62 | |
| 63 | |
| 64 | class apply_actions(instruction_id): |
| 65 | type = 4 |
| 66 | |
| 67 | def __init__(self): |
| 68 | return |
| 69 | |
| 70 | def pack(self): |
| 71 | packed = [] |
| 72 | packed.append(struct.pack("!H", self.type)) |
| 73 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 74 | length = sum([len(x) for x in packed]) |
| 75 | packed[1] = struct.pack("!H", length) |
| 76 | return ''.join(packed) |
| 77 | |
| 78 | @staticmethod |
| 79 | def unpack(reader): |
| 80 | obj = apply_actions() |
| 81 | _type = reader.read("!H")[0] |
| 82 | assert(_type == 4) |
| 83 | _len = reader.read("!H")[0] |
| 84 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 85 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 86 | return obj |
| 87 | |
| 88 | def __eq__(self, other): |
| 89 | if type(self) != type(other): return False |
| 90 | return True |
| 91 | |
| 92 | def pretty_print(self, q): |
| 93 | q.text("apply_actions {") |
| 94 | with q.group(): |
| 95 | with q.indent(2): |
| 96 | q.breakable() |
| 97 | q.breakable() |
| 98 | q.text('}') |
| 99 | |
| 100 | instruction_id.subtypes[4] = apply_actions |
| 101 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 102 | class experimenter(instruction_id): |
| 103 | subtypes = {} |
| 104 | |
| 105 | type = 65535 |
| 106 | |
| 107 | def __init__(self, experimenter=None): |
| 108 | if experimenter != None: |
| 109 | self.experimenter = experimenter |
| 110 | else: |
| 111 | self.experimenter = 0 |
| 112 | return |
| 113 | |
| 114 | def pack(self): |
| 115 | packed = [] |
| 116 | packed.append(struct.pack("!H", self.type)) |
| 117 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 118 | packed.append(struct.pack("!L", self.experimenter)) |
| 119 | length = sum([len(x) for x in packed]) |
| 120 | packed[1] = struct.pack("!H", length) |
| 121 | return ''.join(packed) |
| 122 | |
| 123 | @staticmethod |
| 124 | def unpack(reader): |
| 125 | subtype, = reader.peek('!L', 4) |
| 126 | subclass = experimenter.subtypes.get(subtype) |
| 127 | if subclass: |
| 128 | return subclass.unpack(reader) |
| 129 | |
| 130 | obj = experimenter() |
| 131 | _type = reader.read("!H")[0] |
| 132 | assert(_type == 65535) |
| 133 | _len = reader.read("!H")[0] |
| 134 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 135 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 136 | obj.experimenter = reader.read("!L")[0] |
| 137 | return obj |
| 138 | |
| 139 | def __eq__(self, other): |
| 140 | if type(self) != type(other): return False |
| 141 | if self.experimenter != other.experimenter: return False |
| 142 | return True |
| 143 | |
| 144 | def pretty_print(self, q): |
| 145 | q.text("experimenter {") |
| 146 | with q.group(): |
| 147 | with q.indent(2): |
| 148 | q.breakable() |
| 149 | q.breakable() |
| 150 | q.text('}') |
| 151 | |
| 152 | instruction_id.subtypes[65535] = experimenter |
| 153 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 154 | class bsn(experimenter): |
| 155 | subtypes = {} |
| 156 | |
| 157 | type = 65535 |
| 158 | experimenter = 6035143 |
| 159 | |
| 160 | def __init__(self, subtype=None): |
| 161 | if subtype != None: |
| 162 | self.subtype = subtype |
| 163 | else: |
| 164 | self.subtype = 0 |
| 165 | return |
| 166 | |
| 167 | def pack(self): |
| 168 | packed = [] |
| 169 | packed.append(struct.pack("!H", self.type)) |
| 170 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 171 | packed.append(struct.pack("!L", self.experimenter)) |
| 172 | packed.append(struct.pack("!L", self.subtype)) |
| 173 | length = sum([len(x) for x in packed]) |
| 174 | packed[1] = struct.pack("!H", length) |
| 175 | return ''.join(packed) |
| 176 | |
| 177 | @staticmethod |
| 178 | def unpack(reader): |
| 179 | subtype, = reader.peek('!L', 8) |
| 180 | subclass = bsn.subtypes.get(subtype) |
| 181 | if subclass: |
| 182 | return subclass.unpack(reader) |
| 183 | |
| 184 | obj = bsn() |
| 185 | _type = reader.read("!H")[0] |
| 186 | assert(_type == 65535) |
| 187 | _len = reader.read("!H")[0] |
| 188 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 189 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 190 | _experimenter = reader.read("!L")[0] |
| 191 | assert(_experimenter == 6035143) |
| 192 | obj.subtype = reader.read("!L")[0] |
| 193 | return obj |
| 194 | |
| 195 | def __eq__(self, other): |
| 196 | if type(self) != type(other): return False |
| 197 | if self.subtype != other.subtype: return False |
| 198 | return True |
| 199 | |
| 200 | def pretty_print(self, q): |
| 201 | q.text("bsn {") |
| 202 | with q.group(): |
| 203 | with q.indent(2): |
| 204 | q.breakable() |
| 205 | q.breakable() |
| 206 | q.text('}') |
| 207 | |
| 208 | experimenter.subtypes[6035143] = bsn |
| 209 | |
| 210 | class bsn_arp_offload(bsn): |
| 211 | type = 65535 |
| 212 | experimenter = 6035143 |
| 213 | subtype = 1 |
| 214 | |
| 215 | def __init__(self): |
| 216 | return |
| 217 | |
| 218 | def pack(self): |
| 219 | packed = [] |
| 220 | packed.append(struct.pack("!H", self.type)) |
| 221 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 222 | packed.append(struct.pack("!L", self.experimenter)) |
| 223 | packed.append(struct.pack("!L", self.subtype)) |
| 224 | length = sum([len(x) for x in packed]) |
| 225 | packed[1] = struct.pack("!H", length) |
| 226 | return ''.join(packed) |
| 227 | |
| 228 | @staticmethod |
| 229 | def unpack(reader): |
| 230 | obj = bsn_arp_offload() |
| 231 | _type = reader.read("!H")[0] |
| 232 | assert(_type == 65535) |
| 233 | _len = reader.read("!H")[0] |
| 234 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 235 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 236 | _experimenter = reader.read("!L")[0] |
| 237 | assert(_experimenter == 6035143) |
| 238 | _subtype = reader.read("!L")[0] |
| 239 | assert(_subtype == 1) |
| 240 | return obj |
| 241 | |
| 242 | def __eq__(self, other): |
| 243 | if type(self) != type(other): return False |
| 244 | return True |
| 245 | |
| 246 | def pretty_print(self, q): |
| 247 | q.text("bsn_arp_offload {") |
| 248 | with q.group(): |
| 249 | with q.indent(2): |
| 250 | q.breakable() |
| 251 | q.breakable() |
| 252 | q.text('}') |
| 253 | |
| 254 | bsn.subtypes[1] = bsn_arp_offload |
| 255 | |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 256 | class bsn_auto_negotiation(bsn): |
| 257 | type = 65535 |
| 258 | experimenter = 6035143 |
| 259 | subtype = 11 |
| 260 | |
| 261 | def __init__(self): |
| 262 | return |
| 263 | |
| 264 | def pack(self): |
| 265 | packed = [] |
| 266 | packed.append(struct.pack("!H", self.type)) |
| 267 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 268 | packed.append(struct.pack("!L", self.experimenter)) |
| 269 | packed.append(struct.pack("!L", self.subtype)) |
| 270 | length = sum([len(x) for x in packed]) |
| 271 | packed[1] = struct.pack("!H", length) |
| 272 | return ''.join(packed) |
| 273 | |
| 274 | @staticmethod |
| 275 | def unpack(reader): |
| 276 | obj = bsn_auto_negotiation() |
| 277 | _type = reader.read("!H")[0] |
| 278 | assert(_type == 65535) |
| 279 | _len = reader.read("!H")[0] |
| 280 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 281 | reader = orig_reader.slice(_len, 4) |
Harshmeet Singh | 301f717 | 2014-12-08 13:07:29 -0800 | [diff] [blame] | 282 | _experimenter = reader.read("!L")[0] |
| 283 | assert(_experimenter == 6035143) |
| 284 | _subtype = reader.read("!L")[0] |
| 285 | assert(_subtype == 11) |
| 286 | return obj |
| 287 | |
| 288 | def __eq__(self, other): |
| 289 | if type(self) != type(other): return False |
| 290 | return True |
| 291 | |
| 292 | def pretty_print(self, q): |
| 293 | q.text("bsn_auto_negotiation {") |
| 294 | with q.group(): |
| 295 | with q.indent(2): |
| 296 | q.breakable() |
| 297 | q.breakable() |
| 298 | q.text('}') |
| 299 | |
| 300 | bsn.subtypes[11] = bsn_auto_negotiation |
| 301 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 302 | class bsn_deny(bsn): |
| 303 | type = 65535 |
| 304 | experimenter = 6035143 |
| 305 | subtype = 5 |
| 306 | |
| 307 | def __init__(self): |
| 308 | return |
| 309 | |
| 310 | def pack(self): |
| 311 | packed = [] |
| 312 | packed.append(struct.pack("!H", self.type)) |
| 313 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 314 | packed.append(struct.pack("!L", self.experimenter)) |
| 315 | packed.append(struct.pack("!L", self.subtype)) |
| 316 | length = sum([len(x) for x in packed]) |
| 317 | packed[1] = struct.pack("!H", length) |
| 318 | return ''.join(packed) |
| 319 | |
| 320 | @staticmethod |
| 321 | def unpack(reader): |
| 322 | obj = bsn_deny() |
| 323 | _type = reader.read("!H")[0] |
| 324 | assert(_type == 65535) |
| 325 | _len = reader.read("!H")[0] |
| 326 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 327 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 328 | _experimenter = reader.read("!L")[0] |
| 329 | assert(_experimenter == 6035143) |
| 330 | _subtype = reader.read("!L")[0] |
| 331 | assert(_subtype == 5) |
| 332 | return obj |
| 333 | |
| 334 | def __eq__(self, other): |
| 335 | if type(self) != type(other): return False |
| 336 | return True |
| 337 | |
| 338 | def pretty_print(self, q): |
| 339 | q.text("bsn_deny {") |
| 340 | with q.group(): |
| 341 | with q.indent(2): |
| 342 | q.breakable() |
| 343 | q.breakable() |
| 344 | q.text('}') |
| 345 | |
| 346 | bsn.subtypes[5] = bsn_deny |
| 347 | |
| 348 | class bsn_dhcp_offload(bsn): |
| 349 | type = 65535 |
| 350 | experimenter = 6035143 |
| 351 | subtype = 2 |
| 352 | |
| 353 | def __init__(self): |
| 354 | return |
| 355 | |
| 356 | def pack(self): |
| 357 | packed = [] |
| 358 | packed.append(struct.pack("!H", self.type)) |
| 359 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 360 | packed.append(struct.pack("!L", self.experimenter)) |
| 361 | packed.append(struct.pack("!L", self.subtype)) |
| 362 | length = sum([len(x) for x in packed]) |
| 363 | packed[1] = struct.pack("!H", length) |
| 364 | return ''.join(packed) |
| 365 | |
| 366 | @staticmethod |
| 367 | def unpack(reader): |
| 368 | obj = bsn_dhcp_offload() |
| 369 | _type = reader.read("!H")[0] |
| 370 | assert(_type == 65535) |
| 371 | _len = reader.read("!H")[0] |
| 372 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 373 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 374 | _experimenter = reader.read("!L")[0] |
| 375 | assert(_experimenter == 6035143) |
| 376 | _subtype = reader.read("!L")[0] |
| 377 | assert(_subtype == 2) |
| 378 | return obj |
| 379 | |
| 380 | def __eq__(self, other): |
| 381 | if type(self) != type(other): return False |
| 382 | return True |
| 383 | |
| 384 | def pretty_print(self, q): |
| 385 | q.text("bsn_dhcp_offload {") |
| 386 | with q.group(): |
| 387 | with q.indent(2): |
| 388 | q.breakable() |
| 389 | q.breakable() |
| 390 | q.text('}') |
| 391 | |
| 392 | bsn.subtypes[2] = bsn_dhcp_offload |
| 393 | |
Kiran Poola | 36a302c | 2015-04-22 11:20:16 -0700 | [diff] [blame] | 394 | class bsn_disable_l3(bsn): |
| 395 | type = 65535 |
| 396 | experimenter = 6035143 |
| 397 | subtype = 13 |
| 398 | |
| 399 | def __init__(self): |
| 400 | return |
| 401 | |
| 402 | def pack(self): |
| 403 | packed = [] |
| 404 | packed.append(struct.pack("!H", self.type)) |
| 405 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 406 | packed.append(struct.pack("!L", self.experimenter)) |
| 407 | packed.append(struct.pack("!L", self.subtype)) |
| 408 | length = sum([len(x) for x in packed]) |
| 409 | packed[1] = struct.pack("!H", length) |
| 410 | return ''.join(packed) |
| 411 | |
| 412 | @staticmethod |
| 413 | def unpack(reader): |
| 414 | obj = bsn_disable_l3() |
| 415 | _type = reader.read("!H")[0] |
| 416 | assert(_type == 65535) |
| 417 | _len = reader.read("!H")[0] |
| 418 | orig_reader = reader |
| 419 | reader = orig_reader.slice(_len, 4) |
| 420 | _experimenter = reader.read("!L")[0] |
| 421 | assert(_experimenter == 6035143) |
| 422 | _subtype = reader.read("!L")[0] |
| 423 | assert(_subtype == 13) |
| 424 | return obj |
| 425 | |
| 426 | def __eq__(self, other): |
| 427 | if type(self) != type(other): return False |
| 428 | return True |
| 429 | |
| 430 | def pretty_print(self, q): |
| 431 | q.text("bsn_disable_l3 {") |
| 432 | with q.group(): |
| 433 | with q.indent(2): |
| 434 | q.breakable() |
| 435 | q.breakable() |
| 436 | q.text('}') |
| 437 | |
| 438 | bsn.subtypes[13] = bsn_disable_l3 |
| 439 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 440 | class bsn_disable_src_mac_check(bsn): |
| 441 | type = 65535 |
| 442 | experimenter = 6035143 |
| 443 | subtype = 0 |
| 444 | |
| 445 | def __init__(self): |
| 446 | return |
| 447 | |
| 448 | def pack(self): |
| 449 | packed = [] |
| 450 | packed.append(struct.pack("!H", self.type)) |
| 451 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 452 | packed.append(struct.pack("!L", self.experimenter)) |
| 453 | packed.append(struct.pack("!L", self.subtype)) |
| 454 | length = sum([len(x) for x in packed]) |
| 455 | packed[1] = struct.pack("!H", length) |
| 456 | return ''.join(packed) |
| 457 | |
| 458 | @staticmethod |
| 459 | def unpack(reader): |
| 460 | obj = bsn_disable_src_mac_check() |
| 461 | _type = reader.read("!H")[0] |
| 462 | assert(_type == 65535) |
| 463 | _len = reader.read("!H")[0] |
| 464 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 465 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 466 | _experimenter = reader.read("!L")[0] |
| 467 | assert(_experimenter == 6035143) |
| 468 | _subtype = reader.read("!L")[0] |
| 469 | assert(_subtype == 0) |
| 470 | return obj |
| 471 | |
| 472 | def __eq__(self, other): |
| 473 | if type(self) != type(other): return False |
| 474 | return True |
| 475 | |
| 476 | def pretty_print(self, q): |
| 477 | q.text("bsn_disable_src_mac_check {") |
| 478 | with q.group(): |
| 479 | with q.indent(2): |
| 480 | q.breakable() |
| 481 | q.breakable() |
| 482 | q.text('}') |
| 483 | |
| 484 | bsn.subtypes[0] = bsn_disable_src_mac_check |
| 485 | |
| 486 | class bsn_disable_vlan_counters(bsn): |
| 487 | type = 65535 |
| 488 | experimenter = 6035143 |
| 489 | subtype = 9 |
| 490 | |
| 491 | def __init__(self): |
| 492 | return |
| 493 | |
| 494 | def pack(self): |
| 495 | packed = [] |
| 496 | packed.append(struct.pack("!H", self.type)) |
| 497 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 498 | packed.append(struct.pack("!L", self.experimenter)) |
| 499 | packed.append(struct.pack("!L", self.subtype)) |
| 500 | length = sum([len(x) for x in packed]) |
| 501 | packed[1] = struct.pack("!H", length) |
| 502 | return ''.join(packed) |
| 503 | |
| 504 | @staticmethod |
| 505 | def unpack(reader): |
| 506 | obj = bsn_disable_vlan_counters() |
| 507 | _type = reader.read("!H")[0] |
| 508 | assert(_type == 65535) |
| 509 | _len = reader.read("!H")[0] |
| 510 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 511 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 512 | _experimenter = reader.read("!L")[0] |
| 513 | assert(_experimenter == 6035143) |
| 514 | _subtype = reader.read("!L")[0] |
| 515 | assert(_subtype == 9) |
| 516 | return obj |
| 517 | |
| 518 | def __eq__(self, other): |
| 519 | if type(self) != type(other): return False |
| 520 | return True |
| 521 | |
| 522 | def pretty_print(self, q): |
| 523 | q.text("bsn_disable_vlan_counters {") |
| 524 | with q.group(): |
| 525 | with q.indent(2): |
| 526 | q.breakable() |
| 527 | q.breakable() |
| 528 | q.text('}') |
| 529 | |
| 530 | bsn.subtypes[9] = bsn_disable_vlan_counters |
| 531 | |
Rich Lane | 7b69e79 | 2015-03-31 11:12:50 -0700 | [diff] [blame] | 532 | class bsn_internal_priority(bsn): |
| 533 | type = 65535 |
| 534 | experimenter = 6035143 |
| 535 | subtype = 12 |
| 536 | |
| 537 | def __init__(self): |
| 538 | return |
| 539 | |
| 540 | def pack(self): |
| 541 | packed = [] |
| 542 | packed.append(struct.pack("!H", self.type)) |
| 543 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 544 | packed.append(struct.pack("!L", self.experimenter)) |
| 545 | packed.append(struct.pack("!L", self.subtype)) |
| 546 | length = sum([len(x) for x in packed]) |
| 547 | packed[1] = struct.pack("!H", length) |
| 548 | return ''.join(packed) |
| 549 | |
| 550 | @staticmethod |
| 551 | def unpack(reader): |
| 552 | obj = bsn_internal_priority() |
| 553 | _type = reader.read("!H")[0] |
| 554 | assert(_type == 65535) |
| 555 | _len = reader.read("!H")[0] |
| 556 | orig_reader = reader |
| 557 | reader = orig_reader.slice(_len, 4) |
| 558 | _experimenter = reader.read("!L")[0] |
| 559 | assert(_experimenter == 6035143) |
| 560 | _subtype = reader.read("!L")[0] |
| 561 | assert(_subtype == 12) |
| 562 | return obj |
| 563 | |
| 564 | def __eq__(self, other): |
| 565 | if type(self) != type(other): return False |
| 566 | return True |
| 567 | |
| 568 | def pretty_print(self, q): |
| 569 | q.text("bsn_internal_priority {") |
| 570 | with q.group(): |
| 571 | with q.indent(2): |
| 572 | q.breakable() |
| 573 | q.breakable() |
| 574 | q.text('}') |
| 575 | |
| 576 | bsn.subtypes[12] = bsn_internal_priority |
| 577 | |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 578 | class bsn_packet_of_death(bsn): |
| 579 | type = 65535 |
| 580 | experimenter = 6035143 |
| 581 | subtype = 6 |
| 582 | |
| 583 | def __init__(self): |
| 584 | return |
| 585 | |
| 586 | def pack(self): |
| 587 | packed = [] |
| 588 | packed.append(struct.pack("!H", self.type)) |
| 589 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 590 | packed.append(struct.pack("!L", self.experimenter)) |
| 591 | packed.append(struct.pack("!L", self.subtype)) |
| 592 | length = sum([len(x) for x in packed]) |
| 593 | packed[1] = struct.pack("!H", length) |
| 594 | return ''.join(packed) |
| 595 | |
| 596 | @staticmethod |
| 597 | def unpack(reader): |
| 598 | obj = bsn_packet_of_death() |
| 599 | _type = reader.read("!H")[0] |
| 600 | assert(_type == 65535) |
| 601 | _len = reader.read("!H")[0] |
| 602 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 603 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 604 | _experimenter = reader.read("!L")[0] |
| 605 | assert(_experimenter == 6035143) |
| 606 | _subtype = reader.read("!L")[0] |
| 607 | assert(_subtype == 6) |
| 608 | return obj |
| 609 | |
| 610 | def __eq__(self, other): |
| 611 | if type(self) != type(other): return False |
| 612 | return True |
| 613 | |
| 614 | def pretty_print(self, q): |
| 615 | q.text("bsn_packet_of_death {") |
| 616 | with q.group(): |
| 617 | with q.indent(2): |
| 618 | q.breakable() |
| 619 | q.breakable() |
| 620 | q.text('}') |
| 621 | |
| 622 | bsn.subtypes[6] = bsn_packet_of_death |
| 623 | |
| 624 | class bsn_permit(bsn): |
| 625 | type = 65535 |
| 626 | experimenter = 6035143 |
| 627 | subtype = 4 |
| 628 | |
| 629 | def __init__(self): |
| 630 | return |
| 631 | |
| 632 | def pack(self): |
| 633 | packed = [] |
| 634 | packed.append(struct.pack("!H", self.type)) |
| 635 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 636 | packed.append(struct.pack("!L", self.experimenter)) |
| 637 | packed.append(struct.pack("!L", self.subtype)) |
| 638 | length = sum([len(x) for x in packed]) |
| 639 | packed[1] = struct.pack("!H", length) |
| 640 | return ''.join(packed) |
| 641 | |
| 642 | @staticmethod |
| 643 | def unpack(reader): |
| 644 | obj = bsn_permit() |
| 645 | _type = reader.read("!H")[0] |
| 646 | assert(_type == 65535) |
| 647 | _len = reader.read("!H")[0] |
| 648 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 649 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 650 | _experimenter = reader.read("!L")[0] |
| 651 | assert(_experimenter == 6035143) |
| 652 | _subtype = reader.read("!L")[0] |
| 653 | assert(_subtype == 4) |
| 654 | return obj |
| 655 | |
| 656 | def __eq__(self, other): |
| 657 | if type(self) != type(other): return False |
| 658 | return True |
| 659 | |
| 660 | def pretty_print(self, q): |
| 661 | q.text("bsn_permit {") |
| 662 | with q.group(): |
| 663 | with q.indent(2): |
| 664 | q.breakable() |
| 665 | q.breakable() |
| 666 | q.text('}') |
| 667 | |
| 668 | bsn.subtypes[4] = bsn_permit |
| 669 | |
| 670 | class bsn_prioritize_pdus(bsn): |
| 671 | type = 65535 |
| 672 | experimenter = 6035143 |
| 673 | subtype = 7 |
| 674 | |
| 675 | def __init__(self): |
| 676 | return |
| 677 | |
| 678 | def pack(self): |
| 679 | packed = [] |
| 680 | packed.append(struct.pack("!H", self.type)) |
| 681 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 682 | packed.append(struct.pack("!L", self.experimenter)) |
| 683 | packed.append(struct.pack("!L", self.subtype)) |
| 684 | length = sum([len(x) for x in packed]) |
| 685 | packed[1] = struct.pack("!H", length) |
| 686 | return ''.join(packed) |
| 687 | |
| 688 | @staticmethod |
| 689 | def unpack(reader): |
| 690 | obj = bsn_prioritize_pdus() |
| 691 | _type = reader.read("!H")[0] |
| 692 | assert(_type == 65535) |
| 693 | _len = reader.read("!H")[0] |
| 694 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 695 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 696 | _experimenter = reader.read("!L")[0] |
| 697 | assert(_experimenter == 6035143) |
| 698 | _subtype = reader.read("!L")[0] |
| 699 | assert(_subtype == 7) |
| 700 | return obj |
| 701 | |
| 702 | def __eq__(self, other): |
| 703 | if type(self) != type(other): return False |
| 704 | return True |
| 705 | |
| 706 | def pretty_print(self, q): |
| 707 | q.text("bsn_prioritize_pdus {") |
| 708 | with q.group(): |
| 709 | with q.indent(2): |
| 710 | q.breakable() |
| 711 | q.breakable() |
| 712 | q.text('}') |
| 713 | |
| 714 | bsn.subtypes[7] = bsn_prioritize_pdus |
| 715 | |
| 716 | class bsn_require_vlan_xlate(bsn): |
| 717 | type = 65535 |
| 718 | experimenter = 6035143 |
| 719 | subtype = 8 |
| 720 | |
| 721 | def __init__(self): |
| 722 | return |
| 723 | |
| 724 | def pack(self): |
| 725 | packed = [] |
| 726 | packed.append(struct.pack("!H", self.type)) |
| 727 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 728 | packed.append(struct.pack("!L", self.experimenter)) |
| 729 | packed.append(struct.pack("!L", self.subtype)) |
| 730 | length = sum([len(x) for x in packed]) |
| 731 | packed[1] = struct.pack("!H", length) |
| 732 | return ''.join(packed) |
| 733 | |
| 734 | @staticmethod |
| 735 | def unpack(reader): |
| 736 | obj = bsn_require_vlan_xlate() |
| 737 | _type = reader.read("!H")[0] |
| 738 | assert(_type == 65535) |
| 739 | _len = reader.read("!H")[0] |
| 740 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 741 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 742 | _experimenter = reader.read("!L")[0] |
| 743 | assert(_experimenter == 6035143) |
| 744 | _subtype = reader.read("!L")[0] |
| 745 | assert(_subtype == 8) |
| 746 | return obj |
| 747 | |
| 748 | def __eq__(self, other): |
| 749 | if type(self) != type(other): return False |
| 750 | return True |
| 751 | |
| 752 | def pretty_print(self, q): |
| 753 | q.text("bsn_require_vlan_xlate {") |
| 754 | with q.group(): |
| 755 | with q.indent(2): |
| 756 | q.breakable() |
| 757 | q.breakable() |
| 758 | q.text('}') |
| 759 | |
| 760 | bsn.subtypes[8] = bsn_require_vlan_xlate |
| 761 | |
| 762 | class bsn_span_destination(bsn): |
| 763 | type = 65535 |
| 764 | experimenter = 6035143 |
| 765 | subtype = 10 |
| 766 | |
| 767 | def __init__(self): |
| 768 | return |
| 769 | |
| 770 | def pack(self): |
| 771 | packed = [] |
| 772 | packed.append(struct.pack("!H", self.type)) |
| 773 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 774 | packed.append(struct.pack("!L", self.experimenter)) |
| 775 | packed.append(struct.pack("!L", self.subtype)) |
| 776 | length = sum([len(x) for x in packed]) |
| 777 | packed[1] = struct.pack("!H", length) |
| 778 | return ''.join(packed) |
| 779 | |
| 780 | @staticmethod |
| 781 | def unpack(reader): |
| 782 | obj = bsn_span_destination() |
| 783 | _type = reader.read("!H")[0] |
| 784 | assert(_type == 65535) |
| 785 | _len = reader.read("!H")[0] |
| 786 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 787 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 788 | _experimenter = reader.read("!L")[0] |
| 789 | assert(_experimenter == 6035143) |
| 790 | _subtype = reader.read("!L")[0] |
| 791 | assert(_subtype == 10) |
| 792 | return obj |
| 793 | |
| 794 | def __eq__(self, other): |
| 795 | if type(self) != type(other): return False |
| 796 | return True |
| 797 | |
| 798 | def pretty_print(self, q): |
| 799 | q.text("bsn_span_destination {") |
| 800 | with q.group(): |
| 801 | with q.indent(2): |
| 802 | q.breakable() |
| 803 | q.breakable() |
| 804 | q.text('}') |
| 805 | |
| 806 | bsn.subtypes[10] = bsn_span_destination |
| 807 | |
| 808 | class clear_actions(instruction_id): |
| 809 | type = 5 |
| 810 | |
| 811 | def __init__(self): |
| 812 | return |
| 813 | |
| 814 | def pack(self): |
| 815 | packed = [] |
| 816 | packed.append(struct.pack("!H", self.type)) |
| 817 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 818 | length = sum([len(x) for x in packed]) |
| 819 | packed[1] = struct.pack("!H", length) |
| 820 | return ''.join(packed) |
| 821 | |
| 822 | @staticmethod |
| 823 | def unpack(reader): |
| 824 | obj = clear_actions() |
| 825 | _type = reader.read("!H")[0] |
| 826 | assert(_type == 5) |
| 827 | _len = reader.read("!H")[0] |
| 828 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 829 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 830 | return obj |
| 831 | |
| 832 | def __eq__(self, other): |
| 833 | if type(self) != type(other): return False |
| 834 | return True |
| 835 | |
| 836 | def pretty_print(self, q): |
| 837 | q.text("clear_actions {") |
| 838 | with q.group(): |
| 839 | with q.indent(2): |
| 840 | q.breakable() |
| 841 | q.breakable() |
| 842 | q.text('}') |
| 843 | |
| 844 | instruction_id.subtypes[5] = clear_actions |
| 845 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 846 | class goto_table(instruction_id): |
| 847 | type = 1 |
| 848 | |
| 849 | def __init__(self): |
| 850 | return |
| 851 | |
| 852 | def pack(self): |
| 853 | packed = [] |
| 854 | packed.append(struct.pack("!H", self.type)) |
| 855 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 856 | length = sum([len(x) for x in packed]) |
| 857 | packed[1] = struct.pack("!H", length) |
| 858 | return ''.join(packed) |
| 859 | |
| 860 | @staticmethod |
| 861 | def unpack(reader): |
| 862 | obj = goto_table() |
| 863 | _type = reader.read("!H")[0] |
| 864 | assert(_type == 1) |
| 865 | _len = reader.read("!H")[0] |
| 866 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 867 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 868 | return obj |
| 869 | |
| 870 | def __eq__(self, other): |
| 871 | if type(self) != type(other): return False |
| 872 | return True |
| 873 | |
| 874 | def pretty_print(self, q): |
| 875 | q.text("goto_table {") |
| 876 | with q.group(): |
| 877 | with q.indent(2): |
| 878 | q.breakable() |
| 879 | q.breakable() |
| 880 | q.text('}') |
| 881 | |
| 882 | instruction_id.subtypes[1] = goto_table |
| 883 | |
| 884 | class meter(instruction_id): |
| 885 | type = 6 |
| 886 | |
| 887 | def __init__(self): |
| 888 | return |
| 889 | |
| 890 | def pack(self): |
| 891 | packed = [] |
| 892 | packed.append(struct.pack("!H", self.type)) |
| 893 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 894 | length = sum([len(x) for x in packed]) |
| 895 | packed[1] = struct.pack("!H", length) |
| 896 | return ''.join(packed) |
| 897 | |
| 898 | @staticmethod |
| 899 | def unpack(reader): |
| 900 | obj = meter() |
| 901 | _type = reader.read("!H")[0] |
| 902 | assert(_type == 6) |
| 903 | _len = reader.read("!H")[0] |
| 904 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 905 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 906 | return obj |
| 907 | |
| 908 | def __eq__(self, other): |
| 909 | if type(self) != type(other): return False |
| 910 | return True |
| 911 | |
| 912 | def pretty_print(self, q): |
| 913 | q.text("meter {") |
| 914 | with q.group(): |
| 915 | with q.indent(2): |
| 916 | q.breakable() |
| 917 | q.breakable() |
| 918 | q.text('}') |
| 919 | |
| 920 | instruction_id.subtypes[6] = meter |
| 921 | |
| 922 | class write_actions(instruction_id): |
| 923 | type = 3 |
| 924 | |
| 925 | def __init__(self): |
| 926 | return |
| 927 | |
| 928 | def pack(self): |
| 929 | packed = [] |
| 930 | packed.append(struct.pack("!H", self.type)) |
| 931 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 932 | length = sum([len(x) for x in packed]) |
| 933 | packed[1] = struct.pack("!H", length) |
| 934 | return ''.join(packed) |
| 935 | |
| 936 | @staticmethod |
| 937 | def unpack(reader): |
| 938 | obj = write_actions() |
| 939 | _type = reader.read("!H")[0] |
| 940 | assert(_type == 3) |
| 941 | _len = reader.read("!H")[0] |
| 942 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 943 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 944 | return obj |
| 945 | |
| 946 | def __eq__(self, other): |
| 947 | if type(self) != type(other): return False |
| 948 | return True |
| 949 | |
| 950 | def pretty_print(self, q): |
| 951 | q.text("write_actions {") |
| 952 | with q.group(): |
| 953 | with q.indent(2): |
| 954 | q.breakable() |
| 955 | q.breakable() |
| 956 | q.text('}') |
| 957 | |
| 958 | instruction_id.subtypes[3] = write_actions |
| 959 | |
| 960 | class write_metadata(instruction_id): |
| 961 | type = 2 |
| 962 | |
| 963 | def __init__(self): |
| 964 | return |
| 965 | |
| 966 | def pack(self): |
| 967 | packed = [] |
| 968 | packed.append(struct.pack("!H", self.type)) |
| 969 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 970 | length = sum([len(x) for x in packed]) |
| 971 | packed[1] = struct.pack("!H", length) |
| 972 | return ''.join(packed) |
| 973 | |
| 974 | @staticmethod |
| 975 | def unpack(reader): |
| 976 | obj = write_metadata() |
| 977 | _type = reader.read("!H")[0] |
| 978 | assert(_type == 2) |
| 979 | _len = reader.read("!H")[0] |
| 980 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 981 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 982 | return obj |
| 983 | |
| 984 | def __eq__(self, other): |
| 985 | if type(self) != type(other): return False |
| 986 | return True |
| 987 | |
| 988 | def pretty_print(self, q): |
| 989 | q.text("write_metadata {") |
| 990 | with q.group(): |
| 991 | with q.indent(2): |
| 992 | q.breakable() |
| 993 | q.breakable() |
| 994 | q.text('}') |
| 995 | |
| 996 | instruction_id.subtypes[2] = write_metadata |
| 997 | |
| 998 | |