blob: d664ed1776bf09cc655cece60308c06d050f7810 [file] [log] [blame]
Rich Laneccd32ed2014-11-10 17:48:24 -08001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
13import bsn_tlv
14import meter_band
15import table_mod_prop
16import instruction
17import queue_desc_prop
18import oxm
19import bundle_prop
20import common
21import instruction_id
22import action
23import role_prop
24import message
25import queue_stats_prop
26import port_stats_prop
27import port_mod_prop
28import async_config_prop
29import action_id
30import util
31import loxi.generic_util
32
33class bsn_tlv(loxi.OFObject):
34 subtypes = {}
35
36
37 def __init__(self, type=None):
38 if type != None:
39 self.type = type
40 else:
41 self.type = 0
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!H", self.type))
47 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
48 length = sum([len(x) for x in packed])
49 packed[1] = struct.pack("!H", length)
50 return ''.join(packed)
51
52 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
55 subclass = bsn_tlv.subtypes.get(subtype)
56 if subclass:
57 return subclass.unpack(reader)
58
59 obj = bsn_tlv()
60 obj.type = reader.read("!H")[0]
61 _length = reader.read("!H")[0]
62 orig_reader = reader
63 reader = orig_reader.slice(_length - (2 + 2))
64 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("bsn_tlv {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.breakable()
77 q.text('}')
78
79
80class actor_key(bsn_tlv):
81 type = 44
82
83 def __init__(self, value=None):
84 if value != None:
85 self.value = value
86 else:
87 self.value = 0
88 return
89
90 def pack(self):
91 packed = []
92 packed.append(struct.pack("!H", self.type))
93 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
94 packed.append(struct.pack("!H", self.value))
95 length = sum([len(x) for x in packed])
96 packed[1] = struct.pack("!H", length)
97 return ''.join(packed)
98
99 @staticmethod
100 def unpack(reader):
101 obj = actor_key()
102 _type = reader.read("!H")[0]
103 assert(_type == 44)
104 _length = reader.read("!H")[0]
105 orig_reader = reader
106 reader = orig_reader.slice(_length - (2 + 2))
107 obj.value = reader.read("!H")[0]
108 return obj
109
110 def __eq__(self, other):
111 if type(self) != type(other): return False
112 if self.value != other.value: return False
113 return True
114
115 def pretty_print(self, q):
116 q.text("actor_key {")
117 with q.group():
118 with q.indent(2):
119 q.breakable()
120 q.text("value = ");
121 q.text("%#x" % self.value)
122 q.breakable()
123 q.text('}')
124
125bsn_tlv.subtypes[44] = actor_key
126
127class actor_port_num(bsn_tlv):
128 type = 43
129
130 def __init__(self, value=None):
131 if value != None:
132 self.value = value
133 else:
134 self.value = 0
135 return
136
137 def pack(self):
138 packed = []
139 packed.append(struct.pack("!H", self.type))
140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
141 packed.append(struct.pack("!H", self.value))
142 length = sum([len(x) for x in packed])
143 packed[1] = struct.pack("!H", length)
144 return ''.join(packed)
145
146 @staticmethod
147 def unpack(reader):
148 obj = actor_port_num()
149 _type = reader.read("!H")[0]
150 assert(_type == 43)
151 _length = reader.read("!H")[0]
152 orig_reader = reader
153 reader = orig_reader.slice(_length - (2 + 2))
154 obj.value = reader.read("!H")[0]
155 return obj
156
157 def __eq__(self, other):
158 if type(self) != type(other): return False
159 if self.value != other.value: return False
160 return True
161
162 def pretty_print(self, q):
163 q.text("actor_port_num {")
164 with q.group():
165 with q.indent(2):
166 q.breakable()
167 q.text("value = ");
168 q.text("%#x" % self.value)
169 q.breakable()
170 q.text('}')
171
172bsn_tlv.subtypes[43] = actor_port_num
173
174class actor_port_priority(bsn_tlv):
175 type = 42
176
177 def __init__(self, value=None):
178 if value != None:
179 self.value = value
180 else:
181 self.value = 0
182 return
183
184 def pack(self):
185 packed = []
186 packed.append(struct.pack("!H", self.type))
187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
188 packed.append(struct.pack("!H", self.value))
189 length = sum([len(x) for x in packed])
190 packed[1] = struct.pack("!H", length)
191 return ''.join(packed)
192
193 @staticmethod
194 def unpack(reader):
195 obj = actor_port_priority()
196 _type = reader.read("!H")[0]
197 assert(_type == 42)
198 _length = reader.read("!H")[0]
199 orig_reader = reader
200 reader = orig_reader.slice(_length - (2 + 2))
201 obj.value = reader.read("!H")[0]
202 return obj
203
204 def __eq__(self, other):
205 if type(self) != type(other): return False
206 if self.value != other.value: return False
207 return True
208
209 def pretty_print(self, q):
210 q.text("actor_port_priority {")
211 with q.group():
212 with q.indent(2):
213 q.breakable()
214 q.text("value = ");
215 q.text("%#x" % self.value)
216 q.breakable()
217 q.text('}')
218
219bsn_tlv.subtypes[42] = actor_port_priority
220
221class actor_state(bsn_tlv):
222 type = 53
223
224 def __init__(self, value=None):
225 if value != None:
226 self.value = value
227 else:
228 self.value = 0
229 return
230
231 def pack(self):
232 packed = []
233 packed.append(struct.pack("!H", self.type))
234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
235 packed.append(struct.pack("!B", self.value))
236 length = sum([len(x) for x in packed])
237 packed[1] = struct.pack("!H", length)
238 return ''.join(packed)
239
240 @staticmethod
241 def unpack(reader):
242 obj = actor_state()
243 _type = reader.read("!H")[0]
244 assert(_type == 53)
245 _length = reader.read("!H")[0]
246 orig_reader = reader
247 reader = orig_reader.slice(_length - (2 + 2))
248 obj.value = reader.read("!B")[0]
249 return obj
250
251 def __eq__(self, other):
252 if type(self) != type(other): return False
253 if self.value != other.value: return False
254 return True
255
256 def pretty_print(self, q):
257 q.text("actor_state {")
258 with q.group():
259 with q.indent(2):
260 q.breakable()
261 q.text("value = ");
262 q.text("%#x" % self.value)
263 q.breakable()
264 q.text('}')
265
266bsn_tlv.subtypes[53] = actor_state
267
268class actor_system_mac(bsn_tlv):
269 type = 41
270
271 def __init__(self, value=None):
272 if value != None:
273 self.value = value
274 else:
275 self.value = [0,0,0,0,0,0]
276 return
277
278 def pack(self):
279 packed = []
280 packed.append(struct.pack("!H", self.type))
281 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
282 packed.append(struct.pack("!6B", *self.value))
283 length = sum([len(x) for x in packed])
284 packed[1] = struct.pack("!H", length)
285 return ''.join(packed)
286
287 @staticmethod
288 def unpack(reader):
289 obj = actor_system_mac()
290 _type = reader.read("!H")[0]
291 assert(_type == 41)
292 _length = reader.read("!H")[0]
293 orig_reader = reader
294 reader = orig_reader.slice(_length - (2 + 2))
295 obj.value = list(reader.read('!6B'))
296 return obj
297
298 def __eq__(self, other):
299 if type(self) != type(other): return False
300 if self.value != other.value: return False
301 return True
302
303 def pretty_print(self, q):
304 q.text("actor_system_mac {")
305 with q.group():
306 with q.indent(2):
307 q.breakable()
308 q.text("value = ");
309 q.text(util.pretty_mac(self.value))
310 q.breakable()
311 q.text('}')
312
313bsn_tlv.subtypes[41] = actor_system_mac
314
315class actor_system_priority(bsn_tlv):
316 type = 40
317
318 def __init__(self, value=None):
319 if value != None:
320 self.value = value
321 else:
322 self.value = 0
323 return
324
325 def pack(self):
326 packed = []
327 packed.append(struct.pack("!H", self.type))
328 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
329 packed.append(struct.pack("!H", self.value))
330 length = sum([len(x) for x in packed])
331 packed[1] = struct.pack("!H", length)
332 return ''.join(packed)
333
334 @staticmethod
335 def unpack(reader):
336 obj = actor_system_priority()
337 _type = reader.read("!H")[0]
338 assert(_type == 40)
339 _length = reader.read("!H")[0]
340 orig_reader = reader
341 reader = orig_reader.slice(_length - (2 + 2))
342 obj.value = reader.read("!H")[0]
343 return obj
344
345 def __eq__(self, other):
346 if type(self) != type(other): return False
347 if self.value != other.value: return False
348 return True
349
350 def pretty_print(self, q):
351 q.text("actor_system_priority {")
352 with q.group():
353 with q.indent(2):
354 q.breakable()
355 q.text("value = ");
356 q.text("%#x" % self.value)
357 q.breakable()
358 q.text('}')
359
360bsn_tlv.subtypes[40] = actor_system_priority
361
362class broadcast_query_timeout(bsn_tlv):
363 type = 10
364
365 def __init__(self, value=None):
366 if value != None:
367 self.value = value
368 else:
369 self.value = 0
370 return
371
372 def pack(self):
373 packed = []
374 packed.append(struct.pack("!H", self.type))
375 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
376 packed.append(struct.pack("!L", self.value))
377 length = sum([len(x) for x in packed])
378 packed[1] = struct.pack("!H", length)
379 return ''.join(packed)
380
381 @staticmethod
382 def unpack(reader):
383 obj = broadcast_query_timeout()
384 _type = reader.read("!H")[0]
385 assert(_type == 10)
386 _length = reader.read("!H")[0]
387 orig_reader = reader
388 reader = orig_reader.slice(_length - (2 + 2))
389 obj.value = reader.read("!L")[0]
390 return obj
391
392 def __eq__(self, other):
393 if type(self) != type(other): return False
394 if self.value != other.value: return False
395 return True
396
397 def pretty_print(self, q):
398 q.text("broadcast_query_timeout {")
399 with q.group():
400 with q.indent(2):
401 q.breakable()
402 q.text("value = ");
403 q.text("%#x" % self.value)
404 q.breakable()
405 q.text('}')
406
407bsn_tlv.subtypes[10] = broadcast_query_timeout
408
409class circuit_id(bsn_tlv):
410 type = 14
411
412 def __init__(self, value=None):
413 if value != None:
414 self.value = value
415 else:
416 self.value = ''
417 return
418
419 def pack(self):
420 packed = []
421 packed.append(struct.pack("!H", self.type))
422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
423 packed.append(self.value)
424 length = sum([len(x) for x in packed])
425 packed[1] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
429 def unpack(reader):
430 obj = circuit_id()
431 _type = reader.read("!H")[0]
432 assert(_type == 14)
433 _length = reader.read("!H")[0]
434 orig_reader = reader
435 reader = orig_reader.slice(_length - (2 + 2))
436 obj.value = str(reader.read_all())
437 return obj
438
439 def __eq__(self, other):
440 if type(self) != type(other): return False
441 if self.value != other.value: return False
442 return True
443
444 def pretty_print(self, q):
445 q.text("circuit_id {")
446 with q.group():
447 with q.indent(2):
448 q.breakable()
449 q.text("value = ");
450 q.pp(self.value)
451 q.breakable()
452 q.text('}')
453
454bsn_tlv.subtypes[14] = circuit_id
455
456class convergence_status(bsn_tlv):
457 type = 45
458
459 def __init__(self, value=None):
460 if value != None:
461 self.value = value
462 else:
463 self.value = 0
464 return
465
466 def pack(self):
467 packed = []
468 packed.append(struct.pack("!H", self.type))
469 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
470 packed.append(struct.pack("!B", self.value))
471 length = sum([len(x) for x in packed])
472 packed[1] = struct.pack("!H", length)
473 return ''.join(packed)
474
475 @staticmethod
476 def unpack(reader):
477 obj = convergence_status()
478 _type = reader.read("!H")[0]
479 assert(_type == 45)
480 _length = reader.read("!H")[0]
481 orig_reader = reader
482 reader = orig_reader.slice(_length - (2 + 2))
483 obj.value = reader.read("!B")[0]
484 return obj
485
486 def __eq__(self, other):
487 if type(self) != type(other): return False
488 if self.value != other.value: return False
489 return True
490
491 def pretty_print(self, q):
492 q.text("convergence_status {")
493 with q.group():
494 with q.indent(2):
495 q.breakable()
496 q.text("value = ");
497 q.text("%#x" % self.value)
498 q.breakable()
499 q.text('}')
500
501bsn_tlv.subtypes[45] = convergence_status
502
503class crc_enabled(bsn_tlv):
504 type = 22
505
506 def __init__(self, value=None):
507 if value != None:
508 self.value = value
509 else:
510 self.value = 0
511 return
512
513 def pack(self):
514 packed = []
515 packed.append(struct.pack("!H", self.type))
516 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
517 packed.append(struct.pack("!B", self.value))
518 length = sum([len(x) for x in packed])
519 packed[1] = struct.pack("!H", length)
520 return ''.join(packed)
521
522 @staticmethod
523 def unpack(reader):
524 obj = crc_enabled()
525 _type = reader.read("!H")[0]
526 assert(_type == 22)
527 _length = reader.read("!H")[0]
528 orig_reader = reader
529 reader = orig_reader.slice(_length - (2 + 2))
530 obj.value = reader.read("!B")[0]
531 return obj
532
533 def __eq__(self, other):
534 if type(self) != type(other): return False
535 if self.value != other.value: return False
536 return True
537
538 def pretty_print(self, q):
539 q.text("crc_enabled {")
540 with q.group():
541 with q.indent(2):
542 q.breakable()
543 q.text("value = ");
544 q.text("%#x" % self.value)
545 q.breakable()
546 q.text('}')
547
548bsn_tlv.subtypes[22] = crc_enabled
549
550class data(bsn_tlv):
551 type = 55
552
553 def __init__(self, value=None):
554 if value != None:
555 self.value = value
556 else:
557 self.value = ''
558 return
559
560 def pack(self):
561 packed = []
562 packed.append(struct.pack("!H", self.type))
563 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
564 packed.append(self.value)
565 length = sum([len(x) for x in packed])
566 packed[1] = struct.pack("!H", length)
567 return ''.join(packed)
568
569 @staticmethod
570 def unpack(reader):
571 obj = data()
572 _type = reader.read("!H")[0]
573 assert(_type == 55)
574 _length = reader.read("!H")[0]
575 orig_reader = reader
576 reader = orig_reader.slice(_length - (2 + 2))
577 obj.value = str(reader.read_all())
578 return obj
579
580 def __eq__(self, other):
581 if type(self) != type(other): return False
582 if self.value != other.value: return False
583 return True
584
585 def pretty_print(self, q):
586 q.text("data {")
587 with q.group():
588 with q.indent(2):
589 q.breakable()
590 q.text("value = ");
591 q.pp(self.value)
592 q.breakable()
593 q.text('}')
594
595bsn_tlv.subtypes[55] = data
596
597class eth_dst(bsn_tlv):
598 type = 33
599
600 def __init__(self, value=None):
601 if value != None:
602 self.value = value
603 else:
604 self.value = [0,0,0,0,0,0]
605 return
606
607 def pack(self):
608 packed = []
609 packed.append(struct.pack("!H", self.type))
610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
611 packed.append(struct.pack("!6B", *self.value))
612 length = sum([len(x) for x in packed])
613 packed[1] = struct.pack("!H", length)
614 return ''.join(packed)
615
616 @staticmethod
617 def unpack(reader):
618 obj = eth_dst()
619 _type = reader.read("!H")[0]
620 assert(_type == 33)
621 _length = reader.read("!H")[0]
622 orig_reader = reader
623 reader = orig_reader.slice(_length - (2 + 2))
624 obj.value = list(reader.read('!6B'))
625 return obj
626
627 def __eq__(self, other):
628 if type(self) != type(other): return False
629 if self.value != other.value: return False
630 return True
631
632 def pretty_print(self, q):
633 q.text("eth_dst {")
634 with q.group():
635 with q.indent(2):
636 q.breakable()
637 q.text("value = ");
638 q.text(util.pretty_mac(self.value))
639 q.breakable()
640 q.text('}')
641
642bsn_tlv.subtypes[33] = eth_dst
643
644class eth_src(bsn_tlv):
645 type = 32
646
647 def __init__(self, value=None):
648 if value != None:
649 self.value = value
650 else:
651 self.value = [0,0,0,0,0,0]
652 return
653
654 def pack(self):
655 packed = []
656 packed.append(struct.pack("!H", self.type))
657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
658 packed.append(struct.pack("!6B", *self.value))
659 length = sum([len(x) for x in packed])
660 packed[1] = struct.pack("!H", length)
661 return ''.join(packed)
662
663 @staticmethod
664 def unpack(reader):
665 obj = eth_src()
666 _type = reader.read("!H")[0]
667 assert(_type == 32)
668 _length = reader.read("!H")[0]
669 orig_reader = reader
670 reader = orig_reader.slice(_length - (2 + 2))
671 obj.value = list(reader.read('!6B'))
672 return obj
673
674 def __eq__(self, other):
675 if type(self) != type(other): return False
676 if self.value != other.value: return False
677 return True
678
679 def pretty_print(self, q):
680 q.text("eth_src {")
681 with q.group():
682 with q.indent(2):
683 q.breakable()
684 q.text("value = ");
685 q.text(util.pretty_mac(self.value))
686 q.breakable()
687 q.text('}')
688
689bsn_tlv.subtypes[32] = eth_src
690
691class external_gateway_ip(bsn_tlv):
692 type = 26
693
694 def __init__(self, value=None):
695 if value != None:
696 self.value = value
697 else:
698 self.value = 0
699 return
700
701 def pack(self):
702 packed = []
703 packed.append(struct.pack("!H", self.type))
704 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
705 packed.append(struct.pack("!L", self.value))
706 length = sum([len(x) for x in packed])
707 packed[1] = struct.pack("!H", length)
708 return ''.join(packed)
709
710 @staticmethod
711 def unpack(reader):
712 obj = external_gateway_ip()
713 _type = reader.read("!H")[0]
714 assert(_type == 26)
715 _length = reader.read("!H")[0]
716 orig_reader = reader
717 reader = orig_reader.slice(_length - (2 + 2))
718 obj.value = reader.read("!L")[0]
719 return obj
720
721 def __eq__(self, other):
722 if type(self) != type(other): return False
723 if self.value != other.value: return False
724 return True
725
726 def pretty_print(self, q):
727 q.text("external_gateway_ip {")
728 with q.group():
729 with q.indent(2):
730 q.breakable()
731 q.text("value = ");
732 q.text(util.pretty_ipv4(self.value))
733 q.breakable()
734 q.text('}')
735
736bsn_tlv.subtypes[26] = external_gateway_ip
737
738class external_gateway_mac(bsn_tlv):
739 type = 29
740
741 def __init__(self, value=None):
742 if value != None:
743 self.value = value
744 else:
745 self.value = [0,0,0,0,0,0]
746 return
747
748 def pack(self):
749 packed = []
750 packed.append(struct.pack("!H", self.type))
751 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
752 packed.append(struct.pack("!6B", *self.value))
753 length = sum([len(x) for x in packed])
754 packed[1] = struct.pack("!H", length)
755 return ''.join(packed)
756
757 @staticmethod
758 def unpack(reader):
759 obj = external_gateway_mac()
760 _type = reader.read("!H")[0]
761 assert(_type == 29)
762 _length = reader.read("!H")[0]
763 orig_reader = reader
764 reader = orig_reader.slice(_length - (2 + 2))
765 obj.value = list(reader.read('!6B'))
766 return obj
767
768 def __eq__(self, other):
769 if type(self) != type(other): return False
770 if self.value != other.value: return False
771 return True
772
773 def pretty_print(self, q):
774 q.text("external_gateway_mac {")
775 with q.group():
776 with q.indent(2):
777 q.breakable()
778 q.text("value = ");
779 q.text(util.pretty_mac(self.value))
780 q.breakable()
781 q.text('}')
782
783bsn_tlv.subtypes[29] = external_gateway_mac
784
785class external_ip(bsn_tlv):
786 type = 23
787
788 def __init__(self, value=None):
789 if value != None:
790 self.value = value
791 else:
792 self.value = 0
793 return
794
795 def pack(self):
796 packed = []
797 packed.append(struct.pack("!H", self.type))
798 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
799 packed.append(struct.pack("!L", self.value))
800 length = sum([len(x) for x in packed])
801 packed[1] = struct.pack("!H", length)
802 return ''.join(packed)
803
804 @staticmethod
805 def unpack(reader):
806 obj = external_ip()
807 _type = reader.read("!H")[0]
808 assert(_type == 23)
809 _length = reader.read("!H")[0]
810 orig_reader = reader
811 reader = orig_reader.slice(_length - (2 + 2))
812 obj.value = reader.read("!L")[0]
813 return obj
814
815 def __eq__(self, other):
816 if type(self) != type(other): return False
817 if self.value != other.value: return False
818 return True
819
820 def pretty_print(self, q):
821 q.text("external_ip {")
822 with q.group():
823 with q.indent(2):
824 q.breakable()
825 q.text("value = ");
826 q.text(util.pretty_ipv4(self.value))
827 q.breakable()
828 q.text('}')
829
830bsn_tlv.subtypes[23] = external_ip
831
832class external_mac(bsn_tlv):
833 type = 24
834
835 def __init__(self, value=None):
836 if value != None:
837 self.value = value
838 else:
839 self.value = [0,0,0,0,0,0]
840 return
841
842 def pack(self):
843 packed = []
844 packed.append(struct.pack("!H", self.type))
845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
846 packed.append(struct.pack("!6B", *self.value))
847 length = sum([len(x) for x in packed])
848 packed[1] = struct.pack("!H", length)
849 return ''.join(packed)
850
851 @staticmethod
852 def unpack(reader):
853 obj = external_mac()
854 _type = reader.read("!H")[0]
855 assert(_type == 24)
856 _length = reader.read("!H")[0]
857 orig_reader = reader
858 reader = orig_reader.slice(_length - (2 + 2))
859 obj.value = list(reader.read('!6B'))
860 return obj
861
862 def __eq__(self, other):
863 if type(self) != type(other): return False
864 if self.value != other.value: return False
865 return True
866
867 def pretty_print(self, q):
868 q.text("external_mac {")
869 with q.group():
870 with q.indent(2):
871 q.breakable()
872 q.text("value = ");
873 q.text(util.pretty_mac(self.value))
874 q.breakable()
875 q.text('}')
876
877bsn_tlv.subtypes[24] = external_mac
878
879class external_netmask(bsn_tlv):
880 type = 25
881
882 def __init__(self, value=None):
883 if value != None:
884 self.value = value
885 else:
886 self.value = 0
887 return
888
889 def pack(self):
890 packed = []
891 packed.append(struct.pack("!H", self.type))
892 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
893 packed.append(struct.pack("!L", self.value))
894 length = sum([len(x) for x in packed])
895 packed[1] = struct.pack("!H", length)
896 return ''.join(packed)
897
898 @staticmethod
899 def unpack(reader):
900 obj = external_netmask()
901 _type = reader.read("!H")[0]
902 assert(_type == 25)
903 _length = reader.read("!H")[0]
904 orig_reader = reader
905 reader = orig_reader.slice(_length - (2 + 2))
906 obj.value = reader.read("!L")[0]
907 return obj
908
909 def __eq__(self, other):
910 if type(self) != type(other): return False
911 if self.value != other.value: return False
912 return True
913
914 def pretty_print(self, q):
915 q.text("external_netmask {")
916 with q.group():
917 with q.indent(2):
918 q.breakable()
919 q.text("value = ");
920 q.text(util.pretty_ipv4(self.value))
921 q.breakable()
922 q.text('}')
923
924bsn_tlv.subtypes[25] = external_netmask
925
926class header_size(bsn_tlv):
927 type = 31
928
929 def __init__(self, value=None):
930 if value != None:
931 self.value = value
932 else:
933 self.value = 0
934 return
935
936 def pack(self):
937 packed = []
938 packed.append(struct.pack("!H", self.type))
939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
940 packed.append(struct.pack("!L", self.value))
941 length = sum([len(x) for x in packed])
942 packed[1] = struct.pack("!H", length)
943 return ''.join(packed)
944
945 @staticmethod
946 def unpack(reader):
947 obj = header_size()
948 _type = reader.read("!H")[0]
949 assert(_type == 31)
950 _length = reader.read("!H")[0]
951 orig_reader = reader
952 reader = orig_reader.slice(_length - (2 + 2))
953 obj.value = reader.read("!L")[0]
954 return obj
955
956 def __eq__(self, other):
957 if type(self) != type(other): return False
958 if self.value != other.value: return False
959 return True
960
961 def pretty_print(self, q):
962 q.text("header_size {")
963 with q.group():
964 with q.indent(2):
965 q.breakable()
966 q.text("value = ");
967 q.text("%#x" % self.value)
968 q.breakable()
969 q.text('}')
970
971bsn_tlv.subtypes[31] = header_size
972
973class idle_notification(bsn_tlv):
974 type = 7
975
976 def __init__(self):
977 return
978
979 def pack(self):
980 packed = []
981 packed.append(struct.pack("!H", self.type))
982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
983 length = sum([len(x) for x in packed])
984 packed[1] = struct.pack("!H", length)
985 return ''.join(packed)
986
987 @staticmethod
988 def unpack(reader):
989 obj = idle_notification()
990 _type = reader.read("!H")[0]
991 assert(_type == 7)
992 _length = reader.read("!H")[0]
993 orig_reader = reader
994 reader = orig_reader.slice(_length - (2 + 2))
995 return obj
996
997 def __eq__(self, other):
998 if type(self) != type(other): return False
999 return True
1000
1001 def pretty_print(self, q):
1002 q.text("idle_notification {")
1003 with q.group():
1004 with q.indent(2):
1005 q.breakable()
1006 q.breakable()
1007 q.text('}')
1008
1009bsn_tlv.subtypes[7] = idle_notification
1010
1011class idle_time(bsn_tlv):
1012 type = 5
1013
1014 def __init__(self, value=None):
1015 if value != None:
1016 self.value = value
1017 else:
1018 self.value = 0
1019 return
1020
1021 def pack(self):
1022 packed = []
1023 packed.append(struct.pack("!H", self.type))
1024 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1025 packed.append(struct.pack("!Q", self.value))
1026 length = sum([len(x) for x in packed])
1027 packed[1] = struct.pack("!H", length)
1028 return ''.join(packed)
1029
1030 @staticmethod
1031 def unpack(reader):
1032 obj = idle_time()
1033 _type = reader.read("!H")[0]
1034 assert(_type == 5)
1035 _length = reader.read("!H")[0]
1036 orig_reader = reader
1037 reader = orig_reader.slice(_length - (2 + 2))
1038 obj.value = reader.read("!Q")[0]
1039 return obj
1040
1041 def __eq__(self, other):
1042 if type(self) != type(other): return False
1043 if self.value != other.value: return False
1044 return True
1045
1046 def pretty_print(self, q):
1047 q.text("idle_time {")
1048 with q.group():
1049 with q.indent(2):
1050 q.breakable()
1051 q.text("value = ");
1052 q.text("%#x" % self.value)
1053 q.breakable()
1054 q.text('}')
1055
1056bsn_tlv.subtypes[5] = idle_time
1057
1058class idle_timeout(bsn_tlv):
1059 type = 8
1060
1061 def __init__(self, value=None):
1062 if value != None:
1063 self.value = value
1064 else:
1065 self.value = 0
1066 return
1067
1068 def pack(self):
1069 packed = []
1070 packed.append(struct.pack("!H", self.type))
1071 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1072 packed.append(struct.pack("!L", self.value))
1073 length = sum([len(x) for x in packed])
1074 packed[1] = struct.pack("!H", length)
1075 return ''.join(packed)
1076
1077 @staticmethod
1078 def unpack(reader):
1079 obj = idle_timeout()
1080 _type = reader.read("!H")[0]
1081 assert(_type == 8)
1082 _length = reader.read("!H")[0]
1083 orig_reader = reader
1084 reader = orig_reader.slice(_length - (2 + 2))
1085 obj.value = reader.read("!L")[0]
1086 return obj
1087
1088 def __eq__(self, other):
1089 if type(self) != type(other): return False
1090 if self.value != other.value: return False
1091 return True
1092
1093 def pretty_print(self, q):
1094 q.text("idle_timeout {")
1095 with q.group():
1096 with q.indent(2):
1097 q.breakable()
1098 q.text("value = ");
1099 q.text("%#x" % self.value)
1100 q.breakable()
1101 q.text('}')
1102
1103bsn_tlv.subtypes[8] = idle_timeout
1104
1105class internal_gateway_mac(bsn_tlv):
1106 type = 28
1107
1108 def __init__(self, value=None):
1109 if value != None:
1110 self.value = value
1111 else:
1112 self.value = [0,0,0,0,0,0]
1113 return
1114
1115 def pack(self):
1116 packed = []
1117 packed.append(struct.pack("!H", self.type))
1118 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1119 packed.append(struct.pack("!6B", *self.value))
1120 length = sum([len(x) for x in packed])
1121 packed[1] = struct.pack("!H", length)
1122 return ''.join(packed)
1123
1124 @staticmethod
1125 def unpack(reader):
1126 obj = internal_gateway_mac()
1127 _type = reader.read("!H")[0]
1128 assert(_type == 28)
1129 _length = reader.read("!H")[0]
1130 orig_reader = reader
1131 reader = orig_reader.slice(_length - (2 + 2))
1132 obj.value = list(reader.read('!6B'))
1133 return obj
1134
1135 def __eq__(self, other):
1136 if type(self) != type(other): return False
1137 if self.value != other.value: return False
1138 return True
1139
1140 def pretty_print(self, q):
1141 q.text("internal_gateway_mac {")
1142 with q.group():
1143 with q.indent(2):
1144 q.breakable()
1145 q.text("value = ");
1146 q.text(util.pretty_mac(self.value))
1147 q.breakable()
1148 q.text('}')
1149
1150bsn_tlv.subtypes[28] = internal_gateway_mac
1151
1152class internal_mac(bsn_tlv):
1153 type = 27
1154
1155 def __init__(self, value=None):
1156 if value != None:
1157 self.value = value
1158 else:
1159 self.value = [0,0,0,0,0,0]
1160 return
1161
1162 def pack(self):
1163 packed = []
1164 packed.append(struct.pack("!H", self.type))
1165 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1166 packed.append(struct.pack("!6B", *self.value))
1167 length = sum([len(x) for x in packed])
1168 packed[1] = struct.pack("!H", length)
1169 return ''.join(packed)
1170
1171 @staticmethod
1172 def unpack(reader):
1173 obj = internal_mac()
1174 _type = reader.read("!H")[0]
1175 assert(_type == 27)
1176 _length = reader.read("!H")[0]
1177 orig_reader = reader
1178 reader = orig_reader.slice(_length - (2 + 2))
1179 obj.value = list(reader.read('!6B'))
1180 return obj
1181
1182 def __eq__(self, other):
1183 if type(self) != type(other): return False
1184 if self.value != other.value: return False
1185 return True
1186
1187 def pretty_print(self, q):
1188 q.text("internal_mac {")
1189 with q.group():
1190 with q.indent(2):
1191 q.breakable()
1192 q.text("value = ");
1193 q.text(util.pretty_mac(self.value))
1194 q.breakable()
1195 q.text('}')
1196
1197bsn_tlv.subtypes[27] = internal_mac
1198
1199class ipv4(bsn_tlv):
1200 type = 4
1201
1202 def __init__(self, value=None):
1203 if value != None:
1204 self.value = value
1205 else:
1206 self.value = 0
1207 return
1208
1209 def pack(self):
1210 packed = []
1211 packed.append(struct.pack("!H", self.type))
1212 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1213 packed.append(struct.pack("!L", self.value))
1214 length = sum([len(x) for x in packed])
1215 packed[1] = struct.pack("!H", length)
1216 return ''.join(packed)
1217
1218 @staticmethod
1219 def unpack(reader):
1220 obj = ipv4()
1221 _type = reader.read("!H")[0]
1222 assert(_type == 4)
1223 _length = reader.read("!H")[0]
1224 orig_reader = reader
1225 reader = orig_reader.slice(_length - (2 + 2))
1226 obj.value = reader.read("!L")[0]
1227 return obj
1228
1229 def __eq__(self, other):
1230 if type(self) != type(other): return False
1231 if self.value != other.value: return False
1232 return True
1233
1234 def pretty_print(self, q):
1235 q.text("ipv4 {")
1236 with q.group():
1237 with q.indent(2):
1238 q.breakable()
1239 q.text("value = ");
1240 q.text(util.pretty_ipv4(self.value))
1241 q.breakable()
1242 q.text('}')
1243
1244bsn_tlv.subtypes[4] = ipv4
1245
1246class ipv4_dst(bsn_tlv):
1247 type = 35
1248
1249 def __init__(self, value=None):
1250 if value != None:
1251 self.value = value
1252 else:
1253 self.value = 0
1254 return
1255
1256 def pack(self):
1257 packed = []
1258 packed.append(struct.pack("!H", self.type))
1259 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1260 packed.append(struct.pack("!L", self.value))
1261 length = sum([len(x) for x in packed])
1262 packed[1] = struct.pack("!H", length)
1263 return ''.join(packed)
1264
1265 @staticmethod
1266 def unpack(reader):
1267 obj = ipv4_dst()
1268 _type = reader.read("!H")[0]
1269 assert(_type == 35)
1270 _length = reader.read("!H")[0]
1271 orig_reader = reader
1272 reader = orig_reader.slice(_length - (2 + 2))
1273 obj.value = reader.read("!L")[0]
1274 return obj
1275
1276 def __eq__(self, other):
1277 if type(self) != type(other): return False
1278 if self.value != other.value: return False
1279 return True
1280
1281 def pretty_print(self, q):
1282 q.text("ipv4_dst {")
1283 with q.group():
1284 with q.indent(2):
1285 q.breakable()
1286 q.text("value = ");
1287 q.text(util.pretty_ipv4(self.value))
1288 q.breakable()
1289 q.text('}')
1290
1291bsn_tlv.subtypes[35] = ipv4_dst
1292
1293class ipv4_src(bsn_tlv):
1294 type = 34
1295
1296 def __init__(self, value=None):
1297 if value != None:
1298 self.value = value
1299 else:
1300 self.value = 0
1301 return
1302
1303 def pack(self):
1304 packed = []
1305 packed.append(struct.pack("!H", self.type))
1306 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1307 packed.append(struct.pack("!L", self.value))
1308 length = sum([len(x) for x in packed])
1309 packed[1] = struct.pack("!H", length)
1310 return ''.join(packed)
1311
1312 @staticmethod
1313 def unpack(reader):
1314 obj = ipv4_src()
1315 _type = reader.read("!H")[0]
1316 assert(_type == 34)
1317 _length = reader.read("!H")[0]
1318 orig_reader = reader
1319 reader = orig_reader.slice(_length - (2 + 2))
1320 obj.value = reader.read("!L")[0]
1321 return obj
1322
1323 def __eq__(self, other):
1324 if type(self) != type(other): return False
1325 if self.value != other.value: return False
1326 return True
1327
1328 def pretty_print(self, q):
1329 q.text("ipv4_src {")
1330 with q.group():
1331 with q.indent(2):
1332 q.breakable()
1333 q.text("value = ");
1334 q.text(util.pretty_ipv4(self.value))
1335 q.breakable()
1336 q.text('}')
1337
1338bsn_tlv.subtypes[34] = ipv4_src
1339
1340class mac(bsn_tlv):
1341 type = 1
1342
1343 def __init__(self, value=None):
1344 if value != None:
1345 self.value = value
1346 else:
1347 self.value = [0,0,0,0,0,0]
1348 return
1349
1350 def pack(self):
1351 packed = []
1352 packed.append(struct.pack("!H", self.type))
1353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1354 packed.append(struct.pack("!6B", *self.value))
1355 length = sum([len(x) for x in packed])
1356 packed[1] = struct.pack("!H", length)
1357 return ''.join(packed)
1358
1359 @staticmethod
1360 def unpack(reader):
1361 obj = mac()
1362 _type = reader.read("!H")[0]
1363 assert(_type == 1)
1364 _length = reader.read("!H")[0]
1365 orig_reader = reader
1366 reader = orig_reader.slice(_length - (2 + 2))
1367 obj.value = list(reader.read('!6B'))
1368 return obj
1369
1370 def __eq__(self, other):
1371 if type(self) != type(other): return False
1372 if self.value != other.value: return False
1373 return True
1374
1375 def pretty_print(self, q):
1376 q.text("mac {")
1377 with q.group():
1378 with q.indent(2):
1379 q.breakable()
1380 q.text("value = ");
1381 q.text(util.pretty_mac(self.value))
1382 q.breakable()
1383 q.text('}')
1384
1385bsn_tlv.subtypes[1] = mac
1386
1387class mac_mask(bsn_tlv):
1388 type = 56
1389
1390 def __init__(self, value=None):
1391 if value != None:
1392 self.value = value
1393 else:
1394 self.value = [0,0,0,0,0,0]
1395 return
1396
1397 def pack(self):
1398 packed = []
1399 packed.append(struct.pack("!H", self.type))
1400 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1401 packed.append(struct.pack("!6B", *self.value))
1402 length = sum([len(x) for x in packed])
1403 packed[1] = struct.pack("!H", length)
1404 return ''.join(packed)
1405
1406 @staticmethod
1407 def unpack(reader):
1408 obj = mac_mask()
1409 _type = reader.read("!H")[0]
1410 assert(_type == 56)
1411 _length = reader.read("!H")[0]
1412 orig_reader = reader
1413 reader = orig_reader.slice(_length - (2 + 2))
1414 obj.value = list(reader.read('!6B'))
1415 return obj
1416
1417 def __eq__(self, other):
1418 if type(self) != type(other): return False
1419 if self.value != other.value: return False
1420 return True
1421
1422 def pretty_print(self, q):
1423 q.text("mac_mask {")
1424 with q.group():
1425 with q.indent(2):
1426 q.breakable()
1427 q.text("value = ");
1428 q.text(util.pretty_mac(self.value))
1429 q.breakable()
1430 q.text('}')
1431
1432bsn_tlv.subtypes[56] = mac_mask
1433
1434class miss_packets(bsn_tlv):
1435 type = 13
1436
1437 def __init__(self, value=None):
1438 if value != None:
1439 self.value = value
1440 else:
1441 self.value = 0
1442 return
1443
1444 def pack(self):
1445 packed = []
1446 packed.append(struct.pack("!H", self.type))
1447 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1448 packed.append(struct.pack("!Q", self.value))
1449 length = sum([len(x) for x in packed])
1450 packed[1] = struct.pack("!H", length)
1451 return ''.join(packed)
1452
1453 @staticmethod
1454 def unpack(reader):
1455 obj = miss_packets()
1456 _type = reader.read("!H")[0]
1457 assert(_type == 13)
1458 _length = reader.read("!H")[0]
1459 orig_reader = reader
1460 reader = orig_reader.slice(_length - (2 + 2))
1461 obj.value = reader.read("!Q")[0]
1462 return obj
1463
1464 def __eq__(self, other):
1465 if type(self) != type(other): return False
1466 if self.value != other.value: return False
1467 return True
1468
1469 def pretty_print(self, q):
1470 q.text("miss_packets {")
1471 with q.group():
1472 with q.indent(2):
1473 q.breakable()
1474 q.text("value = ");
1475 q.text("%#x" % self.value)
1476 q.breakable()
1477 q.text('}')
1478
1479bsn_tlv.subtypes[13] = miss_packets
1480
1481class name(bsn_tlv):
1482 type = 52
1483
1484 def __init__(self, value=None):
1485 if value != None:
1486 self.value = value
1487 else:
1488 self.value = ''
1489 return
1490
1491 def pack(self):
1492 packed = []
1493 packed.append(struct.pack("!H", self.type))
1494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1495 packed.append(self.value)
1496 length = sum([len(x) for x in packed])
1497 packed[1] = struct.pack("!H", length)
1498 return ''.join(packed)
1499
1500 @staticmethod
1501 def unpack(reader):
1502 obj = name()
1503 _type = reader.read("!H")[0]
1504 assert(_type == 52)
1505 _length = reader.read("!H")[0]
1506 orig_reader = reader
1507 reader = orig_reader.slice(_length - (2 + 2))
1508 obj.value = str(reader.read_all())
1509 return obj
1510
1511 def __eq__(self, other):
1512 if type(self) != type(other): return False
1513 if self.value != other.value: return False
1514 return True
1515
1516 def pretty_print(self, q):
1517 q.text("name {")
1518 with q.group():
1519 with q.indent(2):
1520 q.breakable()
1521 q.text("value = ");
1522 q.pp(self.value)
1523 q.breakable()
1524 q.text('}')
1525
1526bsn_tlv.subtypes[52] = name
1527
1528class partner_key(bsn_tlv):
1529 type = 51
1530
1531 def __init__(self, value=None):
1532 if value != None:
1533 self.value = value
1534 else:
1535 self.value = 0
1536 return
1537
1538 def pack(self):
1539 packed = []
1540 packed.append(struct.pack("!H", self.type))
1541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1542 packed.append(struct.pack("!H", self.value))
1543 length = sum([len(x) for x in packed])
1544 packed[1] = struct.pack("!H", length)
1545 return ''.join(packed)
1546
1547 @staticmethod
1548 def unpack(reader):
1549 obj = partner_key()
1550 _type = reader.read("!H")[0]
1551 assert(_type == 51)
1552 _length = reader.read("!H")[0]
1553 orig_reader = reader
1554 reader = orig_reader.slice(_length - (2 + 2))
1555 obj.value = reader.read("!H")[0]
1556 return obj
1557
1558 def __eq__(self, other):
1559 if type(self) != type(other): return False
1560 if self.value != other.value: return False
1561 return True
1562
1563 def pretty_print(self, q):
1564 q.text("partner_key {")
1565 with q.group():
1566 with q.indent(2):
1567 q.breakable()
1568 q.text("value = ");
1569 q.text("%#x" % self.value)
1570 q.breakable()
1571 q.text('}')
1572
1573bsn_tlv.subtypes[51] = partner_key
1574
1575class partner_port_num(bsn_tlv):
1576 type = 50
1577
1578 def __init__(self, value=None):
1579 if value != None:
1580 self.value = value
1581 else:
1582 self.value = 0
1583 return
1584
1585 def pack(self):
1586 packed = []
1587 packed.append(struct.pack("!H", self.type))
1588 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1589 packed.append(struct.pack("!H", self.value))
1590 length = sum([len(x) for x in packed])
1591 packed[1] = struct.pack("!H", length)
1592 return ''.join(packed)
1593
1594 @staticmethod
1595 def unpack(reader):
1596 obj = partner_port_num()
1597 _type = reader.read("!H")[0]
1598 assert(_type == 50)
1599 _length = reader.read("!H")[0]
1600 orig_reader = reader
1601 reader = orig_reader.slice(_length - (2 + 2))
1602 obj.value = reader.read("!H")[0]
1603 return obj
1604
1605 def __eq__(self, other):
1606 if type(self) != type(other): return False
1607 if self.value != other.value: return False
1608 return True
1609
1610 def pretty_print(self, q):
1611 q.text("partner_port_num {")
1612 with q.group():
1613 with q.indent(2):
1614 q.breakable()
1615 q.text("value = ");
1616 q.text("%#x" % self.value)
1617 q.breakable()
1618 q.text('}')
1619
1620bsn_tlv.subtypes[50] = partner_port_num
1621
1622class partner_port_priority(bsn_tlv):
1623 type = 49
1624
1625 def __init__(self, value=None):
1626 if value != None:
1627 self.value = value
1628 else:
1629 self.value = 0
1630 return
1631
1632 def pack(self):
1633 packed = []
1634 packed.append(struct.pack("!H", self.type))
1635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1636 packed.append(struct.pack("!H", self.value))
1637 length = sum([len(x) for x in packed])
1638 packed[1] = struct.pack("!H", length)
1639 return ''.join(packed)
1640
1641 @staticmethod
1642 def unpack(reader):
1643 obj = partner_port_priority()
1644 _type = reader.read("!H")[0]
1645 assert(_type == 49)
1646 _length = reader.read("!H")[0]
1647 orig_reader = reader
1648 reader = orig_reader.slice(_length - (2 + 2))
1649 obj.value = reader.read("!H")[0]
1650 return obj
1651
1652 def __eq__(self, other):
1653 if type(self) != type(other): return False
1654 if self.value != other.value: return False
1655 return True
1656
1657 def pretty_print(self, q):
1658 q.text("partner_port_priority {")
1659 with q.group():
1660 with q.indent(2):
1661 q.breakable()
1662 q.text("value = ");
1663 q.text("%#x" % self.value)
1664 q.breakable()
1665 q.text('}')
1666
1667bsn_tlv.subtypes[49] = partner_port_priority
1668
1669class partner_state(bsn_tlv):
1670 type = 54
1671
1672 def __init__(self, value=None):
1673 if value != None:
1674 self.value = value
1675 else:
1676 self.value = 0
1677 return
1678
1679 def pack(self):
1680 packed = []
1681 packed.append(struct.pack("!H", self.type))
1682 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1683 packed.append(struct.pack("!B", self.value))
1684 length = sum([len(x) for x in packed])
1685 packed[1] = struct.pack("!H", length)
1686 return ''.join(packed)
1687
1688 @staticmethod
1689 def unpack(reader):
1690 obj = partner_state()
1691 _type = reader.read("!H")[0]
1692 assert(_type == 54)
1693 _length = reader.read("!H")[0]
1694 orig_reader = reader
1695 reader = orig_reader.slice(_length - (2 + 2))
1696 obj.value = reader.read("!B")[0]
1697 return obj
1698
1699 def __eq__(self, other):
1700 if type(self) != type(other): return False
1701 if self.value != other.value: return False
1702 return True
1703
1704 def pretty_print(self, q):
1705 q.text("partner_state {")
1706 with q.group():
1707 with q.indent(2):
1708 q.breakable()
1709 q.text("value = ");
1710 q.text("%#x" % self.value)
1711 q.breakable()
1712 q.text('}')
1713
1714bsn_tlv.subtypes[54] = partner_state
1715
1716class partner_system_mac(bsn_tlv):
1717 type = 48
1718
1719 def __init__(self, value=None):
1720 if value != None:
1721 self.value = value
1722 else:
1723 self.value = [0,0,0,0,0,0]
1724 return
1725
1726 def pack(self):
1727 packed = []
1728 packed.append(struct.pack("!H", self.type))
1729 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1730 packed.append(struct.pack("!6B", *self.value))
1731 length = sum([len(x) for x in packed])
1732 packed[1] = struct.pack("!H", length)
1733 return ''.join(packed)
1734
1735 @staticmethod
1736 def unpack(reader):
1737 obj = partner_system_mac()
1738 _type = reader.read("!H")[0]
1739 assert(_type == 48)
1740 _length = reader.read("!H")[0]
1741 orig_reader = reader
1742 reader = orig_reader.slice(_length - (2 + 2))
1743 obj.value = list(reader.read('!6B'))
1744 return obj
1745
1746 def __eq__(self, other):
1747 if type(self) != type(other): return False
1748 if self.value != other.value: return False
1749 return True
1750
1751 def pretty_print(self, q):
1752 q.text("partner_system_mac {")
1753 with q.group():
1754 with q.indent(2):
1755 q.breakable()
1756 q.text("value = ");
1757 q.text(util.pretty_mac(self.value))
1758 q.breakable()
1759 q.text('}')
1760
1761bsn_tlv.subtypes[48] = partner_system_mac
1762
1763class partner_system_priority(bsn_tlv):
1764 type = 47
1765
1766 def __init__(self, value=None):
1767 if value != None:
1768 self.value = value
1769 else:
1770 self.value = 0
1771 return
1772
1773 def pack(self):
1774 packed = []
1775 packed.append(struct.pack("!H", self.type))
1776 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1777 packed.append(struct.pack("!H", self.value))
1778 length = sum([len(x) for x in packed])
1779 packed[1] = struct.pack("!H", length)
1780 return ''.join(packed)
1781
1782 @staticmethod
1783 def unpack(reader):
1784 obj = partner_system_priority()
1785 _type = reader.read("!H")[0]
1786 assert(_type == 47)
1787 _length = reader.read("!H")[0]
1788 orig_reader = reader
1789 reader = orig_reader.slice(_length - (2 + 2))
1790 obj.value = reader.read("!H")[0]
1791 return obj
1792
1793 def __eq__(self, other):
1794 if type(self) != type(other): return False
1795 if self.value != other.value: return False
1796 return True
1797
1798 def pretty_print(self, q):
1799 q.text("partner_system_priority {")
1800 with q.group():
1801 with q.indent(2):
1802 q.breakable()
1803 q.text("value = ");
1804 q.text("%#x" % self.value)
1805 q.breakable()
1806 q.text('}')
1807
1808bsn_tlv.subtypes[47] = partner_system_priority
1809
1810class port(bsn_tlv):
1811 type = 0
1812
1813 def __init__(self, value=None):
1814 if value != None:
1815 self.value = value
1816 else:
1817 self.value = 0
1818 return
1819
1820 def pack(self):
1821 packed = []
1822 packed.append(struct.pack("!H", self.type))
1823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1824 packed.append(util.pack_port_no(self.value))
1825 length = sum([len(x) for x in packed])
1826 packed[1] = struct.pack("!H", length)
1827 return ''.join(packed)
1828
1829 @staticmethod
1830 def unpack(reader):
1831 obj = port()
1832 _type = reader.read("!H")[0]
1833 assert(_type == 0)
1834 _length = reader.read("!H")[0]
1835 orig_reader = reader
1836 reader = orig_reader.slice(_length - (2 + 2))
1837 obj.value = util.unpack_port_no(reader)
1838 return obj
1839
1840 def __eq__(self, other):
1841 if type(self) != type(other): return False
1842 if self.value != other.value: return False
1843 return True
1844
1845 def pretty_print(self, q):
1846 q.text("port {")
1847 with q.group():
1848 with q.indent(2):
1849 q.breakable()
1850 q.text("value = ");
1851 q.text(util.pretty_port(self.value))
1852 q.breakable()
1853 q.text('}')
1854
1855bsn_tlv.subtypes[0] = port
1856
1857class priority(bsn_tlv):
1858 type = 57
1859
1860 def __init__(self, value=None):
1861 if value != None:
1862 self.value = value
1863 else:
1864 self.value = 0
1865 return
1866
1867 def pack(self):
1868 packed = []
1869 packed.append(struct.pack("!H", self.type))
1870 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1871 packed.append(struct.pack("!L", self.value))
1872 length = sum([len(x) for x in packed])
1873 packed[1] = struct.pack("!H", length)
1874 return ''.join(packed)
1875
1876 @staticmethod
1877 def unpack(reader):
1878 obj = priority()
1879 _type = reader.read("!H")[0]
1880 assert(_type == 57)
1881 _length = reader.read("!H")[0]
1882 orig_reader = reader
1883 reader = orig_reader.slice(_length - (2 + 2))
1884 obj.value = reader.read("!L")[0]
1885 return obj
1886
1887 def __eq__(self, other):
1888 if type(self) != type(other): return False
1889 if self.value != other.value: return False
1890 return True
1891
1892 def pretty_print(self, q):
1893 q.text("priority {")
1894 with q.group():
1895 with q.indent(2):
1896 q.breakable()
1897 q.text("value = ");
1898 q.text("%#x" % self.value)
1899 q.breakable()
1900 q.text('}')
1901
1902bsn_tlv.subtypes[57] = priority
1903
1904class queue_id(bsn_tlv):
1905 type = 20
1906
1907 def __init__(self, value=None):
1908 if value != None:
1909 self.value = value
1910 else:
1911 self.value = 0
1912 return
1913
1914 def pack(self):
1915 packed = []
1916 packed.append(struct.pack("!H", self.type))
1917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1918 packed.append(struct.pack("!L", self.value))
1919 length = sum([len(x) for x in packed])
1920 packed[1] = struct.pack("!H", length)
1921 return ''.join(packed)
1922
1923 @staticmethod
1924 def unpack(reader):
1925 obj = queue_id()
1926 _type = reader.read("!H")[0]
1927 assert(_type == 20)
1928 _length = reader.read("!H")[0]
1929 orig_reader = reader
1930 reader = orig_reader.slice(_length - (2 + 2))
1931 obj.value = reader.read("!L")[0]
1932 return obj
1933
1934 def __eq__(self, other):
1935 if type(self) != type(other): return False
1936 if self.value != other.value: return False
1937 return True
1938
1939 def pretty_print(self, q):
1940 q.text("queue_id {")
1941 with q.group():
1942 with q.indent(2):
1943 q.breakable()
1944 q.text("value = ");
1945 q.text("%#x" % self.value)
1946 q.breakable()
1947 q.text('}')
1948
1949bsn_tlv.subtypes[20] = queue_id
1950
1951class queue_weight(bsn_tlv):
1952 type = 21
1953
1954 def __init__(self, value=None):
1955 if value != None:
1956 self.value = value
1957 else:
1958 self.value = 0
1959 return
1960
1961 def pack(self):
1962 packed = []
1963 packed.append(struct.pack("!H", self.type))
1964 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1965 packed.append(struct.pack("!L", self.value))
1966 length = sum([len(x) for x in packed])
1967 packed[1] = struct.pack("!H", length)
1968 return ''.join(packed)
1969
1970 @staticmethod
1971 def unpack(reader):
1972 obj = queue_weight()
1973 _type = reader.read("!H")[0]
1974 assert(_type == 21)
1975 _length = reader.read("!H")[0]
1976 orig_reader = reader
1977 reader = orig_reader.slice(_length - (2 + 2))
1978 obj.value = reader.read("!L")[0]
1979 return obj
1980
1981 def __eq__(self, other):
1982 if type(self) != type(other): return False
1983 if self.value != other.value: return False
1984 return True
1985
1986 def pretty_print(self, q):
1987 q.text("queue_weight {")
1988 with q.group():
1989 with q.indent(2):
1990 q.breakable()
1991 q.text("value = ");
1992 q.text("%#x" % self.value)
1993 q.breakable()
1994 q.text('}')
1995
1996bsn_tlv.subtypes[21] = queue_weight
1997
1998class reply_packets(bsn_tlv):
1999 type = 12
2000
2001 def __init__(self, value=None):
2002 if value != None:
2003 self.value = value
2004 else:
2005 self.value = 0
2006 return
2007
2008 def pack(self):
2009 packed = []
2010 packed.append(struct.pack("!H", self.type))
2011 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2012 packed.append(struct.pack("!Q", self.value))
2013 length = sum([len(x) for x in packed])
2014 packed[1] = struct.pack("!H", length)
2015 return ''.join(packed)
2016
2017 @staticmethod
2018 def unpack(reader):
2019 obj = reply_packets()
2020 _type = reader.read("!H")[0]
2021 assert(_type == 12)
2022 _length = reader.read("!H")[0]
2023 orig_reader = reader
2024 reader = orig_reader.slice(_length - (2 + 2))
2025 obj.value = reader.read("!Q")[0]
2026 return obj
2027
2028 def __eq__(self, other):
2029 if type(self) != type(other): return False
2030 if self.value != other.value: return False
2031 return True
2032
2033 def pretty_print(self, q):
2034 q.text("reply_packets {")
2035 with q.group():
2036 with q.indent(2):
2037 q.breakable()
2038 q.text("value = ");
2039 q.text("%#x" % self.value)
2040 q.breakable()
2041 q.text('}')
2042
2043bsn_tlv.subtypes[12] = reply_packets
2044
2045class request_packets(bsn_tlv):
2046 type = 11
2047
2048 def __init__(self, value=None):
2049 if value != None:
2050 self.value = value
2051 else:
2052 self.value = 0
2053 return
2054
2055 def pack(self):
2056 packed = []
2057 packed.append(struct.pack("!H", self.type))
2058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2059 packed.append(struct.pack("!Q", self.value))
2060 length = sum([len(x) for x in packed])
2061 packed[1] = struct.pack("!H", length)
2062 return ''.join(packed)
2063
2064 @staticmethod
2065 def unpack(reader):
2066 obj = request_packets()
2067 _type = reader.read("!H")[0]
2068 assert(_type == 11)
2069 _length = reader.read("!H")[0]
2070 orig_reader = reader
2071 reader = orig_reader.slice(_length - (2 + 2))
2072 obj.value = reader.read("!Q")[0]
2073 return obj
2074
2075 def __eq__(self, other):
2076 if type(self) != type(other): return False
2077 if self.value != other.value: return False
2078 return True
2079
2080 def pretty_print(self, q):
2081 q.text("request_packets {")
2082 with q.group():
2083 with q.indent(2):
2084 q.breakable()
2085 q.text("value = ");
2086 q.text("%#x" % self.value)
2087 q.breakable()
2088 q.text('}')
2089
2090bsn_tlv.subtypes[11] = request_packets
2091
2092class rx_packets(bsn_tlv):
2093 type = 2
2094
2095 def __init__(self, value=None):
2096 if value != None:
2097 self.value = value
2098 else:
2099 self.value = 0
2100 return
2101
2102 def pack(self):
2103 packed = []
2104 packed.append(struct.pack("!H", self.type))
2105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2106 packed.append(struct.pack("!Q", self.value))
2107 length = sum([len(x) for x in packed])
2108 packed[1] = struct.pack("!H", length)
2109 return ''.join(packed)
2110
2111 @staticmethod
2112 def unpack(reader):
2113 obj = rx_packets()
2114 _type = reader.read("!H")[0]
2115 assert(_type == 2)
2116 _length = reader.read("!H")[0]
2117 orig_reader = reader
2118 reader = orig_reader.slice(_length - (2 + 2))
2119 obj.value = reader.read("!Q")[0]
2120 return obj
2121
2122 def __eq__(self, other):
2123 if type(self) != type(other): return False
2124 if self.value != other.value: return False
2125 return True
2126
2127 def pretty_print(self, q):
2128 q.text("rx_packets {")
2129 with q.group():
2130 with q.indent(2):
2131 q.breakable()
2132 q.text("value = ");
2133 q.text("%#x" % self.value)
2134 q.breakable()
2135 q.text('}')
2136
2137bsn_tlv.subtypes[2] = rx_packets
2138
2139class sampling_rate(bsn_tlv):
2140 type = 30
2141
2142 def __init__(self, value=None):
2143 if value != None:
2144 self.value = value
2145 else:
2146 self.value = 0
2147 return
2148
2149 def pack(self):
2150 packed = []
2151 packed.append(struct.pack("!H", self.type))
2152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2153 packed.append(struct.pack("!L", self.value))
2154 length = sum([len(x) for x in packed])
2155 packed[1] = struct.pack("!H", length)
2156 return ''.join(packed)
2157
2158 @staticmethod
2159 def unpack(reader):
2160 obj = sampling_rate()
2161 _type = reader.read("!H")[0]
2162 assert(_type == 30)
2163 _length = reader.read("!H")[0]
2164 orig_reader = reader
2165 reader = orig_reader.slice(_length - (2 + 2))
2166 obj.value = reader.read("!L")[0]
2167 return obj
2168
2169 def __eq__(self, other):
2170 if type(self) != type(other): return False
2171 if self.value != other.value: return False
2172 return True
2173
2174 def pretty_print(self, q):
2175 q.text("sampling_rate {")
2176 with q.group():
2177 with q.indent(2):
2178 q.breakable()
2179 q.text("value = ");
2180 q.text("%#x" % self.value)
2181 q.breakable()
2182 q.text('}')
2183
2184bsn_tlv.subtypes[30] = sampling_rate
2185
2186class sub_agent_id(bsn_tlv):
2187 type = 38
2188
2189 def __init__(self, value=None):
2190 if value != None:
2191 self.value = value
2192 else:
2193 self.value = 0
2194 return
2195
2196 def pack(self):
2197 packed = []
2198 packed.append(struct.pack("!H", self.type))
2199 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2200 packed.append(struct.pack("!L", self.value))
2201 length = sum([len(x) for x in packed])
2202 packed[1] = struct.pack("!H", length)
2203 return ''.join(packed)
2204
2205 @staticmethod
2206 def unpack(reader):
2207 obj = sub_agent_id()
2208 _type = reader.read("!H")[0]
2209 assert(_type == 38)
2210 _length = reader.read("!H")[0]
2211 orig_reader = reader
2212 reader = orig_reader.slice(_length - (2 + 2))
2213 obj.value = reader.read("!L")[0]
2214 return obj
2215
2216 def __eq__(self, other):
2217 if type(self) != type(other): return False
2218 if self.value != other.value: return False
2219 return True
2220
2221 def pretty_print(self, q):
2222 q.text("sub_agent_id {")
2223 with q.group():
2224 with q.indent(2):
2225 q.breakable()
2226 q.text("value = ");
2227 q.text("%#x" % self.value)
2228 q.breakable()
2229 q.text('}')
2230
2231bsn_tlv.subtypes[38] = sub_agent_id
2232
2233class tx_bytes(bsn_tlv):
2234 type = 39
2235
2236 def __init__(self, value=None):
2237 if value != None:
2238 self.value = value
2239 else:
2240 self.value = 0
2241 return
2242
2243 def pack(self):
2244 packed = []
2245 packed.append(struct.pack("!H", self.type))
2246 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2247 packed.append(struct.pack("!Q", self.value))
2248 length = sum([len(x) for x in packed])
2249 packed[1] = struct.pack("!H", length)
2250 return ''.join(packed)
2251
2252 @staticmethod
2253 def unpack(reader):
2254 obj = tx_bytes()
2255 _type = reader.read("!H")[0]
2256 assert(_type == 39)
2257 _length = reader.read("!H")[0]
2258 orig_reader = reader
2259 reader = orig_reader.slice(_length - (2 + 2))
2260 obj.value = reader.read("!Q")[0]
2261 return obj
2262
2263 def __eq__(self, other):
2264 if type(self) != type(other): return False
2265 if self.value != other.value: return False
2266 return True
2267
2268 def pretty_print(self, q):
2269 q.text("tx_bytes {")
2270 with q.group():
2271 with q.indent(2):
2272 q.breakable()
2273 q.text("value = ");
2274 q.text("%#x" % self.value)
2275 q.breakable()
2276 q.text('}')
2277
2278bsn_tlv.subtypes[39] = tx_bytes
2279
2280class tx_packets(bsn_tlv):
2281 type = 3
2282
2283 def __init__(self, value=None):
2284 if value != None:
2285 self.value = value
2286 else:
2287 self.value = 0
2288 return
2289
2290 def pack(self):
2291 packed = []
2292 packed.append(struct.pack("!H", self.type))
2293 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2294 packed.append(struct.pack("!Q", self.value))
2295 length = sum([len(x) for x in packed])
2296 packed[1] = struct.pack("!H", length)
2297 return ''.join(packed)
2298
2299 @staticmethod
2300 def unpack(reader):
2301 obj = tx_packets()
2302 _type = reader.read("!H")[0]
2303 assert(_type == 3)
2304 _length = reader.read("!H")[0]
2305 orig_reader = reader
2306 reader = orig_reader.slice(_length - (2 + 2))
2307 obj.value = reader.read("!Q")[0]
2308 return obj
2309
2310 def __eq__(self, other):
2311 if type(self) != type(other): return False
2312 if self.value != other.value: return False
2313 return True
2314
2315 def pretty_print(self, q):
2316 q.text("tx_packets {")
2317 with q.group():
2318 with q.indent(2):
2319 q.breakable()
2320 q.text("value = ");
2321 q.text("%#x" % self.value)
2322 q.breakable()
2323 q.text('}')
2324
2325bsn_tlv.subtypes[3] = tx_packets
2326
2327class udf_anchor(bsn_tlv):
2328 type = 16
2329
2330 def __init__(self, value=None):
2331 if value != None:
2332 self.value = value
2333 else:
2334 self.value = 0
2335 return
2336
2337 def pack(self):
2338 packed = []
2339 packed.append(struct.pack("!H", self.type))
2340 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2341 packed.append(struct.pack("!H", self.value))
2342 length = sum([len(x) for x in packed])
2343 packed[1] = struct.pack("!H", length)
2344 return ''.join(packed)
2345
2346 @staticmethod
2347 def unpack(reader):
2348 obj = udf_anchor()
2349 _type = reader.read("!H")[0]
2350 assert(_type == 16)
2351 _length = reader.read("!H")[0]
2352 orig_reader = reader
2353 reader = orig_reader.slice(_length - (2 + 2))
2354 obj.value = reader.read("!H")[0]
2355 return obj
2356
2357 def __eq__(self, other):
2358 if type(self) != type(other): return False
2359 if self.value != other.value: return False
2360 return True
2361
2362 def pretty_print(self, q):
2363 q.text("udf_anchor {")
2364 with q.group():
2365 with q.indent(2):
2366 q.breakable()
2367 q.text("value = ");
2368 q.text("%#x" % self.value)
2369 q.breakable()
2370 q.text('}')
2371
2372bsn_tlv.subtypes[16] = udf_anchor
2373
2374class udf_id(bsn_tlv):
2375 type = 15
2376
2377 def __init__(self, value=None):
2378 if value != None:
2379 self.value = value
2380 else:
2381 self.value = 0
2382 return
2383
2384 def pack(self):
2385 packed = []
2386 packed.append(struct.pack("!H", self.type))
2387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2388 packed.append(struct.pack("!H", self.value))
2389 length = sum([len(x) for x in packed])
2390 packed[1] = struct.pack("!H", length)
2391 return ''.join(packed)
2392
2393 @staticmethod
2394 def unpack(reader):
2395 obj = udf_id()
2396 _type = reader.read("!H")[0]
2397 assert(_type == 15)
2398 _length = reader.read("!H")[0]
2399 orig_reader = reader
2400 reader = orig_reader.slice(_length - (2 + 2))
2401 obj.value = reader.read("!H")[0]
2402 return obj
2403
2404 def __eq__(self, other):
2405 if type(self) != type(other): return False
2406 if self.value != other.value: return False
2407 return True
2408
2409 def pretty_print(self, q):
2410 q.text("udf_id {")
2411 with q.group():
2412 with q.indent(2):
2413 q.breakable()
2414 q.text("value = ");
2415 q.text("%#x" % self.value)
2416 q.breakable()
2417 q.text('}')
2418
2419bsn_tlv.subtypes[15] = udf_id
2420
2421class udf_length(bsn_tlv):
2422 type = 18
2423
2424 def __init__(self, value=None):
2425 if value != None:
2426 self.value = value
2427 else:
2428 self.value = 0
2429 return
2430
2431 def pack(self):
2432 packed = []
2433 packed.append(struct.pack("!H", self.type))
2434 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2435 packed.append(struct.pack("!H", self.value))
2436 length = sum([len(x) for x in packed])
2437 packed[1] = struct.pack("!H", length)
2438 return ''.join(packed)
2439
2440 @staticmethod
2441 def unpack(reader):
2442 obj = udf_length()
2443 _type = reader.read("!H")[0]
2444 assert(_type == 18)
2445 _length = reader.read("!H")[0]
2446 orig_reader = reader
2447 reader = orig_reader.slice(_length - (2 + 2))
2448 obj.value = reader.read("!H")[0]
2449 return obj
2450
2451 def __eq__(self, other):
2452 if type(self) != type(other): return False
2453 if self.value != other.value: return False
2454 return True
2455
2456 def pretty_print(self, q):
2457 q.text("udf_length {")
2458 with q.group():
2459 with q.indent(2):
2460 q.breakable()
2461 q.text("value = ");
2462 q.text("%#x" % self.value)
2463 q.breakable()
2464 q.text('}')
2465
2466bsn_tlv.subtypes[18] = udf_length
2467
2468class udf_offset(bsn_tlv):
2469 type = 17
2470
2471 def __init__(self, value=None):
2472 if value != None:
2473 self.value = value
2474 else:
2475 self.value = 0
2476 return
2477
2478 def pack(self):
2479 packed = []
2480 packed.append(struct.pack("!H", self.type))
2481 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2482 packed.append(struct.pack("!H", self.value))
2483 length = sum([len(x) for x in packed])
2484 packed[1] = struct.pack("!H", length)
2485 return ''.join(packed)
2486
2487 @staticmethod
2488 def unpack(reader):
2489 obj = udf_offset()
2490 _type = reader.read("!H")[0]
2491 assert(_type == 17)
2492 _length = reader.read("!H")[0]
2493 orig_reader = reader
2494 reader = orig_reader.slice(_length - (2 + 2))
2495 obj.value = reader.read("!H")[0]
2496 return obj
2497
2498 def __eq__(self, other):
2499 if type(self) != type(other): return False
2500 if self.value != other.value: return False
2501 return True
2502
2503 def pretty_print(self, q):
2504 q.text("udf_offset {")
2505 with q.group():
2506 with q.indent(2):
2507 q.breakable()
2508 q.text("value = ");
2509 q.text("%#x" % self.value)
2510 q.breakable()
2511 q.text('}')
2512
2513bsn_tlv.subtypes[17] = udf_offset
2514
2515class udp_dst(bsn_tlv):
2516 type = 37
2517
2518 def __init__(self, value=None):
2519 if value != None:
2520 self.value = value
2521 else:
2522 self.value = 0
2523 return
2524
2525 def pack(self):
2526 packed = []
2527 packed.append(struct.pack("!H", self.type))
2528 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2529 packed.append(struct.pack("!H", self.value))
2530 length = sum([len(x) for x in packed])
2531 packed[1] = struct.pack("!H", length)
2532 return ''.join(packed)
2533
2534 @staticmethod
2535 def unpack(reader):
2536 obj = udp_dst()
2537 _type = reader.read("!H")[0]
2538 assert(_type == 37)
2539 _length = reader.read("!H")[0]
2540 orig_reader = reader
2541 reader = orig_reader.slice(_length - (2 + 2))
2542 obj.value = reader.read("!H")[0]
2543 return obj
2544
2545 def __eq__(self, other):
2546 if type(self) != type(other): return False
2547 if self.value != other.value: return False
2548 return True
2549
2550 def pretty_print(self, q):
2551 q.text("udp_dst {")
2552 with q.group():
2553 with q.indent(2):
2554 q.breakable()
2555 q.text("value = ");
2556 q.text("%#x" % self.value)
2557 q.breakable()
2558 q.text('}')
2559
2560bsn_tlv.subtypes[37] = udp_dst
2561
2562class udp_src(bsn_tlv):
2563 type = 36
2564
2565 def __init__(self, value=None):
2566 if value != None:
2567 self.value = value
2568 else:
2569 self.value = 0
2570 return
2571
2572 def pack(self):
2573 packed = []
2574 packed.append(struct.pack("!H", self.type))
2575 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2576 packed.append(struct.pack("!H", self.value))
2577 length = sum([len(x) for x in packed])
2578 packed[1] = struct.pack("!H", length)
2579 return ''.join(packed)
2580
2581 @staticmethod
2582 def unpack(reader):
2583 obj = udp_src()
2584 _type = reader.read("!H")[0]
2585 assert(_type == 36)
2586 _length = reader.read("!H")[0]
2587 orig_reader = reader
2588 reader = orig_reader.slice(_length - (2 + 2))
2589 obj.value = reader.read("!H")[0]
2590 return obj
2591
2592 def __eq__(self, other):
2593 if type(self) != type(other): return False
2594 if self.value != other.value: return False
2595 return True
2596
2597 def pretty_print(self, q):
2598 q.text("udp_src {")
2599 with q.group():
2600 with q.indent(2):
2601 q.breakable()
2602 q.text("value = ");
2603 q.text("%#x" % self.value)
2604 q.breakable()
2605 q.text('}')
2606
2607bsn_tlv.subtypes[36] = udp_src
2608
2609class unicast_query_timeout(bsn_tlv):
2610 type = 9
2611
2612 def __init__(self, value=None):
2613 if value != None:
2614 self.value = value
2615 else:
2616 self.value = 0
2617 return
2618
2619 def pack(self):
2620 packed = []
2621 packed.append(struct.pack("!H", self.type))
2622 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2623 packed.append(struct.pack("!L", self.value))
2624 length = sum([len(x) for x in packed])
2625 packed[1] = struct.pack("!H", length)
2626 return ''.join(packed)
2627
2628 @staticmethod
2629 def unpack(reader):
2630 obj = unicast_query_timeout()
2631 _type = reader.read("!H")[0]
2632 assert(_type == 9)
2633 _length = reader.read("!H")[0]
2634 orig_reader = reader
2635 reader = orig_reader.slice(_length - (2 + 2))
2636 obj.value = reader.read("!L")[0]
2637 return obj
2638
2639 def __eq__(self, other):
2640 if type(self) != type(other): return False
2641 if self.value != other.value: return False
2642 return True
2643
2644 def pretty_print(self, q):
2645 q.text("unicast_query_timeout {")
2646 with q.group():
2647 with q.indent(2):
2648 q.breakable()
2649 q.text("value = ");
2650 q.text("%#x" % self.value)
2651 q.breakable()
2652 q.text('}')
2653
2654bsn_tlv.subtypes[9] = unicast_query_timeout
2655
2656class vlan_vid(bsn_tlv):
2657 type = 6
2658
2659 def __init__(self, value=None):
2660 if value != None:
2661 self.value = value
2662 else:
2663 self.value = 0
2664 return
2665
2666 def pack(self):
2667 packed = []
2668 packed.append(struct.pack("!H", self.type))
2669 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2670 packed.append(struct.pack("!H", self.value))
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 = vlan_vid()
2678 _type = reader.read("!H")[0]
2679 assert(_type == 6)
2680 _length = reader.read("!H")[0]
2681 orig_reader = reader
2682 reader = orig_reader.slice(_length - (2 + 2))
2683 obj.value = reader.read("!H")[0]
2684 return obj
2685
2686 def __eq__(self, other):
2687 if type(self) != type(other): return False
2688 if self.value != other.value: return False
2689 return True
2690
2691 def pretty_print(self, q):
2692 q.text("vlan_vid {")
2693 with q.group():
2694 with q.indent(2):
2695 q.breakable()
2696 q.text("value = ");
2697 q.text("%#x" % self.value)
2698 q.breakable()
2699 q.text('}')
2700
2701bsn_tlv.subtypes[6] = vlan_vid
2702
2703class vrf(bsn_tlv):
2704 type = 19
2705
2706 def __init__(self, value=None):
2707 if value != None:
2708 self.value = value
2709 else:
2710 self.value = 0
2711 return
2712
2713 def pack(self):
2714 packed = []
2715 packed.append(struct.pack("!H", self.type))
2716 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2717 packed.append(struct.pack("!L", self.value))
2718 length = sum([len(x) for x in packed])
2719 packed[1] = struct.pack("!H", length)
2720 return ''.join(packed)
2721
2722 @staticmethod
2723 def unpack(reader):
2724 obj = vrf()
2725 _type = reader.read("!H")[0]
2726 assert(_type == 19)
2727 _length = reader.read("!H")[0]
2728 orig_reader = reader
2729 reader = orig_reader.slice(_length - (2 + 2))
2730 obj.value = reader.read("!L")[0]
2731 return obj
2732
2733 def __eq__(self, other):
2734 if type(self) != type(other): return False
2735 if self.value != other.value: return False
2736 return True
2737
2738 def pretty_print(self, q):
2739 q.text("vrf {")
2740 with q.group():
2741 with q.indent(2):
2742 q.breakable()
2743 q.text("value = ");
2744 q.text("%#x" % self.value)
2745 q.breakable()
2746 q.text('}')
2747
2748bsn_tlv.subtypes[19] = vrf
2749
2750