blob: 71fff545f93bd4efef7ef765f81c80dd791500c6 [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
11import const
12import port_desc_prop
Rich Laneccd32ed2014-11-10 17:48:24 -080013import bsn_tlv
Rich Lane2e079da2014-10-29 15:30:24 -070014import meter_band
15import table_mod_prop
16import instruction
17import queue_desc_prop
18import oxm
19import bundle_prop
20import common
21import instruction_id
22import action
23import role_prop
24import message
25import queue_stats_prop
26import port_stats_prop
27import port_mod_prop
28import async_config_prop
29import action_id
30import util
31import loxi.generic_util
32
33class instruction_id(loxi.OFObject):
34 subtypes = {}
35
36
37 def __init__(self, type=None):
38 if type != None:
39 self.type = type
40 else:
41 self.type = 0
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!H", self.type))
47 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
48 length = sum([len(x) for x in packed])
49 packed[1] = struct.pack("!H", length)
50 return ''.join(packed)
51
52 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
55 subclass = instruction_id.subtypes.get(subtype)
56 if subclass:
57 return subclass.unpack(reader)
58
59 obj = instruction_id()
60 obj.type = reader.read("!H")[0]
61 _len = reader.read("!H")[0]
62 orig_reader = reader
63 reader = orig_reader.slice(_len - (2 + 2))
64 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("instruction_id {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.breakable()
77 q.text('}')
78
79
80class apply_actions(instruction_id):
81 type = 4
82
83 def __init__(self):
84 return
85
86 def pack(self):
87 packed = []
88 packed.append(struct.pack("!H", self.type))
89 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
90 length = sum([len(x) for x in packed])
91 packed[1] = struct.pack("!H", length)
92 return ''.join(packed)
93
94 @staticmethod
95 def unpack(reader):
96 obj = apply_actions()
97 _type = reader.read("!H")[0]
98 assert(_type == 4)
99 _len = reader.read("!H")[0]
100 orig_reader = reader
101 reader = orig_reader.slice(_len - (2 + 2))
102 return obj
103
104 def __eq__(self, other):
105 if type(self) != type(other): return False
106 return True
107
108 def pretty_print(self, q):
109 q.text("apply_actions {")
110 with q.group():
111 with q.indent(2):
112 q.breakable()
113 q.breakable()
114 q.text('}')
115
116instruction_id.subtypes[4] = apply_actions
117
Rich Lane2e079da2014-10-29 15:30:24 -0700118class experimenter(instruction_id):
119 subtypes = {}
120
121 type = 65535
122
123 def __init__(self, experimenter=None):
124 if experimenter != None:
125 self.experimenter = experimenter
126 else:
127 self.experimenter = 0
128 return
129
130 def pack(self):
131 packed = []
132 packed.append(struct.pack("!H", self.type))
133 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
134 packed.append(struct.pack("!L", self.experimenter))
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', 4)
142 subclass = experimenter.subtypes.get(subtype)
143 if subclass:
144 return subclass.unpack(reader)
145
146 obj = experimenter()
147 _type = reader.read("!H")[0]
148 assert(_type == 65535)
149 _len = reader.read("!H")[0]
150 orig_reader = reader
151 reader = orig_reader.slice(_len - (2 + 2))
152 obj.experimenter = reader.read("!L")[0]
153 return obj
154
155 def __eq__(self, other):
156 if type(self) != type(other): return False
157 if self.experimenter != other.experimenter: return False
158 return True
159
160 def pretty_print(self, q):
161 q.text("experimenter {")
162 with q.group():
163 with q.indent(2):
164 q.breakable()
165 q.breakable()
166 q.text('}')
167
168instruction_id.subtypes[65535] = experimenter
169
Rich Laneccd32ed2014-11-10 17:48:24 -0800170class bsn(experimenter):
171 subtypes = {}
172
173 type = 65535
174 experimenter = 6035143
175
176 def __init__(self, subtype=None):
177 if subtype != None:
178 self.subtype = subtype
179 else:
180 self.subtype = 0
181 return
182
183 def pack(self):
184 packed = []
185 packed.append(struct.pack("!H", self.type))
186 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
187 packed.append(struct.pack("!L", self.experimenter))
188 packed.append(struct.pack("!L", self.subtype))
189 length = sum([len(x) for x in packed])
190 packed[1] = struct.pack("!H", length)
191 return ''.join(packed)
192
193 @staticmethod
194 def unpack(reader):
195 subtype, = reader.peek('!L', 8)
196 subclass = bsn.subtypes.get(subtype)
197 if subclass:
198 return subclass.unpack(reader)
199
200 obj = bsn()
201 _type = reader.read("!H")[0]
202 assert(_type == 65535)
203 _len = reader.read("!H")[0]
204 orig_reader = reader
205 reader = orig_reader.slice(_len - (2 + 2))
206 _experimenter = reader.read("!L")[0]
207 assert(_experimenter == 6035143)
208 obj.subtype = reader.read("!L")[0]
209 return obj
210
211 def __eq__(self, other):
212 if type(self) != type(other): return False
213 if self.subtype != other.subtype: return False
214 return True
215
216 def pretty_print(self, q):
217 q.text("bsn {")
218 with q.group():
219 with q.indent(2):
220 q.breakable()
221 q.breakable()
222 q.text('}')
223
224experimenter.subtypes[6035143] = bsn
225
226class bsn_arp_offload(bsn):
227 type = 65535
228 experimenter = 6035143
229 subtype = 1
230
231 def __init__(self):
232 return
233
234 def pack(self):
235 packed = []
236 packed.append(struct.pack("!H", self.type))
237 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
238 packed.append(struct.pack("!L", self.experimenter))
239 packed.append(struct.pack("!L", self.subtype))
240 length = sum([len(x) for x in packed])
241 packed[1] = struct.pack("!H", length)
242 return ''.join(packed)
243
244 @staticmethod
245 def unpack(reader):
246 obj = bsn_arp_offload()
247 _type = reader.read("!H")[0]
248 assert(_type == 65535)
249 _len = reader.read("!H")[0]
250 orig_reader = reader
251 reader = orig_reader.slice(_len - (2 + 2))
252 _experimenter = reader.read("!L")[0]
253 assert(_experimenter == 6035143)
254 _subtype = reader.read("!L")[0]
255 assert(_subtype == 1)
256 return obj
257
258 def __eq__(self, other):
259 if type(self) != type(other): return False
260 return True
261
262 def pretty_print(self, q):
263 q.text("bsn_arp_offload {")
264 with q.group():
265 with q.indent(2):
266 q.breakable()
267 q.breakable()
268 q.text('}')
269
270bsn.subtypes[1] = bsn_arp_offload
271
272class bsn_deny(bsn):
273 type = 65535
274 experimenter = 6035143
275 subtype = 5
276
277 def __init__(self):
278 return
279
280 def pack(self):
281 packed = []
282 packed.append(struct.pack("!H", self.type))
283 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
284 packed.append(struct.pack("!L", self.experimenter))
285 packed.append(struct.pack("!L", self.subtype))
286 length = sum([len(x) for x in packed])
287 packed[1] = struct.pack("!H", length)
288 return ''.join(packed)
289
290 @staticmethod
291 def unpack(reader):
292 obj = bsn_deny()
293 _type = reader.read("!H")[0]
294 assert(_type == 65535)
295 _len = reader.read("!H")[0]
296 orig_reader = reader
297 reader = orig_reader.slice(_len - (2 + 2))
298 _experimenter = reader.read("!L")[0]
299 assert(_experimenter == 6035143)
300 _subtype = reader.read("!L")[0]
301 assert(_subtype == 5)
302 return obj
303
304 def __eq__(self, other):
305 if type(self) != type(other): return False
306 return True
307
308 def pretty_print(self, q):
309 q.text("bsn_deny {")
310 with q.group():
311 with q.indent(2):
312 q.breakable()
313 q.breakable()
314 q.text('}')
315
316bsn.subtypes[5] = bsn_deny
317
318class bsn_dhcp_offload(bsn):
319 type = 65535
320 experimenter = 6035143
321 subtype = 2
322
323 def __init__(self):
324 return
325
326 def pack(self):
327 packed = []
328 packed.append(struct.pack("!H", self.type))
329 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
330 packed.append(struct.pack("!L", self.experimenter))
331 packed.append(struct.pack("!L", self.subtype))
332 length = sum([len(x) for x in packed])
333 packed[1] = struct.pack("!H", length)
334 return ''.join(packed)
335
336 @staticmethod
337 def unpack(reader):
338 obj = bsn_dhcp_offload()
339 _type = reader.read("!H")[0]
340 assert(_type == 65535)
341 _len = reader.read("!H")[0]
342 orig_reader = reader
343 reader = orig_reader.slice(_len - (2 + 2))
344 _experimenter = reader.read("!L")[0]
345 assert(_experimenter == 6035143)
346 _subtype = reader.read("!L")[0]
347 assert(_subtype == 2)
348 return obj
349
350 def __eq__(self, other):
351 if type(self) != type(other): return False
352 return True
353
354 def pretty_print(self, q):
355 q.text("bsn_dhcp_offload {")
356 with q.group():
357 with q.indent(2):
358 q.breakable()
359 q.breakable()
360 q.text('}')
361
362bsn.subtypes[2] = bsn_dhcp_offload
363
364class bsn_disable_src_mac_check(bsn):
365 type = 65535
366 experimenter = 6035143
367 subtype = 0
368
369 def __init__(self):
370 return
371
372 def pack(self):
373 packed = []
374 packed.append(struct.pack("!H", self.type))
375 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
376 packed.append(struct.pack("!L", self.experimenter))
377 packed.append(struct.pack("!L", self.subtype))
378 length = sum([len(x) for x in packed])
379 packed[1] = struct.pack("!H", length)
380 return ''.join(packed)
381
382 @staticmethod
383 def unpack(reader):
384 obj = bsn_disable_src_mac_check()
385 _type = reader.read("!H")[0]
386 assert(_type == 65535)
387 _len = reader.read("!H")[0]
388 orig_reader = reader
389 reader = orig_reader.slice(_len - (2 + 2))
390 _experimenter = reader.read("!L")[0]
391 assert(_experimenter == 6035143)
392 _subtype = reader.read("!L")[0]
393 assert(_subtype == 0)
394 return obj
395
396 def __eq__(self, other):
397 if type(self) != type(other): return False
398 return True
399
400 def pretty_print(self, q):
401 q.text("bsn_disable_src_mac_check {")
402 with q.group():
403 with q.indent(2):
404 q.breakable()
405 q.breakable()
406 q.text('}')
407
408bsn.subtypes[0] = bsn_disable_src_mac_check
409
410class bsn_disable_vlan_counters(bsn):
411 type = 65535
412 experimenter = 6035143
413 subtype = 9
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(struct.pack("!L", self.experimenter))
423 packed.append(struct.pack("!L", self.subtype))
424 length = sum([len(x) for x in packed])
425 packed[1] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
429 def unpack(reader):
430 obj = bsn_disable_vlan_counters()
431 _type = reader.read("!H")[0]
432 assert(_type == 65535)
433 _len = reader.read("!H")[0]
434 orig_reader = reader
435 reader = orig_reader.slice(_len - (2 + 2))
436 _experimenter = reader.read("!L")[0]
437 assert(_experimenter == 6035143)
438 _subtype = reader.read("!L")[0]
439 assert(_subtype == 9)
440 return obj
441
442 def __eq__(self, other):
443 if type(self) != type(other): return False
444 return True
445
446 def pretty_print(self, q):
447 q.text("bsn_disable_vlan_counters {")
448 with q.group():
449 with q.indent(2):
450 q.breakable()
451 q.breakable()
452 q.text('}')
453
454bsn.subtypes[9] = bsn_disable_vlan_counters
455
456class bsn_packet_of_death(bsn):
457 type = 65535
458 experimenter = 6035143
459 subtype = 6
460
461 def __init__(self):
462 return
463
464 def pack(self):
465 packed = []
466 packed.append(struct.pack("!H", self.type))
467 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
468 packed.append(struct.pack("!L", self.experimenter))
469 packed.append(struct.pack("!L", self.subtype))
470 length = sum([len(x) for x in packed])
471 packed[1] = struct.pack("!H", length)
472 return ''.join(packed)
473
474 @staticmethod
475 def unpack(reader):
476 obj = bsn_packet_of_death()
477 _type = reader.read("!H")[0]
478 assert(_type == 65535)
479 _len = reader.read("!H")[0]
480 orig_reader = reader
481 reader = orig_reader.slice(_len - (2 + 2))
482 _experimenter = reader.read("!L")[0]
483 assert(_experimenter == 6035143)
484 _subtype = reader.read("!L")[0]
485 assert(_subtype == 6)
486 return obj
487
488 def __eq__(self, other):
489 if type(self) != type(other): return False
490 return True
491
492 def pretty_print(self, q):
493 q.text("bsn_packet_of_death {")
494 with q.group():
495 with q.indent(2):
496 q.breakable()
497 q.breakable()
498 q.text('}')
499
500bsn.subtypes[6] = bsn_packet_of_death
501
502class bsn_permit(bsn):
503 type = 65535
504 experimenter = 6035143
505 subtype = 4
506
507 def __init__(self):
508 return
509
510 def pack(self):
511 packed = []
512 packed.append(struct.pack("!H", self.type))
513 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
514 packed.append(struct.pack("!L", self.experimenter))
515 packed.append(struct.pack("!L", self.subtype))
516 length = sum([len(x) for x in packed])
517 packed[1] = struct.pack("!H", length)
518 return ''.join(packed)
519
520 @staticmethod
521 def unpack(reader):
522 obj = bsn_permit()
523 _type = reader.read("!H")[0]
524 assert(_type == 65535)
525 _len = reader.read("!H")[0]
526 orig_reader = reader
527 reader = orig_reader.slice(_len - (2 + 2))
528 _experimenter = reader.read("!L")[0]
529 assert(_experimenter == 6035143)
530 _subtype = reader.read("!L")[0]
531 assert(_subtype == 4)
532 return obj
533
534 def __eq__(self, other):
535 if type(self) != type(other): return False
536 return True
537
538 def pretty_print(self, q):
539 q.text("bsn_permit {")
540 with q.group():
541 with q.indent(2):
542 q.breakable()
543 q.breakable()
544 q.text('}')
545
546bsn.subtypes[4] = bsn_permit
547
548class bsn_prioritize_pdus(bsn):
549 type = 65535
550 experimenter = 6035143
551 subtype = 7
552
553 def __init__(self):
554 return
555
556 def pack(self):
557 packed = []
558 packed.append(struct.pack("!H", self.type))
559 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
560 packed.append(struct.pack("!L", self.experimenter))
561 packed.append(struct.pack("!L", self.subtype))
562 length = sum([len(x) for x in packed])
563 packed[1] = struct.pack("!H", length)
564 return ''.join(packed)
565
566 @staticmethod
567 def unpack(reader):
568 obj = bsn_prioritize_pdus()
569 _type = reader.read("!H")[0]
570 assert(_type == 65535)
571 _len = reader.read("!H")[0]
572 orig_reader = reader
573 reader = orig_reader.slice(_len - (2 + 2))
574 _experimenter = reader.read("!L")[0]
575 assert(_experimenter == 6035143)
576 _subtype = reader.read("!L")[0]
577 assert(_subtype == 7)
578 return obj
579
580 def __eq__(self, other):
581 if type(self) != type(other): return False
582 return True
583
584 def pretty_print(self, q):
585 q.text("bsn_prioritize_pdus {")
586 with q.group():
587 with q.indent(2):
588 q.breakable()
589 q.breakable()
590 q.text('}')
591
592bsn.subtypes[7] = bsn_prioritize_pdus
593
594class bsn_require_vlan_xlate(bsn):
595 type = 65535
596 experimenter = 6035143
597 subtype = 8
598
599 def __init__(self):
600 return
601
602 def pack(self):
603 packed = []
604 packed.append(struct.pack("!H", self.type))
605 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
606 packed.append(struct.pack("!L", self.experimenter))
607 packed.append(struct.pack("!L", self.subtype))
608 length = sum([len(x) for x in packed])
609 packed[1] = struct.pack("!H", length)
610 return ''.join(packed)
611
612 @staticmethod
613 def unpack(reader):
614 obj = bsn_require_vlan_xlate()
615 _type = reader.read("!H")[0]
616 assert(_type == 65535)
617 _len = reader.read("!H")[0]
618 orig_reader = reader
619 reader = orig_reader.slice(_len - (2 + 2))
620 _experimenter = reader.read("!L")[0]
621 assert(_experimenter == 6035143)
622 _subtype = reader.read("!L")[0]
623 assert(_subtype == 8)
624 return obj
625
626 def __eq__(self, other):
627 if type(self) != type(other): return False
628 return True
629
630 def pretty_print(self, q):
631 q.text("bsn_require_vlan_xlate {")
632 with q.group():
633 with q.indent(2):
634 q.breakable()
635 q.breakable()
636 q.text('}')
637
638bsn.subtypes[8] = bsn_require_vlan_xlate
639
640class bsn_span_destination(bsn):
641 type = 65535
642 experimenter = 6035143
643 subtype = 10
644
645 def __init__(self):
646 return
647
648 def pack(self):
649 packed = []
650 packed.append(struct.pack("!H", self.type))
651 packed.append(struct.pack("!H", 0)) # placeholder for len at index 1
652 packed.append(struct.pack("!L", self.experimenter))
653 packed.append(struct.pack("!L", self.subtype))
654 length = sum([len(x) for x in packed])
655 packed[1] = struct.pack("!H", length)
656 return ''.join(packed)
657
658 @staticmethod
659 def unpack(reader):
660 obj = bsn_span_destination()
661 _type = reader.read("!H")[0]
662 assert(_type == 65535)
663 _len = reader.read("!H")[0]
664 orig_reader = reader
665 reader = orig_reader.slice(_len - (2 + 2))
666 _experimenter = reader.read("!L")[0]
667 assert(_experimenter == 6035143)
668 _subtype = reader.read("!L")[0]
669 assert(_subtype == 10)
670 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("bsn_span_destination {")
678 with q.group():
679 with q.indent(2):
680 q.breakable()
681 q.breakable()
682 q.text('}')
683
684bsn.subtypes[10] = bsn_span_destination
685
686class clear_actions(instruction_id):
687 type = 5
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 = clear_actions()
703 _type = reader.read("!H")[0]
704 assert(_type == 5)
705 _len = reader.read("!H")[0]
706 orig_reader = reader
707 reader = orig_reader.slice(_len - (2 + 2))
708 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("clear_actions {")
716 with q.group():
717 with q.indent(2):
718 q.breakable()
719 q.breakable()
720 q.text('}')
721
722instruction_id.subtypes[5] = clear_actions
723
Rich Lane2e079da2014-10-29 15:30:24 -0700724class goto_table(instruction_id):
725 type = 1
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 = goto_table()
741 _type = reader.read("!H")[0]
742 assert(_type == 1)
743 _len = reader.read("!H")[0]
744 orig_reader = reader
745 reader = orig_reader.slice(_len - (2 + 2))
746 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("goto_table {")
754 with q.group():
755 with q.indent(2):
756 q.breakable()
757 q.breakable()
758 q.text('}')
759
760instruction_id.subtypes[1] = goto_table
761
762class meter(instruction_id):
763 type = 6
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 = meter()
779 _type = reader.read("!H")[0]
780 assert(_type == 6)
781 _len = reader.read("!H")[0]
782 orig_reader = reader
783 reader = orig_reader.slice(_len - (2 + 2))
784 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("meter {")
792 with q.group():
793 with q.indent(2):
794 q.breakable()
795 q.breakable()
796 q.text('}')
797
798instruction_id.subtypes[6] = meter
799
800class write_actions(instruction_id):
801 type = 3
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 = write_actions()
817 _type = reader.read("!H")[0]
818 assert(_type == 3)
819 _len = reader.read("!H")[0]
820 orig_reader = reader
821 reader = orig_reader.slice(_len - (2 + 2))
822 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("write_actions {")
830 with q.group():
831 with q.indent(2):
832 q.breakable()
833 q.breakable()
834 q.text('}')
835
836instruction_id.subtypes[3] = write_actions
837
838class write_metadata(instruction_id):
839 type = 2
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 = write_metadata()
855 _type = reader.read("!H")[0]
856 assert(_type == 2)
857 _len = reader.read("!H")[0]
858 orig_reader = reader
859 reader = orig_reader.slice(_len - (2 + 2))
860 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("write_metadata {")
868 with q.group():
869 with q.indent(2):
870 q.breakable()
871 q.breakable()
872 q.text('}')
873
874instruction_id.subtypes[2] = write_metadata
875
876