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