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