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