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