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