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