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