blob: 7cf5acb488f4f5947e6807e20ab095883dba82a4 [file] [log] [blame]
Nathan Knuth418fdc82016-09-16 22:51:15 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import util
12import loxi.generic_util
13
14import sys
15ofp = sys.modules['loxi.of11']
16
17class action(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 packed.append('\x00' * 4)
33 length = sum([len(x) for x in packed])
34 packed[1] = struct.pack("!H", length)
35 return ''.join(packed)
36
37 @staticmethod
38 def unpack(reader):
39 subtype, = reader.peek('!H', 0)
40 subclass = action.subtypes.get(subtype)
41 if subclass:
42 return subclass.unpack(reader)
43
44 obj = action()
45 obj.type = reader.read("!H")[0]
46 _len = reader.read("!H")[0]
47 orig_reader = reader
48 reader = orig_reader.slice(_len, 4)
49 reader.skip(4)
50 return obj
51
52 def __eq__(self, other):
53 if type(self) != type(other): return False
54 if self.type != other.type: return False
55 return True
56
57 def pretty_print(self, q):
58 q.text("action {")
59 with q.group():
60 with q.indent(2):
61 q.breakable()
62 q.breakable()
63 q.text('}')
64
65
66class experimenter(action):
67 subtypes = {}
68
69 type = 65535
70
71 def __init__(self, experimenter=None, data=None):
72 if experimenter != None:
73 self.experimenter = experimenter
74 else:
75 self.experimenter = 0
76 if data != None:
77 self.data = data
78 else:
79 self.data = ''
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 packed.append(self.data)
88 length = sum([len(x) for x in packed])
89 packed[1] = struct.pack("!H", length)
90 return ''.join(packed)
91
92 @staticmethod
93 def unpack(reader):
94 subtype, = reader.peek('!L', 4)
95 subclass = experimenter.subtypes.get(subtype)
96 if subclass:
97 return subclass.unpack(reader)
98
99 obj = experimenter()
100 _type = reader.read("!H")[0]
101 assert(_type == 65535)
102 _len = reader.read("!H")[0]
103 orig_reader = reader
104 reader = orig_reader.slice(_len, 4)
105 obj.experimenter = reader.read("!L")[0]
106 obj.data = str(reader.read_all())
107 return obj
108
109 def __eq__(self, other):
110 if type(self) != type(other): return False
111 if self.experimenter != other.experimenter: return False
112 if self.data != other.data: return False
113 return True
114
115 def pretty_print(self, q):
116 q.text("experimenter {")
117 with q.group():
118 with q.indent(2):
119 q.breakable()
120 q.text("data = ");
121 q.pp(self.data)
122 q.breakable()
123 q.text('}')
124
125action.subtypes[65535] = experimenter
126
127class bsn(experimenter):
128 subtypes = {}
129
130 type = 65535
131 experimenter = 6035143
132
133 def __init__(self, subtype=None):
134 if subtype != None:
135 self.subtype = subtype
136 else:
137 self.subtype = 0
138 return
139
140 def pack(self):
141 packed = []
142 packed.append(struct.pack("!H", self.type))
143 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
144 packed.append(struct.pack("!L", self.experimenter))
145 packed.append(struct.pack("!L", self.subtype))
146 packed.append('\x00' * 4)
147 length = sum([len(x) for x in packed])
148 packed[1] = struct.pack("!H", length)
149 return ''.join(packed)
150
151 @staticmethod
152 def unpack(reader):
153 subtype, = reader.peek('!L', 8)
154 subclass = bsn.subtypes.get(subtype)
155 if subclass:
156 return subclass.unpack(reader)
157
158 obj = bsn()
159 _type = reader.read("!H")[0]
160 assert(_type == 65535)
161 _len = reader.read("!H")[0]
162 orig_reader = reader
163 reader = orig_reader.slice(_len, 4)
164 _experimenter = reader.read("!L")[0]
165 assert(_experimenter == 6035143)
166 obj.subtype = reader.read("!L")[0]
167 reader.skip(4)
168 return obj
169
170 def __eq__(self, other):
171 if type(self) != type(other): return False
172 if self.subtype != other.subtype: return False
173 return True
174
175 def pretty_print(self, q):
176 q.text("bsn {")
177 with q.group():
178 with q.indent(2):
179 q.breakable()
180 q.breakable()
181 q.text('}')
182
183experimenter.subtypes[6035143] = bsn
184
185class bsn_checksum(bsn):
186 type = 65535
187 experimenter = 6035143
188 subtype = 4
189
190 def __init__(self, checksum=None):
191 if checksum != None:
192 self.checksum = checksum
193 else:
194 self.checksum = 0
195 return
196
197 def pack(self):
198 packed = []
199 packed.append(struct.pack("!H", self.type))
200 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
201 packed.append(struct.pack("!L", self.experimenter))
202 packed.append(struct.pack("!L", self.subtype))
203 packed.append(util.pack_checksum_128(self.checksum))
204 length = sum([len(x) for x in packed])
205 packed[1] = struct.pack("!H", length)
206 return ''.join(packed)
207
208 @staticmethod
209 def unpack(reader):
210 obj = bsn_checksum()
211 _type = reader.read("!H")[0]
212 assert(_type == 65535)
213 _len = reader.read("!H")[0]
214 orig_reader = reader
215 reader = orig_reader.slice(_len, 4)
216 _experimenter = reader.read("!L")[0]
217 assert(_experimenter == 6035143)
218 _subtype = reader.read("!L")[0]
219 assert(_subtype == 4)
220 obj.checksum = util.unpack_checksum_128(reader)
221 return obj
222
223 def __eq__(self, other):
224 if type(self) != type(other): return False
225 if self.checksum != other.checksum: return False
226 return True
227
228 def pretty_print(self, q):
229 q.text("bsn_checksum {")
230 with q.group():
231 with q.indent(2):
232 q.breakable()
233 q.text("checksum = ");
234 q.pp(self.checksum)
235 q.breakable()
236 q.text('}')
237
238bsn.subtypes[4] = bsn_checksum
239
240class bsn_mirror(bsn):
241 type = 65535
242 experimenter = 6035143
243 subtype = 1
244
245 def __init__(self, dest_port=None, vlan_tag=None, copy_stage=None):
246 if dest_port != None:
247 self.dest_port = dest_port
248 else:
249 self.dest_port = 0
250 if vlan_tag != None:
251 self.vlan_tag = vlan_tag
252 else:
253 self.vlan_tag = 0
254 if copy_stage != None:
255 self.copy_stage = copy_stage
256 else:
257 self.copy_stage = 0
258 return
259
260 def pack(self):
261 packed = []
262 packed.append(struct.pack("!H", self.type))
263 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
264 packed.append(struct.pack("!L", self.experimenter))
265 packed.append(struct.pack("!L", self.subtype))
266 packed.append(struct.pack("!L", self.dest_port))
267 packed.append(struct.pack("!L", self.vlan_tag))
268 packed.append(struct.pack("!B", self.copy_stage))
269 packed.append('\x00' * 3)
270 length = sum([len(x) for x in packed])
271 packed[1] = struct.pack("!H", length)
272 return ''.join(packed)
273
274 @staticmethod
275 def unpack(reader):
276 obj = bsn_mirror()
277 _type = reader.read("!H")[0]
278 assert(_type == 65535)
279 _len = reader.read("!H")[0]
280 orig_reader = reader
281 reader = orig_reader.slice(_len, 4)
282 _experimenter = reader.read("!L")[0]
283 assert(_experimenter == 6035143)
284 _subtype = reader.read("!L")[0]
285 assert(_subtype == 1)
286 obj.dest_port = reader.read("!L")[0]
287 obj.vlan_tag = reader.read("!L")[0]
288 obj.copy_stage = reader.read("!B")[0]
289 reader.skip(3)
290 return obj
291
292 def __eq__(self, other):
293 if type(self) != type(other): return False
294 if self.dest_port != other.dest_port: return False
295 if self.vlan_tag != other.vlan_tag: return False
296 if self.copy_stage != other.copy_stage: return False
297 return True
298
299 def pretty_print(self, q):
300 q.text("bsn_mirror {")
301 with q.group():
302 with q.indent(2):
303 q.breakable()
304 q.text("dest_port = ");
305 q.text("%#x" % self.dest_port)
306 q.text(","); q.breakable()
307 q.text("vlan_tag = ");
308 q.text("%#x" % self.vlan_tag)
309 q.text(","); q.breakable()
310 q.text("copy_stage = ");
311 q.text("%#x" % self.copy_stage)
312 q.breakable()
313 q.text('}')
314
315bsn.subtypes[1] = bsn_mirror
316
317class bsn_set_tunnel_dst(bsn):
318 type = 65535
319 experimenter = 6035143
320 subtype = 2
321
322 def __init__(self, dst=None):
323 if dst != None:
324 self.dst = dst
325 else:
326 self.dst = 0
327 return
328
329 def pack(self):
330 packed = []
331 packed.append(struct.pack("!H", self.type))
332 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
333 packed.append(struct.pack("!L", self.experimenter))
334 packed.append(struct.pack("!L", self.subtype))
335 packed.append(struct.pack("!L", self.dst))
336 length = sum([len(x) for x in packed])
337 packed[1] = struct.pack("!H", length)
338 return ''.join(packed)
339
340 @staticmethod
341 def unpack(reader):
342 obj = bsn_set_tunnel_dst()
343 _type = reader.read("!H")[0]
344 assert(_type == 65535)
345 _len = reader.read("!H")[0]
346 orig_reader = reader
347 reader = orig_reader.slice(_len, 4)
348 _experimenter = reader.read("!L")[0]
349 assert(_experimenter == 6035143)
350 _subtype = reader.read("!L")[0]
351 assert(_subtype == 2)
352 obj.dst = reader.read("!L")[0]
353 return obj
354
355 def __eq__(self, other):
356 if type(self) != type(other): return False
357 if self.dst != other.dst: return False
358 return True
359
360 def pretty_print(self, q):
361 q.text("bsn_set_tunnel_dst {")
362 with q.group():
363 with q.indent(2):
364 q.breakable()
365 q.text("dst = ");
366 q.text("%#x" % self.dst)
367 q.breakable()
368 q.text('}')
369
370bsn.subtypes[2] = bsn_set_tunnel_dst
371
372class copy_ttl_in(action):
373 type = 12
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('\x00' * 4)
383 length = sum([len(x) for x in packed])
384 packed[1] = struct.pack("!H", length)
385 return ''.join(packed)
386
387 @staticmethod
388 def unpack(reader):
389 obj = copy_ttl_in()
390 _type = reader.read("!H")[0]
391 assert(_type == 12)
392 _len = reader.read("!H")[0]
393 orig_reader = reader
394 reader = orig_reader.slice(_len, 4)
395 reader.skip(4)
396 return obj
397
398 def __eq__(self, other):
399 if type(self) != type(other): return False
400 return True
401
402 def pretty_print(self, q):
403 q.text("copy_ttl_in {")
404 with q.group():
405 with q.indent(2):
406 q.breakable()
407 q.breakable()
408 q.text('}')
409
410action.subtypes[12] = copy_ttl_in
411
412class copy_ttl_out(action):
413 type = 11
414
415 def __init__(self):
416 return
417
418 def pack(self):
419 packed = []
420 packed.append(struct.pack("!H", self.type))
421 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
422 packed.append('\x00' * 4)
423 length = sum([len(x) for x in packed])
424 packed[1] = struct.pack("!H", length)
425 return ''.join(packed)
426
427 @staticmethod
428 def unpack(reader):
429 obj = copy_ttl_out()
430 _type = reader.read("!H")[0]
431 assert(_type == 11)
432 _len = reader.read("!H")[0]
433 orig_reader = reader
434 reader = orig_reader.slice(_len, 4)
435 reader.skip(4)
436 return obj
437
438 def __eq__(self, other):
439 if type(self) != type(other): return False
440 return True
441
442 def pretty_print(self, q):
443 q.text("copy_ttl_out {")
444 with q.group():
445 with q.indent(2):
446 q.breakable()
447 q.breakable()
448 q.text('}')
449
450action.subtypes[11] = copy_ttl_out
451
452class dec_mpls_ttl(action):
453 type = 16
454
455 def __init__(self):
456 return
457
458 def pack(self):
459 packed = []
460 packed.append(struct.pack("!H", self.type))
461 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
462 packed.append('\x00' * 4)
463 length = sum([len(x) for x in packed])
464 packed[1] = struct.pack("!H", length)
465 return ''.join(packed)
466
467 @staticmethod
468 def unpack(reader):
469 obj = dec_mpls_ttl()
470 _type = reader.read("!H")[0]
471 assert(_type == 16)
472 _len = reader.read("!H")[0]
473 orig_reader = reader
474 reader = orig_reader.slice(_len, 4)
475 reader.skip(4)
476 return obj
477
478 def __eq__(self, other):
479 if type(self) != type(other): return False
480 return True
481
482 def pretty_print(self, q):
483 q.text("dec_mpls_ttl {")
484 with q.group():
485 with q.indent(2):
486 q.breakable()
487 q.breakable()
488 q.text('}')
489
490action.subtypes[16] = dec_mpls_ttl
491
492class dec_nw_ttl(action):
493 type = 24
494
495 def __init__(self):
496 return
497
498 def pack(self):
499 packed = []
500 packed.append(struct.pack("!H", self.type))
501 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
502 packed.append('\x00' * 4)
503 length = sum([len(x) for x in packed])
504 packed[1] = struct.pack("!H", length)
505 return ''.join(packed)
506
507 @staticmethod
508 def unpack(reader):
509 obj = dec_nw_ttl()
510 _type = reader.read("!H")[0]
511 assert(_type == 24)
512 _len = reader.read("!H")[0]
513 orig_reader = reader
514 reader = orig_reader.slice(_len, 4)
515 reader.skip(4)
516 return obj
517
518 def __eq__(self, other):
519 if type(self) != type(other): return False
520 return True
521
522 def pretty_print(self, q):
523 q.text("dec_nw_ttl {")
524 with q.group():
525 with q.indent(2):
526 q.breakable()
527 q.breakable()
528 q.text('}')
529
530action.subtypes[24] = dec_nw_ttl
531
532class group(action):
533 type = 22
534
535 def __init__(self, group_id=None):
536 if group_id != None:
537 self.group_id = group_id
538 else:
539 self.group_id = 0
540 return
541
542 def pack(self):
543 packed = []
544 packed.append(struct.pack("!H", self.type))
545 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
546 packed.append(struct.pack("!L", self.group_id))
547 length = sum([len(x) for x in packed])
548 packed[1] = struct.pack("!H", length)
549 return ''.join(packed)
550
551 @staticmethod
552 def unpack(reader):
553 obj = group()
554 _type = reader.read("!H")[0]
555 assert(_type == 22)
556 _len = reader.read("!H")[0]
557 orig_reader = reader
558 reader = orig_reader.slice(_len, 4)
559 obj.group_id = reader.read("!L")[0]
560 return obj
561
562 def __eq__(self, other):
563 if type(self) != type(other): return False
564 if self.group_id != other.group_id: return False
565 return True
566
567 def pretty_print(self, q):
568 q.text("group {")
569 with q.group():
570 with q.indent(2):
571 q.breakable()
572 q.text("group_id = ");
573 q.text("%#x" % self.group_id)
574 q.breakable()
575 q.text('}')
576
577action.subtypes[22] = group
578
579class nicira(experimenter):
580 subtypes = {}
581
582 type = 65535
583 experimenter = 8992
584
585 def __init__(self, subtype=None):
586 if subtype != None:
587 self.subtype = subtype
588 else:
589 self.subtype = 0
590 return
591
592 def pack(self):
593 packed = []
594 packed.append(struct.pack("!H", self.type))
595 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
596 packed.append(struct.pack("!L", self.experimenter))
597 packed.append(struct.pack("!H", self.subtype))
598 packed.append('\x00' * 2)
599 packed.append('\x00' * 4)
600 length = sum([len(x) for x in packed])
601 packed[1] = struct.pack("!H", length)
602 return ''.join(packed)
603
604 @staticmethod
605 def unpack(reader):
606 subtype, = reader.peek('!H', 8)
607 subclass = nicira.subtypes.get(subtype)
608 if subclass:
609 return subclass.unpack(reader)
610
611 obj = nicira()
612 _type = reader.read("!H")[0]
613 assert(_type == 65535)
614 _len = reader.read("!H")[0]
615 orig_reader = reader
616 reader = orig_reader.slice(_len, 4)
617 _experimenter = reader.read("!L")[0]
618 assert(_experimenter == 8992)
619 obj.subtype = reader.read("!H")[0]
620 reader.skip(2)
621 reader.skip(4)
622 return obj
623
624 def __eq__(self, other):
625 if type(self) != type(other): return False
626 if self.subtype != other.subtype: return False
627 return True
628
629 def pretty_print(self, q):
630 q.text("nicira {")
631 with q.group():
632 with q.indent(2):
633 q.breakable()
634 q.breakable()
635 q.text('}')
636
637experimenter.subtypes[8992] = nicira
638
639class nicira_dec_ttl(nicira):
640 type = 65535
641 experimenter = 8992
642 subtype = 18
643
644 def __init__(self):
645 return
646
647 def pack(self):
648 packed = []
649 packed.append(struct.pack("!H", self.type))
650 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
651 packed.append(struct.pack("!L", self.experimenter))
652 packed.append(struct.pack("!H", self.subtype))
653 packed.append('\x00' * 2)
654 packed.append('\x00' * 4)
655 length = sum([len(x) for x in packed])
656 packed[1] = struct.pack("!H", length)
657 return ''.join(packed)
658
659 @staticmethod
660 def unpack(reader):
661 obj = nicira_dec_ttl()
662 _type = reader.read("!H")[0]
663 assert(_type == 65535)
664 _len = reader.read("!H")[0]
665 orig_reader = reader
666 reader = orig_reader.slice(_len, 4)
667 _experimenter = reader.read("!L")[0]
668 assert(_experimenter == 8992)
669 _subtype = reader.read("!H")[0]
670 assert(_subtype == 18)
671 reader.skip(2)
672 reader.skip(4)
673 return obj
674
675 def __eq__(self, other):
676 if type(self) != type(other): return False
677 return True
678
679 def pretty_print(self, q):
680 q.text("nicira_dec_ttl {")
681 with q.group():
682 with q.indent(2):
683 q.breakable()
684 q.breakable()
685 q.text('}')
686
687nicira.subtypes[18] = nicira_dec_ttl
688
689class output(action):
690 type = 0
691
692 def __init__(self, port=None, max_len=None):
693 if port != None:
694 self.port = port
695 else:
696 self.port = 0
697 if max_len != None:
698 self.max_len = max_len
699 else:
700 self.max_len = 0
701 return
702
703 def pack(self):
704 packed = []
705 packed.append(struct.pack("!H", self.type))
706 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
707 packed.append(util.pack_port_no(self.port))
708 packed.append(struct.pack("!H", self.max_len))
709 packed.append('\x00' * 6)
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 = output()
717 _type = reader.read("!H")[0]
718 assert(_type == 0)
719 _len = reader.read("!H")[0]
720 orig_reader = reader
721 reader = orig_reader.slice(_len, 4)
722 obj.port = util.unpack_port_no(reader)
723 obj.max_len = reader.read("!H")[0]
724 reader.skip(6)
725 return obj
726
727 def __eq__(self, other):
728 if type(self) != type(other): return False
729 if self.port != other.port: return False
730 if self.max_len != other.max_len: return False
731 return True
732
733 def pretty_print(self, q):
734 q.text("output {")
735 with q.group():
736 with q.indent(2):
737 q.breakable()
738 q.text("port = ");
739 q.text(util.pretty_port(self.port))
740 q.text(","); q.breakable()
741 q.text("max_len = ");
742 q.text("%#x" % self.max_len)
743 q.breakable()
744 q.text('}')
745
746action.subtypes[0] = output
747
748class pop_mpls(action):
749 type = 20
750
751 def __init__(self, ethertype=None):
752 if ethertype != None:
753 self.ethertype = ethertype
754 else:
755 self.ethertype = 0
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
762 packed.append(struct.pack("!H", self.ethertype))
763 packed.append('\x00' * 2)
764 length = sum([len(x) for x in packed])
765 packed[1] = struct.pack("!H", length)
766 return ''.join(packed)
767
768 @staticmethod
769 def unpack(reader):
770 obj = pop_mpls()
771 _type = reader.read("!H")[0]
772 assert(_type == 20)
773 _len = reader.read("!H")[0]
774 orig_reader = reader
775 reader = orig_reader.slice(_len, 4)
776 obj.ethertype = reader.read("!H")[0]
777 reader.skip(2)
778 return obj
779
780 def __eq__(self, other):
781 if type(self) != type(other): return False
782 if self.ethertype != other.ethertype: return False
783 return True
784
785 def pretty_print(self, q):
786 q.text("pop_mpls {")
787 with q.group():
788 with q.indent(2):
789 q.breakable()
790 q.text("ethertype = ");
791 q.text("%#x" % self.ethertype)
792 q.breakable()
793 q.text('}')
794
795action.subtypes[20] = pop_mpls
796
797class pop_vlan(action):
798 type = 18
799
800 def __init__(self):
801 return
802
803 def pack(self):
804 packed = []
805 packed.append(struct.pack("!H", self.type))
806 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
807 packed.append('\x00' * 4)
808 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 = pop_vlan()
815 _type = reader.read("!H")[0]
816 assert(_type == 18)
817 _len = reader.read("!H")[0]
818 orig_reader = reader
819 reader = orig_reader.slice(_len, 4)
820 reader.skip(4)
821 return obj
822
823 def __eq__(self, other):
824 if type(self) != type(other): return False
825 return True
826
827 def pretty_print(self, q):
828 q.text("pop_vlan {")
829 with q.group():
830 with q.indent(2):
831 q.breakable()
832 q.breakable()
833 q.text('}')
834
835action.subtypes[18] = pop_vlan
836
837class push_mpls(action):
838 type = 19
839
840 def __init__(self, ethertype=None):
841 if ethertype != None:
842 self.ethertype = ethertype
843 else:
844 self.ethertype = 0
845 return
846
847 def pack(self):
848 packed = []
849 packed.append(struct.pack("!H", self.type))
850 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
851 packed.append(struct.pack("!H", self.ethertype))
852 packed.append('\x00' * 2)
853 length = sum([len(x) for x in packed])
854 packed[1] = struct.pack("!H", length)
855 return ''.join(packed)
856
857 @staticmethod
858 def unpack(reader):
859 obj = push_mpls()
860 _type = reader.read("!H")[0]
861 assert(_type == 19)
862 _len = reader.read("!H")[0]
863 orig_reader = reader
864 reader = orig_reader.slice(_len, 4)
865 obj.ethertype = reader.read("!H")[0]
866 reader.skip(2)
867 return obj
868
869 def __eq__(self, other):
870 if type(self) != type(other): return False
871 if self.ethertype != other.ethertype: return False
872 return True
873
874 def pretty_print(self, q):
875 q.text("push_mpls {")
876 with q.group():
877 with q.indent(2):
878 q.breakable()
879 q.text("ethertype = ");
880 q.text("%#x" % self.ethertype)
881 q.breakable()
882 q.text('}')
883
884action.subtypes[19] = push_mpls
885
886class push_vlan(action):
887 type = 17
888
889 def __init__(self, ethertype=None):
890 if ethertype != None:
891 self.ethertype = ethertype
892 else:
893 self.ethertype = 0
894 return
895
896 def pack(self):
897 packed = []
898 packed.append(struct.pack("!H", self.type))
899 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
900 packed.append(struct.pack("!H", self.ethertype))
901 packed.append('\x00' * 2)
902 length = sum([len(x) for x in packed])
903 packed[1] = struct.pack("!H", length)
904 return ''.join(packed)
905
906 @staticmethod
907 def unpack(reader):
908 obj = push_vlan()
909 _type = reader.read("!H")[0]
910 assert(_type == 17)
911 _len = reader.read("!H")[0]
912 orig_reader = reader
913 reader = orig_reader.slice(_len, 4)
914 obj.ethertype = reader.read("!H")[0]
915 reader.skip(2)
916 return obj
917
918 def __eq__(self, other):
919 if type(self) != type(other): return False
920 if self.ethertype != other.ethertype: return False
921 return True
922
923 def pretty_print(self, q):
924 q.text("push_vlan {")
925 with q.group():
926 with q.indent(2):
927 q.breakable()
928 q.text("ethertype = ");
929 q.text("%#x" % self.ethertype)
930 q.breakable()
931 q.text('}')
932
933action.subtypes[17] = push_vlan
934
935class set_dl_dst(action):
936 type = 4
937
938 def __init__(self, dl_addr=None):
939 if dl_addr != None:
940 self.dl_addr = dl_addr
941 else:
942 self.dl_addr = [0,0,0,0,0,0]
943 return
944
945 def pack(self):
946 packed = []
947 packed.append(struct.pack("!H", self.type))
948 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
949 packed.append(struct.pack("!6B", *self.dl_addr))
950 packed.append('\x00' * 6)
951 length = sum([len(x) for x in packed])
952 packed[1] = struct.pack("!H", length)
953 return ''.join(packed)
954
955 @staticmethod
956 def unpack(reader):
957 obj = set_dl_dst()
958 _type = reader.read("!H")[0]
959 assert(_type == 4)
960 _len = reader.read("!H")[0]
961 orig_reader = reader
962 reader = orig_reader.slice(_len, 4)
963 obj.dl_addr = list(reader.read('!6B'))
964 reader.skip(6)
965 return obj
966
967 def __eq__(self, other):
968 if type(self) != type(other): return False
969 if self.dl_addr != other.dl_addr: return False
970 return True
971
972 def pretty_print(self, q):
973 q.text("set_dl_dst {")
974 with q.group():
975 with q.indent(2):
976 q.breakable()
977 q.text("dl_addr = ");
978 q.text(util.pretty_mac(self.dl_addr))
979 q.breakable()
980 q.text('}')
981
982action.subtypes[4] = set_dl_dst
983
984class set_dl_src(action):
985 type = 3
986
987 def __init__(self, dl_addr=None):
988 if dl_addr != None:
989 self.dl_addr = dl_addr
990 else:
991 self.dl_addr = [0,0,0,0,0,0]
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 packed.append(struct.pack("!6B", *self.dl_addr))
999 packed.append('\x00' * 6)
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_dl_src()
1007 _type = reader.read("!H")[0]
1008 assert(_type == 3)
1009 _len = reader.read("!H")[0]
1010 orig_reader = reader
1011 reader = orig_reader.slice(_len, 4)
1012 obj.dl_addr = list(reader.read('!6B'))
1013 reader.skip(6)
1014 return obj
1015
1016 def __eq__(self, other):
1017 if type(self) != type(other): return False
1018 if self.dl_addr != other.dl_addr: return False
1019 return True
1020
1021 def pretty_print(self, q):
1022 q.text("set_dl_src {")
1023 with q.group():
1024 with q.indent(2):
1025 q.breakable()
1026 q.text("dl_addr = ");
1027 q.text(util.pretty_mac(self.dl_addr))
1028 q.breakable()
1029 q.text('}')
1030
1031action.subtypes[3] = set_dl_src
1032
1033class set_mpls_label(action):
1034 type = 13
1035
1036 def __init__(self, mpls_label=None):
1037 if mpls_label != None:
1038 self.mpls_label = mpls_label
1039 else:
1040 self.mpls_label = 0
1041 return
1042
1043 def pack(self):
1044 packed = []
1045 packed.append(struct.pack("!H", self.type))
1046 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1047 packed.append(struct.pack("!L", self.mpls_label))
1048 length = sum([len(x) for x in packed])
1049 packed[1] = struct.pack("!H", length)
1050 return ''.join(packed)
1051
1052 @staticmethod
1053 def unpack(reader):
1054 obj = set_mpls_label()
1055 _type = reader.read("!H")[0]
1056 assert(_type == 13)
1057 _len = reader.read("!H")[0]
1058 orig_reader = reader
1059 reader = orig_reader.slice(_len, 4)
1060 obj.mpls_label = reader.read("!L")[0]
1061 return obj
1062
1063 def __eq__(self, other):
1064 if type(self) != type(other): return False
1065 if self.mpls_label != other.mpls_label: return False
1066 return True
1067
1068 def pretty_print(self, q):
1069 q.text("set_mpls_label {")
1070 with q.group():
1071 with q.indent(2):
1072 q.breakable()
1073 q.text("mpls_label = ");
1074 q.text("%#x" % self.mpls_label)
1075 q.breakable()
1076 q.text('}')
1077
1078action.subtypes[13] = set_mpls_label
1079
1080class set_mpls_tc(action):
1081 type = 14
1082
1083 def __init__(self, mpls_tc=None):
1084 if mpls_tc != None:
1085 self.mpls_tc = mpls_tc
1086 else:
1087 self.mpls_tc = 0
1088 return
1089
1090 def pack(self):
1091 packed = []
1092 packed.append(struct.pack("!H", self.type))
1093 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1094 packed.append(struct.pack("!B", self.mpls_tc))
1095 packed.append('\x00' * 3)
1096 length = sum([len(x) for x in packed])
1097 packed[1] = struct.pack("!H", length)
1098 return ''.join(packed)
1099
1100 @staticmethod
1101 def unpack(reader):
1102 obj = set_mpls_tc()
1103 _type = reader.read("!H")[0]
1104 assert(_type == 14)
1105 _len = reader.read("!H")[0]
1106 orig_reader = reader
1107 reader = orig_reader.slice(_len, 4)
1108 obj.mpls_tc = reader.read("!B")[0]
1109 reader.skip(3)
1110 return obj
1111
1112 def __eq__(self, other):
1113 if type(self) != type(other): return False
1114 if self.mpls_tc != other.mpls_tc: return False
1115 return True
1116
1117 def pretty_print(self, q):
1118 q.text("set_mpls_tc {")
1119 with q.group():
1120 with q.indent(2):
1121 q.breakable()
1122 q.text("mpls_tc = ");
1123 q.text("%#x" % self.mpls_tc)
1124 q.breakable()
1125 q.text('}')
1126
1127action.subtypes[14] = set_mpls_tc
1128
1129class set_mpls_ttl(action):
1130 type = 15
1131
1132 def __init__(self, mpls_ttl=None):
1133 if mpls_ttl != None:
1134 self.mpls_ttl = mpls_ttl
1135 else:
1136 self.mpls_ttl = 0
1137 return
1138
1139 def pack(self):
1140 packed = []
1141 packed.append(struct.pack("!H", self.type))
1142 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1143 packed.append(struct.pack("!B", self.mpls_ttl))
1144 packed.append('\x00' * 3)
1145 length = sum([len(x) for x in packed])
1146 packed[1] = struct.pack("!H", length)
1147 return ''.join(packed)
1148
1149 @staticmethod
1150 def unpack(reader):
1151 obj = set_mpls_ttl()
1152 _type = reader.read("!H")[0]
1153 assert(_type == 15)
1154 _len = reader.read("!H")[0]
1155 orig_reader = reader
1156 reader = orig_reader.slice(_len, 4)
1157 obj.mpls_ttl = reader.read("!B")[0]
1158 reader.skip(3)
1159 return obj
1160
1161 def __eq__(self, other):
1162 if type(self) != type(other): return False
1163 if self.mpls_ttl != other.mpls_ttl: return False
1164 return True
1165
1166 def pretty_print(self, q):
1167 q.text("set_mpls_ttl {")
1168 with q.group():
1169 with q.indent(2):
1170 q.breakable()
1171 q.text("mpls_ttl = ");
1172 q.text("%#x" % self.mpls_ttl)
1173 q.breakable()
1174 q.text('}')
1175
1176action.subtypes[15] = set_mpls_ttl
1177
1178class set_nw_dst(action):
1179 type = 6
1180
1181 def __init__(self, nw_addr=None):
1182 if nw_addr != None:
1183 self.nw_addr = nw_addr
1184 else:
1185 self.nw_addr = 0
1186 return
1187
1188 def pack(self):
1189 packed = []
1190 packed.append(struct.pack("!H", self.type))
1191 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1192 packed.append(struct.pack("!L", self.nw_addr))
1193 length = sum([len(x) for x in packed])
1194 packed[1] = struct.pack("!H", length)
1195 return ''.join(packed)
1196
1197 @staticmethod
1198 def unpack(reader):
1199 obj = set_nw_dst()
1200 _type = reader.read("!H")[0]
1201 assert(_type == 6)
1202 _len = reader.read("!H")[0]
1203 orig_reader = reader
1204 reader = orig_reader.slice(_len, 4)
1205 obj.nw_addr = reader.read("!L")[0]
1206 return obj
1207
1208 def __eq__(self, other):
1209 if type(self) != type(other): return False
1210 if self.nw_addr != other.nw_addr: return False
1211 return True
1212
1213 def pretty_print(self, q):
1214 q.text("set_nw_dst {")
1215 with q.group():
1216 with q.indent(2):
1217 q.breakable()
1218 q.text("nw_addr = ");
1219 q.text("%#x" % self.nw_addr)
1220 q.breakable()
1221 q.text('}')
1222
1223action.subtypes[6] = set_nw_dst
1224
1225class set_nw_ecn(action):
1226 type = 8
1227
1228 def __init__(self, nw_ecn=None):
1229 if nw_ecn != None:
1230 self.nw_ecn = nw_ecn
1231 else:
1232 self.nw_ecn = 0
1233 return
1234
1235 def pack(self):
1236 packed = []
1237 packed.append(struct.pack("!H", self.type))
1238 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1239 packed.append(struct.pack("!B", self.nw_ecn))
1240 packed.append('\x00' * 3)
1241 length = sum([len(x) for x in packed])
1242 packed[1] = struct.pack("!H", length)
1243 return ''.join(packed)
1244
1245 @staticmethod
1246 def unpack(reader):
1247 obj = set_nw_ecn()
1248 _type = reader.read("!H")[0]
1249 assert(_type == 8)
1250 _len = reader.read("!H")[0]
1251 orig_reader = reader
1252 reader = orig_reader.slice(_len, 4)
1253 obj.nw_ecn = reader.read("!B")[0]
1254 reader.skip(3)
1255 return obj
1256
1257 def __eq__(self, other):
1258 if type(self) != type(other): return False
1259 if self.nw_ecn != other.nw_ecn: return False
1260 return True
1261
1262 def pretty_print(self, q):
1263 q.text("set_nw_ecn {")
1264 with q.group():
1265 with q.indent(2):
1266 q.breakable()
1267 q.text("nw_ecn = ");
1268 q.text("%#x" % self.nw_ecn)
1269 q.breakable()
1270 q.text('}')
1271
1272action.subtypes[8] = set_nw_ecn
1273
1274class set_nw_src(action):
1275 type = 5
1276
1277 def __init__(self, nw_addr=None):
1278 if nw_addr != None:
1279 self.nw_addr = nw_addr
1280 else:
1281 self.nw_addr = 0
1282 return
1283
1284 def pack(self):
1285 packed = []
1286 packed.append(struct.pack("!H", self.type))
1287 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1288 packed.append(struct.pack("!L", self.nw_addr))
1289 length = sum([len(x) for x in packed])
1290 packed[1] = struct.pack("!H", length)
1291 return ''.join(packed)
1292
1293 @staticmethod
1294 def unpack(reader):
1295 obj = set_nw_src()
1296 _type = reader.read("!H")[0]
1297 assert(_type == 5)
1298 _len = reader.read("!H")[0]
1299 orig_reader = reader
1300 reader = orig_reader.slice(_len, 4)
1301 obj.nw_addr = reader.read("!L")[0]
1302 return obj
1303
1304 def __eq__(self, other):
1305 if type(self) != type(other): return False
1306 if self.nw_addr != other.nw_addr: return False
1307 return True
1308
1309 def pretty_print(self, q):
1310 q.text("set_nw_src {")
1311 with q.group():
1312 with q.indent(2):
1313 q.breakable()
1314 q.text("nw_addr = ");
1315 q.text("%#x" % self.nw_addr)
1316 q.breakable()
1317 q.text('}')
1318
1319action.subtypes[5] = set_nw_src
1320
1321class set_nw_tos(action):
1322 type = 7
1323
1324 def __init__(self, nw_tos=None):
1325 if nw_tos != None:
1326 self.nw_tos = nw_tos
1327 else:
1328 self.nw_tos = 0
1329 return
1330
1331 def pack(self):
1332 packed = []
1333 packed.append(struct.pack("!H", self.type))
1334 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1335 packed.append(struct.pack("!B", self.nw_tos))
1336 packed.append('\x00' * 3)
1337 length = sum([len(x) for x in packed])
1338 packed[1] = struct.pack("!H", length)
1339 return ''.join(packed)
1340
1341 @staticmethod
1342 def unpack(reader):
1343 obj = set_nw_tos()
1344 _type = reader.read("!H")[0]
1345 assert(_type == 7)
1346 _len = reader.read("!H")[0]
1347 orig_reader = reader
1348 reader = orig_reader.slice(_len, 4)
1349 obj.nw_tos = reader.read("!B")[0]
1350 reader.skip(3)
1351 return obj
1352
1353 def __eq__(self, other):
1354 if type(self) != type(other): return False
1355 if self.nw_tos != other.nw_tos: return False
1356 return True
1357
1358 def pretty_print(self, q):
1359 q.text("set_nw_tos {")
1360 with q.group():
1361 with q.indent(2):
1362 q.breakable()
1363 q.text("nw_tos = ");
1364 q.text("%#x" % self.nw_tos)
1365 q.breakable()
1366 q.text('}')
1367
1368action.subtypes[7] = set_nw_tos
1369
1370class set_nw_ttl(action):
1371 type = 23
1372
1373 def __init__(self, nw_ttl=None):
1374 if nw_ttl != None:
1375 self.nw_ttl = nw_ttl
1376 else:
1377 self.nw_ttl = 0
1378 return
1379
1380 def pack(self):
1381 packed = []
1382 packed.append(struct.pack("!H", self.type))
1383 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1384 packed.append(struct.pack("!B", self.nw_ttl))
1385 packed.append('\x00' * 3)
1386 length = sum([len(x) for x in packed])
1387 packed[1] = struct.pack("!H", length)
1388 return ''.join(packed)
1389
1390 @staticmethod
1391 def unpack(reader):
1392 obj = set_nw_ttl()
1393 _type = reader.read("!H")[0]
1394 assert(_type == 23)
1395 _len = reader.read("!H")[0]
1396 orig_reader = reader
1397 reader = orig_reader.slice(_len, 4)
1398 obj.nw_ttl = reader.read("!B")[0]
1399 reader.skip(3)
1400 return obj
1401
1402 def __eq__(self, other):
1403 if type(self) != type(other): return False
1404 if self.nw_ttl != other.nw_ttl: return False
1405 return True
1406
1407 def pretty_print(self, q):
1408 q.text("set_nw_ttl {")
1409 with q.group():
1410 with q.indent(2):
1411 q.breakable()
1412 q.text("nw_ttl = ");
1413 q.text("%#x" % self.nw_ttl)
1414 q.breakable()
1415 q.text('}')
1416
1417action.subtypes[23] = set_nw_ttl
1418
1419class set_queue(action):
1420 type = 21
1421
1422 def __init__(self, queue_id=None):
1423 if queue_id != None:
1424 self.queue_id = queue_id
1425 else:
1426 self.queue_id = 0
1427 return
1428
1429 def pack(self):
1430 packed = []
1431 packed.append(struct.pack("!H", self.type))
1432 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1433 packed.append(struct.pack("!L", self.queue_id))
1434 length = sum([len(x) for x in packed])
1435 packed[1] = struct.pack("!H", length)
1436 return ''.join(packed)
1437
1438 @staticmethod
1439 def unpack(reader):
1440 obj = set_queue()
1441 _type = reader.read("!H")[0]
1442 assert(_type == 21)
1443 _len = reader.read("!H")[0]
1444 orig_reader = reader
1445 reader = orig_reader.slice(_len, 4)
1446 obj.queue_id = reader.read("!L")[0]
1447 return obj
1448
1449 def __eq__(self, other):
1450 if type(self) != type(other): return False
1451 if self.queue_id != other.queue_id: return False
1452 return True
1453
1454 def pretty_print(self, q):
1455 q.text("set_queue {")
1456 with q.group():
1457 with q.indent(2):
1458 q.breakable()
1459 q.text("queue_id = ");
1460 q.text("%#x" % self.queue_id)
1461 q.breakable()
1462 q.text('}')
1463
1464action.subtypes[21] = set_queue
1465
1466class set_tp_dst(action):
1467 type = 10
1468
1469 def __init__(self, tp_port=None):
1470 if tp_port != None:
1471 self.tp_port = tp_port
1472 else:
1473 self.tp_port = 0
1474 return
1475
1476 def pack(self):
1477 packed = []
1478 packed.append(struct.pack("!H", self.type))
1479 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1480 packed.append(struct.pack("!H", self.tp_port))
1481 packed.append('\x00' * 2)
1482 length = sum([len(x) for x in packed])
1483 packed[1] = struct.pack("!H", length)
1484 return ''.join(packed)
1485
1486 @staticmethod
1487 def unpack(reader):
1488 obj = set_tp_dst()
1489 _type = reader.read("!H")[0]
1490 assert(_type == 10)
1491 _len = reader.read("!H")[0]
1492 orig_reader = reader
1493 reader = orig_reader.slice(_len, 4)
1494 obj.tp_port = reader.read("!H")[0]
1495 reader.skip(2)
1496 return obj
1497
1498 def __eq__(self, other):
1499 if type(self) != type(other): return False
1500 if self.tp_port != other.tp_port: return False
1501 return True
1502
1503 def pretty_print(self, q):
1504 q.text("set_tp_dst {")
1505 with q.group():
1506 with q.indent(2):
1507 q.breakable()
1508 q.text("tp_port = ");
1509 q.text("%#x" % self.tp_port)
1510 q.breakable()
1511 q.text('}')
1512
1513action.subtypes[10] = set_tp_dst
1514
1515class set_tp_src(action):
1516 type = 9
1517
1518 def __init__(self, tp_port=None):
1519 if tp_port != None:
1520 self.tp_port = tp_port
1521 else:
1522 self.tp_port = 0
1523 return
1524
1525 def pack(self):
1526 packed = []
1527 packed.append(struct.pack("!H", self.type))
1528 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1529 packed.append(struct.pack("!H", self.tp_port))
1530 packed.append('\x00' * 2)
1531 length = sum([len(x) for x in packed])
1532 packed[1] = struct.pack("!H", length)
1533 return ''.join(packed)
1534
1535 @staticmethod
1536 def unpack(reader):
1537 obj = set_tp_src()
1538 _type = reader.read("!H")[0]
1539 assert(_type == 9)
1540 _len = reader.read("!H")[0]
1541 orig_reader = reader
1542 reader = orig_reader.slice(_len, 4)
1543 obj.tp_port = reader.read("!H")[0]
1544 reader.skip(2)
1545 return obj
1546
1547 def __eq__(self, other):
1548 if type(self) != type(other): return False
1549 if self.tp_port != other.tp_port: return False
1550 return True
1551
1552 def pretty_print(self, q):
1553 q.text("set_tp_src {")
1554 with q.group():
1555 with q.indent(2):
1556 q.breakable()
1557 q.text("tp_port = ");
1558 q.text("%#x" % self.tp_port)
1559 q.breakable()
1560 q.text('}')
1561
1562action.subtypes[9] = set_tp_src
1563
1564class set_vlan_pcp(action):
1565 type = 2
1566
1567 def __init__(self, vlan_pcp=None):
1568 if vlan_pcp != None:
1569 self.vlan_pcp = vlan_pcp
1570 else:
1571 self.vlan_pcp = 0
1572 return
1573
1574 def pack(self):
1575 packed = []
1576 packed.append(struct.pack("!H", self.type))
1577 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1578 packed.append(struct.pack("!B", self.vlan_pcp))
1579 packed.append('\x00' * 3)
1580 length = sum([len(x) for x in packed])
1581 packed[1] = struct.pack("!H", length)
1582 return ''.join(packed)
1583
1584 @staticmethod
1585 def unpack(reader):
1586 obj = set_vlan_pcp()
1587 _type = reader.read("!H")[0]
1588 assert(_type == 2)
1589 _len = reader.read("!H")[0]
1590 orig_reader = reader
1591 reader = orig_reader.slice(_len, 4)
1592 obj.vlan_pcp = reader.read("!B")[0]
1593 reader.skip(3)
1594 return obj
1595
1596 def __eq__(self, other):
1597 if type(self) != type(other): return False
1598 if self.vlan_pcp != other.vlan_pcp: return False
1599 return True
1600
1601 def pretty_print(self, q):
1602 q.text("set_vlan_pcp {")
1603 with q.group():
1604 with q.indent(2):
1605 q.breakable()
1606 q.text("vlan_pcp = ");
1607 q.text("%#x" % self.vlan_pcp)
1608 q.breakable()
1609 q.text('}')
1610
1611action.subtypes[2] = set_vlan_pcp
1612
1613class set_vlan_vid(action):
1614 type = 1
1615
1616 def __init__(self, vlan_vid=None):
1617 if vlan_vid != None:
1618 self.vlan_vid = vlan_vid
1619 else:
1620 self.vlan_vid = 0
1621 return
1622
1623 def pack(self):
1624 packed = []
1625 packed.append(struct.pack("!H", self.type))
1626 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
1627 packed.append(struct.pack("!H", self.vlan_vid))
1628 packed.append('\x00' * 2)
1629 length = sum([len(x) for x in packed])
1630 packed[1] = struct.pack("!H", length)
1631 return ''.join(packed)
1632
1633 @staticmethod
1634 def unpack(reader):
1635 obj = set_vlan_vid()
1636 _type = reader.read("!H")[0]
1637 assert(_type == 1)
1638 _len = reader.read("!H")[0]
1639 orig_reader = reader
1640 reader = orig_reader.slice(_len, 4)
1641 obj.vlan_vid = reader.read("!H")[0]
1642 reader.skip(2)
1643 return obj
1644
1645 def __eq__(self, other):
1646 if type(self) != type(other): return False
1647 if self.vlan_vid != other.vlan_vid: return False
1648 return True
1649
1650 def pretty_print(self, q):
1651 q.text("set_vlan_vid {")
1652 with q.group():
1653 with q.indent(2):
1654 q.breakable()
1655 q.text("vlan_vid = ");
1656 q.text("%#x" % self.vlan_vid)
1657 q.breakable()
1658 q.text('}')
1659
1660action.subtypes[1] = set_vlan_vid
1661
1662