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 | |
| 394 | class bsn_disable_src_mac_check(bsn): |
| 395 | type = 65535 |
| 396 | experimenter = 6035143 |
| 397 | subtype = 0 |
| 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_src_mac_check() |
| 415 | _type = reader.read("!H")[0] |
| 416 | assert(_type == 65535) |
| 417 | _len = reader.read("!H")[0] |
| 418 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 419 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 420 | _experimenter = reader.read("!L")[0] |
| 421 | assert(_experimenter == 6035143) |
| 422 | _subtype = reader.read("!L")[0] |
| 423 | assert(_subtype == 0) |
| 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_src_mac_check {") |
| 432 | with q.group(): |
| 433 | with q.indent(2): |
| 434 | q.breakable() |
| 435 | q.breakable() |
| 436 | q.text('}') |
| 437 | |
| 438 | bsn.subtypes[0] = bsn_disable_src_mac_check |
| 439 | |
| 440 | class bsn_disable_vlan_counters(bsn): |
| 441 | type = 65535 |
| 442 | experimenter = 6035143 |
| 443 | subtype = 9 |
| 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_vlan_counters() |
| 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 == 9) |
| 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_vlan_counters {") |
| 478 | with q.group(): |
| 479 | with q.indent(2): |
| 480 | q.breakable() |
| 481 | q.breakable() |
| 482 | q.text('}') |
| 483 | |
| 484 | bsn.subtypes[9] = bsn_disable_vlan_counters |
| 485 | |
| 486 | class bsn_packet_of_death(bsn): |
| 487 | type = 65535 |
| 488 | experimenter = 6035143 |
| 489 | subtype = 6 |
| 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_packet_of_death() |
| 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 == 6) |
| 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_packet_of_death {") |
| 524 | with q.group(): |
| 525 | with q.indent(2): |
| 526 | q.breakable() |
| 527 | q.breakable() |
| 528 | q.text('}') |
| 529 | |
| 530 | bsn.subtypes[6] = bsn_packet_of_death |
| 531 | |
| 532 | class bsn_permit(bsn): |
| 533 | type = 65535 |
| 534 | experimenter = 6035143 |
| 535 | subtype = 4 |
| 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_permit() |
| 553 | _type = reader.read("!H")[0] |
| 554 | assert(_type == 65535) |
| 555 | _len = reader.read("!H")[0] |
| 556 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 557 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 558 | _experimenter = reader.read("!L")[0] |
| 559 | assert(_experimenter == 6035143) |
| 560 | _subtype = reader.read("!L")[0] |
| 561 | assert(_subtype == 4) |
| 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_permit {") |
| 570 | with q.group(): |
| 571 | with q.indent(2): |
| 572 | q.breakable() |
| 573 | q.breakable() |
| 574 | q.text('}') |
| 575 | |
| 576 | bsn.subtypes[4] = bsn_permit |
| 577 | |
| 578 | class bsn_prioritize_pdus(bsn): |
| 579 | type = 65535 |
| 580 | experimenter = 6035143 |
| 581 | subtype = 7 |
| 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_prioritize_pdus() |
| 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 == 7) |
| 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_prioritize_pdus {") |
| 616 | with q.group(): |
| 617 | with q.indent(2): |
| 618 | q.breakable() |
| 619 | q.breakable() |
| 620 | q.text('}') |
| 621 | |
| 622 | bsn.subtypes[7] = bsn_prioritize_pdus |
| 623 | |
| 624 | class bsn_require_vlan_xlate(bsn): |
| 625 | type = 65535 |
| 626 | experimenter = 6035143 |
| 627 | subtype = 8 |
| 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_require_vlan_xlate() |
| 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 == 8) |
| 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_require_vlan_xlate {") |
| 662 | with q.group(): |
| 663 | with q.indent(2): |
| 664 | q.breakable() |
| 665 | q.breakable() |
| 666 | q.text('}') |
| 667 | |
| 668 | bsn.subtypes[8] = bsn_require_vlan_xlate |
| 669 | |
| 670 | class bsn_span_destination(bsn): |
| 671 | type = 65535 |
| 672 | experimenter = 6035143 |
| 673 | subtype = 10 |
| 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_span_destination() |
| 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 == 10) |
| 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_span_destination {") |
| 708 | with q.group(): |
| 709 | with q.indent(2): |
| 710 | q.breakable() |
| 711 | q.breakable() |
| 712 | q.text('}') |
| 713 | |
| 714 | bsn.subtypes[10] = bsn_span_destination |
| 715 | |
| 716 | class clear_actions(instruction_id): |
| 717 | type = 5 |
| 718 | |
| 719 | def __init__(self): |
| 720 | return |
| 721 | |
| 722 | def pack(self): |
| 723 | packed = [] |
| 724 | packed.append(struct.pack("!H", self.type)) |
| 725 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 726 | length = sum([len(x) for x in packed]) |
| 727 | packed[1] = struct.pack("!H", length) |
| 728 | return ''.join(packed) |
| 729 | |
| 730 | @staticmethod |
| 731 | def unpack(reader): |
| 732 | obj = clear_actions() |
| 733 | _type = reader.read("!H")[0] |
| 734 | assert(_type == 5) |
| 735 | _len = reader.read("!H")[0] |
| 736 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 737 | reader = orig_reader.slice(_len, 4) |
Rich Lane | ccd32ed | 2014-11-10 17:48:24 -0800 | [diff] [blame] | 738 | return obj |
| 739 | |
| 740 | def __eq__(self, other): |
| 741 | if type(self) != type(other): return False |
| 742 | return True |
| 743 | |
| 744 | def pretty_print(self, q): |
| 745 | q.text("clear_actions {") |
| 746 | with q.group(): |
| 747 | with q.indent(2): |
| 748 | q.breakable() |
| 749 | q.breakable() |
| 750 | q.text('}') |
| 751 | |
| 752 | instruction_id.subtypes[5] = clear_actions |
| 753 | |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 754 | class goto_table(instruction_id): |
| 755 | type = 1 |
| 756 | |
| 757 | def __init__(self): |
| 758 | return |
| 759 | |
| 760 | def pack(self): |
| 761 | packed = [] |
| 762 | packed.append(struct.pack("!H", self.type)) |
| 763 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 764 | length = sum([len(x) for x in packed]) |
| 765 | packed[1] = struct.pack("!H", length) |
| 766 | return ''.join(packed) |
| 767 | |
| 768 | @staticmethod |
| 769 | def unpack(reader): |
| 770 | obj = goto_table() |
| 771 | _type = reader.read("!H")[0] |
| 772 | assert(_type == 1) |
| 773 | _len = reader.read("!H")[0] |
| 774 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 775 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 776 | return obj |
| 777 | |
| 778 | def __eq__(self, other): |
| 779 | if type(self) != type(other): return False |
| 780 | return True |
| 781 | |
| 782 | def pretty_print(self, q): |
| 783 | q.text("goto_table {") |
| 784 | with q.group(): |
| 785 | with q.indent(2): |
| 786 | q.breakable() |
| 787 | q.breakable() |
| 788 | q.text('}') |
| 789 | |
| 790 | instruction_id.subtypes[1] = goto_table |
| 791 | |
| 792 | class meter(instruction_id): |
| 793 | type = 6 |
| 794 | |
| 795 | def __init__(self): |
| 796 | return |
| 797 | |
| 798 | def pack(self): |
| 799 | packed = [] |
| 800 | packed.append(struct.pack("!H", self.type)) |
| 801 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 802 | length = sum([len(x) for x in packed]) |
| 803 | packed[1] = struct.pack("!H", length) |
| 804 | return ''.join(packed) |
| 805 | |
| 806 | @staticmethod |
| 807 | def unpack(reader): |
| 808 | obj = meter() |
| 809 | _type = reader.read("!H")[0] |
| 810 | assert(_type == 6) |
| 811 | _len = reader.read("!H")[0] |
| 812 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 813 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 814 | return obj |
| 815 | |
| 816 | def __eq__(self, other): |
| 817 | if type(self) != type(other): return False |
| 818 | return True |
| 819 | |
| 820 | def pretty_print(self, q): |
| 821 | q.text("meter {") |
| 822 | with q.group(): |
| 823 | with q.indent(2): |
| 824 | q.breakable() |
| 825 | q.breakable() |
| 826 | q.text('}') |
| 827 | |
| 828 | instruction_id.subtypes[6] = meter |
| 829 | |
| 830 | class write_actions(instruction_id): |
| 831 | type = 3 |
| 832 | |
| 833 | def __init__(self): |
| 834 | return |
| 835 | |
| 836 | def pack(self): |
| 837 | packed = [] |
| 838 | packed.append(struct.pack("!H", self.type)) |
| 839 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 840 | length = sum([len(x) for x in packed]) |
| 841 | packed[1] = struct.pack("!H", length) |
| 842 | return ''.join(packed) |
| 843 | |
| 844 | @staticmethod |
| 845 | def unpack(reader): |
| 846 | obj = write_actions() |
| 847 | _type = reader.read("!H")[0] |
| 848 | assert(_type == 3) |
| 849 | _len = reader.read("!H")[0] |
| 850 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 851 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 852 | return obj |
| 853 | |
| 854 | def __eq__(self, other): |
| 855 | if type(self) != type(other): return False |
| 856 | return True |
| 857 | |
| 858 | def pretty_print(self, q): |
| 859 | q.text("write_actions {") |
| 860 | with q.group(): |
| 861 | with q.indent(2): |
| 862 | q.breakable() |
| 863 | q.breakable() |
| 864 | q.text('}') |
| 865 | |
| 866 | instruction_id.subtypes[3] = write_actions |
| 867 | |
| 868 | class write_metadata(instruction_id): |
| 869 | type = 2 |
| 870 | |
| 871 | def __init__(self): |
| 872 | return |
| 873 | |
| 874 | def pack(self): |
| 875 | packed = [] |
| 876 | packed.append(struct.pack("!H", self.type)) |
| 877 | packed.append(struct.pack("!H", 0)) # placeholder for len at index 1 |
| 878 | length = sum([len(x) for x in packed]) |
| 879 | packed[1] = struct.pack("!H", length) |
| 880 | return ''.join(packed) |
| 881 | |
| 882 | @staticmethod |
| 883 | def unpack(reader): |
| 884 | obj = write_metadata() |
| 885 | _type = reader.read("!H")[0] |
| 886 | assert(_type == 2) |
| 887 | _len = reader.read("!H")[0] |
| 888 | orig_reader = reader |
Rich Lane | cb18dbd | 2014-12-18 10:02:29 -0800 | [diff] [blame] | 889 | reader = orig_reader.slice(_len, 4) |
Rich Lane | 2e079da | 2014-10-29 15:30:24 -0700 | [diff] [blame] | 890 | return obj |
| 891 | |
| 892 | def __eq__(self, other): |
| 893 | if type(self) != type(other): return False |
| 894 | return True |
| 895 | |
| 896 | def pretty_print(self, q): |
| 897 | q.text("write_metadata {") |
| 898 | with q.group(): |
| 899 | with q.indent(2): |
| 900 | q.breakable() |
| 901 | q.breakable() |
| 902 | q.text('}') |
| 903 | |
| 904 | instruction_id.subtypes[2] = write_metadata |
| 905 | |
| 906 | |