blob: b1519f091d5df81cbfdd6d5e3cc721ac4f4bbc79 [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
178class bsn_mirror(bsn):
179 type = 65535
180 experimenter = 6035143
181 subtype = 1
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))
Rich Lane7dcdf022013-12-11 14:45:27 -0800192 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_mirror()
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 == 1)
Rich Lane7dcdf022013-12-11 14:45:27 -0800208 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_mirror {")
216 with q.group():
217 with q.indent(2):
218 q.breakable()
219 q.breakable()
220 q.text('}')
221
222bsn.subtypes[1] = bsn_mirror
223
224class bsn_set_tunnel_dst(bsn):
225 type = 65535
226 experimenter = 6035143
227 subtype = 2
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))
238 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_set_tunnel_dst()
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 == 2)
254 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_set_tunnel_dst {")
262 with q.group():
263 with q.indent(2):
264 q.breakable()
265 q.breakable()
266 q.text('}')
267
268bsn.subtypes[2] = bsn_set_tunnel_dst
269
270class copy_ttl_in(action_id):
271 type = 12
272
273 def __init__(self):
274 return
275
276 def pack(self):
277 packed = []
278 packed.append(struct.pack("!H", self.type))
279 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800280 length = sum([len(x) for x in packed])
281 packed[1] = struct.pack("!H", length)
282 return ''.join(packed)
283
284 @staticmethod
285 def unpack(reader):
286 obj = copy_ttl_in()
287 _type = reader.read("!H")[0]
288 assert(_type == 12)
289 _len = reader.read("!H")[0]
290 orig_reader = reader
291 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800292 return obj
293
294 def __eq__(self, other):
295 if type(self) != type(other): return False
296 return True
297
298 def pretty_print(self, q):
299 q.text("copy_ttl_in {")
300 with q.group():
301 with q.indent(2):
302 q.breakable()
303 q.breakable()
304 q.text('}')
305
306action_id.subtypes[12] = copy_ttl_in
307
308class copy_ttl_out(action_id):
309 type = 11
310
311 def __init__(self):
312 return
313
314 def pack(self):
315 packed = []
316 packed.append(struct.pack("!H", self.type))
317 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800318 length = sum([len(x) for x in packed])
319 packed[1] = struct.pack("!H", length)
320 return ''.join(packed)
321
322 @staticmethod
323 def unpack(reader):
324 obj = copy_ttl_out()
325 _type = reader.read("!H")[0]
326 assert(_type == 11)
327 _len = reader.read("!H")[0]
328 orig_reader = reader
329 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800330 return obj
331
332 def __eq__(self, other):
333 if type(self) != type(other): return False
334 return True
335
336 def pretty_print(self, q):
337 q.text("copy_ttl_out {")
338 with q.group():
339 with q.indent(2):
340 q.breakable()
341 q.breakable()
342 q.text('}')
343
344action_id.subtypes[11] = copy_ttl_out
345
346class dec_mpls_ttl(action_id):
347 type = 16
348
349 def __init__(self):
350 return
351
352 def pack(self):
353 packed = []
354 packed.append(struct.pack("!H", self.type))
355 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800356 length = sum([len(x) for x in packed])
357 packed[1] = struct.pack("!H", length)
358 return ''.join(packed)
359
360 @staticmethod
361 def unpack(reader):
362 obj = dec_mpls_ttl()
363 _type = reader.read("!H")[0]
364 assert(_type == 16)
365 _len = reader.read("!H")[0]
366 orig_reader = reader
367 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800368 return obj
369
370 def __eq__(self, other):
371 if type(self) != type(other): return False
372 return True
373
374 def pretty_print(self, q):
375 q.text("dec_mpls_ttl {")
376 with q.group():
377 with q.indent(2):
378 q.breakable()
379 q.breakable()
380 q.text('}')
381
382action_id.subtypes[16] = dec_mpls_ttl
383
384class dec_nw_ttl(action_id):
385 type = 24
386
387 def __init__(self):
388 return
389
390 def pack(self):
391 packed = []
392 packed.append(struct.pack("!H", self.type))
393 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800394 length = sum([len(x) for x in packed])
395 packed[1] = struct.pack("!H", length)
396 return ''.join(packed)
397
398 @staticmethod
399 def unpack(reader):
400 obj = dec_nw_ttl()
401 _type = reader.read("!H")[0]
402 assert(_type == 24)
403 _len = reader.read("!H")[0]
404 orig_reader = reader
405 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800406 return obj
407
408 def __eq__(self, other):
409 if type(self) != type(other): return False
410 return True
411
412 def pretty_print(self, q):
413 q.text("dec_nw_ttl {")
414 with q.group():
415 with q.indent(2):
416 q.breakable()
417 q.breakable()
418 q.text('}')
419
420action_id.subtypes[24] = dec_nw_ttl
421
422class group(action_id):
423 type = 22
424
425 def __init__(self):
426 return
427
428 def pack(self):
429 packed = []
430 packed.append(struct.pack("!H", self.type))
431 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
432 length = sum([len(x) for x in packed])
433 packed[1] = struct.pack("!H", length)
434 return ''.join(packed)
435
436 @staticmethod
437 def unpack(reader):
438 obj = group()
439 _type = reader.read("!H")[0]
440 assert(_type == 22)
441 _len = reader.read("!H")[0]
442 orig_reader = reader
443 reader = orig_reader.slice(_len - (2 + 2))
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("group {")
452 with q.group():
453 with q.indent(2):
454 q.breakable()
455 q.breakable()
456 q.text('}')
457
458action_id.subtypes[22] = group
459
460class nicira(experimenter):
461 subtypes = {}
462
Rich Lane95f7fc92014-01-27 17:08:16 -0800463 type = 65535
464 experimenter = 8992
465
466 def __init__(self, subtype=None):
467 if subtype != None:
468 self.subtype = subtype
469 else:
470 self.subtype = 0
471 return
472
473 def pack(self):
474 packed = []
475 packed.append(struct.pack("!H", self.type))
476 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
477 packed.append(struct.pack("!L", self.experimenter))
478 packed.append(struct.pack("!H", self.subtype))
Rich Lane95f7fc92014-01-27 17:08:16 -0800479 length = sum([len(x) for x in packed])
480 packed[1] = struct.pack("!H", length)
481 return ''.join(packed)
482
Rich Lane7dcdf022013-12-11 14:45:27 -0800483 @staticmethod
484 def unpack(reader):
485 subtype, = reader.peek('!H', 8)
Rich Lane95f7fc92014-01-27 17:08:16 -0800486 subclass = nicira.subtypes.get(subtype)
487 if subclass:
488 return subclass.unpack(reader)
489
490 obj = nicira()
491 _type = reader.read("!H")[0]
492 assert(_type == 65535)
493 _len = reader.read("!H")[0]
494 orig_reader = reader
495 reader = orig_reader.slice(_len - (2 + 2))
496 _experimenter = reader.read("!L")[0]
497 assert(_experimenter == 8992)
498 obj.subtype = reader.read("!H")[0]
Rich Lane95f7fc92014-01-27 17:08:16 -0800499 return obj
500
501 def __eq__(self, other):
502 if type(self) != type(other): return False
503 if self.subtype != other.subtype: return False
504 return True
505
506 def pretty_print(self, q):
507 q.text("nicira {")
508 with q.group():
509 with q.indent(2):
510 q.breakable()
511 q.breakable()
512 q.text('}')
Rich Lane7dcdf022013-12-11 14:45:27 -0800513
514experimenter.subtypes[8992] = nicira
515
516class nicira_dec_ttl(nicira):
517 type = 65535
518 experimenter = 8992
519 subtype = 18
520
521 def __init__(self):
522 return
523
524 def pack(self):
525 packed = []
526 packed.append(struct.pack("!H", self.type))
527 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
528 packed.append(struct.pack("!L", self.experimenter))
529 packed.append(struct.pack("!H", self.subtype))
Rich Lane7dcdf022013-12-11 14:45:27 -0800530 length = sum([len(x) for x in packed])
531 packed[1] = struct.pack("!H", length)
532 return ''.join(packed)
533
534 @staticmethod
535 def unpack(reader):
536 obj = nicira_dec_ttl()
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 _subtype = reader.read("!H")[0]
545 assert(_subtype == 18)
Rich Lane7dcdf022013-12-11 14:45:27 -0800546 return obj
547
548 def __eq__(self, other):
549 if type(self) != type(other): return False
550 return True
551
552 def pretty_print(self, q):
553 q.text("nicira_dec_ttl {")
554 with q.group():
555 with q.indent(2):
556 q.breakable()
557 q.breakable()
558 q.text('}')
559
560nicira.subtypes[18] = nicira_dec_ttl
561
562class output(action_id):
563 type = 0
564
565 def __init__(self):
566 return
567
568 def pack(self):
569 packed = []
570 packed.append(struct.pack("!H", self.type))
571 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800572 length = sum([len(x) for x in packed])
573 packed[1] = struct.pack("!H", length)
574 return ''.join(packed)
575
576 @staticmethod
577 def unpack(reader):
578 obj = output()
579 _type = reader.read("!H")[0]
580 assert(_type == 0)
581 _len = reader.read("!H")[0]
582 orig_reader = reader
583 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800584 return obj
585
586 def __eq__(self, other):
587 if type(self) != type(other): return False
588 return True
589
590 def pretty_print(self, q):
591 q.text("output {")
592 with q.group():
593 with q.indent(2):
594 q.breakable()
595 q.breakable()
596 q.text('}')
597
598action_id.subtypes[0] = output
599
600class pop_mpls(action_id):
601 type = 20
602
603 def __init__(self):
604 return
605
606 def pack(self):
607 packed = []
608 packed.append(struct.pack("!H", self.type))
609 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800610 length = sum([len(x) for x in packed])
611 packed[1] = struct.pack("!H", length)
612 return ''.join(packed)
613
614 @staticmethod
615 def unpack(reader):
616 obj = pop_mpls()
617 _type = reader.read("!H")[0]
618 assert(_type == 20)
619 _len = reader.read("!H")[0]
620 orig_reader = reader
621 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800622 return obj
623
624 def __eq__(self, other):
625 if type(self) != type(other): return False
626 return True
627
628 def pretty_print(self, q):
629 q.text("pop_mpls {")
630 with q.group():
631 with q.indent(2):
632 q.breakable()
633 q.breakable()
634 q.text('}')
635
636action_id.subtypes[20] = pop_mpls
637
638class pop_pbb(action_id):
639 type = 27
640
641 def __init__(self):
642 return
643
644 def pack(self):
645 packed = []
646 packed.append(struct.pack("!H", self.type))
647 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800648 length = sum([len(x) for x in packed])
649 packed[1] = struct.pack("!H", length)
650 return ''.join(packed)
651
652 @staticmethod
653 def unpack(reader):
654 obj = pop_pbb()
655 _type = reader.read("!H")[0]
656 assert(_type == 27)
657 _len = reader.read("!H")[0]
658 orig_reader = reader
659 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800660 return obj
661
662 def __eq__(self, other):
663 if type(self) != type(other): return False
664 return True
665
666 def pretty_print(self, q):
667 q.text("pop_pbb {")
668 with q.group():
669 with q.indent(2):
670 q.breakable()
671 q.breakable()
672 q.text('}')
673
674action_id.subtypes[27] = pop_pbb
675
676class pop_vlan(action_id):
677 type = 18
678
679 def __init__(self):
680 return
681
682 def pack(self):
683 packed = []
684 packed.append(struct.pack("!H", self.type))
685 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800686 length = sum([len(x) for x in packed])
687 packed[1] = struct.pack("!H", length)
688 return ''.join(packed)
689
690 @staticmethod
691 def unpack(reader):
692 obj = pop_vlan()
693 _type = reader.read("!H")[0]
694 assert(_type == 18)
695 _len = reader.read("!H")[0]
696 orig_reader = reader
697 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800698 return obj
699
700 def __eq__(self, other):
701 if type(self) != type(other): return False
702 return True
703
704 def pretty_print(self, q):
705 q.text("pop_vlan {")
706 with q.group():
707 with q.indent(2):
708 q.breakable()
709 q.breakable()
710 q.text('}')
711
712action_id.subtypes[18] = pop_vlan
713
714class push_mpls(action_id):
715 type = 19
716
717 def __init__(self):
718 return
719
720 def pack(self):
721 packed = []
722 packed.append(struct.pack("!H", self.type))
723 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800724 length = sum([len(x) for x in packed])
725 packed[1] = struct.pack("!H", length)
726 return ''.join(packed)
727
728 @staticmethod
729 def unpack(reader):
730 obj = push_mpls()
731 _type = reader.read("!H")[0]
732 assert(_type == 19)
733 _len = reader.read("!H")[0]
734 orig_reader = reader
735 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800736 return obj
737
738 def __eq__(self, other):
739 if type(self) != type(other): return False
740 return True
741
742 def pretty_print(self, q):
743 q.text("push_mpls {")
744 with q.group():
745 with q.indent(2):
746 q.breakable()
747 q.breakable()
748 q.text('}')
749
750action_id.subtypes[19] = push_mpls
751
752class push_pbb(action_id):
753 type = 26
754
755 def __init__(self):
756 return
757
758 def pack(self):
759 packed = []
760 packed.append(struct.pack("!H", self.type))
761 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800762 length = sum([len(x) for x in packed])
763 packed[1] = struct.pack("!H", length)
764 return ''.join(packed)
765
766 @staticmethod
767 def unpack(reader):
768 obj = push_pbb()
769 _type = reader.read("!H")[0]
770 assert(_type == 26)
771 _len = reader.read("!H")[0]
772 orig_reader = reader
773 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800774 return obj
775
776 def __eq__(self, other):
777 if type(self) != type(other): return False
778 return True
779
780 def pretty_print(self, q):
781 q.text("push_pbb {")
782 with q.group():
783 with q.indent(2):
784 q.breakable()
785 q.breakable()
786 q.text('}')
787
788action_id.subtypes[26] = push_pbb
789
790class push_vlan(action_id):
791 type = 17
792
793 def __init__(self):
794 return
795
796 def pack(self):
797 packed = []
798 packed.append(struct.pack("!H", self.type))
799 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800800 length = sum([len(x) for x in packed])
801 packed[1] = struct.pack("!H", length)
802 return ''.join(packed)
803
804 @staticmethod
805 def unpack(reader):
806 obj = push_vlan()
807 _type = reader.read("!H")[0]
808 assert(_type == 17)
809 _len = reader.read("!H")[0]
810 orig_reader = reader
811 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800812 return obj
813
814 def __eq__(self, other):
815 if type(self) != type(other): return False
816 return True
817
818 def pretty_print(self, q):
819 q.text("push_vlan {")
820 with q.group():
821 with q.indent(2):
822 q.breakable()
823 q.breakable()
824 q.text('}')
825
826action_id.subtypes[17] = push_vlan
827
828class set_field(action_id):
829 type = 25
830
831 def __init__(self):
832 return
833
834 def pack(self):
835 packed = []
836 packed.append(struct.pack("!H", self.type))
837 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
838 length = sum([len(x) for x in packed])
839 packed[1] = struct.pack("!H", length)
840 return ''.join(packed)
841
842 @staticmethod
843 def unpack(reader):
844 obj = set_field()
845 _type = reader.read("!H")[0]
846 assert(_type == 25)
847 _len = reader.read("!H")[0]
848 orig_reader = reader
849 reader = orig_reader.slice(_len - (2 + 2))
850 return obj
851
852 def __eq__(self, other):
853 if type(self) != type(other): return False
854 return True
855
856 def pretty_print(self, q):
857 q.text("set_field {")
858 with q.group():
859 with q.indent(2):
860 q.breakable()
861 q.breakable()
862 q.text('}')
863
864action_id.subtypes[25] = set_field
865
866class set_mpls_ttl(action_id):
867 type = 15
868
869 def __init__(self):
870 return
871
872 def pack(self):
873 packed = []
874 packed.append(struct.pack("!H", self.type))
875 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800876 length = sum([len(x) for x in packed])
877 packed[1] = struct.pack("!H", length)
878 return ''.join(packed)
879
880 @staticmethod
881 def unpack(reader):
882 obj = set_mpls_ttl()
883 _type = reader.read("!H")[0]
884 assert(_type == 15)
885 _len = reader.read("!H")[0]
886 orig_reader = reader
887 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800888 return obj
889
890 def __eq__(self, other):
891 if type(self) != type(other): return False
892 return True
893
894 def pretty_print(self, q):
895 q.text("set_mpls_ttl {")
896 with q.group():
897 with q.indent(2):
898 q.breakable()
899 q.breakable()
900 q.text('}')
901
902action_id.subtypes[15] = set_mpls_ttl
903
904class set_nw_ttl(action_id):
905 type = 23
906
907 def __init__(self):
908 return
909
910 def pack(self):
911 packed = []
912 packed.append(struct.pack("!H", self.type))
913 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
Rich Lane7dcdf022013-12-11 14:45:27 -0800914 length = sum([len(x) for x in packed])
915 packed[1] = struct.pack("!H", length)
916 return ''.join(packed)
917
918 @staticmethod
919 def unpack(reader):
920 obj = set_nw_ttl()
921 _type = reader.read("!H")[0]
922 assert(_type == 23)
923 _len = reader.read("!H")[0]
924 orig_reader = reader
925 reader = orig_reader.slice(_len - (2 + 2))
Rich Lane7dcdf022013-12-11 14:45:27 -0800926 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_nw_ttl {")
934 with q.group():
935 with q.indent(2):
936 q.breakable()
937 q.breakable()
938 q.text('}')
939
940action_id.subtypes[23] = set_nw_ttl
941
942class set_queue(action_id):
943 type = 21
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 length = sum([len(x) for x in packed])
953 packed[1] = struct.pack("!H", length)
954 return ''.join(packed)
955
956 @staticmethod
957 def unpack(reader):
958 obj = set_queue()
959 _type = reader.read("!H")[0]
960 assert(_type == 21)
961 _len = reader.read("!H")[0]
962 orig_reader = reader
963 reader = orig_reader.slice(_len - (2 + 2))
964 return obj
965
966 def __eq__(self, other):
967 if type(self) != type(other): return False
968 return True
969
970 def pretty_print(self, q):
971 q.text("set_queue {")
972 with q.group():
973 with q.indent(2):
974 q.breakable()
975 q.breakable()
976 q.text('}')
977
978action_id.subtypes[21] = set_queue
979
980