blob: 9397d52806f29f66ebe0d3b09f239ebabd841669 [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.of13']
16
17class bsn_tlv(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 length 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 = bsn_tlv.subtypes.get(subtype)
40 if subclass:
41 return subclass.unpack(reader)
42
43 obj = bsn_tlv()
44 obj.type = reader.read("!H")[0]
45 _length = reader.read("!H")[0]
46 orig_reader = reader
47 reader = orig_reader.slice(_length, 4)
48 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("bsn_tlv {")
57 with q.group():
58 with q.indent(2):
59 q.breakable()
60 q.breakable()
61 q.text('}')
62
63
64class actor_key(bsn_tlv):
65 type = 44
66
67 def __init__(self, value=None):
68 if value != None:
69 self.value = value
70 else:
71 self.value = 0
72 return
73
74 def pack(self):
75 packed = []
76 packed.append(struct.pack("!H", self.type))
77 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
78 packed.append(struct.pack("!H", self.value))
79 length = sum([len(x) for x in packed])
80 packed[1] = struct.pack("!H", length)
81 return ''.join(packed)
82
83 @staticmethod
84 def unpack(reader):
85 obj = actor_key()
86 _type = reader.read("!H")[0]
87 assert(_type == 44)
88 _length = reader.read("!H")[0]
89 orig_reader = reader
90 reader = orig_reader.slice(_length, 4)
91 obj.value = reader.read("!H")[0]
92 return obj
93
94 def __eq__(self, other):
95 if type(self) != type(other): return False
96 if self.value != other.value: return False
97 return True
98
99 def pretty_print(self, q):
100 q.text("actor_key {")
101 with q.group():
102 with q.indent(2):
103 q.breakable()
104 q.text("value = ");
105 q.text("%#x" % self.value)
106 q.breakable()
107 q.text('}')
108
109bsn_tlv.subtypes[44] = actor_key
110
111class actor_port_num(bsn_tlv):
112 type = 43
113
114 def __init__(self, value=None):
115 if value != None:
116 self.value = value
117 else:
118 self.value = 0
119 return
120
121 def pack(self):
122 packed = []
123 packed.append(struct.pack("!H", self.type))
124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
125 packed.append(struct.pack("!H", self.value))
126 length = sum([len(x) for x in packed])
127 packed[1] = struct.pack("!H", length)
128 return ''.join(packed)
129
130 @staticmethod
131 def unpack(reader):
132 obj = actor_port_num()
133 _type = reader.read("!H")[0]
134 assert(_type == 43)
135 _length = reader.read("!H")[0]
136 orig_reader = reader
137 reader = orig_reader.slice(_length, 4)
138 obj.value = reader.read("!H")[0]
139 return obj
140
141 def __eq__(self, other):
142 if type(self) != type(other): return False
143 if self.value != other.value: return False
144 return True
145
146 def pretty_print(self, q):
147 q.text("actor_port_num {")
148 with q.group():
149 with q.indent(2):
150 q.breakable()
151 q.text("value = ");
152 q.text("%#x" % self.value)
153 q.breakable()
154 q.text('}')
155
156bsn_tlv.subtypes[43] = actor_port_num
157
158class actor_port_priority(bsn_tlv):
159 type = 42
160
161 def __init__(self, value=None):
162 if value != None:
163 self.value = value
164 else:
165 self.value = 0
166 return
167
168 def pack(self):
169 packed = []
170 packed.append(struct.pack("!H", self.type))
171 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
172 packed.append(struct.pack("!H", self.value))
173 length = sum([len(x) for x in packed])
174 packed[1] = struct.pack("!H", length)
175 return ''.join(packed)
176
177 @staticmethod
178 def unpack(reader):
179 obj = actor_port_priority()
180 _type = reader.read("!H")[0]
181 assert(_type == 42)
182 _length = reader.read("!H")[0]
183 orig_reader = reader
184 reader = orig_reader.slice(_length, 4)
185 obj.value = reader.read("!H")[0]
186 return obj
187
188 def __eq__(self, other):
189 if type(self) != type(other): return False
190 if self.value != other.value: return False
191 return True
192
193 def pretty_print(self, q):
194 q.text("actor_port_priority {")
195 with q.group():
196 with q.indent(2):
197 q.breakable()
198 q.text("value = ");
199 q.text("%#x" % self.value)
200 q.breakable()
201 q.text('}')
202
203bsn_tlv.subtypes[42] = actor_port_priority
204
205class actor_state(bsn_tlv):
206 type = 53
207
208 def __init__(self, value=None):
209 if value != None:
210 self.value = value
211 else:
212 self.value = 0
213 return
214
215 def pack(self):
216 packed = []
217 packed.append(struct.pack("!H", self.type))
218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
219 packed.append(struct.pack("!B", self.value))
220 length = sum([len(x) for x in packed])
221 packed[1] = struct.pack("!H", length)
222 return ''.join(packed)
223
224 @staticmethod
225 def unpack(reader):
226 obj = actor_state()
227 _type = reader.read("!H")[0]
228 assert(_type == 53)
229 _length = reader.read("!H")[0]
230 orig_reader = reader
231 reader = orig_reader.slice(_length, 4)
232 obj.value = reader.read("!B")[0]
233 return obj
234
235 def __eq__(self, other):
236 if type(self) != type(other): return False
237 if self.value != other.value: return False
238 return True
239
240 def pretty_print(self, q):
241 q.text("actor_state {")
242 with q.group():
243 with q.indent(2):
244 q.breakable()
245 q.text("value = ");
246 q.text("%#x" % self.value)
247 q.breakable()
248 q.text('}')
249
250bsn_tlv.subtypes[53] = actor_state
251
252class actor_system_mac(bsn_tlv):
253 type = 41
254
255 def __init__(self, value=None):
256 if value != None:
257 self.value = value
258 else:
259 self.value = [0,0,0,0,0,0]
260 return
261
262 def pack(self):
263 packed = []
264 packed.append(struct.pack("!H", self.type))
265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
266 packed.append(struct.pack("!6B", *self.value))
267 length = sum([len(x) for x in packed])
268 packed[1] = struct.pack("!H", length)
269 return ''.join(packed)
270
271 @staticmethod
272 def unpack(reader):
273 obj = actor_system_mac()
274 _type = reader.read("!H")[0]
275 assert(_type == 41)
276 _length = reader.read("!H")[0]
277 orig_reader = reader
278 reader = orig_reader.slice(_length, 4)
279 obj.value = list(reader.read('!6B'))
280 return obj
281
282 def __eq__(self, other):
283 if type(self) != type(other): return False
284 if self.value != other.value: return False
285 return True
286
287 def pretty_print(self, q):
288 q.text("actor_system_mac {")
289 with q.group():
290 with q.indent(2):
291 q.breakable()
292 q.text("value = ");
293 q.text(util.pretty_mac(self.value))
294 q.breakable()
295 q.text('}')
296
297bsn_tlv.subtypes[41] = actor_system_mac
298
299class actor_system_priority(bsn_tlv):
300 type = 40
301
302 def __init__(self, value=None):
303 if value != None:
304 self.value = value
305 else:
306 self.value = 0
307 return
308
309 def pack(self):
310 packed = []
311 packed.append(struct.pack("!H", self.type))
312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
313 packed.append(struct.pack("!H", self.value))
314 length = sum([len(x) for x in packed])
315 packed[1] = struct.pack("!H", length)
316 return ''.join(packed)
317
318 @staticmethod
319 def unpack(reader):
320 obj = actor_system_priority()
321 _type = reader.read("!H")[0]
322 assert(_type == 40)
323 _length = reader.read("!H")[0]
324 orig_reader = reader
325 reader = orig_reader.slice(_length, 4)
326 obj.value = reader.read("!H")[0]
327 return obj
328
329 def __eq__(self, other):
330 if type(self) != type(other): return False
331 if self.value != other.value: return False
332 return True
333
334 def pretty_print(self, q):
335 q.text("actor_system_priority {")
336 with q.group():
337 with q.indent(2):
338 q.breakable()
339 q.text("value = ");
340 q.text("%#x" % self.value)
341 q.breakable()
342 q.text('}')
343
344bsn_tlv.subtypes[40] = actor_system_priority
345
346class anchor(bsn_tlv):
347 type = 81
348
349 def __init__(self, value=None):
350 if value != None:
351 self.value = value
352 else:
353 self.value = 0
354 return
355
356 def pack(self):
357 packed = []
358 packed.append(struct.pack("!H", self.type))
359 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
360 packed.append(struct.pack("!H", self.value))
361 length = sum([len(x) for x in packed])
362 packed[1] = struct.pack("!H", length)
363 return ''.join(packed)
364
365 @staticmethod
366 def unpack(reader):
367 obj = anchor()
368 _type = reader.read("!H")[0]
369 assert(_type == 81)
370 _length = reader.read("!H")[0]
371 orig_reader = reader
372 reader = orig_reader.slice(_length, 4)
373 obj.value = reader.read("!H")[0]
374 return obj
375
376 def __eq__(self, other):
377 if type(self) != type(other): return False
378 if self.value != other.value: return False
379 return True
380
381 def pretty_print(self, q):
382 q.text("anchor {")
383 with q.group():
384 with q.indent(2):
385 q.breakable()
386 q.text("value = ");
387 q.text("%#x" % self.value)
388 q.breakable()
389 q.text('}')
390
391bsn_tlv.subtypes[81] = anchor
392
393class broadcast_query_timeout(bsn_tlv):
394 type = 10
395
396 def __init__(self, value=None):
397 if value != None:
398 self.value = value
399 else:
400 self.value = 0
401 return
402
403 def pack(self):
404 packed = []
405 packed.append(struct.pack("!H", self.type))
406 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
407 packed.append(struct.pack("!L", self.value))
408 length = sum([len(x) for x in packed])
409 packed[1] = struct.pack("!H", length)
410 return ''.join(packed)
411
412 @staticmethod
413 def unpack(reader):
414 obj = broadcast_query_timeout()
415 _type = reader.read("!H")[0]
416 assert(_type == 10)
417 _length = reader.read("!H")[0]
418 orig_reader = reader
419 reader = orig_reader.slice(_length, 4)
420 obj.value = reader.read("!L")[0]
421 return obj
422
423 def __eq__(self, other):
424 if type(self) != type(other): return False
425 if self.value != other.value: return False
426 return True
427
428 def pretty_print(self, q):
429 q.text("broadcast_query_timeout {")
430 with q.group():
431 with q.indent(2):
432 q.breakable()
433 q.text("value = ");
434 q.text("%#x" % self.value)
435 q.breakable()
436 q.text('}')
437
438bsn_tlv.subtypes[10] = broadcast_query_timeout
439
440class broadcast_rate(bsn_tlv):
441 type = 90
442
443 def __init__(self, value=None):
444 if value != None:
445 self.value = value
446 else:
447 self.value = 0
448 return
449
450 def pack(self):
451 packed = []
452 packed.append(struct.pack("!H", self.type))
453 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
454 packed.append(struct.pack("!L", self.value))
455 length = sum([len(x) for x in packed])
456 packed[1] = struct.pack("!H", length)
457 return ''.join(packed)
458
459 @staticmethod
460 def unpack(reader):
461 obj = broadcast_rate()
462 _type = reader.read("!H")[0]
463 assert(_type == 90)
464 _length = reader.read("!H")[0]
465 orig_reader = reader
466 reader = orig_reader.slice(_length, 4)
467 obj.value = reader.read("!L")[0]
468 return obj
469
470 def __eq__(self, other):
471 if type(self) != type(other): return False
472 if self.value != other.value: return False
473 return True
474
475 def pretty_print(self, q):
476 q.text("broadcast_rate {")
477 with q.group():
478 with q.indent(2):
479 q.breakable()
480 q.text("value = ");
481 q.text("%#x" % self.value)
482 q.breakable()
483 q.text('}')
484
485bsn_tlv.subtypes[90] = broadcast_rate
486
487class bucket(bsn_tlv):
488 type = 64
489
490 def __init__(self, value=None):
491 if value != None:
492 self.value = value
493 else:
494 self.value = []
495 return
496
497 def pack(self):
498 packed = []
499 packed.append(struct.pack("!H", self.type))
500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
501 packed.append(loxi.generic_util.pack_list(self.value))
502 length = sum([len(x) for x in packed])
503 packed[1] = struct.pack("!H", length)
504 return ''.join(packed)
505
506 @staticmethod
507 def unpack(reader):
508 obj = bucket()
509 _type = reader.read("!H")[0]
510 assert(_type == 64)
511 _length = reader.read("!H")[0]
512 orig_reader = reader
513 reader = orig_reader.slice(_length, 4)
514 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
515 return obj
516
517 def __eq__(self, other):
518 if type(self) != type(other): return False
519 if self.value != other.value: return False
520 return True
521
522 def pretty_print(self, q):
523 q.text("bucket {")
524 with q.group():
525 with q.indent(2):
526 q.breakable()
527 q.text("value = ");
528 q.pp(self.value)
529 q.breakable()
530 q.text('}')
531
532bsn_tlv.subtypes[64] = bucket
533
534class circuit_id(bsn_tlv):
535 type = 14
536
537 def __init__(self, value=None):
538 if value != None:
539 self.value = value
540 else:
541 self.value = ''
542 return
543
544 def pack(self):
545 packed = []
546 packed.append(struct.pack("!H", self.type))
547 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
548 packed.append(self.value)
549 length = sum([len(x) for x in packed])
550 packed[1] = struct.pack("!H", length)
551 return ''.join(packed)
552
553 @staticmethod
554 def unpack(reader):
555 obj = circuit_id()
556 _type = reader.read("!H")[0]
557 assert(_type == 14)
558 _length = reader.read("!H")[0]
559 orig_reader = reader
560 reader = orig_reader.slice(_length, 4)
561 obj.value = str(reader.read_all())
562 return obj
563
564 def __eq__(self, other):
565 if type(self) != type(other): return False
566 if self.value != other.value: return False
567 return True
568
569 def pretty_print(self, q):
570 q.text("circuit_id {")
571 with q.group():
572 with q.indent(2):
573 q.breakable()
574 q.text("value = ");
575 q.pp(self.value)
576 q.breakable()
577 q.text('}')
578
579bsn_tlv.subtypes[14] = circuit_id
580
581class convergence_status(bsn_tlv):
582 type = 45
583
584 def __init__(self, value=None):
585 if value != None:
586 self.value = value
587 else:
588 self.value = 0
589 return
590
591 def pack(self):
592 packed = []
593 packed.append(struct.pack("!H", self.type))
594 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
595 packed.append(struct.pack("!B", self.value))
596 length = sum([len(x) for x in packed])
597 packed[1] = struct.pack("!H", length)
598 return ''.join(packed)
599
600 @staticmethod
601 def unpack(reader):
602 obj = convergence_status()
603 _type = reader.read("!H")[0]
604 assert(_type == 45)
605 _length = reader.read("!H")[0]
606 orig_reader = reader
607 reader = orig_reader.slice(_length, 4)
608 obj.value = reader.read("!B")[0]
609 return obj
610
611 def __eq__(self, other):
612 if type(self) != type(other): return False
613 if self.value != other.value: return False
614 return True
615
616 def pretty_print(self, q):
617 q.text("convergence_status {")
618 with q.group():
619 with q.indent(2):
620 q.breakable()
621 q.text("value = ");
622 q.text("%#x" % self.value)
623 q.breakable()
624 q.text('}')
625
626bsn_tlv.subtypes[45] = convergence_status
627
628class crc_enabled(bsn_tlv):
629 type = 22
630
631 def __init__(self, value=None):
632 if value != None:
633 self.value = value
634 else:
635 self.value = 0
636 return
637
638 def pack(self):
639 packed = []
640 packed.append(struct.pack("!H", self.type))
641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
642 packed.append(struct.pack("!B", self.value))
643 length = sum([len(x) for x in packed])
644 packed[1] = struct.pack("!H", length)
645 return ''.join(packed)
646
647 @staticmethod
648 def unpack(reader):
649 obj = crc_enabled()
650 _type = reader.read("!H")[0]
651 assert(_type == 22)
652 _length = reader.read("!H")[0]
653 orig_reader = reader
654 reader = orig_reader.slice(_length, 4)
655 obj.value = reader.read("!B")[0]
656 return obj
657
658 def __eq__(self, other):
659 if type(self) != type(other): return False
660 if self.value != other.value: return False
661 return True
662
663 def pretty_print(self, q):
664 q.text("crc_enabled {")
665 with q.group():
666 with q.indent(2):
667 q.breakable()
668 q.text("value = ");
669 q.text("%#x" % self.value)
670 q.breakable()
671 q.text('}')
672
673bsn_tlv.subtypes[22] = crc_enabled
674
675class data(bsn_tlv):
676 type = 55
677
678 def __init__(self, value=None):
679 if value != None:
680 self.value = value
681 else:
682 self.value = ''
683 return
684
685 def pack(self):
686 packed = []
687 packed.append(struct.pack("!H", self.type))
688 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
689 packed.append(self.value)
690 length = sum([len(x) for x in packed])
691 packed[1] = struct.pack("!H", length)
692 return ''.join(packed)
693
694 @staticmethod
695 def unpack(reader):
696 obj = data()
697 _type = reader.read("!H")[0]
698 assert(_type == 55)
699 _length = reader.read("!H")[0]
700 orig_reader = reader
701 reader = orig_reader.slice(_length, 4)
702 obj.value = str(reader.read_all())
703 return obj
704
705 def __eq__(self, other):
706 if type(self) != type(other): return False
707 if self.value != other.value: return False
708 return True
709
710 def pretty_print(self, q):
711 q.text("data {")
712 with q.group():
713 with q.indent(2):
714 q.breakable()
715 q.text("value = ");
716 q.pp(self.value)
717 q.breakable()
718 q.text('}')
719
720bsn_tlv.subtypes[55] = data
721
722class decap(bsn_tlv):
723 type = 85
724
725 def __init__(self, value=None):
726 if value != None:
727 self.value = value
728 else:
729 self.value = 0
730 return
731
732 def pack(self):
733 packed = []
734 packed.append(struct.pack("!H", self.type))
735 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
736 packed.append(struct.pack("!H", self.value))
737 length = sum([len(x) for x in packed])
738 packed[1] = struct.pack("!H", length)
739 return ''.join(packed)
740
741 @staticmethod
742 def unpack(reader):
743 obj = decap()
744 _type = reader.read("!H")[0]
745 assert(_type == 85)
746 _length = reader.read("!H")[0]
747 orig_reader = reader
748 reader = orig_reader.slice(_length, 4)
749 obj.value = reader.read("!H")[0]
750 return obj
751
752 def __eq__(self, other):
753 if type(self) != type(other): return False
754 if self.value != other.value: return False
755 return True
756
757 def pretty_print(self, q):
758 q.text("decap {")
759 with q.group():
760 with q.indent(2):
761 q.breakable()
762 q.text("value = ");
763 q.text("%#x" % self.value)
764 q.breakable()
765 q.text('}')
766
767bsn_tlv.subtypes[85] = decap
768
769class eth_dst(bsn_tlv):
770 type = 33
771
772 def __init__(self, value=None):
773 if value != None:
774 self.value = value
775 else:
776 self.value = [0,0,0,0,0,0]
777 return
778
779 def pack(self):
780 packed = []
781 packed.append(struct.pack("!H", self.type))
782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
783 packed.append(struct.pack("!6B", *self.value))
784 length = sum([len(x) for x in packed])
785 packed[1] = struct.pack("!H", length)
786 return ''.join(packed)
787
788 @staticmethod
789 def unpack(reader):
790 obj = eth_dst()
791 _type = reader.read("!H")[0]
792 assert(_type == 33)
793 _length = reader.read("!H")[0]
794 orig_reader = reader
795 reader = orig_reader.slice(_length, 4)
796 obj.value = list(reader.read('!6B'))
797 return obj
798
799 def __eq__(self, other):
800 if type(self) != type(other): return False
801 if self.value != other.value: return False
802 return True
803
804 def pretty_print(self, q):
805 q.text("eth_dst {")
806 with q.group():
807 with q.indent(2):
808 q.breakable()
809 q.text("value = ");
810 q.text(util.pretty_mac(self.value))
811 q.breakable()
812 q.text('}')
813
814bsn_tlv.subtypes[33] = eth_dst
815
816class eth_src(bsn_tlv):
817 type = 32
818
819 def __init__(self, value=None):
820 if value != None:
821 self.value = value
822 else:
823 self.value = [0,0,0,0,0,0]
824 return
825
826 def pack(self):
827 packed = []
828 packed.append(struct.pack("!H", self.type))
829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
830 packed.append(struct.pack("!6B", *self.value))
831 length = sum([len(x) for x in packed])
832 packed[1] = struct.pack("!H", length)
833 return ''.join(packed)
834
835 @staticmethod
836 def unpack(reader):
837 obj = eth_src()
838 _type = reader.read("!H")[0]
839 assert(_type == 32)
840 _length = reader.read("!H")[0]
841 orig_reader = reader
842 reader = orig_reader.slice(_length, 4)
843 obj.value = list(reader.read('!6B'))
844 return obj
845
846 def __eq__(self, other):
847 if type(self) != type(other): return False
848 if self.value != other.value: return False
849 return True
850
851 def pretty_print(self, q):
852 q.text("eth_src {")
853 with q.group():
854 with q.indent(2):
855 q.breakable()
856 q.text("value = ");
857 q.text(util.pretty_mac(self.value))
858 q.breakable()
859 q.text('}')
860
861bsn_tlv.subtypes[32] = eth_src
862
863class external_gateway_ip(bsn_tlv):
864 type = 26
865
866 def __init__(self, value=None):
867 if value != None:
868 self.value = value
869 else:
870 self.value = 0
871 return
872
873 def pack(self):
874 packed = []
875 packed.append(struct.pack("!H", self.type))
876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
877 packed.append(struct.pack("!L", self.value))
878 length = sum([len(x) for x in packed])
879 packed[1] = struct.pack("!H", length)
880 return ''.join(packed)
881
882 @staticmethod
883 def unpack(reader):
884 obj = external_gateway_ip()
885 _type = reader.read("!H")[0]
886 assert(_type == 26)
887 _length = reader.read("!H")[0]
888 orig_reader = reader
889 reader = orig_reader.slice(_length, 4)
890 obj.value = reader.read("!L")[0]
891 return obj
892
893 def __eq__(self, other):
894 if type(self) != type(other): return False
895 if self.value != other.value: return False
896 return True
897
898 def pretty_print(self, q):
899 q.text("external_gateway_ip {")
900 with q.group():
901 with q.indent(2):
902 q.breakable()
903 q.text("value = ");
904 q.text(util.pretty_ipv4(self.value))
905 q.breakable()
906 q.text('}')
907
908bsn_tlv.subtypes[26] = external_gateway_ip
909
910class external_gateway_mac(bsn_tlv):
911 type = 29
912
913 def __init__(self, value=None):
914 if value != None:
915 self.value = value
916 else:
917 self.value = [0,0,0,0,0,0]
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 length at index 1
924 packed.append(struct.pack("!6B", *self.value))
925 length = sum([len(x) for x in packed])
926 packed[1] = struct.pack("!H", length)
927 return ''.join(packed)
928
929 @staticmethod
930 def unpack(reader):
931 obj = external_gateway_mac()
932 _type = reader.read("!H")[0]
933 assert(_type == 29)
934 _length = reader.read("!H")[0]
935 orig_reader = reader
936 reader = orig_reader.slice(_length, 4)
937 obj.value = list(reader.read('!6B'))
938 return obj
939
940 def __eq__(self, other):
941 if type(self) != type(other): return False
942 if self.value != other.value: return False
943 return True
944
945 def pretty_print(self, q):
946 q.text("external_gateway_mac {")
947 with q.group():
948 with q.indent(2):
949 q.breakable()
950 q.text("value = ");
951 q.text(util.pretty_mac(self.value))
952 q.breakable()
953 q.text('}')
954
955bsn_tlv.subtypes[29] = external_gateway_mac
956
957class external_ip(bsn_tlv):
958 type = 23
959
960 def __init__(self, value=None):
961 if value != None:
962 self.value = value
963 else:
964 self.value = 0
965 return
966
967 def pack(self):
968 packed = []
969 packed.append(struct.pack("!H", self.type))
970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
971 packed.append(struct.pack("!L", self.value))
972 length = sum([len(x) for x in packed])
973 packed[1] = struct.pack("!H", length)
974 return ''.join(packed)
975
976 @staticmethod
977 def unpack(reader):
978 obj = external_ip()
979 _type = reader.read("!H")[0]
980 assert(_type == 23)
981 _length = reader.read("!H")[0]
982 orig_reader = reader
983 reader = orig_reader.slice(_length, 4)
984 obj.value = reader.read("!L")[0]
985 return obj
986
987 def __eq__(self, other):
988 if type(self) != type(other): return False
989 if self.value != other.value: return False
990 return True
991
992 def pretty_print(self, q):
993 q.text("external_ip {")
994 with q.group():
995 with q.indent(2):
996 q.breakable()
997 q.text("value = ");
998 q.text(util.pretty_ipv4(self.value))
999 q.breakable()
1000 q.text('}')
1001
1002bsn_tlv.subtypes[23] = external_ip
1003
1004class external_mac(bsn_tlv):
1005 type = 24
1006
1007 def __init__(self, value=None):
1008 if value != None:
1009 self.value = value
1010 else:
1011 self.value = [0,0,0,0,0,0]
1012 return
1013
1014 def pack(self):
1015 packed = []
1016 packed.append(struct.pack("!H", self.type))
1017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1018 packed.append(struct.pack("!6B", *self.value))
1019 length = sum([len(x) for x in packed])
1020 packed[1] = struct.pack("!H", length)
1021 return ''.join(packed)
1022
1023 @staticmethod
1024 def unpack(reader):
1025 obj = external_mac()
1026 _type = reader.read("!H")[0]
1027 assert(_type == 24)
1028 _length = reader.read("!H")[0]
1029 orig_reader = reader
1030 reader = orig_reader.slice(_length, 4)
1031 obj.value = list(reader.read('!6B'))
1032 return obj
1033
1034 def __eq__(self, other):
1035 if type(self) != type(other): return False
1036 if self.value != other.value: return False
1037 return True
1038
1039 def pretty_print(self, q):
1040 q.text("external_mac {")
1041 with q.group():
1042 with q.indent(2):
1043 q.breakable()
1044 q.text("value = ");
1045 q.text(util.pretty_mac(self.value))
1046 q.breakable()
1047 q.text('}')
1048
1049bsn_tlv.subtypes[24] = external_mac
1050
1051class external_netmask(bsn_tlv):
1052 type = 25
1053
1054 def __init__(self, value=None):
1055 if value != None:
1056 self.value = value
1057 else:
1058 self.value = 0
1059 return
1060
1061 def pack(self):
1062 packed = []
1063 packed.append(struct.pack("!H", self.type))
1064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1065 packed.append(struct.pack("!L", self.value))
1066 length = sum([len(x) for x in packed])
1067 packed[1] = struct.pack("!H", length)
1068 return ''.join(packed)
1069
1070 @staticmethod
1071 def unpack(reader):
1072 obj = external_netmask()
1073 _type = reader.read("!H")[0]
1074 assert(_type == 25)
1075 _length = reader.read("!H")[0]
1076 orig_reader = reader
1077 reader = orig_reader.slice(_length, 4)
1078 obj.value = reader.read("!L")[0]
1079 return obj
1080
1081 def __eq__(self, other):
1082 if type(self) != type(other): return False
1083 if self.value != other.value: return False
1084 return True
1085
1086 def pretty_print(self, q):
1087 q.text("external_netmask {")
1088 with q.group():
1089 with q.indent(2):
1090 q.breakable()
1091 q.text("value = ");
1092 q.text(util.pretty_ipv4(self.value))
1093 q.breakable()
1094 q.text('}')
1095
1096bsn_tlv.subtypes[25] = external_netmask
1097
1098class generation_id(bsn_tlv):
1099 type = 80
1100
1101 def __init__(self, value=None):
1102 if value != None:
1103 self.value = value
1104 else:
1105 self.value = 0
1106 return
1107
1108 def pack(self):
1109 packed = []
1110 packed.append(struct.pack("!H", self.type))
1111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1112 packed.append(struct.pack("!Q", self.value))
1113 length = sum([len(x) for x in packed])
1114 packed[1] = struct.pack("!H", length)
1115 return ''.join(packed)
1116
1117 @staticmethod
1118 def unpack(reader):
1119 obj = generation_id()
1120 _type = reader.read("!H")[0]
1121 assert(_type == 80)
1122 _length = reader.read("!H")[0]
1123 orig_reader = reader
1124 reader = orig_reader.slice(_length, 4)
1125 obj.value = reader.read("!Q")[0]
1126 return obj
1127
1128 def __eq__(self, other):
1129 if type(self) != type(other): return False
1130 if self.value != other.value: return False
1131 return True
1132
1133 def pretty_print(self, q):
1134 q.text("generation_id {")
1135 with q.group():
1136 with q.indent(2):
1137 q.breakable()
1138 q.text("value = ");
1139 q.text("%#x" % self.value)
1140 q.breakable()
1141 q.text('}')
1142
1143bsn_tlv.subtypes[80] = generation_id
1144
1145class hash_packet_field(bsn_tlv):
1146 type = 103
1147
1148 def __init__(self, value=None):
1149 if value != None:
1150 self.value = value
1151 else:
1152 self.value = 0
1153 return
1154
1155 def pack(self):
1156 packed = []
1157 packed.append(struct.pack("!H", self.type))
1158 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1159 packed.append(struct.pack("!Q", self.value))
1160 length = sum([len(x) for x in packed])
1161 packed[1] = struct.pack("!H", length)
1162 return ''.join(packed)
1163
1164 @staticmethod
1165 def unpack(reader):
1166 obj = hash_packet_field()
1167 _type = reader.read("!H")[0]
1168 assert(_type == 103)
1169 _length = reader.read("!H")[0]
1170 orig_reader = reader
1171 reader = orig_reader.slice(_length, 4)
1172 obj.value = reader.read("!Q")[0]
1173 return obj
1174
1175 def __eq__(self, other):
1176 if type(self) != type(other): return False
1177 if self.value != other.value: return False
1178 return True
1179
1180 def pretty_print(self, q):
1181 q.text("hash_packet_field {")
1182 with q.group():
1183 with q.indent(2):
1184 q.breakable()
1185 q.text("value = ");
1186 q.text("%#x" % self.value)
1187 q.breakable()
1188 q.text('}')
1189
1190bsn_tlv.subtypes[103] = hash_packet_field
1191
1192class hash_packet_type(bsn_tlv):
1193 type = 102
1194
1195 def __init__(self, value=None):
1196 if value != None:
1197 self.value = value
1198 else:
1199 self.value = 0
1200 return
1201
1202 def pack(self):
1203 packed = []
1204 packed.append(struct.pack("!H", self.type))
1205 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1206 packed.append(struct.pack("!B", self.value))
1207 length = sum([len(x) for x in packed])
1208 packed[1] = struct.pack("!H", length)
1209 return ''.join(packed)
1210
1211 @staticmethod
1212 def unpack(reader):
1213 obj = hash_packet_type()
1214 _type = reader.read("!H")[0]
1215 assert(_type == 102)
1216 _length = reader.read("!H")[0]
1217 orig_reader = reader
1218 reader = orig_reader.slice(_length, 4)
1219 obj.value = reader.read("!B")[0]
1220 return obj
1221
1222 def __eq__(self, other):
1223 if type(self) != type(other): return False
1224 if self.value != other.value: return False
1225 return True
1226
1227 def pretty_print(self, q):
1228 q.text("hash_packet_type {")
1229 with q.group():
1230 with q.indent(2):
1231 q.breakable()
1232 q.text("value = ");
1233 q.text("%#x" % self.value)
1234 q.breakable()
1235 q.text('}')
1236
1237bsn_tlv.subtypes[102] = hash_packet_type
1238
1239class hash_seed(bsn_tlv):
1240 type = 100
1241
1242 def __init__(self, seed1=None, seed2=None):
1243 if seed1 != None:
1244 self.seed1 = seed1
1245 else:
1246 self.seed1 = 0
1247 if seed2 != None:
1248 self.seed2 = seed2
1249 else:
1250 self.seed2 = 0
1251 return
1252
1253 def pack(self):
1254 packed = []
1255 packed.append(struct.pack("!H", self.type))
1256 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1257 packed.append(struct.pack("!L", self.seed1))
1258 packed.append(struct.pack("!L", self.seed2))
1259 length = sum([len(x) for x in packed])
1260 packed[1] = struct.pack("!H", length)
1261 return ''.join(packed)
1262
1263 @staticmethod
1264 def unpack(reader):
1265 obj = hash_seed()
1266 _type = reader.read("!H")[0]
1267 assert(_type == 100)
1268 _length = reader.read("!H")[0]
1269 orig_reader = reader
1270 reader = orig_reader.slice(_length, 4)
1271 obj.seed1 = reader.read("!L")[0]
1272 obj.seed2 = reader.read("!L")[0]
1273 return obj
1274
1275 def __eq__(self, other):
1276 if type(self) != type(other): return False
1277 if self.seed1 != other.seed1: return False
1278 if self.seed2 != other.seed2: return False
1279 return True
1280
1281 def pretty_print(self, q):
1282 q.text("hash_seed {")
1283 with q.group():
1284 with q.indent(2):
1285 q.breakable()
1286 q.text("seed1 = ");
1287 q.text("%#x" % self.seed1)
1288 q.text(","); q.breakable()
1289 q.text("seed2 = ");
1290 q.text("%#x" % self.seed2)
1291 q.breakable()
1292 q.text('}')
1293
1294bsn_tlv.subtypes[100] = hash_seed
1295
1296class hash_type(bsn_tlv):
1297 type = 101
1298
1299 def __init__(self, value=None):
1300 if value != None:
1301 self.value = value
1302 else:
1303 self.value = 0
1304 return
1305
1306 def pack(self):
1307 packed = []
1308 packed.append(struct.pack("!H", self.type))
1309 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1310 packed.append(struct.pack("!B", self.value))
1311 length = sum([len(x) for x in packed])
1312 packed[1] = struct.pack("!H", length)
1313 return ''.join(packed)
1314
1315 @staticmethod
1316 def unpack(reader):
1317 obj = hash_type()
1318 _type = reader.read("!H")[0]
1319 assert(_type == 101)
1320 _length = reader.read("!H")[0]
1321 orig_reader = reader
1322 reader = orig_reader.slice(_length, 4)
1323 obj.value = reader.read("!B")[0]
1324 return obj
1325
1326 def __eq__(self, other):
1327 if type(self) != type(other): return False
1328 if self.value != other.value: return False
1329 return True
1330
1331 def pretty_print(self, q):
1332 q.text("hash_type {")
1333 with q.group():
1334 with q.indent(2):
1335 q.breakable()
1336 q.text("value = ");
1337 q.text("%#x" % self.value)
1338 q.breakable()
1339 q.text('}')
1340
1341bsn_tlv.subtypes[101] = hash_type
1342
1343class header_size(bsn_tlv):
1344 type = 31
1345
1346 def __init__(self, value=None):
1347 if value != None:
1348 self.value = value
1349 else:
1350 self.value = 0
1351 return
1352
1353 def pack(self):
1354 packed = []
1355 packed.append(struct.pack("!H", self.type))
1356 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1357 packed.append(struct.pack("!L", self.value))
1358 length = sum([len(x) for x in packed])
1359 packed[1] = struct.pack("!H", length)
1360 return ''.join(packed)
1361
1362 @staticmethod
1363 def unpack(reader):
1364 obj = header_size()
1365 _type = reader.read("!H")[0]
1366 assert(_type == 31)
1367 _length = reader.read("!H")[0]
1368 orig_reader = reader
1369 reader = orig_reader.slice(_length, 4)
1370 obj.value = reader.read("!L")[0]
1371 return obj
1372
1373 def __eq__(self, other):
1374 if type(self) != type(other): return False
1375 if self.value != other.value: return False
1376 return True
1377
1378 def pretty_print(self, q):
1379 q.text("header_size {")
1380 with q.group():
1381 with q.indent(2):
1382 q.breakable()
1383 q.text("value = ");
1384 q.text("%#x" % self.value)
1385 q.breakable()
1386 q.text('}')
1387
1388bsn_tlv.subtypes[31] = header_size
1389
1390class icmp_code(bsn_tlv):
1391 type = 69
1392
1393 def __init__(self, value=None):
1394 if value != None:
1395 self.value = value
1396 else:
1397 self.value = 0
1398 return
1399
1400 def pack(self):
1401 packed = []
1402 packed.append(struct.pack("!H", self.type))
1403 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1404 packed.append(struct.pack("!B", self.value))
1405 length = sum([len(x) for x in packed])
1406 packed[1] = struct.pack("!H", length)
1407 return ''.join(packed)
1408
1409 @staticmethod
1410 def unpack(reader):
1411 obj = icmp_code()
1412 _type = reader.read("!H")[0]
1413 assert(_type == 69)
1414 _length = reader.read("!H")[0]
1415 orig_reader = reader
1416 reader = orig_reader.slice(_length, 4)
1417 obj.value = reader.read("!B")[0]
1418 return obj
1419
1420 def __eq__(self, other):
1421 if type(self) != type(other): return False
1422 if self.value != other.value: return False
1423 return True
1424
1425 def pretty_print(self, q):
1426 q.text("icmp_code {")
1427 with q.group():
1428 with q.indent(2):
1429 q.breakable()
1430 q.text("value = ");
1431 q.text("%#x" % self.value)
1432 q.breakable()
1433 q.text('}')
1434
1435bsn_tlv.subtypes[69] = icmp_code
1436
1437class icmp_id(bsn_tlv):
1438 type = 70
1439
1440 def __init__(self, value=None):
1441 if value != None:
1442 self.value = value
1443 else:
1444 self.value = 0
1445 return
1446
1447 def pack(self):
1448 packed = []
1449 packed.append(struct.pack("!H", self.type))
1450 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1451 packed.append(struct.pack("!H", self.value))
1452 length = sum([len(x) for x in packed])
1453 packed[1] = struct.pack("!H", length)
1454 return ''.join(packed)
1455
1456 @staticmethod
1457 def unpack(reader):
1458 obj = icmp_id()
1459 _type = reader.read("!H")[0]
1460 assert(_type == 70)
1461 _length = reader.read("!H")[0]
1462 orig_reader = reader
1463 reader = orig_reader.slice(_length, 4)
1464 obj.value = reader.read("!H")[0]
1465 return obj
1466
1467 def __eq__(self, other):
1468 if type(self) != type(other): return False
1469 if self.value != other.value: return False
1470 return True
1471
1472 def pretty_print(self, q):
1473 q.text("icmp_id {")
1474 with q.group():
1475 with q.indent(2):
1476 q.breakable()
1477 q.text("value = ");
1478 q.text("%#x" % self.value)
1479 q.breakable()
1480 q.text('}')
1481
1482bsn_tlv.subtypes[70] = icmp_id
1483
1484class icmp_type(bsn_tlv):
1485 type = 68
1486
1487 def __init__(self, value=None):
1488 if value != None:
1489 self.value = value
1490 else:
1491 self.value = 0
1492 return
1493
1494 def pack(self):
1495 packed = []
1496 packed.append(struct.pack("!H", self.type))
1497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1498 packed.append(struct.pack("!B", self.value))
1499 length = sum([len(x) for x in packed])
1500 packed[1] = struct.pack("!H", length)
1501 return ''.join(packed)
1502
1503 @staticmethod
1504 def unpack(reader):
1505 obj = icmp_type()
1506 _type = reader.read("!H")[0]
1507 assert(_type == 68)
1508 _length = reader.read("!H")[0]
1509 orig_reader = reader
1510 reader = orig_reader.slice(_length, 4)
1511 obj.value = reader.read("!B")[0]
1512 return obj
1513
1514 def __eq__(self, other):
1515 if type(self) != type(other): return False
1516 if self.value != other.value: return False
1517 return True
1518
1519 def pretty_print(self, q):
1520 q.text("icmp_type {")
1521 with q.group():
1522 with q.indent(2):
1523 q.breakable()
1524 q.text("value = ");
1525 q.text("%#x" % self.value)
1526 q.breakable()
1527 q.text('}')
1528
1529bsn_tlv.subtypes[68] = icmp_type
1530
1531class idle_notification(bsn_tlv):
1532 type = 7
1533
1534 def __init__(self):
1535 return
1536
1537 def pack(self):
1538 packed = []
1539 packed.append(struct.pack("!H", self.type))
1540 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1541 length = sum([len(x) for x in packed])
1542 packed[1] = struct.pack("!H", length)
1543 return ''.join(packed)
1544
1545 @staticmethod
1546 def unpack(reader):
1547 obj = idle_notification()
1548 _type = reader.read("!H")[0]
1549 assert(_type == 7)
1550 _length = reader.read("!H")[0]
1551 orig_reader = reader
1552 reader = orig_reader.slice(_length, 4)
1553 return obj
1554
1555 def __eq__(self, other):
1556 if type(self) != type(other): return False
1557 return True
1558
1559 def pretty_print(self, q):
1560 q.text("idle_notification {")
1561 with q.group():
1562 with q.indent(2):
1563 q.breakable()
1564 q.breakable()
1565 q.text('}')
1566
1567bsn_tlv.subtypes[7] = idle_notification
1568
1569class idle_time(bsn_tlv):
1570 type = 5
1571
1572 def __init__(self, value=None):
1573 if value != None:
1574 self.value = value
1575 else:
1576 self.value = 0
1577 return
1578
1579 def pack(self):
1580 packed = []
1581 packed.append(struct.pack("!H", self.type))
1582 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1583 packed.append(struct.pack("!Q", self.value))
1584 length = sum([len(x) for x in packed])
1585 packed[1] = struct.pack("!H", length)
1586 return ''.join(packed)
1587
1588 @staticmethod
1589 def unpack(reader):
1590 obj = idle_time()
1591 _type = reader.read("!H")[0]
1592 assert(_type == 5)
1593 _length = reader.read("!H")[0]
1594 orig_reader = reader
1595 reader = orig_reader.slice(_length, 4)
1596 obj.value = reader.read("!Q")[0]
1597 return obj
1598
1599 def __eq__(self, other):
1600 if type(self) != type(other): return False
1601 if self.value != other.value: return False
1602 return True
1603
1604 def pretty_print(self, q):
1605 q.text("idle_time {")
1606 with q.group():
1607 with q.indent(2):
1608 q.breakable()
1609 q.text("value = ");
1610 q.text("%#x" % self.value)
1611 q.breakable()
1612 q.text('}')
1613
1614bsn_tlv.subtypes[5] = idle_time
1615
1616class idle_timeout(bsn_tlv):
1617 type = 8
1618
1619 def __init__(self, value=None):
1620 if value != None:
1621 self.value = value
1622 else:
1623 self.value = 0
1624 return
1625
1626 def pack(self):
1627 packed = []
1628 packed.append(struct.pack("!H", self.type))
1629 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1630 packed.append(struct.pack("!L", self.value))
1631 length = sum([len(x) for x in packed])
1632 packed[1] = struct.pack("!H", length)
1633 return ''.join(packed)
1634
1635 @staticmethod
1636 def unpack(reader):
1637 obj = idle_timeout()
1638 _type = reader.read("!H")[0]
1639 assert(_type == 8)
1640 _length = reader.read("!H")[0]
1641 orig_reader = reader
1642 reader = orig_reader.slice(_length, 4)
1643 obj.value = reader.read("!L")[0]
1644 return obj
1645
1646 def __eq__(self, other):
1647 if type(self) != type(other): return False
1648 if self.value != other.value: return False
1649 return True
1650
1651 def pretty_print(self, q):
1652 q.text("idle_timeout {")
1653 with q.group():
1654 with q.indent(2):
1655 q.breakable()
1656 q.text("value = ");
1657 q.text("%#x" % self.value)
1658 q.breakable()
1659 q.text('}')
1660
1661bsn_tlv.subtypes[8] = idle_timeout
1662
1663class igmp_snooping(bsn_tlv):
1664 type = 78
1665
1666 def __init__(self):
1667 return
1668
1669 def pack(self):
1670 packed = []
1671 packed.append(struct.pack("!H", self.type))
1672 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1673 length = sum([len(x) for x in packed])
1674 packed[1] = struct.pack("!H", length)
1675 return ''.join(packed)
1676
1677 @staticmethod
1678 def unpack(reader):
1679 obj = igmp_snooping()
1680 _type = reader.read("!H")[0]
1681 assert(_type == 78)
1682 _length = reader.read("!H")[0]
1683 orig_reader = reader
1684 reader = orig_reader.slice(_length, 4)
1685 return obj
1686
1687 def __eq__(self, other):
1688 if type(self) != type(other): return False
1689 return True
1690
1691 def pretty_print(self, q):
1692 q.text("igmp_snooping {")
1693 with q.group():
1694 with q.indent(2):
1695 q.breakable()
1696 q.breakable()
1697 q.text('}')
1698
1699bsn_tlv.subtypes[78] = igmp_snooping
1700
1701class internal_gateway_mac(bsn_tlv):
1702 type = 28
1703
1704 def __init__(self, value=None):
1705 if value != None:
1706 self.value = value
1707 else:
1708 self.value = [0,0,0,0,0,0]
1709 return
1710
1711 def pack(self):
1712 packed = []
1713 packed.append(struct.pack("!H", self.type))
1714 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1715 packed.append(struct.pack("!6B", *self.value))
1716 length = sum([len(x) for x in packed])
1717 packed[1] = struct.pack("!H", length)
1718 return ''.join(packed)
1719
1720 @staticmethod
1721 def unpack(reader):
1722 obj = internal_gateway_mac()
1723 _type = reader.read("!H")[0]
1724 assert(_type == 28)
1725 _length = reader.read("!H")[0]
1726 orig_reader = reader
1727 reader = orig_reader.slice(_length, 4)
1728 obj.value = list(reader.read('!6B'))
1729 return obj
1730
1731 def __eq__(self, other):
1732 if type(self) != type(other): return False
1733 if self.value != other.value: return False
1734 return True
1735
1736 def pretty_print(self, q):
1737 q.text("internal_gateway_mac {")
1738 with q.group():
1739 with q.indent(2):
1740 q.breakable()
1741 q.text("value = ");
1742 q.text(util.pretty_mac(self.value))
1743 q.breakable()
1744 q.text('}')
1745
1746bsn_tlv.subtypes[28] = internal_gateway_mac
1747
1748class internal_mac(bsn_tlv):
1749 type = 27
1750
1751 def __init__(self, value=None):
1752 if value != None:
1753 self.value = value
1754 else:
1755 self.value = [0,0,0,0,0,0]
1756 return
1757
1758 def pack(self):
1759 packed = []
1760 packed.append(struct.pack("!H", self.type))
1761 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1762 packed.append(struct.pack("!6B", *self.value))
1763 length = sum([len(x) for x in packed])
1764 packed[1] = struct.pack("!H", length)
1765 return ''.join(packed)
1766
1767 @staticmethod
1768 def unpack(reader):
1769 obj = internal_mac()
1770 _type = reader.read("!H")[0]
1771 assert(_type == 27)
1772 _length = reader.read("!H")[0]
1773 orig_reader = reader
1774 reader = orig_reader.slice(_length, 4)
1775 obj.value = list(reader.read('!6B'))
1776 return obj
1777
1778 def __eq__(self, other):
1779 if type(self) != type(other): return False
1780 if self.value != other.value: return False
1781 return True
1782
1783 def pretty_print(self, q):
1784 q.text("internal_mac {")
1785 with q.group():
1786 with q.indent(2):
1787 q.breakable()
1788 q.text("value = ");
1789 q.text(util.pretty_mac(self.value))
1790 q.breakable()
1791 q.text('}')
1792
1793bsn_tlv.subtypes[27] = internal_mac
1794
1795class interval(bsn_tlv):
1796 type = 58
1797
1798 def __init__(self, value=None):
1799 if value != None:
1800 self.value = value
1801 else:
1802 self.value = 0
1803 return
1804
1805 def pack(self):
1806 packed = []
1807 packed.append(struct.pack("!H", self.type))
1808 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1809 packed.append(struct.pack("!L", self.value))
1810 length = sum([len(x) for x in packed])
1811 packed[1] = struct.pack("!H", length)
1812 return ''.join(packed)
1813
1814 @staticmethod
1815 def unpack(reader):
1816 obj = interval()
1817 _type = reader.read("!H")[0]
1818 assert(_type == 58)
1819 _length = reader.read("!H")[0]
1820 orig_reader = reader
1821 reader = orig_reader.slice(_length, 4)
1822 obj.value = reader.read("!L")[0]
1823 return obj
1824
1825 def __eq__(self, other):
1826 if type(self) != type(other): return False
1827 if self.value != other.value: return False
1828 return True
1829
1830 def pretty_print(self, q):
1831 q.text("interval {")
1832 with q.group():
1833 with q.indent(2):
1834 q.breakable()
1835 q.text("value = ");
1836 q.text("%#x" % self.value)
1837 q.breakable()
1838 q.text('}')
1839
1840bsn_tlv.subtypes[58] = interval
1841
1842class ip_proto(bsn_tlv):
1843 type = 67
1844
1845 def __init__(self, value=None):
1846 if value != None:
1847 self.value = value
1848 else:
1849 self.value = 0
1850 return
1851
1852 def pack(self):
1853 packed = []
1854 packed.append(struct.pack("!H", self.type))
1855 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1856 packed.append(struct.pack("!B", self.value))
1857 length = sum([len(x) for x in packed])
1858 packed[1] = struct.pack("!H", length)
1859 return ''.join(packed)
1860
1861 @staticmethod
1862 def unpack(reader):
1863 obj = ip_proto()
1864 _type = reader.read("!H")[0]
1865 assert(_type == 67)
1866 _length = reader.read("!H")[0]
1867 orig_reader = reader
1868 reader = orig_reader.slice(_length, 4)
1869 obj.value = reader.read("!B")[0]
1870 return obj
1871
1872 def __eq__(self, other):
1873 if type(self) != type(other): return False
1874 if self.value != other.value: return False
1875 return True
1876
1877 def pretty_print(self, q):
1878 q.text("ip_proto {")
1879 with q.group():
1880 with q.indent(2):
1881 q.breakable()
1882 q.text("value = ");
1883 q.text("%#x" % self.value)
1884 q.breakable()
1885 q.text('}')
1886
1887bsn_tlv.subtypes[67] = ip_proto
1888
1889class ipv4(bsn_tlv):
1890 type = 4
1891
1892 def __init__(self, value=None):
1893 if value != None:
1894 self.value = value
1895 else:
1896 self.value = 0
1897 return
1898
1899 def pack(self):
1900 packed = []
1901 packed.append(struct.pack("!H", self.type))
1902 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1903 packed.append(struct.pack("!L", self.value))
1904 length = sum([len(x) for x in packed])
1905 packed[1] = struct.pack("!H", length)
1906 return ''.join(packed)
1907
1908 @staticmethod
1909 def unpack(reader):
1910 obj = ipv4()
1911 _type = reader.read("!H")[0]
1912 assert(_type == 4)
1913 _length = reader.read("!H")[0]
1914 orig_reader = reader
1915 reader = orig_reader.slice(_length, 4)
1916 obj.value = reader.read("!L")[0]
1917 return obj
1918
1919 def __eq__(self, other):
1920 if type(self) != type(other): return False
1921 if self.value != other.value: return False
1922 return True
1923
1924 def pretty_print(self, q):
1925 q.text("ipv4 {")
1926 with q.group():
1927 with q.indent(2):
1928 q.breakable()
1929 q.text("value = ");
1930 q.text(util.pretty_ipv4(self.value))
1931 q.breakable()
1932 q.text('}')
1933
1934bsn_tlv.subtypes[4] = ipv4
1935
1936class ipv4_dst(bsn_tlv):
1937 type = 35
1938
1939 def __init__(self, value=None):
1940 if value != None:
1941 self.value = value
1942 else:
1943 self.value = 0
1944 return
1945
1946 def pack(self):
1947 packed = []
1948 packed.append(struct.pack("!H", self.type))
1949 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1950 packed.append(struct.pack("!L", self.value))
1951 length = sum([len(x) for x in packed])
1952 packed[1] = struct.pack("!H", length)
1953 return ''.join(packed)
1954
1955 @staticmethod
1956 def unpack(reader):
1957 obj = ipv4_dst()
1958 _type = reader.read("!H")[0]
1959 assert(_type == 35)
1960 _length = reader.read("!H")[0]
1961 orig_reader = reader
1962 reader = orig_reader.slice(_length, 4)
1963 obj.value = reader.read("!L")[0]
1964 return obj
1965
1966 def __eq__(self, other):
1967 if type(self) != type(other): return False
1968 if self.value != other.value: return False
1969 return True
1970
1971 def pretty_print(self, q):
1972 q.text("ipv4_dst {")
1973 with q.group():
1974 with q.indent(2):
1975 q.breakable()
1976 q.text("value = ");
1977 q.text(util.pretty_ipv4(self.value))
1978 q.breakable()
1979 q.text('}')
1980
1981bsn_tlv.subtypes[35] = ipv4_dst
1982
1983class ipv4_netmask(bsn_tlv):
1984 type = 60
1985
1986 def __init__(self, value=None):
1987 if value != None:
1988 self.value = value
1989 else:
1990 self.value = 0
1991 return
1992
1993 def pack(self):
1994 packed = []
1995 packed.append(struct.pack("!H", self.type))
1996 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1997 packed.append(struct.pack("!L", self.value))
1998 length = sum([len(x) for x in packed])
1999 packed[1] = struct.pack("!H", length)
2000 return ''.join(packed)
2001
2002 @staticmethod
2003 def unpack(reader):
2004 obj = ipv4_netmask()
2005 _type = reader.read("!H")[0]
2006 assert(_type == 60)
2007 _length = reader.read("!H")[0]
2008 orig_reader = reader
2009 reader = orig_reader.slice(_length, 4)
2010 obj.value = reader.read("!L")[0]
2011 return obj
2012
2013 def __eq__(self, other):
2014 if type(self) != type(other): return False
2015 if self.value != other.value: return False
2016 return True
2017
2018 def pretty_print(self, q):
2019 q.text("ipv4_netmask {")
2020 with q.group():
2021 with q.indent(2):
2022 q.breakable()
2023 q.text("value = ");
2024 q.text(util.pretty_ipv4(self.value))
2025 q.breakable()
2026 q.text('}')
2027
2028bsn_tlv.subtypes[60] = ipv4_netmask
2029
2030class ipv4_src(bsn_tlv):
2031 type = 34
2032
2033 def __init__(self, value=None):
2034 if value != None:
2035 self.value = value
2036 else:
2037 self.value = 0
2038 return
2039
2040 def pack(self):
2041 packed = []
2042 packed.append(struct.pack("!H", self.type))
2043 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2044 packed.append(struct.pack("!L", self.value))
2045 length = sum([len(x) for x in packed])
2046 packed[1] = struct.pack("!H", length)
2047 return ''.join(packed)
2048
2049 @staticmethod
2050 def unpack(reader):
2051 obj = ipv4_src()
2052 _type = reader.read("!H")[0]
2053 assert(_type == 34)
2054 _length = reader.read("!H")[0]
2055 orig_reader = reader
2056 reader = orig_reader.slice(_length, 4)
2057 obj.value = reader.read("!L")[0]
2058 return obj
2059
2060 def __eq__(self, other):
2061 if type(self) != type(other): return False
2062 if self.value != other.value: return False
2063 return True
2064
2065 def pretty_print(self, q):
2066 q.text("ipv4_src {")
2067 with q.group():
2068 with q.indent(2):
2069 q.breakable()
2070 q.text("value = ");
2071 q.text(util.pretty_ipv4(self.value))
2072 q.breakable()
2073 q.text('}')
2074
2075bsn_tlv.subtypes[34] = ipv4_src
2076
2077class ipv6(bsn_tlv):
2078 type = 84
2079
2080 def __init__(self, value=None):
2081 if value != None:
2082 self.value = value
2083 else:
2084 self.value = '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
2085 return
2086
2087 def pack(self):
2088 packed = []
2089 packed.append(struct.pack("!H", self.type))
2090 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2091 packed.append(struct.pack("!16s", self.value))
2092 length = sum([len(x) for x in packed])
2093 packed[1] = struct.pack("!H", length)
2094 return ''.join(packed)
2095
2096 @staticmethod
2097 def unpack(reader):
2098 obj = ipv6()
2099 _type = reader.read("!H")[0]
2100 assert(_type == 84)
2101 _length = reader.read("!H")[0]
2102 orig_reader = reader
2103 reader = orig_reader.slice(_length, 4)
2104 obj.value = reader.read('!16s')[0]
2105 return obj
2106
2107 def __eq__(self, other):
2108 if type(self) != type(other): return False
2109 if self.value != other.value: return False
2110 return True
2111
2112 def pretty_print(self, q):
2113 q.text("ipv6 {")
2114 with q.group():
2115 with q.indent(2):
2116 q.breakable()
2117 q.text("value = ");
2118 q.pp(self.value)
2119 q.breakable()
2120 q.text('}')
2121
2122bsn_tlv.subtypes[84] = ipv6
2123
2124class known_multicast_rate(bsn_tlv):
2125 type = 91
2126
2127 def __init__(self, value=None):
2128 if value != None:
2129 self.value = value
2130 else:
2131 self.value = 0
2132 return
2133
2134 def pack(self):
2135 packed = []
2136 packed.append(struct.pack("!H", self.type))
2137 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2138 packed.append(struct.pack("!L", self.value))
2139 length = sum([len(x) for x in packed])
2140 packed[1] = struct.pack("!H", length)
2141 return ''.join(packed)
2142
2143 @staticmethod
2144 def unpack(reader):
2145 obj = known_multicast_rate()
2146 _type = reader.read("!H")[0]
2147 assert(_type == 91)
2148 _length = reader.read("!H")[0]
2149 orig_reader = reader
2150 reader = orig_reader.slice(_length, 4)
2151 obj.value = reader.read("!L")[0]
2152 return obj
2153
2154 def __eq__(self, other):
2155 if type(self) != type(other): return False
2156 if self.value != other.value: return False
2157 return True
2158
2159 def pretty_print(self, q):
2160 q.text("known_multicast_rate {")
2161 with q.group():
2162 with q.indent(2):
2163 q.breakable()
2164 q.text("value = ");
2165 q.text("%#x" % self.value)
2166 q.breakable()
2167 q.text('}')
2168
2169bsn_tlv.subtypes[91] = known_multicast_rate
2170
2171class l2_multicast_lookup(bsn_tlv):
2172 type = 79
2173
2174 def __init__(self):
2175 return
2176
2177 def pack(self):
2178 packed = []
2179 packed.append(struct.pack("!H", self.type))
2180 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2181 length = sum([len(x) for x in packed])
2182 packed[1] = struct.pack("!H", length)
2183 return ''.join(packed)
2184
2185 @staticmethod
2186 def unpack(reader):
2187 obj = l2_multicast_lookup()
2188 _type = reader.read("!H")[0]
2189 assert(_type == 79)
2190 _length = reader.read("!H")[0]
2191 orig_reader = reader
2192 reader = orig_reader.slice(_length, 4)
2193 return obj
2194
2195 def __eq__(self, other):
2196 if type(self) != type(other): return False
2197 return True
2198
2199 def pretty_print(self, q):
2200 q.text("l2_multicast_lookup {")
2201 with q.group():
2202 with q.indent(2):
2203 q.breakable()
2204 q.breakable()
2205 q.text('}')
2206
2207bsn_tlv.subtypes[79] = l2_multicast_lookup
2208
2209class mac(bsn_tlv):
2210 type = 1
2211
2212 def __init__(self, value=None):
2213 if value != None:
2214 self.value = value
2215 else:
2216 self.value = [0,0,0,0,0,0]
2217 return
2218
2219 def pack(self):
2220 packed = []
2221 packed.append(struct.pack("!H", self.type))
2222 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2223 packed.append(struct.pack("!6B", *self.value))
2224 length = sum([len(x) for x in packed])
2225 packed[1] = struct.pack("!H", length)
2226 return ''.join(packed)
2227
2228 @staticmethod
2229 def unpack(reader):
2230 obj = mac()
2231 _type = reader.read("!H")[0]
2232 assert(_type == 1)
2233 _length = reader.read("!H")[0]
2234 orig_reader = reader
2235 reader = orig_reader.slice(_length, 4)
2236 obj.value = list(reader.read('!6B'))
2237 return obj
2238
2239 def __eq__(self, other):
2240 if type(self) != type(other): return False
2241 if self.value != other.value: return False
2242 return True
2243
2244 def pretty_print(self, q):
2245 q.text("mac {")
2246 with q.group():
2247 with q.indent(2):
2248 q.breakable()
2249 q.text("value = ");
2250 q.text(util.pretty_mac(self.value))
2251 q.breakable()
2252 q.text('}')
2253
2254bsn_tlv.subtypes[1] = mac
2255
2256class mac_mask(bsn_tlv):
2257 type = 56
2258
2259 def __init__(self, value=None):
2260 if value != None:
2261 self.value = value
2262 else:
2263 self.value = [0,0,0,0,0,0]
2264 return
2265
2266 def pack(self):
2267 packed = []
2268 packed.append(struct.pack("!H", self.type))
2269 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2270 packed.append(struct.pack("!6B", *self.value))
2271 length = sum([len(x) for x in packed])
2272 packed[1] = struct.pack("!H", length)
2273 return ''.join(packed)
2274
2275 @staticmethod
2276 def unpack(reader):
2277 obj = mac_mask()
2278 _type = reader.read("!H")[0]
2279 assert(_type == 56)
2280 _length = reader.read("!H")[0]
2281 orig_reader = reader
2282 reader = orig_reader.slice(_length, 4)
2283 obj.value = list(reader.read('!6B'))
2284 return obj
2285
2286 def __eq__(self, other):
2287 if type(self) != type(other): return False
2288 if self.value != other.value: return False
2289 return True
2290
2291 def pretty_print(self, q):
2292 q.text("mac_mask {")
2293 with q.group():
2294 with q.indent(2):
2295 q.breakable()
2296 q.text("value = ");
2297 q.text(util.pretty_mac(self.value))
2298 q.breakable()
2299 q.text('}')
2300
2301bsn_tlv.subtypes[56] = mac_mask
2302
2303class mcg_type_vxlan(bsn_tlv):
2304 type = 87
2305
2306 def __init__(self):
2307 return
2308
2309 def pack(self):
2310 packed = []
2311 packed.append(struct.pack("!H", self.type))
2312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2313 length = sum([len(x) for x in packed])
2314 packed[1] = struct.pack("!H", length)
2315 return ''.join(packed)
2316
2317 @staticmethod
2318 def unpack(reader):
2319 obj = mcg_type_vxlan()
2320 _type = reader.read("!H")[0]
2321 assert(_type == 87)
2322 _length = reader.read("!H")[0]
2323 orig_reader = reader
2324 reader = orig_reader.slice(_length, 4)
2325 return obj
2326
2327 def __eq__(self, other):
2328 if type(self) != type(other): return False
2329 return True
2330
2331 def pretty_print(self, q):
2332 q.text("mcg_type_vxlan {")
2333 with q.group():
2334 with q.indent(2):
2335 q.breakable()
2336 q.breakable()
2337 q.text('}')
2338
2339bsn_tlv.subtypes[87] = mcg_type_vxlan
2340
2341class miss_packets(bsn_tlv):
2342 type = 13
2343
2344 def __init__(self, value=None):
2345 if value != None:
2346 self.value = value
2347 else:
2348 self.value = 0
2349 return
2350
2351 def pack(self):
2352 packed = []
2353 packed.append(struct.pack("!H", self.type))
2354 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2355 packed.append(struct.pack("!Q", self.value))
2356 length = sum([len(x) for x in packed])
2357 packed[1] = struct.pack("!H", length)
2358 return ''.join(packed)
2359
2360 @staticmethod
2361 def unpack(reader):
2362 obj = miss_packets()
2363 _type = reader.read("!H")[0]
2364 assert(_type == 13)
2365 _length = reader.read("!H")[0]
2366 orig_reader = reader
2367 reader = orig_reader.slice(_length, 4)
2368 obj.value = reader.read("!Q")[0]
2369 return obj
2370
2371 def __eq__(self, other):
2372 if type(self) != type(other): return False
2373 if self.value != other.value: return False
2374 return True
2375
2376 def pretty_print(self, q):
2377 q.text("miss_packets {")
2378 with q.group():
2379 with q.indent(2):
2380 q.breakable()
2381 q.text("value = ");
2382 q.text("%#x" % self.value)
2383 q.breakable()
2384 q.text('}')
2385
2386bsn_tlv.subtypes[13] = miss_packets
2387
2388class mpls_control_word(bsn_tlv):
2389 type = 62
2390
2391 def __init__(self, value=None):
2392 if value != None:
2393 self.value = value
2394 else:
2395 self.value = 0
2396 return
2397
2398 def pack(self):
2399 packed = []
2400 packed.append(struct.pack("!H", self.type))
2401 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2402 packed.append(struct.pack("!B", self.value))
2403 length = sum([len(x) for x in packed])
2404 packed[1] = struct.pack("!H", length)
2405 return ''.join(packed)
2406
2407 @staticmethod
2408 def unpack(reader):
2409 obj = mpls_control_word()
2410 _type = reader.read("!H")[0]
2411 assert(_type == 62)
2412 _length = reader.read("!H")[0]
2413 orig_reader = reader
2414 reader = orig_reader.slice(_length, 4)
2415 obj.value = reader.read("!B")[0]
2416 return obj
2417
2418 def __eq__(self, other):
2419 if type(self) != type(other): return False
2420 if self.value != other.value: return False
2421 return True
2422
2423 def pretty_print(self, q):
2424 q.text("mpls_control_word {")
2425 with q.group():
2426 with q.indent(2):
2427 q.breakable()
2428 q.text("value = ");
2429 q.text("%#x" % self.value)
2430 q.breakable()
2431 q.text('}')
2432
2433bsn_tlv.subtypes[62] = mpls_control_word
2434
2435class mpls_label(bsn_tlv):
2436 type = 61
2437
2438 def __init__(self, value=None):
2439 if value != None:
2440 self.value = value
2441 else:
2442 self.value = 0
2443 return
2444
2445 def pack(self):
2446 packed = []
2447 packed.append(struct.pack("!H", self.type))
2448 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2449 packed.append(struct.pack("!L", self.value))
2450 length = sum([len(x) for x in packed])
2451 packed[1] = struct.pack("!H", length)
2452 return ''.join(packed)
2453
2454 @staticmethod
2455 def unpack(reader):
2456 obj = mpls_label()
2457 _type = reader.read("!H")[0]
2458 assert(_type == 61)
2459 _length = reader.read("!H")[0]
2460 orig_reader = reader
2461 reader = orig_reader.slice(_length, 4)
2462 obj.value = reader.read("!L")[0]
2463 return obj
2464
2465 def __eq__(self, other):
2466 if type(self) != type(other): return False
2467 if self.value != other.value: return False
2468 return True
2469
2470 def pretty_print(self, q):
2471 q.text("mpls_label {")
2472 with q.group():
2473 with q.indent(2):
2474 q.breakable()
2475 q.text("value = ");
2476 q.text("%#x" % self.value)
2477 q.breakable()
2478 q.text('}')
2479
2480bsn_tlv.subtypes[61] = mpls_label
2481
2482class mpls_sequenced(bsn_tlv):
2483 type = 63
2484
2485 def __init__(self, value=None):
2486 if value != None:
2487 self.value = value
2488 else:
2489 self.value = 0
2490 return
2491
2492 def pack(self):
2493 packed = []
2494 packed.append(struct.pack("!H", self.type))
2495 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2496 packed.append(struct.pack("!B", self.value))
2497 length = sum([len(x) for x in packed])
2498 packed[1] = struct.pack("!H", length)
2499 return ''.join(packed)
2500
2501 @staticmethod
2502 def unpack(reader):
2503 obj = mpls_sequenced()
2504 _type = reader.read("!H")[0]
2505 assert(_type == 63)
2506 _length = reader.read("!H")[0]
2507 orig_reader = reader
2508 reader = orig_reader.slice(_length, 4)
2509 obj.value = reader.read("!B")[0]
2510 return obj
2511
2512 def __eq__(self, other):
2513 if type(self) != type(other): return False
2514 if self.value != other.value: return False
2515 return True
2516
2517 def pretty_print(self, q):
2518 q.text("mpls_sequenced {")
2519 with q.group():
2520 with q.indent(2):
2521 q.breakable()
2522 q.text("value = ");
2523 q.text("%#x" % self.value)
2524 q.breakable()
2525 q.text('}')
2526
2527bsn_tlv.subtypes[63] = mpls_sequenced
2528
2529class multicast_interface_id(bsn_tlv):
2530 type = 95
2531
2532 def __init__(self, value=None):
2533 if value != None:
2534 self.value = value
2535 else:
2536 self.value = 0
2537 return
2538
2539 def pack(self):
2540 packed = []
2541 packed.append(struct.pack("!H", self.type))
2542 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2543 packed.append(struct.pack("!L", self.value))
2544 length = sum([len(x) for x in packed])
2545 packed[1] = struct.pack("!H", length)
2546 return ''.join(packed)
2547
2548 @staticmethod
2549 def unpack(reader):
2550 obj = multicast_interface_id()
2551 _type = reader.read("!H")[0]
2552 assert(_type == 95)
2553 _length = reader.read("!H")[0]
2554 orig_reader = reader
2555 reader = orig_reader.slice(_length, 4)
2556 obj.value = reader.read("!L")[0]
2557 return obj
2558
2559 def __eq__(self, other):
2560 if type(self) != type(other): return False
2561 if self.value != other.value: return False
2562 return True
2563
2564 def pretty_print(self, q):
2565 q.text("multicast_interface_id {")
2566 with q.group():
2567 with q.indent(2):
2568 q.breakable()
2569 q.text("value = ");
2570 q.text("%#x" % self.value)
2571 q.breakable()
2572 q.text('}')
2573
2574bsn_tlv.subtypes[95] = multicast_interface_id
2575
2576class name(bsn_tlv):
2577 type = 52
2578
2579 def __init__(self, value=None):
2580 if value != None:
2581 self.value = value
2582 else:
2583 self.value = ''
2584 return
2585
2586 def pack(self):
2587 packed = []
2588 packed.append(struct.pack("!H", self.type))
2589 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2590 packed.append(self.value)
2591 length = sum([len(x) for x in packed])
2592 packed[1] = struct.pack("!H", length)
2593 return ''.join(packed)
2594
2595 @staticmethod
2596 def unpack(reader):
2597 obj = name()
2598 _type = reader.read("!H")[0]
2599 assert(_type == 52)
2600 _length = reader.read("!H")[0]
2601 orig_reader = reader
2602 reader = orig_reader.slice(_length, 4)
2603 obj.value = str(reader.read_all())
2604 return obj
2605
2606 def __eq__(self, other):
2607 if type(self) != type(other): return False
2608 if self.value != other.value: return False
2609 return True
2610
2611 def pretty_print(self, q):
2612 q.text("name {")
2613 with q.group():
2614 with q.indent(2):
2615 q.breakable()
2616 q.text("value = ");
2617 q.pp(self.value)
2618 q.breakable()
2619 q.text('}')
2620
2621bsn_tlv.subtypes[52] = name
2622
2623class negate(bsn_tlv):
2624 type = 83
2625
2626 def __init__(self):
2627 return
2628
2629 def pack(self):
2630 packed = []
2631 packed.append(struct.pack("!H", self.type))
2632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2633 length = sum([len(x) for x in packed])
2634 packed[1] = struct.pack("!H", length)
2635 return ''.join(packed)
2636
2637 @staticmethod
2638 def unpack(reader):
2639 obj = negate()
2640 _type = reader.read("!H")[0]
2641 assert(_type == 83)
2642 _length = reader.read("!H")[0]
2643 orig_reader = reader
2644 reader = orig_reader.slice(_length, 4)
2645 return obj
2646
2647 def __eq__(self, other):
2648 if type(self) != type(other): return False
2649 return True
2650
2651 def pretty_print(self, q):
2652 q.text("negate {")
2653 with q.group():
2654 with q.indent(2):
2655 q.breakable()
2656 q.breakable()
2657 q.text('}')
2658
2659bsn_tlv.subtypes[83] = negate
2660
2661class nexthop_type_vxlan(bsn_tlv):
2662 type = 94
2663
2664 def __init__(self):
2665 return
2666
2667 def pack(self):
2668 packed = []
2669 packed.append(struct.pack("!H", self.type))
2670 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2671 length = sum([len(x) for x in packed])
2672 packed[1] = struct.pack("!H", length)
2673 return ''.join(packed)
2674
2675 @staticmethod
2676 def unpack(reader):
2677 obj = nexthop_type_vxlan()
2678 _type = reader.read("!H")[0]
2679 assert(_type == 94)
2680 _length = reader.read("!H")[0]
2681 orig_reader = reader
2682 reader = orig_reader.slice(_length, 4)
2683 return obj
2684
2685 def __eq__(self, other):
2686 if type(self) != type(other): return False
2687 return True
2688
2689 def pretty_print(self, q):
2690 q.text("nexthop_type_vxlan {")
2691 with q.group():
2692 with q.indent(2):
2693 q.breakable()
2694 q.breakable()
2695 q.text('}')
2696
2697bsn_tlv.subtypes[94] = nexthop_type_vxlan
2698
2699class offset(bsn_tlv):
2700 type = 82
2701
2702 def __init__(self, value=None):
2703 if value != None:
2704 self.value = value
2705 else:
2706 self.value = 0
2707 return
2708
2709 def pack(self):
2710 packed = []
2711 packed.append(struct.pack("!H", self.type))
2712 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2713 packed.append(struct.pack("!H", self.value))
2714 length = sum([len(x) for x in packed])
2715 packed[1] = struct.pack("!H", length)
2716 return ''.join(packed)
2717
2718 @staticmethod
2719 def unpack(reader):
2720 obj = offset()
2721 _type = reader.read("!H")[0]
2722 assert(_type == 82)
2723 _length = reader.read("!H")[0]
2724 orig_reader = reader
2725 reader = orig_reader.slice(_length, 4)
2726 obj.value = reader.read("!H")[0]
2727 return obj
2728
2729 def __eq__(self, other):
2730 if type(self) != type(other): return False
2731 if self.value != other.value: return False
2732 return True
2733
2734 def pretty_print(self, q):
2735 q.text("offset {")
2736 with q.group():
2737 with q.indent(2):
2738 q.breakable()
2739 q.text("value = ");
2740 q.text("%#x" % self.value)
2741 q.breakable()
2742 q.text('}')
2743
2744bsn_tlv.subtypes[82] = offset
2745
2746class partner_key(bsn_tlv):
2747 type = 51
2748
2749 def __init__(self, value=None):
2750 if value != None:
2751 self.value = value
2752 else:
2753 self.value = 0
2754 return
2755
2756 def pack(self):
2757 packed = []
2758 packed.append(struct.pack("!H", self.type))
2759 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2760 packed.append(struct.pack("!H", self.value))
2761 length = sum([len(x) for x in packed])
2762 packed[1] = struct.pack("!H", length)
2763 return ''.join(packed)
2764
2765 @staticmethod
2766 def unpack(reader):
2767 obj = partner_key()
2768 _type = reader.read("!H")[0]
2769 assert(_type == 51)
2770 _length = reader.read("!H")[0]
2771 orig_reader = reader
2772 reader = orig_reader.slice(_length, 4)
2773 obj.value = reader.read("!H")[0]
2774 return obj
2775
2776 def __eq__(self, other):
2777 if type(self) != type(other): return False
2778 if self.value != other.value: return False
2779 return True
2780
2781 def pretty_print(self, q):
2782 q.text("partner_key {")
2783 with q.group():
2784 with q.indent(2):
2785 q.breakable()
2786 q.text("value = ");
2787 q.text("%#x" % self.value)
2788 q.breakable()
2789 q.text('}')
2790
2791bsn_tlv.subtypes[51] = partner_key
2792
2793class partner_port_num(bsn_tlv):
2794 type = 50
2795
2796 def __init__(self, value=None):
2797 if value != None:
2798 self.value = value
2799 else:
2800 self.value = 0
2801 return
2802
2803 def pack(self):
2804 packed = []
2805 packed.append(struct.pack("!H", self.type))
2806 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2807 packed.append(struct.pack("!H", self.value))
2808 length = sum([len(x) for x in packed])
2809 packed[1] = struct.pack("!H", length)
2810 return ''.join(packed)
2811
2812 @staticmethod
2813 def unpack(reader):
2814 obj = partner_port_num()
2815 _type = reader.read("!H")[0]
2816 assert(_type == 50)
2817 _length = reader.read("!H")[0]
2818 orig_reader = reader
2819 reader = orig_reader.slice(_length, 4)
2820 obj.value = reader.read("!H")[0]
2821 return obj
2822
2823 def __eq__(self, other):
2824 if type(self) != type(other): return False
2825 if self.value != other.value: return False
2826 return True
2827
2828 def pretty_print(self, q):
2829 q.text("partner_port_num {")
2830 with q.group():
2831 with q.indent(2):
2832 q.breakable()
2833 q.text("value = ");
2834 q.text("%#x" % self.value)
2835 q.breakable()
2836 q.text('}')
2837
2838bsn_tlv.subtypes[50] = partner_port_num
2839
2840class partner_port_priority(bsn_tlv):
2841 type = 49
2842
2843 def __init__(self, value=None):
2844 if value != None:
2845 self.value = value
2846 else:
2847 self.value = 0
2848 return
2849
2850 def pack(self):
2851 packed = []
2852 packed.append(struct.pack("!H", self.type))
2853 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2854 packed.append(struct.pack("!H", self.value))
2855 length = sum([len(x) for x in packed])
2856 packed[1] = struct.pack("!H", length)
2857 return ''.join(packed)
2858
2859 @staticmethod
2860 def unpack(reader):
2861 obj = partner_port_priority()
2862 _type = reader.read("!H")[0]
2863 assert(_type == 49)
2864 _length = reader.read("!H")[0]
2865 orig_reader = reader
2866 reader = orig_reader.slice(_length, 4)
2867 obj.value = reader.read("!H")[0]
2868 return obj
2869
2870 def __eq__(self, other):
2871 if type(self) != type(other): return False
2872 if self.value != other.value: return False
2873 return True
2874
2875 def pretty_print(self, q):
2876 q.text("partner_port_priority {")
2877 with q.group():
2878 with q.indent(2):
2879 q.breakable()
2880 q.text("value = ");
2881 q.text("%#x" % self.value)
2882 q.breakable()
2883 q.text('}')
2884
2885bsn_tlv.subtypes[49] = partner_port_priority
2886
2887class partner_state(bsn_tlv):
2888 type = 54
2889
2890 def __init__(self, value=None):
2891 if value != None:
2892 self.value = value
2893 else:
2894 self.value = 0
2895 return
2896
2897 def pack(self):
2898 packed = []
2899 packed.append(struct.pack("!H", self.type))
2900 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2901 packed.append(struct.pack("!B", self.value))
2902 length = sum([len(x) for x in packed])
2903 packed[1] = struct.pack("!H", length)
2904 return ''.join(packed)
2905
2906 @staticmethod
2907 def unpack(reader):
2908 obj = partner_state()
2909 _type = reader.read("!H")[0]
2910 assert(_type == 54)
2911 _length = reader.read("!H")[0]
2912 orig_reader = reader
2913 reader = orig_reader.slice(_length, 4)
2914 obj.value = reader.read("!B")[0]
2915 return obj
2916
2917 def __eq__(self, other):
2918 if type(self) != type(other): return False
2919 if self.value != other.value: return False
2920 return True
2921
2922 def pretty_print(self, q):
2923 q.text("partner_state {")
2924 with q.group():
2925 with q.indent(2):
2926 q.breakable()
2927 q.text("value = ");
2928 q.text("%#x" % self.value)
2929 q.breakable()
2930 q.text('}')
2931
2932bsn_tlv.subtypes[54] = partner_state
2933
2934class partner_system_mac(bsn_tlv):
2935 type = 48
2936
2937 def __init__(self, value=None):
2938 if value != None:
2939 self.value = value
2940 else:
2941 self.value = [0,0,0,0,0,0]
2942 return
2943
2944 def pack(self):
2945 packed = []
2946 packed.append(struct.pack("!H", self.type))
2947 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2948 packed.append(struct.pack("!6B", *self.value))
2949 length = sum([len(x) for x in packed])
2950 packed[1] = struct.pack("!H", length)
2951 return ''.join(packed)
2952
2953 @staticmethod
2954 def unpack(reader):
2955 obj = partner_system_mac()
2956 _type = reader.read("!H")[0]
2957 assert(_type == 48)
2958 _length = reader.read("!H")[0]
2959 orig_reader = reader
2960 reader = orig_reader.slice(_length, 4)
2961 obj.value = list(reader.read('!6B'))
2962 return obj
2963
2964 def __eq__(self, other):
2965 if type(self) != type(other): return False
2966 if self.value != other.value: return False
2967 return True
2968
2969 def pretty_print(self, q):
2970 q.text("partner_system_mac {")
2971 with q.group():
2972 with q.indent(2):
2973 q.breakable()
2974 q.text("value = ");
2975 q.text(util.pretty_mac(self.value))
2976 q.breakable()
2977 q.text('}')
2978
2979bsn_tlv.subtypes[48] = partner_system_mac
2980
2981class partner_system_priority(bsn_tlv):
2982 type = 47
2983
2984 def __init__(self, value=None):
2985 if value != None:
2986 self.value = value
2987 else:
2988 self.value = 0
2989 return
2990
2991 def pack(self):
2992 packed = []
2993 packed.append(struct.pack("!H", self.type))
2994 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2995 packed.append(struct.pack("!H", self.value))
2996 length = sum([len(x) for x in packed])
2997 packed[1] = struct.pack("!H", length)
2998 return ''.join(packed)
2999
3000 @staticmethod
3001 def unpack(reader):
3002 obj = partner_system_priority()
3003 _type = reader.read("!H")[0]
3004 assert(_type == 47)
3005 _length = reader.read("!H")[0]
3006 orig_reader = reader
3007 reader = orig_reader.slice(_length, 4)
3008 obj.value = reader.read("!H")[0]
3009 return obj
3010
3011 def __eq__(self, other):
3012 if type(self) != type(other): return False
3013 if self.value != other.value: return False
3014 return True
3015
3016 def pretty_print(self, q):
3017 q.text("partner_system_priority {")
3018 with q.group():
3019 with q.indent(2):
3020 q.breakable()
3021 q.text("value = ");
3022 q.text("%#x" % self.value)
3023 q.breakable()
3024 q.text('}')
3025
3026bsn_tlv.subtypes[47] = partner_system_priority
3027
3028class port(bsn_tlv):
3029 type = 0
3030
3031 def __init__(self, value=None):
3032 if value != None:
3033 self.value = value
3034 else:
3035 self.value = 0
3036 return
3037
3038 def pack(self):
3039 packed = []
3040 packed.append(struct.pack("!H", self.type))
3041 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3042 packed.append(util.pack_port_no(self.value))
3043 length = sum([len(x) for x in packed])
3044 packed[1] = struct.pack("!H", length)
3045 return ''.join(packed)
3046
3047 @staticmethod
3048 def unpack(reader):
3049 obj = port()
3050 _type = reader.read("!H")[0]
3051 assert(_type == 0)
3052 _length = reader.read("!H")[0]
3053 orig_reader = reader
3054 reader = orig_reader.slice(_length, 4)
3055 obj.value = util.unpack_port_no(reader)
3056 return obj
3057
3058 def __eq__(self, other):
3059 if type(self) != type(other): return False
3060 if self.value != other.value: return False
3061 return True
3062
3063 def pretty_print(self, q):
3064 q.text("port {")
3065 with q.group():
3066 with q.indent(2):
3067 q.breakable()
3068 q.text("value = ");
3069 q.text(util.pretty_port(self.value))
3070 q.breakable()
3071 q.text('}')
3072
3073bsn_tlv.subtypes[0] = port
3074
3075class port_vxlan_mode(bsn_tlv):
3076 type = 88
3077
3078 def __init__(self, value=None):
3079 if value != None:
3080 self.value = value
3081 else:
3082 self.value = 0
3083 return
3084
3085 def pack(self):
3086 packed = []
3087 packed.append(struct.pack("!H", self.type))
3088 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3089 packed.append(struct.pack("!B", self.value))
3090 length = sum([len(x) for x in packed])
3091 packed[1] = struct.pack("!H", length)
3092 return ''.join(packed)
3093
3094 @staticmethod
3095 def unpack(reader):
3096 obj = port_vxlan_mode()
3097 _type = reader.read("!H")[0]
3098 assert(_type == 88)
3099 _length = reader.read("!H")[0]
3100 orig_reader = reader
3101 reader = orig_reader.slice(_length, 4)
3102 obj.value = reader.read("!B")[0]
3103 return obj
3104
3105 def __eq__(self, other):
3106 if type(self) != type(other): return False
3107 if self.value != other.value: return False
3108 return True
3109
3110 def pretty_print(self, q):
3111 q.text("port_vxlan_mode {")
3112 with q.group():
3113 with q.indent(2):
3114 q.breakable()
3115 q.text("value = ");
3116 q.text("%#x" % self.value)
3117 q.breakable()
3118 q.text('}')
3119
3120bsn_tlv.subtypes[88] = port_vxlan_mode
3121
3122class priority(bsn_tlv):
3123 type = 57
3124
3125 def __init__(self, value=None):
3126 if value != None:
3127 self.value = value
3128 else:
3129 self.value = 0
3130 return
3131
3132 def pack(self):
3133 packed = []
3134 packed.append(struct.pack("!H", self.type))
3135 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3136 packed.append(struct.pack("!L", self.value))
3137 length = sum([len(x) for x in packed])
3138 packed[1] = struct.pack("!H", length)
3139 return ''.join(packed)
3140
3141 @staticmethod
3142 def unpack(reader):
3143 obj = priority()
3144 _type = reader.read("!H")[0]
3145 assert(_type == 57)
3146 _length = reader.read("!H")[0]
3147 orig_reader = reader
3148 reader = orig_reader.slice(_length, 4)
3149 obj.value = reader.read("!L")[0]
3150 return obj
3151
3152 def __eq__(self, other):
3153 if type(self) != type(other): return False
3154 if self.value != other.value: return False
3155 return True
3156
3157 def pretty_print(self, q):
3158 q.text("priority {")
3159 with q.group():
3160 with q.indent(2):
3161 q.breakable()
3162 q.text("value = ");
3163 q.text("%#x" % self.value)
3164 q.breakable()
3165 q.text('}')
3166
3167bsn_tlv.subtypes[57] = priority
3168
3169class queue_id(bsn_tlv):
3170 type = 20
3171
3172 def __init__(self, value=None):
3173 if value != None:
3174 self.value = value
3175 else:
3176 self.value = 0
3177 return
3178
3179 def pack(self):
3180 packed = []
3181 packed.append(struct.pack("!H", self.type))
3182 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3183 packed.append(struct.pack("!L", self.value))
3184 length = sum([len(x) for x in packed])
3185 packed[1] = struct.pack("!H", length)
3186 return ''.join(packed)
3187
3188 @staticmethod
3189 def unpack(reader):
3190 obj = queue_id()
3191 _type = reader.read("!H")[0]
3192 assert(_type == 20)
3193 _length = reader.read("!H")[0]
3194 orig_reader = reader
3195 reader = orig_reader.slice(_length, 4)
3196 obj.value = reader.read("!L")[0]
3197 return obj
3198
3199 def __eq__(self, other):
3200 if type(self) != type(other): return False
3201 if self.value != other.value: return False
3202 return True
3203
3204 def pretty_print(self, q):
3205 q.text("queue_id {")
3206 with q.group():
3207 with q.indent(2):
3208 q.breakable()
3209 q.text("value = ");
3210 q.text("%#x" % self.value)
3211 q.breakable()
3212 q.text('}')
3213
3214bsn_tlv.subtypes[20] = queue_id
3215
3216class queue_weight(bsn_tlv):
3217 type = 21
3218
3219 def __init__(self, value=None):
3220 if value != None:
3221 self.value = value
3222 else:
3223 self.value = 0
3224 return
3225
3226 def pack(self):
3227 packed = []
3228 packed.append(struct.pack("!H", self.type))
3229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3230 packed.append(struct.pack("!L", self.value))
3231 length = sum([len(x) for x in packed])
3232 packed[1] = struct.pack("!H", length)
3233 return ''.join(packed)
3234
3235 @staticmethod
3236 def unpack(reader):
3237 obj = queue_weight()
3238 _type = reader.read("!H")[0]
3239 assert(_type == 21)
3240 _length = reader.read("!H")[0]
3241 orig_reader = reader
3242 reader = orig_reader.slice(_length, 4)
3243 obj.value = reader.read("!L")[0]
3244 return obj
3245
3246 def __eq__(self, other):
3247 if type(self) != type(other): return False
3248 if self.value != other.value: return False
3249 return True
3250
3251 def pretty_print(self, q):
3252 q.text("queue_weight {")
3253 with q.group():
3254 with q.indent(2):
3255 q.breakable()
3256 q.text("value = ");
3257 q.text("%#x" % self.value)
3258 q.breakable()
3259 q.text('}')
3260
3261bsn_tlv.subtypes[21] = queue_weight
3262
3263class rate_unit(bsn_tlv):
3264 type = 89
3265
3266 def __init__(self, value=None):
3267 if value != None:
3268 self.value = value
3269 else:
3270 self.value = 0
3271 return
3272
3273 def pack(self):
3274 packed = []
3275 packed.append(struct.pack("!H", self.type))
3276 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3277 packed.append(struct.pack("!B", self.value))
3278 length = sum([len(x) for x in packed])
3279 packed[1] = struct.pack("!H", length)
3280 return ''.join(packed)
3281
3282 @staticmethod
3283 def unpack(reader):
3284 obj = rate_unit()
3285 _type = reader.read("!H")[0]
3286 assert(_type == 89)
3287 _length = reader.read("!H")[0]
3288 orig_reader = reader
3289 reader = orig_reader.slice(_length, 4)
3290 obj.value = reader.read("!B")[0]
3291 return obj
3292
3293 def __eq__(self, other):
3294 if type(self) != type(other): return False
3295 if self.value != other.value: return False
3296 return True
3297
3298 def pretty_print(self, q):
3299 q.text("rate_unit {")
3300 with q.group():
3301 with q.indent(2):
3302 q.breakable()
3303 q.text("value = ");
3304 q.text("%#x" % self.value)
3305 q.breakable()
3306 q.text('}')
3307
3308bsn_tlv.subtypes[89] = rate_unit
3309
3310class reference(bsn_tlv):
3311 type = 59
3312
3313 def __init__(self, table_id=None, key=None):
3314 if table_id != None:
3315 self.table_id = table_id
3316 else:
3317 self.table_id = 0
3318 if key != None:
3319 self.key = key
3320 else:
3321 self.key = []
3322 return
3323
3324 def pack(self):
3325 packed = []
3326 packed.append(struct.pack("!H", self.type))
3327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3328 packed.append(struct.pack("!H", self.table_id))
3329 packed.append(loxi.generic_util.pack_list(self.key))
3330 length = sum([len(x) for x in packed])
3331 packed[1] = struct.pack("!H", length)
3332 return ''.join(packed)
3333
3334 @staticmethod
3335 def unpack(reader):
3336 obj = reference()
3337 _type = reader.read("!H")[0]
3338 assert(_type == 59)
3339 _length = reader.read("!H")[0]
3340 orig_reader = reader
3341 reader = orig_reader.slice(_length, 4)
3342 obj.table_id = reader.read("!H")[0]
3343 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
3344 return obj
3345
3346 def __eq__(self, other):
3347 if type(self) != type(other): return False
3348 if self.table_id != other.table_id: return False
3349 if self.key != other.key: return False
3350 return True
3351
3352 def pretty_print(self, q):
3353 q.text("reference {")
3354 with q.group():
3355 with q.indent(2):
3356 q.breakable()
3357 q.text("table_id = ");
3358 q.text("%#x" % self.table_id)
3359 q.text(","); q.breakable()
3360 q.text("key = ");
3361 q.pp(self.key)
3362 q.breakable()
3363 q.text('}')
3364
3365bsn_tlv.subtypes[59] = reference
3366
3367class reply_packets(bsn_tlv):
3368 type = 12
3369
3370 def __init__(self, value=None):
3371 if value != None:
3372 self.value = value
3373 else:
3374 self.value = 0
3375 return
3376
3377 def pack(self):
3378 packed = []
3379 packed.append(struct.pack("!H", self.type))
3380 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3381 packed.append(struct.pack("!Q", self.value))
3382 length = sum([len(x) for x in packed])
3383 packed[1] = struct.pack("!H", length)
3384 return ''.join(packed)
3385
3386 @staticmethod
3387 def unpack(reader):
3388 obj = reply_packets()
3389 _type = reader.read("!H")[0]
3390 assert(_type == 12)
3391 _length = reader.read("!H")[0]
3392 orig_reader = reader
3393 reader = orig_reader.slice(_length, 4)
3394 obj.value = reader.read("!Q")[0]
3395 return obj
3396
3397 def __eq__(self, other):
3398 if type(self) != type(other): return False
3399 if self.value != other.value: return False
3400 return True
3401
3402 def pretty_print(self, q):
3403 q.text("reply_packets {")
3404 with q.group():
3405 with q.indent(2):
3406 q.breakable()
3407 q.text("value = ");
3408 q.text("%#x" % self.value)
3409 q.breakable()
3410 q.text('}')
3411
3412bsn_tlv.subtypes[12] = reply_packets
3413
3414class request_packets(bsn_tlv):
3415 type = 11
3416
3417 def __init__(self, value=None):
3418 if value != None:
3419 self.value = value
3420 else:
3421 self.value = 0
3422 return
3423
3424 def pack(self):
3425 packed = []
3426 packed.append(struct.pack("!H", self.type))
3427 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3428 packed.append(struct.pack("!Q", self.value))
3429 length = sum([len(x) for x in packed])
3430 packed[1] = struct.pack("!H", length)
3431 return ''.join(packed)
3432
3433 @staticmethod
3434 def unpack(reader):
3435 obj = request_packets()
3436 _type = reader.read("!H")[0]
3437 assert(_type == 11)
3438 _length = reader.read("!H")[0]
3439 orig_reader = reader
3440 reader = orig_reader.slice(_length, 4)
3441 obj.value = reader.read("!Q")[0]
3442 return obj
3443
3444 def __eq__(self, other):
3445 if type(self) != type(other): return False
3446 if self.value != other.value: return False
3447 return True
3448
3449 def pretty_print(self, q):
3450 q.text("request_packets {")
3451 with q.group():
3452 with q.indent(2):
3453 q.breakable()
3454 q.text("value = ");
3455 q.text("%#x" % self.value)
3456 q.breakable()
3457 q.text('}')
3458
3459bsn_tlv.subtypes[11] = request_packets
3460
3461class rx_bytes(bsn_tlv):
3462 type = 71
3463
3464 def __init__(self, value=None):
3465 if value != None:
3466 self.value = value
3467 else:
3468 self.value = 0
3469 return
3470
3471 def pack(self):
3472 packed = []
3473 packed.append(struct.pack("!H", self.type))
3474 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3475 packed.append(struct.pack("!Q", self.value))
3476 length = sum([len(x) for x in packed])
3477 packed[1] = struct.pack("!H", length)
3478 return ''.join(packed)
3479
3480 @staticmethod
3481 def unpack(reader):
3482 obj = rx_bytes()
3483 _type = reader.read("!H")[0]
3484 assert(_type == 71)
3485 _length = reader.read("!H")[0]
3486 orig_reader = reader
3487 reader = orig_reader.slice(_length, 4)
3488 obj.value = reader.read("!Q")[0]
3489 return obj
3490
3491 def __eq__(self, other):
3492 if type(self) != type(other): return False
3493 if self.value != other.value: return False
3494 return True
3495
3496 def pretty_print(self, q):
3497 q.text("rx_bytes {")
3498 with q.group():
3499 with q.indent(2):
3500 q.breakable()
3501 q.text("value = ");
3502 q.text("%#x" % self.value)
3503 q.breakable()
3504 q.text('}')
3505
3506bsn_tlv.subtypes[71] = rx_bytes
3507
3508class rx_packets(bsn_tlv):
3509 type = 2
3510
3511 def __init__(self, value=None):
3512 if value != None:
3513 self.value = value
3514 else:
3515 self.value = 0
3516 return
3517
3518 def pack(self):
3519 packed = []
3520 packed.append(struct.pack("!H", self.type))
3521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3522 packed.append(struct.pack("!Q", self.value))
3523 length = sum([len(x) for x in packed])
3524 packed[1] = struct.pack("!H", length)
3525 return ''.join(packed)
3526
3527 @staticmethod
3528 def unpack(reader):
3529 obj = rx_packets()
3530 _type = reader.read("!H")[0]
3531 assert(_type == 2)
3532 _length = reader.read("!H")[0]
3533 orig_reader = reader
3534 reader = orig_reader.slice(_length, 4)
3535 obj.value = reader.read("!Q")[0]
3536 return obj
3537
3538 def __eq__(self, other):
3539 if type(self) != type(other): return False
3540 if self.value != other.value: return False
3541 return True
3542
3543 def pretty_print(self, q):
3544 q.text("rx_packets {")
3545 with q.group():
3546 with q.indent(2):
3547 q.breakable()
3548 q.text("value = ");
3549 q.text("%#x" % self.value)
3550 q.breakable()
3551 q.text('}')
3552
3553bsn_tlv.subtypes[2] = rx_packets
3554
3555class sampling_rate(bsn_tlv):
3556 type = 30
3557
3558 def __init__(self, value=None):
3559 if value != None:
3560 self.value = value
3561 else:
3562 self.value = 0
3563 return
3564
3565 def pack(self):
3566 packed = []
3567 packed.append(struct.pack("!H", self.type))
3568 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3569 packed.append(struct.pack("!L", self.value))
3570 length = sum([len(x) for x in packed])
3571 packed[1] = struct.pack("!H", length)
3572 return ''.join(packed)
3573
3574 @staticmethod
3575 def unpack(reader):
3576 obj = sampling_rate()
3577 _type = reader.read("!H")[0]
3578 assert(_type == 30)
3579 _length = reader.read("!H")[0]
3580 orig_reader = reader
3581 reader = orig_reader.slice(_length, 4)
3582 obj.value = reader.read("!L")[0]
3583 return obj
3584
3585 def __eq__(self, other):
3586 if type(self) != type(other): return False
3587 if self.value != other.value: return False
3588 return True
3589
3590 def pretty_print(self, q):
3591 q.text("sampling_rate {")
3592 with q.group():
3593 with q.indent(2):
3594 q.breakable()
3595 q.text("value = ");
3596 q.text("%#x" % self.value)
3597 q.breakable()
3598 q.text('}')
3599
3600bsn_tlv.subtypes[30] = sampling_rate
3601
3602class set_loopback_mode(bsn_tlv):
3603 type = 74
3604
3605 def __init__(self):
3606 return
3607
3608 def pack(self):
3609 packed = []
3610 packed.append(struct.pack("!H", self.type))
3611 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3612 length = sum([len(x) for x in packed])
3613 packed[1] = struct.pack("!H", length)
3614 return ''.join(packed)
3615
3616 @staticmethod
3617 def unpack(reader):
3618 obj = set_loopback_mode()
3619 _type = reader.read("!H")[0]
3620 assert(_type == 74)
3621 _length = reader.read("!H")[0]
3622 orig_reader = reader
3623 reader = orig_reader.slice(_length, 4)
3624 return obj
3625
3626 def __eq__(self, other):
3627 if type(self) != type(other): return False
3628 return True
3629
3630 def pretty_print(self, q):
3631 q.text("set_loopback_mode {")
3632 with q.group():
3633 with q.indent(2):
3634 q.breakable()
3635 q.breakable()
3636 q.text('}')
3637
3638bsn_tlv.subtypes[74] = set_loopback_mode
3639
3640class status(bsn_tlv):
3641 type = 97
3642
3643 def __init__(self, value=None):
3644 if value != None:
3645 self.value = value
3646 else:
3647 self.value = 0
3648 return
3649
3650 def pack(self):
3651 packed = []
3652 packed.append(struct.pack("!H", self.type))
3653 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3654 packed.append(struct.pack("!B", self.value))
3655 length = sum([len(x) for x in packed])
3656 packed[1] = struct.pack("!H", length)
3657 return ''.join(packed)
3658
3659 @staticmethod
3660 def unpack(reader):
3661 obj = status()
3662 _type = reader.read("!H")[0]
3663 assert(_type == 97)
3664 _length = reader.read("!H")[0]
3665 orig_reader = reader
3666 reader = orig_reader.slice(_length, 4)
3667 obj.value = reader.read("!B")[0]
3668 return obj
3669
3670 def __eq__(self, other):
3671 if type(self) != type(other): return False
3672 if self.value != other.value: return False
3673 return True
3674
3675 def pretty_print(self, q):
3676 q.text("status {")
3677 with q.group():
3678 with q.indent(2):
3679 q.breakable()
3680 q.text("value = ");
3681 q.text("%#x" % self.value)
3682 q.breakable()
3683 q.text('}')
3684
3685bsn_tlv.subtypes[97] = status
3686
3687class strip_mpls_l2_on_ingress(bsn_tlv):
3688 type = 75
3689
3690 def __init__(self):
3691 return
3692
3693 def pack(self):
3694 packed = []
3695 packed.append(struct.pack("!H", self.type))
3696 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3697 length = sum([len(x) for x in packed])
3698 packed[1] = struct.pack("!H", length)
3699 return ''.join(packed)
3700
3701 @staticmethod
3702 def unpack(reader):
3703 obj = strip_mpls_l2_on_ingress()
3704 _type = reader.read("!H")[0]
3705 assert(_type == 75)
3706 _length = reader.read("!H")[0]
3707 orig_reader = reader
3708 reader = orig_reader.slice(_length, 4)
3709 return obj
3710
3711 def __eq__(self, other):
3712 if type(self) != type(other): return False
3713 return True
3714
3715 def pretty_print(self, q):
3716 q.text("strip_mpls_l2_on_ingress {")
3717 with q.group():
3718 with q.indent(2):
3719 q.breakable()
3720 q.breakable()
3721 q.text('}')
3722
3723bsn_tlv.subtypes[75] = strip_mpls_l2_on_ingress
3724
3725class strip_mpls_l3_on_ingress(bsn_tlv):
3726 type = 76
3727
3728 def __init__(self):
3729 return
3730
3731 def pack(self):
3732 packed = []
3733 packed.append(struct.pack("!H", self.type))
3734 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3735 length = sum([len(x) for x in packed])
3736 packed[1] = struct.pack("!H", length)
3737 return ''.join(packed)
3738
3739 @staticmethod
3740 def unpack(reader):
3741 obj = strip_mpls_l3_on_ingress()
3742 _type = reader.read("!H")[0]
3743 assert(_type == 76)
3744 _length = reader.read("!H")[0]
3745 orig_reader = reader
3746 reader = orig_reader.slice(_length, 4)
3747 return obj
3748
3749 def __eq__(self, other):
3750 if type(self) != type(other): return False
3751 return True
3752
3753 def pretty_print(self, q):
3754 q.text("strip_mpls_l3_on_ingress {")
3755 with q.group():
3756 with q.indent(2):
3757 q.breakable()
3758 q.breakable()
3759 q.text('}')
3760
3761bsn_tlv.subtypes[76] = strip_mpls_l3_on_ingress
3762
3763class strip_vlan_on_egress(bsn_tlv):
3764 type = 73
3765
3766 def __init__(self):
3767 return
3768
3769 def pack(self):
3770 packed = []
3771 packed.append(struct.pack("!H", self.type))
3772 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3773 length = sum([len(x) for x in packed])
3774 packed[1] = struct.pack("!H", length)
3775 return ''.join(packed)
3776
3777 @staticmethod
3778 def unpack(reader):
3779 obj = strip_vlan_on_egress()
3780 _type = reader.read("!H")[0]
3781 assert(_type == 73)
3782 _length = reader.read("!H")[0]
3783 orig_reader = reader
3784 reader = orig_reader.slice(_length, 4)
3785 return obj
3786
3787 def __eq__(self, other):
3788 if type(self) != type(other): return False
3789 return True
3790
3791 def pretty_print(self, q):
3792 q.text("strip_vlan_on_egress {")
3793 with q.group():
3794 with q.indent(2):
3795 q.breakable()
3796 q.breakable()
3797 q.text('}')
3798
3799bsn_tlv.subtypes[73] = strip_vlan_on_egress
3800
3801class sub_agent_id(bsn_tlv):
3802 type = 38
3803
3804 def __init__(self, value=None):
3805 if value != None:
3806 self.value = value
3807 else:
3808 self.value = 0
3809 return
3810
3811 def pack(self):
3812 packed = []
3813 packed.append(struct.pack("!H", self.type))
3814 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3815 packed.append(struct.pack("!L", self.value))
3816 length = sum([len(x) for x in packed])
3817 packed[1] = struct.pack("!H", length)
3818 return ''.join(packed)
3819
3820 @staticmethod
3821 def unpack(reader):
3822 obj = sub_agent_id()
3823 _type = reader.read("!H")[0]
3824 assert(_type == 38)
3825 _length = reader.read("!H")[0]
3826 orig_reader = reader
3827 reader = orig_reader.slice(_length, 4)
3828 obj.value = reader.read("!L")[0]
3829 return obj
3830
3831 def __eq__(self, other):
3832 if type(self) != type(other): return False
3833 if self.value != other.value: return False
3834 return True
3835
3836 def pretty_print(self, q):
3837 q.text("sub_agent_id {")
3838 with q.group():
3839 with q.indent(2):
3840 q.breakable()
3841 q.text("value = ");
3842 q.text("%#x" % self.value)
3843 q.breakable()
3844 q.text('}')
3845
3846bsn_tlv.subtypes[38] = sub_agent_id
3847
3848class tcp_dst(bsn_tlv):
3849 type = 66
3850
3851 def __init__(self, value=None):
3852 if value != None:
3853 self.value = value
3854 else:
3855 self.value = 0
3856 return
3857
3858 def pack(self):
3859 packed = []
3860 packed.append(struct.pack("!H", self.type))
3861 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3862 packed.append(struct.pack("!H", self.value))
3863 length = sum([len(x) for x in packed])
3864 packed[1] = struct.pack("!H", length)
3865 return ''.join(packed)
3866
3867 @staticmethod
3868 def unpack(reader):
3869 obj = tcp_dst()
3870 _type = reader.read("!H")[0]
3871 assert(_type == 66)
3872 _length = reader.read("!H")[0]
3873 orig_reader = reader
3874 reader = orig_reader.slice(_length, 4)
3875 obj.value = reader.read("!H")[0]
3876 return obj
3877
3878 def __eq__(self, other):
3879 if type(self) != type(other): return False
3880 if self.value != other.value: return False
3881 return True
3882
3883 def pretty_print(self, q):
3884 q.text("tcp_dst {")
3885 with q.group():
3886 with q.indent(2):
3887 q.breakable()
3888 q.text("value = ");
3889 q.text("%#x" % self.value)
3890 q.breakable()
3891 q.text('}')
3892
3893bsn_tlv.subtypes[66] = tcp_dst
3894
3895class tcp_src(bsn_tlv):
3896 type = 65
3897
3898 def __init__(self, value=None):
3899 if value != None:
3900 self.value = value
3901 else:
3902 self.value = 0
3903 return
3904
3905 def pack(self):
3906 packed = []
3907 packed.append(struct.pack("!H", self.type))
3908 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3909 packed.append(struct.pack("!H", self.value))
3910 length = sum([len(x) for x in packed])
3911 packed[1] = struct.pack("!H", length)
3912 return ''.join(packed)
3913
3914 @staticmethod
3915 def unpack(reader):
3916 obj = tcp_src()
3917 _type = reader.read("!H")[0]
3918 assert(_type == 65)
3919 _length = reader.read("!H")[0]
3920 orig_reader = reader
3921 reader = orig_reader.slice(_length, 4)
3922 obj.value = reader.read("!H")[0]
3923 return obj
3924
3925 def __eq__(self, other):
3926 if type(self) != type(other): return False
3927 if self.value != other.value: return False
3928 return True
3929
3930 def pretty_print(self, q):
3931 q.text("tcp_src {")
3932 with q.group():
3933 with q.indent(2):
3934 q.breakable()
3935 q.text("value = ");
3936 q.text("%#x" % self.value)
3937 q.breakable()
3938 q.text('}')
3939
3940bsn_tlv.subtypes[65] = tcp_src
3941
3942class tx_bytes(bsn_tlv):
3943 type = 39
3944
3945 def __init__(self, value=None):
3946 if value != None:
3947 self.value = value
3948 else:
3949 self.value = 0
3950 return
3951
3952 def pack(self):
3953 packed = []
3954 packed.append(struct.pack("!H", self.type))
3955 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3956 packed.append(struct.pack("!Q", self.value))
3957 length = sum([len(x) for x in packed])
3958 packed[1] = struct.pack("!H", length)
3959 return ''.join(packed)
3960
3961 @staticmethod
3962 def unpack(reader):
3963 obj = tx_bytes()
3964 _type = reader.read("!H")[0]
3965 assert(_type == 39)
3966 _length = reader.read("!H")[0]
3967 orig_reader = reader
3968 reader = orig_reader.slice(_length, 4)
3969 obj.value = reader.read("!Q")[0]
3970 return obj
3971
3972 def __eq__(self, other):
3973 if type(self) != type(other): return False
3974 if self.value != other.value: return False
3975 return True
3976
3977 def pretty_print(self, q):
3978 q.text("tx_bytes {")
3979 with q.group():
3980 with q.indent(2):
3981 q.breakable()
3982 q.text("value = ");
3983 q.text("%#x" % self.value)
3984 q.breakable()
3985 q.text('}')
3986
3987bsn_tlv.subtypes[39] = tx_bytes
3988
3989class tx_packets(bsn_tlv):
3990 type = 3
3991
3992 def __init__(self, value=None):
3993 if value != None:
3994 self.value = value
3995 else:
3996 self.value = 0
3997 return
3998
3999 def pack(self):
4000 packed = []
4001 packed.append(struct.pack("!H", self.type))
4002 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4003 packed.append(struct.pack("!Q", self.value))
4004 length = sum([len(x) for x in packed])
4005 packed[1] = struct.pack("!H", length)
4006 return ''.join(packed)
4007
4008 @staticmethod
4009 def unpack(reader):
4010 obj = tx_packets()
4011 _type = reader.read("!H")[0]
4012 assert(_type == 3)
4013 _length = reader.read("!H")[0]
4014 orig_reader = reader
4015 reader = orig_reader.slice(_length, 4)
4016 obj.value = reader.read("!Q")[0]
4017 return obj
4018
4019 def __eq__(self, other):
4020 if type(self) != type(other): return False
4021 if self.value != other.value: return False
4022 return True
4023
4024 def pretty_print(self, q):
4025 q.text("tx_packets {")
4026 with q.group():
4027 with q.indent(2):
4028 q.breakable()
4029 q.text("value = ");
4030 q.text("%#x" % self.value)
4031 q.breakable()
4032 q.text('}')
4033
4034bsn_tlv.subtypes[3] = tx_packets
4035
4036class udf_anchor(bsn_tlv):
4037 type = 16
4038
4039 def __init__(self, value=None):
4040 if value != None:
4041 self.value = value
4042 else:
4043 self.value = 0
4044 return
4045
4046 def pack(self):
4047 packed = []
4048 packed.append(struct.pack("!H", self.type))
4049 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4050 packed.append(struct.pack("!H", self.value))
4051 length = sum([len(x) for x in packed])
4052 packed[1] = struct.pack("!H", length)
4053 return ''.join(packed)
4054
4055 @staticmethod
4056 def unpack(reader):
4057 obj = udf_anchor()
4058 _type = reader.read("!H")[0]
4059 assert(_type == 16)
4060 _length = reader.read("!H")[0]
4061 orig_reader = reader
4062 reader = orig_reader.slice(_length, 4)
4063 obj.value = reader.read("!H")[0]
4064 return obj
4065
4066 def __eq__(self, other):
4067 if type(self) != type(other): return False
4068 if self.value != other.value: return False
4069 return True
4070
4071 def pretty_print(self, q):
4072 q.text("udf_anchor {")
4073 with q.group():
4074 with q.indent(2):
4075 q.breakable()
4076 q.text("value = ");
4077 q.text("%#x" % self.value)
4078 q.breakable()
4079 q.text('}')
4080
4081bsn_tlv.subtypes[16] = udf_anchor
4082
4083class udf_id(bsn_tlv):
4084 type = 15
4085
4086 def __init__(self, value=None):
4087 if value != None:
4088 self.value = value
4089 else:
4090 self.value = 0
4091 return
4092
4093 def pack(self):
4094 packed = []
4095 packed.append(struct.pack("!H", self.type))
4096 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4097 packed.append(struct.pack("!H", self.value))
4098 length = sum([len(x) for x in packed])
4099 packed[1] = struct.pack("!H", length)
4100 return ''.join(packed)
4101
4102 @staticmethod
4103 def unpack(reader):
4104 obj = udf_id()
4105 _type = reader.read("!H")[0]
4106 assert(_type == 15)
4107 _length = reader.read("!H")[0]
4108 orig_reader = reader
4109 reader = orig_reader.slice(_length, 4)
4110 obj.value = reader.read("!H")[0]
4111 return obj
4112
4113 def __eq__(self, other):
4114 if type(self) != type(other): return False
4115 if self.value != other.value: return False
4116 return True
4117
4118 def pretty_print(self, q):
4119 q.text("udf_id {")
4120 with q.group():
4121 with q.indent(2):
4122 q.breakable()
4123 q.text("value = ");
4124 q.text("%#x" % self.value)
4125 q.breakable()
4126 q.text('}')
4127
4128bsn_tlv.subtypes[15] = udf_id
4129
4130class udf_length(bsn_tlv):
4131 type = 18
4132
4133 def __init__(self, value=None):
4134 if value != None:
4135 self.value = value
4136 else:
4137 self.value = 0
4138 return
4139
4140 def pack(self):
4141 packed = []
4142 packed.append(struct.pack("!H", self.type))
4143 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4144 packed.append(struct.pack("!H", self.value))
4145 length = sum([len(x) for x in packed])
4146 packed[1] = struct.pack("!H", length)
4147 return ''.join(packed)
4148
4149 @staticmethod
4150 def unpack(reader):
4151 obj = udf_length()
4152 _type = reader.read("!H")[0]
4153 assert(_type == 18)
4154 _length = reader.read("!H")[0]
4155 orig_reader = reader
4156 reader = orig_reader.slice(_length, 4)
4157 obj.value = reader.read("!H")[0]
4158 return obj
4159
4160 def __eq__(self, other):
4161 if type(self) != type(other): return False
4162 if self.value != other.value: return False
4163 return True
4164
4165 def pretty_print(self, q):
4166 q.text("udf_length {")
4167 with q.group():
4168 with q.indent(2):
4169 q.breakable()
4170 q.text("value = ");
4171 q.text("%#x" % self.value)
4172 q.breakable()
4173 q.text('}')
4174
4175bsn_tlv.subtypes[18] = udf_length
4176
4177class udf_offset(bsn_tlv):
4178 type = 17
4179
4180 def __init__(self, value=None):
4181 if value != None:
4182 self.value = value
4183 else:
4184 self.value = 0
4185 return
4186
4187 def pack(self):
4188 packed = []
4189 packed.append(struct.pack("!H", self.type))
4190 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4191 packed.append(struct.pack("!H", self.value))
4192 length = sum([len(x) for x in packed])
4193 packed[1] = struct.pack("!H", length)
4194 return ''.join(packed)
4195
4196 @staticmethod
4197 def unpack(reader):
4198 obj = udf_offset()
4199 _type = reader.read("!H")[0]
4200 assert(_type == 17)
4201 _length = reader.read("!H")[0]
4202 orig_reader = reader
4203 reader = orig_reader.slice(_length, 4)
4204 obj.value = reader.read("!H")[0]
4205 return obj
4206
4207 def __eq__(self, other):
4208 if type(self) != type(other): return False
4209 if self.value != other.value: return False
4210 return True
4211
4212 def pretty_print(self, q):
4213 q.text("udf_offset {")
4214 with q.group():
4215 with q.indent(2):
4216 q.breakable()
4217 q.text("value = ");
4218 q.text("%#x" % self.value)
4219 q.breakable()
4220 q.text('}')
4221
4222bsn_tlv.subtypes[17] = udf_offset
4223
4224class udp_dst(bsn_tlv):
4225 type = 37
4226
4227 def __init__(self, value=None):
4228 if value != None:
4229 self.value = value
4230 else:
4231 self.value = 0
4232 return
4233
4234 def pack(self):
4235 packed = []
4236 packed.append(struct.pack("!H", self.type))
4237 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4238 packed.append(struct.pack("!H", self.value))
4239 length = sum([len(x) for x in packed])
4240 packed[1] = struct.pack("!H", length)
4241 return ''.join(packed)
4242
4243 @staticmethod
4244 def unpack(reader):
4245 obj = udp_dst()
4246 _type = reader.read("!H")[0]
4247 assert(_type == 37)
4248 _length = reader.read("!H")[0]
4249 orig_reader = reader
4250 reader = orig_reader.slice(_length, 4)
4251 obj.value = reader.read("!H")[0]
4252 return obj
4253
4254 def __eq__(self, other):
4255 if type(self) != type(other): return False
4256 if self.value != other.value: return False
4257 return True
4258
4259 def pretty_print(self, q):
4260 q.text("udp_dst {")
4261 with q.group():
4262 with q.indent(2):
4263 q.breakable()
4264 q.text("value = ");
4265 q.text("%#x" % self.value)
4266 q.breakable()
4267 q.text('}')
4268
4269bsn_tlv.subtypes[37] = udp_dst
4270
4271class udp_src(bsn_tlv):
4272 type = 36
4273
4274 def __init__(self, value=None):
4275 if value != None:
4276 self.value = value
4277 else:
4278 self.value = 0
4279 return
4280
4281 def pack(self):
4282 packed = []
4283 packed.append(struct.pack("!H", self.type))
4284 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4285 packed.append(struct.pack("!H", self.value))
4286 length = sum([len(x) for x in packed])
4287 packed[1] = struct.pack("!H", length)
4288 return ''.join(packed)
4289
4290 @staticmethod
4291 def unpack(reader):
4292 obj = udp_src()
4293 _type = reader.read("!H")[0]
4294 assert(_type == 36)
4295 _length = reader.read("!H")[0]
4296 orig_reader = reader
4297 reader = orig_reader.slice(_length, 4)
4298 obj.value = reader.read("!H")[0]
4299 return obj
4300
4301 def __eq__(self, other):
4302 if type(self) != type(other): return False
4303 if self.value != other.value: return False
4304 return True
4305
4306 def pretty_print(self, q):
4307 q.text("udp_src {")
4308 with q.group():
4309 with q.indent(2):
4310 q.breakable()
4311 q.text("value = ");
4312 q.text("%#x" % self.value)
4313 q.breakable()
4314 q.text('}')
4315
4316bsn_tlv.subtypes[36] = udp_src
4317
4318class unicast_query_timeout(bsn_tlv):
4319 type = 9
4320
4321 def __init__(self, value=None):
4322 if value != None:
4323 self.value = value
4324 else:
4325 self.value = 0
4326 return
4327
4328 def pack(self):
4329 packed = []
4330 packed.append(struct.pack("!H", self.type))
4331 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4332 packed.append(struct.pack("!L", self.value))
4333 length = sum([len(x) for x in packed])
4334 packed[1] = struct.pack("!H", length)
4335 return ''.join(packed)
4336
4337 @staticmethod
4338 def unpack(reader):
4339 obj = unicast_query_timeout()
4340 _type = reader.read("!H")[0]
4341 assert(_type == 9)
4342 _length = reader.read("!H")[0]
4343 orig_reader = reader
4344 reader = orig_reader.slice(_length, 4)
4345 obj.value = reader.read("!L")[0]
4346 return obj
4347
4348 def __eq__(self, other):
4349 if type(self) != type(other): return False
4350 if self.value != other.value: return False
4351 return True
4352
4353 def pretty_print(self, q):
4354 q.text("unicast_query_timeout {")
4355 with q.group():
4356 with q.indent(2):
4357 q.breakable()
4358 q.text("value = ");
4359 q.text("%#x" % self.value)
4360 q.breakable()
4361 q.text('}')
4362
4363bsn_tlv.subtypes[9] = unicast_query_timeout
4364
4365class unicast_rate(bsn_tlv):
4366 type = 93
4367
4368 def __init__(self, value=None):
4369 if value != None:
4370 self.value = value
4371 else:
4372 self.value = 0
4373 return
4374
4375 def pack(self):
4376 packed = []
4377 packed.append(struct.pack("!H", self.type))
4378 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4379 packed.append(struct.pack("!L", self.value))
4380 length = sum([len(x) for x in packed])
4381 packed[1] = struct.pack("!H", length)
4382 return ''.join(packed)
4383
4384 @staticmethod
4385 def unpack(reader):
4386 obj = unicast_rate()
4387 _type = reader.read("!H")[0]
4388 assert(_type == 93)
4389 _length = reader.read("!H")[0]
4390 orig_reader = reader
4391 reader = orig_reader.slice(_length, 4)
4392 obj.value = reader.read("!L")[0]
4393 return obj
4394
4395 def __eq__(self, other):
4396 if type(self) != type(other): return False
4397 if self.value != other.value: return False
4398 return True
4399
4400 def pretty_print(self, q):
4401 q.text("unicast_rate {")
4402 with q.group():
4403 with q.indent(2):
4404 q.breakable()
4405 q.text("value = ");
4406 q.text("%#x" % self.value)
4407 q.breakable()
4408 q.text('}')
4409
4410bsn_tlv.subtypes[93] = unicast_rate
4411
4412class unknown_multicast_rate(bsn_tlv):
4413 type = 92
4414
4415 def __init__(self, value=None):
4416 if value != None:
4417 self.value = value
4418 else:
4419 self.value = 0
4420 return
4421
4422 def pack(self):
4423 packed = []
4424 packed.append(struct.pack("!H", self.type))
4425 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4426 packed.append(struct.pack("!L", self.value))
4427 length = sum([len(x) for x in packed])
4428 packed[1] = struct.pack("!H", length)
4429 return ''.join(packed)
4430
4431 @staticmethod
4432 def unpack(reader):
4433 obj = unknown_multicast_rate()
4434 _type = reader.read("!H")[0]
4435 assert(_type == 92)
4436 _length = reader.read("!H")[0]
4437 orig_reader = reader
4438 reader = orig_reader.slice(_length, 4)
4439 obj.value = reader.read("!L")[0]
4440 return obj
4441
4442 def __eq__(self, other):
4443 if type(self) != type(other): return False
4444 if self.value != other.value: return False
4445 return True
4446
4447 def pretty_print(self, q):
4448 q.text("unknown_multicast_rate {")
4449 with q.group():
4450 with q.indent(2):
4451 q.breakable()
4452 q.text("value = ");
4453 q.text("%#x" % self.value)
4454 q.breakable()
4455 q.text('}')
4456
4457bsn_tlv.subtypes[92] = unknown_multicast_rate
4458
4459class use_packet_state(bsn_tlv):
4460 type = 96
4461
4462 def __init__(self, value=None):
4463 if value != None:
4464 self.value = value
4465 else:
4466 self.value = 0
4467 return
4468
4469 def pack(self):
4470 packed = []
4471 packed.append(struct.pack("!H", self.type))
4472 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4473 packed.append(struct.pack("!B", self.value))
4474 length = sum([len(x) for x in packed])
4475 packed[1] = struct.pack("!H", length)
4476 return ''.join(packed)
4477
4478 @staticmethod
4479 def unpack(reader):
4480 obj = use_packet_state()
4481 _type = reader.read("!H")[0]
4482 assert(_type == 96)
4483 _length = reader.read("!H")[0]
4484 orig_reader = reader
4485 reader = orig_reader.slice(_length, 4)
4486 obj.value = reader.read("!B")[0]
4487 return obj
4488
4489 def __eq__(self, other):
4490 if type(self) != type(other): return False
4491 if self.value != other.value: return False
4492 return True
4493
4494 def pretty_print(self, q):
4495 q.text("use_packet_state {")
4496 with q.group():
4497 with q.indent(2):
4498 q.breakable()
4499 q.text("value = ");
4500 q.text("%#x" % self.value)
4501 q.breakable()
4502 q.text('}')
4503
4504bsn_tlv.subtypes[96] = use_packet_state
4505
4506class vfi(bsn_tlv):
4507 type = 99
4508
4509 def __init__(self, value=None):
4510 if value != None:
4511 self.value = value
4512 else:
4513 self.value = 0
4514 return
4515
4516 def pack(self):
4517 packed = []
4518 packed.append(struct.pack("!H", self.type))
4519 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4520 packed.append(struct.pack("!H", self.value))
4521 length = sum([len(x) for x in packed])
4522 packed[1] = struct.pack("!H", length)
4523 return ''.join(packed)
4524
4525 @staticmethod
4526 def unpack(reader):
4527 obj = vfi()
4528 _type = reader.read("!H")[0]
4529 assert(_type == 99)
4530 _length = reader.read("!H")[0]
4531 orig_reader = reader
4532 reader = orig_reader.slice(_length, 4)
4533 obj.value = reader.read("!H")[0]
4534 return obj
4535
4536 def __eq__(self, other):
4537 if type(self) != type(other): return False
4538 if self.value != other.value: return False
4539 return True
4540
4541 def pretty_print(self, q):
4542 q.text("vfi {")
4543 with q.group():
4544 with q.indent(2):
4545 q.breakable()
4546 q.text("value = ");
4547 q.text("%#x" % self.value)
4548 q.breakable()
4549 q.text('}')
4550
4551bsn_tlv.subtypes[99] = vfi
4552
4553class vlan_pcp(bsn_tlv):
4554 type = 72
4555
4556 def __init__(self, value=None):
4557 if value != None:
4558 self.value = value
4559 else:
4560 self.value = 0
4561 return
4562
4563 def pack(self):
4564 packed = []
4565 packed.append(struct.pack("!H", self.type))
4566 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4567 packed.append(struct.pack("!B", self.value))
4568 length = sum([len(x) for x in packed])
4569 packed[1] = struct.pack("!H", length)
4570 return ''.join(packed)
4571
4572 @staticmethod
4573 def unpack(reader):
4574 obj = vlan_pcp()
4575 _type = reader.read("!H")[0]
4576 assert(_type == 72)
4577 _length = reader.read("!H")[0]
4578 orig_reader = reader
4579 reader = orig_reader.slice(_length, 4)
4580 obj.value = reader.read("!B")[0]
4581 return obj
4582
4583 def __eq__(self, other):
4584 if type(self) != type(other): return False
4585 if self.value != other.value: return False
4586 return True
4587
4588 def pretty_print(self, q):
4589 q.text("vlan_pcp {")
4590 with q.group():
4591 with q.indent(2):
4592 q.breakable()
4593 q.text("value = ");
4594 q.text("%#x" % self.value)
4595 q.breakable()
4596 q.text('}')
4597
4598bsn_tlv.subtypes[72] = vlan_pcp
4599
4600class vlan_vid(bsn_tlv):
4601 type = 6
4602
4603 def __init__(self, value=None):
4604 if value != None:
4605 self.value = value
4606 else:
4607 self.value = 0
4608 return
4609
4610 def pack(self):
4611 packed = []
4612 packed.append(struct.pack("!H", self.type))
4613 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4614 packed.append(struct.pack("!H", self.value))
4615 length = sum([len(x) for x in packed])
4616 packed[1] = struct.pack("!H", length)
4617 return ''.join(packed)
4618
4619 @staticmethod
4620 def unpack(reader):
4621 obj = vlan_vid()
4622 _type = reader.read("!H")[0]
4623 assert(_type == 6)
4624 _length = reader.read("!H")[0]
4625 orig_reader = reader
4626 reader = orig_reader.slice(_length, 4)
4627 obj.value = reader.read("!H")[0]
4628 return obj
4629
4630 def __eq__(self, other):
4631 if type(self) != type(other): return False
4632 if self.value != other.value: return False
4633 return True
4634
4635 def pretty_print(self, q):
4636 q.text("vlan_vid {")
4637 with q.group():
4638 with q.indent(2):
4639 q.breakable()
4640 q.text("value = ");
4641 q.text("%#x" % self.value)
4642 q.breakable()
4643 q.text('}')
4644
4645bsn_tlv.subtypes[6] = vlan_vid
4646
4647class vlan_vid_mask(bsn_tlv):
4648 type = 77
4649
4650 def __init__(self, value=None):
4651 if value != None:
4652 self.value = value
4653 else:
4654 self.value = 0
4655 return
4656
4657 def pack(self):
4658 packed = []
4659 packed.append(struct.pack("!H", self.type))
4660 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4661 packed.append(struct.pack("!H", self.value))
4662 length = sum([len(x) for x in packed])
4663 packed[1] = struct.pack("!H", length)
4664 return ''.join(packed)
4665
4666 @staticmethod
4667 def unpack(reader):
4668 obj = vlan_vid_mask()
4669 _type = reader.read("!H")[0]
4670 assert(_type == 77)
4671 _length = reader.read("!H")[0]
4672 orig_reader = reader
4673 reader = orig_reader.slice(_length, 4)
4674 obj.value = reader.read("!H")[0]
4675 return obj
4676
4677 def __eq__(self, other):
4678 if type(self) != type(other): return False
4679 if self.value != other.value: return False
4680 return True
4681
4682 def pretty_print(self, q):
4683 q.text("vlan_vid_mask {")
4684 with q.group():
4685 with q.indent(2):
4686 q.breakable()
4687 q.text("value = ");
4688 q.text("%#x" % self.value)
4689 q.breakable()
4690 q.text('}')
4691
4692bsn_tlv.subtypes[77] = vlan_vid_mask
4693
4694class vni(bsn_tlv):
4695 type = 86
4696
4697 def __init__(self, value=None):
4698 if value != None:
4699 self.value = value
4700 else:
4701 self.value = 0
4702 return
4703
4704 def pack(self):
4705 packed = []
4706 packed.append(struct.pack("!H", self.type))
4707 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4708 packed.append(struct.pack("!L", self.value))
4709 length = sum([len(x) for x in packed])
4710 packed[1] = struct.pack("!H", length)
4711 return ''.join(packed)
4712
4713 @staticmethod
4714 def unpack(reader):
4715 obj = vni()
4716 _type = reader.read("!H")[0]
4717 assert(_type == 86)
4718 _length = reader.read("!H")[0]
4719 orig_reader = reader
4720 reader = orig_reader.slice(_length, 4)
4721 obj.value = reader.read("!L")[0]
4722 return obj
4723
4724 def __eq__(self, other):
4725 if type(self) != type(other): return False
4726 if self.value != other.value: return False
4727 return True
4728
4729 def pretty_print(self, q):
4730 q.text("vni {")
4731 with q.group():
4732 with q.indent(2):
4733 q.breakable()
4734 q.text("value = ");
4735 q.text("%#x" % self.value)
4736 q.breakable()
4737 q.text('}')
4738
4739bsn_tlv.subtypes[86] = vni
4740
4741class vrf(bsn_tlv):
4742 type = 19
4743
4744 def __init__(self, value=None):
4745 if value != None:
4746 self.value = value
4747 else:
4748 self.value = 0
4749 return
4750
4751 def pack(self):
4752 packed = []
4753 packed.append(struct.pack("!H", self.type))
4754 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
4755 packed.append(struct.pack("!L", self.value))
4756 length = sum([len(x) for x in packed])
4757 packed[1] = struct.pack("!H", length)
4758 return ''.join(packed)
4759
4760 @staticmethod
4761 def unpack(reader):
4762 obj = vrf()
4763 _type = reader.read("!H")[0]
4764 assert(_type == 19)
4765 _length = reader.read("!H")[0]
4766 orig_reader = reader
4767 reader = orig_reader.slice(_length, 4)
4768 obj.value = reader.read("!L")[0]
4769 return obj
4770
4771 def __eq__(self, other):
4772 if type(self) != type(other): return False
4773 if self.value != other.value: return False
4774 return True
4775
4776 def pretty_print(self, q):
4777 q.text("vrf {")
4778 with q.group():
4779 with q.indent(2):
4780 q.breakable()
4781 q.text("value = ");
4782 q.text("%#x" % self.value)
4783 q.breakable()
4784 q.text('}')
4785
4786bsn_tlv.subtypes[19] = vrf
4787
4788