blob: f54e7d5dd6fcf1fac0b71dc738d6403e08488b17 [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
Harshmeet Singh301f7172014-12-08 13:07:29 -08001199class interval(bsn_tlv):
1200 type = 58
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 = interval()
1221 _type = reader.read("!H")[0]
1222 assert(_type == 58)
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("interval {")
1236 with q.group():
1237 with q.indent(2):
1238 q.breakable()
1239 q.text("value = ");
1240 q.text("%#x" % self.value)
1241 q.breakable()
1242 q.text('}')
1243
1244bsn_tlv.subtypes[58] = interval
1245
Rich Laneccd32ed2014-11-10 17:48:24 -08001246class ipv4(bsn_tlv):
1247 type = 4
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()
1268 _type = reader.read("!H")[0]
1269 assert(_type == 4)
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 {")
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[4] = ipv4
1292
1293class ipv4_dst(bsn_tlv):
1294 type = 35
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_dst()
1315 _type = reader.read("!H")[0]
1316 assert(_type == 35)
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_dst {")
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[35] = ipv4_dst
1339
Harshmeet Singh301f7172014-12-08 13:07:29 -08001340class ipv4_netmask(bsn_tlv):
1341 type = 60
1342
1343 def __init__(self, value=None):
1344 if value != None:
1345 self.value = value
1346 else:
1347 self.value = 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("!L", 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 = ipv4_netmask()
1362 _type = reader.read("!H")[0]
1363 assert(_type == 60)
1364 _length = reader.read("!H")[0]
1365 orig_reader = reader
1366 reader = orig_reader.slice(_length - (2 + 2))
1367 obj.value = reader.read("!L")[0]
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("ipv4_netmask {")
1377 with q.group():
1378 with q.indent(2):
1379 q.breakable()
1380 q.text("value = ");
1381 q.text(util.pretty_ipv4(self.value))
1382 q.breakable()
1383 q.text('}')
1384
1385bsn_tlv.subtypes[60] = ipv4_netmask
1386
Rich Laneccd32ed2014-11-10 17:48:24 -08001387class ipv4_src(bsn_tlv):
1388 type = 34
1389
1390 def __init__(self, value=None):
1391 if value != None:
1392 self.value = value
1393 else:
1394 self.value = 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("!L", 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 = ipv4_src()
1409 _type = reader.read("!H")[0]
1410 assert(_type == 34)
1411 _length = reader.read("!H")[0]
1412 orig_reader = reader
1413 reader = orig_reader.slice(_length - (2 + 2))
1414 obj.value = reader.read("!L")[0]
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("ipv4_src {")
1424 with q.group():
1425 with q.indent(2):
1426 q.breakable()
1427 q.text("value = ");
1428 q.text(util.pretty_ipv4(self.value))
1429 q.breakable()
1430 q.text('}')
1431
1432bsn_tlv.subtypes[34] = ipv4_src
1433
1434class mac(bsn_tlv):
1435 type = 1
1436
1437 def __init__(self, value=None):
1438 if value != None:
1439 self.value = value
1440 else:
1441 self.value = [0,0,0,0,0,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("!6B", *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 = mac()
1456 _type = reader.read("!H")[0]
1457 assert(_type == 1)
1458 _length = reader.read("!H")[0]
1459 orig_reader = reader
1460 reader = orig_reader.slice(_length - (2 + 2))
1461 obj.value = list(reader.read('!6B'))
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("mac {")
1471 with q.group():
1472 with q.indent(2):
1473 q.breakable()
1474 q.text("value = ");
1475 q.text(util.pretty_mac(self.value))
1476 q.breakable()
1477 q.text('}')
1478
1479bsn_tlv.subtypes[1] = mac
1480
1481class mac_mask(bsn_tlv):
1482 type = 56
1483
1484 def __init__(self, value=None):
1485 if value != None:
1486 self.value = value
1487 else:
1488 self.value = [0,0,0,0,0,0]
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(struct.pack("!6B", *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 = mac_mask()
1503 _type = reader.read("!H")[0]
1504 assert(_type == 56)
1505 _length = reader.read("!H")[0]
1506 orig_reader = reader
1507 reader = orig_reader.slice(_length - (2 + 2))
1508 obj.value = list(reader.read('!6B'))
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("mac_mask {")
1518 with q.group():
1519 with q.indent(2):
1520 q.breakable()
1521 q.text("value = ");
1522 q.text(util.pretty_mac(self.value))
1523 q.breakable()
1524 q.text('}')
1525
1526bsn_tlv.subtypes[56] = mac_mask
1527
1528class miss_packets(bsn_tlv):
1529 type = 13
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("!Q", 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 = miss_packets()
1550 _type = reader.read("!H")[0]
1551 assert(_type == 13)
1552 _length = reader.read("!H")[0]
1553 orig_reader = reader
1554 reader = orig_reader.slice(_length - (2 + 2))
1555 obj.value = reader.read("!Q")[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("miss_packets {")
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[13] = miss_packets
1574
1575class name(bsn_tlv):
1576 type = 52
1577
1578 def __init__(self, value=None):
1579 if value != None:
1580 self.value = value
1581 else:
1582 self.value = ''
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(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 = name()
1597 _type = reader.read("!H")[0]
1598 assert(_type == 52)
1599 _length = reader.read("!H")[0]
1600 orig_reader = reader
1601 reader = orig_reader.slice(_length - (2 + 2))
1602 obj.value = str(reader.read_all())
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("name {")
1612 with q.group():
1613 with q.indent(2):
1614 q.breakable()
1615 q.text("value = ");
1616 q.pp(self.value)
1617 q.breakable()
1618 q.text('}')
1619
1620bsn_tlv.subtypes[52] = name
1621
1622class partner_key(bsn_tlv):
1623 type = 51
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_key()
1644 _type = reader.read("!H")[0]
1645 assert(_type == 51)
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_key {")
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[51] = partner_key
1668
1669class partner_port_num(bsn_tlv):
1670 type = 50
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("!H", 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_port_num()
1691 _type = reader.read("!H")[0]
1692 assert(_type == 50)
1693 _length = reader.read("!H")[0]
1694 orig_reader = reader
1695 reader = orig_reader.slice(_length - (2 + 2))
1696 obj.value = reader.read("!H")[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_port_num {")
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[50] = partner_port_num
1715
1716class partner_port_priority(bsn_tlv):
1717 type = 49
1718
1719 def __init__(self, value=None):
1720 if value != None:
1721 self.value = value
1722 else:
1723 self.value = 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("!H", 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_port_priority()
1738 _type = reader.read("!H")[0]
1739 assert(_type == 49)
1740 _length = reader.read("!H")[0]
1741 orig_reader = reader
1742 reader = orig_reader.slice(_length - (2 + 2))
1743 obj.value = reader.read("!H")[0]
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_port_priority {")
1753 with q.group():
1754 with q.indent(2):
1755 q.breakable()
1756 q.text("value = ");
1757 q.text("%#x" % self.value)
1758 q.breakable()
1759 q.text('}')
1760
1761bsn_tlv.subtypes[49] = partner_port_priority
1762
1763class partner_state(bsn_tlv):
1764 type = 54
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("!B", 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_state()
1785 _type = reader.read("!H")[0]
1786 assert(_type == 54)
1787 _length = reader.read("!H")[0]
1788 orig_reader = reader
1789 reader = orig_reader.slice(_length - (2 + 2))
1790 obj.value = reader.read("!B")[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_state {")
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[54] = partner_state
1809
1810class partner_system_mac(bsn_tlv):
1811 type = 48
1812
1813 def __init__(self, value=None):
1814 if value != None:
1815 self.value = value
1816 else:
1817 self.value = [0,0,0,0,0,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(struct.pack("!6B", *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 = partner_system_mac()
1832 _type = reader.read("!H")[0]
1833 assert(_type == 48)
1834 _length = reader.read("!H")[0]
1835 orig_reader = reader
1836 reader = orig_reader.slice(_length - (2 + 2))
1837 obj.value = list(reader.read('!6B'))
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("partner_system_mac {")
1847 with q.group():
1848 with q.indent(2):
1849 q.breakable()
1850 q.text("value = ");
1851 q.text(util.pretty_mac(self.value))
1852 q.breakable()
1853 q.text('}')
1854
1855bsn_tlv.subtypes[48] = partner_system_mac
1856
1857class partner_system_priority(bsn_tlv):
1858 type = 47
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("!H", 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 = partner_system_priority()
1879 _type = reader.read("!H")[0]
1880 assert(_type == 47)
1881 _length = reader.read("!H")[0]
1882 orig_reader = reader
1883 reader = orig_reader.slice(_length - (2 + 2))
1884 obj.value = reader.read("!H")[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("partner_system_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[47] = partner_system_priority
1903
1904class port(bsn_tlv):
1905 type = 0
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(util.pack_port_no(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 = port()
1926 _type = reader.read("!H")[0]
1927 assert(_type == 0)
1928 _length = reader.read("!H")[0]
1929 orig_reader = reader
1930 reader = orig_reader.slice(_length - (2 + 2))
1931 obj.value = util.unpack_port_no(reader)
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("port {")
1941 with q.group():
1942 with q.indent(2):
1943 q.breakable()
1944 q.text("value = ");
1945 q.text(util.pretty_port(self.value))
1946 q.breakable()
1947 q.text('}')
1948
1949bsn_tlv.subtypes[0] = port
1950
1951class priority(bsn_tlv):
1952 type = 57
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 = priority()
1973 _type = reader.read("!H")[0]
1974 assert(_type == 57)
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("priority {")
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[57] = priority
1997
1998class queue_id(bsn_tlv):
1999 type = 20
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("!L", 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 = queue_id()
2020 _type = reader.read("!H")[0]
2021 assert(_type == 20)
2022 _length = reader.read("!H")[0]
2023 orig_reader = reader
2024 reader = orig_reader.slice(_length - (2 + 2))
2025 obj.value = reader.read("!L")[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("queue_id {")
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[20] = queue_id
2044
2045class queue_weight(bsn_tlv):
2046 type = 21
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("!L", 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 = queue_weight()
2067 _type = reader.read("!H")[0]
2068 assert(_type == 21)
2069 _length = reader.read("!H")[0]
2070 orig_reader = reader
2071 reader = orig_reader.slice(_length - (2 + 2))
2072 obj.value = reader.read("!L")[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("queue_weight {")
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[21] = queue_weight
2091
Harshmeet Singh301f7172014-12-08 13:07:29 -08002092class reference(bsn_tlv):
2093 type = 59
2094
2095 def __init__(self, table_id=None, key=None):
2096 if table_id != None:
2097 self.table_id = table_id
2098 else:
2099 self.table_id = 0
2100 if key != None:
2101 self.key = key
2102 else:
2103 self.key = []
2104 return
2105
2106 def pack(self):
2107 packed = []
2108 packed.append(struct.pack("!H", self.type))
2109 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2110 packed.append(struct.pack("!H", self.table_id))
2111 packed.append(loxi.generic_util.pack_list(self.key))
2112 length = sum([len(x) for x in packed])
2113 packed[1] = struct.pack("!H", length)
2114 return ''.join(packed)
2115
2116 @staticmethod
2117 def unpack(reader):
2118 obj = reference()
2119 _type = reader.read("!H")[0]
2120 assert(_type == 59)
2121 _length = reader.read("!H")[0]
2122 orig_reader = reader
2123 reader = orig_reader.slice(_length - (2 + 2))
2124 obj.table_id = reader.read("!H")[0]
2125 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
2126 return obj
2127
2128 def __eq__(self, other):
2129 if type(self) != type(other): return False
2130 if self.table_id != other.table_id: return False
2131 if self.key != other.key: return False
2132 return True
2133
2134 def pretty_print(self, q):
2135 q.text("reference {")
2136 with q.group():
2137 with q.indent(2):
2138 q.breakable()
2139 q.text("table_id = ");
2140 q.text("%#x" % self.table_id)
2141 q.text(","); q.breakable()
2142 q.text("key = ");
2143 q.pp(self.key)
2144 q.breakable()
2145 q.text('}')
2146
2147bsn_tlv.subtypes[59] = reference
2148
Rich Laneccd32ed2014-11-10 17:48:24 -08002149class reply_packets(bsn_tlv):
2150 type = 12
2151
2152 def __init__(self, value=None):
2153 if value != None:
2154 self.value = value
2155 else:
2156 self.value = 0
2157 return
2158
2159 def pack(self):
2160 packed = []
2161 packed.append(struct.pack("!H", self.type))
2162 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2163 packed.append(struct.pack("!Q", self.value))
2164 length = sum([len(x) for x in packed])
2165 packed[1] = struct.pack("!H", length)
2166 return ''.join(packed)
2167
2168 @staticmethod
2169 def unpack(reader):
2170 obj = reply_packets()
2171 _type = reader.read("!H")[0]
2172 assert(_type == 12)
2173 _length = reader.read("!H")[0]
2174 orig_reader = reader
2175 reader = orig_reader.slice(_length - (2 + 2))
2176 obj.value = reader.read("!Q")[0]
2177 return obj
2178
2179 def __eq__(self, other):
2180 if type(self) != type(other): return False
2181 if self.value != other.value: return False
2182 return True
2183
2184 def pretty_print(self, q):
2185 q.text("reply_packets {")
2186 with q.group():
2187 with q.indent(2):
2188 q.breakable()
2189 q.text("value = ");
2190 q.text("%#x" % self.value)
2191 q.breakable()
2192 q.text('}')
2193
2194bsn_tlv.subtypes[12] = reply_packets
2195
2196class request_packets(bsn_tlv):
2197 type = 11
2198
2199 def __init__(self, value=None):
2200 if value != None:
2201 self.value = value
2202 else:
2203 self.value = 0
2204 return
2205
2206 def pack(self):
2207 packed = []
2208 packed.append(struct.pack("!H", self.type))
2209 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2210 packed.append(struct.pack("!Q", self.value))
2211 length = sum([len(x) for x in packed])
2212 packed[1] = struct.pack("!H", length)
2213 return ''.join(packed)
2214
2215 @staticmethod
2216 def unpack(reader):
2217 obj = request_packets()
2218 _type = reader.read("!H")[0]
2219 assert(_type == 11)
2220 _length = reader.read("!H")[0]
2221 orig_reader = reader
2222 reader = orig_reader.slice(_length - (2 + 2))
2223 obj.value = reader.read("!Q")[0]
2224 return obj
2225
2226 def __eq__(self, other):
2227 if type(self) != type(other): return False
2228 if self.value != other.value: return False
2229 return True
2230
2231 def pretty_print(self, q):
2232 q.text("request_packets {")
2233 with q.group():
2234 with q.indent(2):
2235 q.breakable()
2236 q.text("value = ");
2237 q.text("%#x" % self.value)
2238 q.breakable()
2239 q.text('}')
2240
2241bsn_tlv.subtypes[11] = request_packets
2242
2243class rx_packets(bsn_tlv):
2244 type = 2
2245
2246 def __init__(self, value=None):
2247 if value != None:
2248 self.value = value
2249 else:
2250 self.value = 0
2251 return
2252
2253 def pack(self):
2254 packed = []
2255 packed.append(struct.pack("!H", self.type))
2256 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2257 packed.append(struct.pack("!Q", self.value))
2258 length = sum([len(x) for x in packed])
2259 packed[1] = struct.pack("!H", length)
2260 return ''.join(packed)
2261
2262 @staticmethod
2263 def unpack(reader):
2264 obj = rx_packets()
2265 _type = reader.read("!H")[0]
2266 assert(_type == 2)
2267 _length = reader.read("!H")[0]
2268 orig_reader = reader
2269 reader = orig_reader.slice(_length - (2 + 2))
2270 obj.value = reader.read("!Q")[0]
2271 return obj
2272
2273 def __eq__(self, other):
2274 if type(self) != type(other): return False
2275 if self.value != other.value: return False
2276 return True
2277
2278 def pretty_print(self, q):
2279 q.text("rx_packets {")
2280 with q.group():
2281 with q.indent(2):
2282 q.breakable()
2283 q.text("value = ");
2284 q.text("%#x" % self.value)
2285 q.breakable()
2286 q.text('}')
2287
2288bsn_tlv.subtypes[2] = rx_packets
2289
2290class sampling_rate(bsn_tlv):
2291 type = 30
2292
2293 def __init__(self, value=None):
2294 if value != None:
2295 self.value = value
2296 else:
2297 self.value = 0
2298 return
2299
2300 def pack(self):
2301 packed = []
2302 packed.append(struct.pack("!H", self.type))
2303 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2304 packed.append(struct.pack("!L", self.value))
2305 length = sum([len(x) for x in packed])
2306 packed[1] = struct.pack("!H", length)
2307 return ''.join(packed)
2308
2309 @staticmethod
2310 def unpack(reader):
2311 obj = sampling_rate()
2312 _type = reader.read("!H")[0]
2313 assert(_type == 30)
2314 _length = reader.read("!H")[0]
2315 orig_reader = reader
2316 reader = orig_reader.slice(_length - (2 + 2))
2317 obj.value = reader.read("!L")[0]
2318 return obj
2319
2320 def __eq__(self, other):
2321 if type(self) != type(other): return False
2322 if self.value != other.value: return False
2323 return True
2324
2325 def pretty_print(self, q):
2326 q.text("sampling_rate {")
2327 with q.group():
2328 with q.indent(2):
2329 q.breakable()
2330 q.text("value = ");
2331 q.text("%#x" % self.value)
2332 q.breakable()
2333 q.text('}')
2334
2335bsn_tlv.subtypes[30] = sampling_rate
2336
2337class sub_agent_id(bsn_tlv):
2338 type = 38
2339
2340 def __init__(self, value=None):
2341 if value != None:
2342 self.value = value
2343 else:
2344 self.value = 0
2345 return
2346
2347 def pack(self):
2348 packed = []
2349 packed.append(struct.pack("!H", self.type))
2350 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2351 packed.append(struct.pack("!L", self.value))
2352 length = sum([len(x) for x in packed])
2353 packed[1] = struct.pack("!H", length)
2354 return ''.join(packed)
2355
2356 @staticmethod
2357 def unpack(reader):
2358 obj = sub_agent_id()
2359 _type = reader.read("!H")[0]
2360 assert(_type == 38)
2361 _length = reader.read("!H")[0]
2362 orig_reader = reader
2363 reader = orig_reader.slice(_length - (2 + 2))
2364 obj.value = reader.read("!L")[0]
2365 return obj
2366
2367 def __eq__(self, other):
2368 if type(self) != type(other): return False
2369 if self.value != other.value: return False
2370 return True
2371
2372 def pretty_print(self, q):
2373 q.text("sub_agent_id {")
2374 with q.group():
2375 with q.indent(2):
2376 q.breakable()
2377 q.text("value = ");
2378 q.text("%#x" % self.value)
2379 q.breakable()
2380 q.text('}')
2381
2382bsn_tlv.subtypes[38] = sub_agent_id
2383
2384class tx_bytes(bsn_tlv):
2385 type = 39
2386
2387 def __init__(self, value=None):
2388 if value != None:
2389 self.value = value
2390 else:
2391 self.value = 0
2392 return
2393
2394 def pack(self):
2395 packed = []
2396 packed.append(struct.pack("!H", self.type))
2397 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2398 packed.append(struct.pack("!Q", self.value))
2399 length = sum([len(x) for x in packed])
2400 packed[1] = struct.pack("!H", length)
2401 return ''.join(packed)
2402
2403 @staticmethod
2404 def unpack(reader):
2405 obj = tx_bytes()
2406 _type = reader.read("!H")[0]
2407 assert(_type == 39)
2408 _length = reader.read("!H")[0]
2409 orig_reader = reader
2410 reader = orig_reader.slice(_length - (2 + 2))
2411 obj.value = reader.read("!Q")[0]
2412 return obj
2413
2414 def __eq__(self, other):
2415 if type(self) != type(other): return False
2416 if self.value != other.value: return False
2417 return True
2418
2419 def pretty_print(self, q):
2420 q.text("tx_bytes {")
2421 with q.group():
2422 with q.indent(2):
2423 q.breakable()
2424 q.text("value = ");
2425 q.text("%#x" % self.value)
2426 q.breakable()
2427 q.text('}')
2428
2429bsn_tlv.subtypes[39] = tx_bytes
2430
2431class tx_packets(bsn_tlv):
2432 type = 3
2433
2434 def __init__(self, value=None):
2435 if value != None:
2436 self.value = value
2437 else:
2438 self.value = 0
2439 return
2440
2441 def pack(self):
2442 packed = []
2443 packed.append(struct.pack("!H", self.type))
2444 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2445 packed.append(struct.pack("!Q", self.value))
2446 length = sum([len(x) for x in packed])
2447 packed[1] = struct.pack("!H", length)
2448 return ''.join(packed)
2449
2450 @staticmethod
2451 def unpack(reader):
2452 obj = tx_packets()
2453 _type = reader.read("!H")[0]
2454 assert(_type == 3)
2455 _length = reader.read("!H")[0]
2456 orig_reader = reader
2457 reader = orig_reader.slice(_length - (2 + 2))
2458 obj.value = reader.read("!Q")[0]
2459 return obj
2460
2461 def __eq__(self, other):
2462 if type(self) != type(other): return False
2463 if self.value != other.value: return False
2464 return True
2465
2466 def pretty_print(self, q):
2467 q.text("tx_packets {")
2468 with q.group():
2469 with q.indent(2):
2470 q.breakable()
2471 q.text("value = ");
2472 q.text("%#x" % self.value)
2473 q.breakable()
2474 q.text('}')
2475
2476bsn_tlv.subtypes[3] = tx_packets
2477
2478class udf_anchor(bsn_tlv):
2479 type = 16
2480
2481 def __init__(self, value=None):
2482 if value != None:
2483 self.value = value
2484 else:
2485 self.value = 0
2486 return
2487
2488 def pack(self):
2489 packed = []
2490 packed.append(struct.pack("!H", self.type))
2491 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2492 packed.append(struct.pack("!H", self.value))
2493 length = sum([len(x) for x in packed])
2494 packed[1] = struct.pack("!H", length)
2495 return ''.join(packed)
2496
2497 @staticmethod
2498 def unpack(reader):
2499 obj = udf_anchor()
2500 _type = reader.read("!H")[0]
2501 assert(_type == 16)
2502 _length = reader.read("!H")[0]
2503 orig_reader = reader
2504 reader = orig_reader.slice(_length - (2 + 2))
2505 obj.value = reader.read("!H")[0]
2506 return obj
2507
2508 def __eq__(self, other):
2509 if type(self) != type(other): return False
2510 if self.value != other.value: return False
2511 return True
2512
2513 def pretty_print(self, q):
2514 q.text("udf_anchor {")
2515 with q.group():
2516 with q.indent(2):
2517 q.breakable()
2518 q.text("value = ");
2519 q.text("%#x" % self.value)
2520 q.breakable()
2521 q.text('}')
2522
2523bsn_tlv.subtypes[16] = udf_anchor
2524
2525class udf_id(bsn_tlv):
2526 type = 15
2527
2528 def __init__(self, value=None):
2529 if value != None:
2530 self.value = value
2531 else:
2532 self.value = 0
2533 return
2534
2535 def pack(self):
2536 packed = []
2537 packed.append(struct.pack("!H", self.type))
2538 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2539 packed.append(struct.pack("!H", self.value))
2540 length = sum([len(x) for x in packed])
2541 packed[1] = struct.pack("!H", length)
2542 return ''.join(packed)
2543
2544 @staticmethod
2545 def unpack(reader):
2546 obj = udf_id()
2547 _type = reader.read("!H")[0]
2548 assert(_type == 15)
2549 _length = reader.read("!H")[0]
2550 orig_reader = reader
2551 reader = orig_reader.slice(_length - (2 + 2))
2552 obj.value = reader.read("!H")[0]
2553 return obj
2554
2555 def __eq__(self, other):
2556 if type(self) != type(other): return False
2557 if self.value != other.value: return False
2558 return True
2559
2560 def pretty_print(self, q):
2561 q.text("udf_id {")
2562 with q.group():
2563 with q.indent(2):
2564 q.breakable()
2565 q.text("value = ");
2566 q.text("%#x" % self.value)
2567 q.breakable()
2568 q.text('}')
2569
2570bsn_tlv.subtypes[15] = udf_id
2571
2572class udf_length(bsn_tlv):
2573 type = 18
2574
2575 def __init__(self, value=None):
2576 if value != None:
2577 self.value = value
2578 else:
2579 self.value = 0
2580 return
2581
2582 def pack(self):
2583 packed = []
2584 packed.append(struct.pack("!H", self.type))
2585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2586 packed.append(struct.pack("!H", self.value))
2587 length = sum([len(x) for x in packed])
2588 packed[1] = struct.pack("!H", length)
2589 return ''.join(packed)
2590
2591 @staticmethod
2592 def unpack(reader):
2593 obj = udf_length()
2594 _type = reader.read("!H")[0]
2595 assert(_type == 18)
2596 _length = reader.read("!H")[0]
2597 orig_reader = reader
2598 reader = orig_reader.slice(_length - (2 + 2))
2599 obj.value = reader.read("!H")[0]
2600 return obj
2601
2602 def __eq__(self, other):
2603 if type(self) != type(other): return False
2604 if self.value != other.value: return False
2605 return True
2606
2607 def pretty_print(self, q):
2608 q.text("udf_length {")
2609 with q.group():
2610 with q.indent(2):
2611 q.breakable()
2612 q.text("value = ");
2613 q.text("%#x" % self.value)
2614 q.breakable()
2615 q.text('}')
2616
2617bsn_tlv.subtypes[18] = udf_length
2618
2619class udf_offset(bsn_tlv):
2620 type = 17
2621
2622 def __init__(self, value=None):
2623 if value != None:
2624 self.value = value
2625 else:
2626 self.value = 0
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 packed.append(struct.pack("!H", self.value))
2634 length = sum([len(x) for x in packed])
2635 packed[1] = struct.pack("!H", length)
2636 return ''.join(packed)
2637
2638 @staticmethod
2639 def unpack(reader):
2640 obj = udf_offset()
2641 _type = reader.read("!H")[0]
2642 assert(_type == 17)
2643 _length = reader.read("!H")[0]
2644 orig_reader = reader
2645 reader = orig_reader.slice(_length - (2 + 2))
2646 obj.value = reader.read("!H")[0]
2647 return obj
2648
2649 def __eq__(self, other):
2650 if type(self) != type(other): return False
2651 if self.value != other.value: return False
2652 return True
2653
2654 def pretty_print(self, q):
2655 q.text("udf_offset {")
2656 with q.group():
2657 with q.indent(2):
2658 q.breakable()
2659 q.text("value = ");
2660 q.text("%#x" % self.value)
2661 q.breakable()
2662 q.text('}')
2663
2664bsn_tlv.subtypes[17] = udf_offset
2665
2666class udp_dst(bsn_tlv):
2667 type = 37
2668
2669 def __init__(self, value=None):
2670 if value != None:
2671 self.value = value
2672 else:
2673 self.value = 0
2674 return
2675
2676 def pack(self):
2677 packed = []
2678 packed.append(struct.pack("!H", self.type))
2679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2680 packed.append(struct.pack("!H", self.value))
2681 length = sum([len(x) for x in packed])
2682 packed[1] = struct.pack("!H", length)
2683 return ''.join(packed)
2684
2685 @staticmethod
2686 def unpack(reader):
2687 obj = udp_dst()
2688 _type = reader.read("!H")[0]
2689 assert(_type == 37)
2690 _length = reader.read("!H")[0]
2691 orig_reader = reader
2692 reader = orig_reader.slice(_length - (2 + 2))
2693 obj.value = reader.read("!H")[0]
2694 return obj
2695
2696 def __eq__(self, other):
2697 if type(self) != type(other): return False
2698 if self.value != other.value: return False
2699 return True
2700
2701 def pretty_print(self, q):
2702 q.text("udp_dst {")
2703 with q.group():
2704 with q.indent(2):
2705 q.breakable()
2706 q.text("value = ");
2707 q.text("%#x" % self.value)
2708 q.breakable()
2709 q.text('}')
2710
2711bsn_tlv.subtypes[37] = udp_dst
2712
2713class udp_src(bsn_tlv):
2714 type = 36
2715
2716 def __init__(self, value=None):
2717 if value != None:
2718 self.value = value
2719 else:
2720 self.value = 0
2721 return
2722
2723 def pack(self):
2724 packed = []
2725 packed.append(struct.pack("!H", self.type))
2726 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2727 packed.append(struct.pack("!H", self.value))
2728 length = sum([len(x) for x in packed])
2729 packed[1] = struct.pack("!H", length)
2730 return ''.join(packed)
2731
2732 @staticmethod
2733 def unpack(reader):
2734 obj = udp_src()
2735 _type = reader.read("!H")[0]
2736 assert(_type == 36)
2737 _length = reader.read("!H")[0]
2738 orig_reader = reader
2739 reader = orig_reader.slice(_length - (2 + 2))
2740 obj.value = reader.read("!H")[0]
2741 return obj
2742
2743 def __eq__(self, other):
2744 if type(self) != type(other): return False
2745 if self.value != other.value: return False
2746 return True
2747
2748 def pretty_print(self, q):
2749 q.text("udp_src {")
2750 with q.group():
2751 with q.indent(2):
2752 q.breakable()
2753 q.text("value = ");
2754 q.text("%#x" % self.value)
2755 q.breakable()
2756 q.text('}')
2757
2758bsn_tlv.subtypes[36] = udp_src
2759
2760class unicast_query_timeout(bsn_tlv):
2761 type = 9
2762
2763 def __init__(self, value=None):
2764 if value != None:
2765 self.value = value
2766 else:
2767 self.value = 0
2768 return
2769
2770 def pack(self):
2771 packed = []
2772 packed.append(struct.pack("!H", self.type))
2773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2774 packed.append(struct.pack("!L", self.value))
2775 length = sum([len(x) for x in packed])
2776 packed[1] = struct.pack("!H", length)
2777 return ''.join(packed)
2778
2779 @staticmethod
2780 def unpack(reader):
2781 obj = unicast_query_timeout()
2782 _type = reader.read("!H")[0]
2783 assert(_type == 9)
2784 _length = reader.read("!H")[0]
2785 orig_reader = reader
2786 reader = orig_reader.slice(_length - (2 + 2))
2787 obj.value = reader.read("!L")[0]
2788 return obj
2789
2790 def __eq__(self, other):
2791 if type(self) != type(other): return False
2792 if self.value != other.value: return False
2793 return True
2794
2795 def pretty_print(self, q):
2796 q.text("unicast_query_timeout {")
2797 with q.group():
2798 with q.indent(2):
2799 q.breakable()
2800 q.text("value = ");
2801 q.text("%#x" % self.value)
2802 q.breakable()
2803 q.text('}')
2804
2805bsn_tlv.subtypes[9] = unicast_query_timeout
2806
2807class vlan_vid(bsn_tlv):
2808 type = 6
2809
2810 def __init__(self, value=None):
2811 if value != None:
2812 self.value = value
2813 else:
2814 self.value = 0
2815 return
2816
2817 def pack(self):
2818 packed = []
2819 packed.append(struct.pack("!H", self.type))
2820 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2821 packed.append(struct.pack("!H", self.value))
2822 length = sum([len(x) for x in packed])
2823 packed[1] = struct.pack("!H", length)
2824 return ''.join(packed)
2825
2826 @staticmethod
2827 def unpack(reader):
2828 obj = vlan_vid()
2829 _type = reader.read("!H")[0]
2830 assert(_type == 6)
2831 _length = reader.read("!H")[0]
2832 orig_reader = reader
2833 reader = orig_reader.slice(_length - (2 + 2))
2834 obj.value = reader.read("!H")[0]
2835 return obj
2836
2837 def __eq__(self, other):
2838 if type(self) != type(other): return False
2839 if self.value != other.value: return False
2840 return True
2841
2842 def pretty_print(self, q):
2843 q.text("vlan_vid {")
2844 with q.group():
2845 with q.indent(2):
2846 q.breakable()
2847 q.text("value = ");
2848 q.text("%#x" % self.value)
2849 q.breakable()
2850 q.text('}')
2851
2852bsn_tlv.subtypes[6] = vlan_vid
2853
2854class vrf(bsn_tlv):
2855 type = 19
2856
2857 def __init__(self, value=None):
2858 if value != None:
2859 self.value = value
2860 else:
2861 self.value = 0
2862 return
2863
2864 def pack(self):
2865 packed = []
2866 packed.append(struct.pack("!H", self.type))
2867 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2868 packed.append(struct.pack("!L", self.value))
2869 length = sum([len(x) for x in packed])
2870 packed[1] = struct.pack("!H", length)
2871 return ''.join(packed)
2872
2873 @staticmethod
2874 def unpack(reader):
2875 obj = vrf()
2876 _type = reader.read("!H")[0]
2877 assert(_type == 19)
2878 _length = reader.read("!H")[0]
2879 orig_reader = reader
2880 reader = orig_reader.slice(_length - (2 + 2))
2881 obj.value = reader.read("!L")[0]
2882 return obj
2883
2884 def __eq__(self, other):
2885 if type(self) != type(other): return False
2886 if self.value != other.value: return False
2887 return True
2888
2889 def pretty_print(self, q):
2890 q.text("vrf {")
2891 with q.group():
2892 with q.indent(2):
2893 q.breakable()
2894 q.text("value = ");
2895 q.text("%#x" % self.value)
2896 q.breakable()
2897 q.text('}')
2898
2899bsn_tlv.subtypes[19] = vrf
2900
2901