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