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