blob: 2f5ef64d03be94cca3a426594d3ff2747bd1a772 [file] [log] [blame]
Rich Laneccd32ed2014-11-10 17:48:24 -08001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
13import bsn_tlv
14import meter_band
15import table_mod_prop
16import instruction
17import queue_desc_prop
18import oxm
19import bundle_prop
20import common
21import instruction_id
22import action
23import role_prop
24import message
25import queue_stats_prop
26import port_stats_prop
27import port_mod_prop
28import async_config_prop
29import action_id
30import util
31import loxi.generic_util
32
33class bsn_tlv(loxi.OFObject):
34 subtypes = {}
35
36
37 def __init__(self, type=None):
38 if type != None:
39 self.type = type
40 else:
41 self.type = 0
42 return
43
44 def pack(self):
45 packed = []
46 packed.append(struct.pack("!H", self.type))
47 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
48 length = sum([len(x) for x in packed])
49 packed[1] = struct.pack("!H", length)
50 return ''.join(packed)
51
52 @staticmethod
53 def unpack(reader):
54 subtype, = reader.peek('!H', 0)
55 subclass = bsn_tlv.subtypes.get(subtype)
56 if subclass:
57 return subclass.unpack(reader)
58
59 obj = bsn_tlv()
60 obj.type = reader.read("!H")[0]
61 _length = reader.read("!H")[0]
62 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080063 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -080064 return obj
65
66 def __eq__(self, other):
67 if type(self) != type(other): return False
68 if self.type != other.type: return False
69 return True
70
71 def pretty_print(self, q):
72 q.text("bsn_tlv {")
73 with q.group():
74 with q.indent(2):
75 q.breakable()
76 q.breakable()
77 q.text('}')
78
79
80class actor_key(bsn_tlv):
81 type = 44
82
83 def __init__(self, value=None):
84 if value != None:
85 self.value = value
86 else:
87 self.value = 0
88 return
89
90 def pack(self):
91 packed = []
92 packed.append(struct.pack("!H", self.type))
93 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
94 packed.append(struct.pack("!H", self.value))
95 length = sum([len(x) for x in packed])
96 packed[1] = struct.pack("!H", length)
97 return ''.join(packed)
98
99 @staticmethod
100 def unpack(reader):
101 obj = actor_key()
102 _type = reader.read("!H")[0]
103 assert(_type == 44)
104 _length = reader.read("!H")[0]
105 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800106 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800107 obj.value = reader.read("!H")[0]
108 return obj
109
110 def __eq__(self, other):
111 if type(self) != type(other): return False
112 if self.value != other.value: return False
113 return True
114
115 def pretty_print(self, q):
116 q.text("actor_key {")
117 with q.group():
118 with q.indent(2):
119 q.breakable()
120 q.text("value = ");
121 q.text("%#x" % self.value)
122 q.breakable()
123 q.text('}')
124
125bsn_tlv.subtypes[44] = actor_key
126
127class actor_port_num(bsn_tlv):
128 type = 43
129
130 def __init__(self, value=None):
131 if value != None:
132 self.value = value
133 else:
134 self.value = 0
135 return
136
137 def pack(self):
138 packed = []
139 packed.append(struct.pack("!H", self.type))
140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
141 packed.append(struct.pack("!H", self.value))
142 length = sum([len(x) for x in packed])
143 packed[1] = struct.pack("!H", length)
144 return ''.join(packed)
145
146 @staticmethod
147 def unpack(reader):
148 obj = actor_port_num()
149 _type = reader.read("!H")[0]
150 assert(_type == 43)
151 _length = reader.read("!H")[0]
152 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800153 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800154 obj.value = reader.read("!H")[0]
155 return obj
156
157 def __eq__(self, other):
158 if type(self) != type(other): return False
159 if self.value != other.value: return False
160 return True
161
162 def pretty_print(self, q):
163 q.text("actor_port_num {")
164 with q.group():
165 with q.indent(2):
166 q.breakable()
167 q.text("value = ");
168 q.text("%#x" % self.value)
169 q.breakable()
170 q.text('}')
171
172bsn_tlv.subtypes[43] = actor_port_num
173
174class actor_port_priority(bsn_tlv):
175 type = 42
176
177 def __init__(self, value=None):
178 if value != None:
179 self.value = value
180 else:
181 self.value = 0
182 return
183
184 def pack(self):
185 packed = []
186 packed.append(struct.pack("!H", self.type))
187 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
188 packed.append(struct.pack("!H", self.value))
189 length = sum([len(x) for x in packed])
190 packed[1] = struct.pack("!H", length)
191 return ''.join(packed)
192
193 @staticmethod
194 def unpack(reader):
195 obj = actor_port_priority()
196 _type = reader.read("!H")[0]
197 assert(_type == 42)
198 _length = reader.read("!H")[0]
199 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800200 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800201 obj.value = reader.read("!H")[0]
202 return obj
203
204 def __eq__(self, other):
205 if type(self) != type(other): return False
206 if self.value != other.value: return False
207 return True
208
209 def pretty_print(self, q):
210 q.text("actor_port_priority {")
211 with q.group():
212 with q.indent(2):
213 q.breakable()
214 q.text("value = ");
215 q.text("%#x" % self.value)
216 q.breakable()
217 q.text('}')
218
219bsn_tlv.subtypes[42] = actor_port_priority
220
221class actor_state(bsn_tlv):
222 type = 53
223
224 def __init__(self, value=None):
225 if value != None:
226 self.value = value
227 else:
228 self.value = 0
229 return
230
231 def pack(self):
232 packed = []
233 packed.append(struct.pack("!H", self.type))
234 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
235 packed.append(struct.pack("!B", self.value))
236 length = sum([len(x) for x in packed])
237 packed[1] = struct.pack("!H", length)
238 return ''.join(packed)
239
240 @staticmethod
241 def unpack(reader):
242 obj = actor_state()
243 _type = reader.read("!H")[0]
244 assert(_type == 53)
245 _length = reader.read("!H")[0]
246 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800247 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800248 obj.value = reader.read("!B")[0]
249 return obj
250
251 def __eq__(self, other):
252 if type(self) != type(other): return False
253 if self.value != other.value: return False
254 return True
255
256 def pretty_print(self, q):
257 q.text("actor_state {")
258 with q.group():
259 with q.indent(2):
260 q.breakable()
261 q.text("value = ");
262 q.text("%#x" % self.value)
263 q.breakable()
264 q.text('}')
265
266bsn_tlv.subtypes[53] = actor_state
267
268class actor_system_mac(bsn_tlv):
269 type = 41
270
271 def __init__(self, value=None):
272 if value != None:
273 self.value = value
274 else:
275 self.value = [0,0,0,0,0,0]
276 return
277
278 def pack(self):
279 packed = []
280 packed.append(struct.pack("!H", self.type))
281 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
282 packed.append(struct.pack("!6B", *self.value))
283 length = sum([len(x) for x in packed])
284 packed[1] = struct.pack("!H", length)
285 return ''.join(packed)
286
287 @staticmethod
288 def unpack(reader):
289 obj = actor_system_mac()
290 _type = reader.read("!H")[0]
291 assert(_type == 41)
292 _length = reader.read("!H")[0]
293 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800294 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800295 obj.value = list(reader.read('!6B'))
296 return obj
297
298 def __eq__(self, other):
299 if type(self) != type(other): return False
300 if self.value != other.value: return False
301 return True
302
303 def pretty_print(self, q):
304 q.text("actor_system_mac {")
305 with q.group():
306 with q.indent(2):
307 q.breakable()
308 q.text("value = ");
309 q.text(util.pretty_mac(self.value))
310 q.breakable()
311 q.text('}')
312
313bsn_tlv.subtypes[41] = actor_system_mac
314
315class actor_system_priority(bsn_tlv):
316 type = 40
317
318 def __init__(self, value=None):
319 if value != None:
320 self.value = value
321 else:
322 self.value = 0
323 return
324
325 def pack(self):
326 packed = []
327 packed.append(struct.pack("!H", self.type))
328 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
329 packed.append(struct.pack("!H", self.value))
330 length = sum([len(x) for x in packed])
331 packed[1] = struct.pack("!H", length)
332 return ''.join(packed)
333
334 @staticmethod
335 def unpack(reader):
336 obj = actor_system_priority()
337 _type = reader.read("!H")[0]
338 assert(_type == 40)
339 _length = reader.read("!H")[0]
340 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800341 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800342 obj.value = reader.read("!H")[0]
343 return obj
344
345 def __eq__(self, other):
346 if type(self) != type(other): return False
347 if self.value != other.value: return False
348 return True
349
350 def pretty_print(self, q):
351 q.text("actor_system_priority {")
352 with q.group():
353 with q.indent(2):
354 q.breakable()
355 q.text("value = ");
356 q.text("%#x" % self.value)
357 q.breakable()
358 q.text('}')
359
360bsn_tlv.subtypes[40] = actor_system_priority
361
362class broadcast_query_timeout(bsn_tlv):
363 type = 10
364
365 def __init__(self, value=None):
366 if value != None:
367 self.value = value
368 else:
369 self.value = 0
370 return
371
372 def pack(self):
373 packed = []
374 packed.append(struct.pack("!H", self.type))
375 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
376 packed.append(struct.pack("!L", self.value))
377 length = sum([len(x) for x in packed])
378 packed[1] = struct.pack("!H", length)
379 return ''.join(packed)
380
381 @staticmethod
382 def unpack(reader):
383 obj = broadcast_query_timeout()
384 _type = reader.read("!H")[0]
385 assert(_type == 10)
386 _length = reader.read("!H")[0]
387 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800388 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800389 obj.value = reader.read("!L")[0]
390 return obj
391
392 def __eq__(self, other):
393 if type(self) != type(other): return False
394 if self.value != other.value: return False
395 return True
396
397 def pretty_print(self, q):
398 q.text("broadcast_query_timeout {")
399 with q.group():
400 with q.indent(2):
401 q.breakable()
402 q.text("value = ");
403 q.text("%#x" % self.value)
404 q.breakable()
405 q.text('}')
406
407bsn_tlv.subtypes[10] = broadcast_query_timeout
408
Rich Lanecb18dbd2014-12-18 10:02:29 -0800409class bucket(bsn_tlv):
410 type = 64
411
412 def __init__(self, value=None):
413 if value != None:
414 self.value = value
415 else:
416 self.value = []
417 return
418
419 def pack(self):
420 packed = []
421 packed.append(struct.pack("!H", self.type))
422 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
423 packed.append(loxi.generic_util.pack_list(self.value))
424 length = sum([len(x) for x in packed])
425 packed[1] = struct.pack("!H", length)
426 return ''.join(packed)
427
428 @staticmethod
429 def unpack(reader):
430 obj = bucket()
431 _type = reader.read("!H")[0]
432 assert(_type == 64)
433 _length = reader.read("!H")[0]
434 orig_reader = reader
435 reader = orig_reader.slice(_length, 4)
436 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
437 return obj
438
439 def __eq__(self, other):
440 if type(self) != type(other): return False
441 if self.value != other.value: return False
442 return True
443
444 def pretty_print(self, q):
445 q.text("bucket {")
446 with q.group():
447 with q.indent(2):
448 q.breakable()
449 q.text("value = ");
450 q.pp(self.value)
451 q.breakable()
452 q.text('}')
453
454bsn_tlv.subtypes[64] = bucket
455
Rich Laneccd32ed2014-11-10 17:48:24 -0800456class circuit_id(bsn_tlv):
457 type = 14
458
459 def __init__(self, value=None):
460 if value != None:
461 self.value = value
462 else:
463 self.value = ''
464 return
465
466 def pack(self):
467 packed = []
468 packed.append(struct.pack("!H", self.type))
469 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
470 packed.append(self.value)
471 length = sum([len(x) for x in packed])
472 packed[1] = struct.pack("!H", length)
473 return ''.join(packed)
474
475 @staticmethod
476 def unpack(reader):
477 obj = circuit_id()
478 _type = reader.read("!H")[0]
479 assert(_type == 14)
480 _length = reader.read("!H")[0]
481 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800482 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800483 obj.value = str(reader.read_all())
484 return obj
485
486 def __eq__(self, other):
487 if type(self) != type(other): return False
488 if self.value != other.value: return False
489 return True
490
491 def pretty_print(self, q):
492 q.text("circuit_id {")
493 with q.group():
494 with q.indent(2):
495 q.breakable()
496 q.text("value = ");
497 q.pp(self.value)
498 q.breakable()
499 q.text('}')
500
501bsn_tlv.subtypes[14] = circuit_id
502
503class convergence_status(bsn_tlv):
504 type = 45
505
506 def __init__(self, value=None):
507 if value != None:
508 self.value = value
509 else:
510 self.value = 0
511 return
512
513 def pack(self):
514 packed = []
515 packed.append(struct.pack("!H", self.type))
516 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
517 packed.append(struct.pack("!B", self.value))
518 length = sum([len(x) for x in packed])
519 packed[1] = struct.pack("!H", length)
520 return ''.join(packed)
521
522 @staticmethod
523 def unpack(reader):
524 obj = convergence_status()
525 _type = reader.read("!H")[0]
526 assert(_type == 45)
527 _length = reader.read("!H")[0]
528 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800529 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800530 obj.value = reader.read("!B")[0]
531 return obj
532
533 def __eq__(self, other):
534 if type(self) != type(other): return False
535 if self.value != other.value: return False
536 return True
537
538 def pretty_print(self, q):
539 q.text("convergence_status {")
540 with q.group():
541 with q.indent(2):
542 q.breakable()
543 q.text("value = ");
544 q.text("%#x" % self.value)
545 q.breakable()
546 q.text('}')
547
548bsn_tlv.subtypes[45] = convergence_status
549
550class crc_enabled(bsn_tlv):
551 type = 22
552
553 def __init__(self, value=None):
554 if value != None:
555 self.value = value
556 else:
557 self.value = 0
558 return
559
560 def pack(self):
561 packed = []
562 packed.append(struct.pack("!H", self.type))
563 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
564 packed.append(struct.pack("!B", self.value))
565 length = sum([len(x) for x in packed])
566 packed[1] = struct.pack("!H", length)
567 return ''.join(packed)
568
569 @staticmethod
570 def unpack(reader):
571 obj = crc_enabled()
572 _type = reader.read("!H")[0]
573 assert(_type == 22)
574 _length = reader.read("!H")[0]
575 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800576 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800577 obj.value = reader.read("!B")[0]
578 return obj
579
580 def __eq__(self, other):
581 if type(self) != type(other): return False
582 if self.value != other.value: return False
583 return True
584
585 def pretty_print(self, q):
586 q.text("crc_enabled {")
587 with q.group():
588 with q.indent(2):
589 q.breakable()
590 q.text("value = ");
591 q.text("%#x" % self.value)
592 q.breakable()
593 q.text('}')
594
595bsn_tlv.subtypes[22] = crc_enabled
596
597class data(bsn_tlv):
598 type = 55
599
600 def __init__(self, value=None):
601 if value != None:
602 self.value = value
603 else:
604 self.value = ''
605 return
606
607 def pack(self):
608 packed = []
609 packed.append(struct.pack("!H", self.type))
610 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
611 packed.append(self.value)
612 length = sum([len(x) for x in packed])
613 packed[1] = struct.pack("!H", length)
614 return ''.join(packed)
615
616 @staticmethod
617 def unpack(reader):
618 obj = data()
619 _type = reader.read("!H")[0]
620 assert(_type == 55)
621 _length = reader.read("!H")[0]
622 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800623 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800624 obj.value = str(reader.read_all())
625 return obj
626
627 def __eq__(self, other):
628 if type(self) != type(other): return False
629 if self.value != other.value: return False
630 return True
631
632 def pretty_print(self, q):
633 q.text("data {")
634 with q.group():
635 with q.indent(2):
636 q.breakable()
637 q.text("value = ");
638 q.pp(self.value)
639 q.breakable()
640 q.text('}')
641
642bsn_tlv.subtypes[55] = data
643
644class eth_dst(bsn_tlv):
645 type = 33
646
647 def __init__(self, value=None):
648 if value != None:
649 self.value = value
650 else:
651 self.value = [0,0,0,0,0,0]
652 return
653
654 def pack(self):
655 packed = []
656 packed.append(struct.pack("!H", self.type))
657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
658 packed.append(struct.pack("!6B", *self.value))
659 length = sum([len(x) for x in packed])
660 packed[1] = struct.pack("!H", length)
661 return ''.join(packed)
662
663 @staticmethod
664 def unpack(reader):
665 obj = eth_dst()
666 _type = reader.read("!H")[0]
667 assert(_type == 33)
668 _length = reader.read("!H")[0]
669 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800670 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800671 obj.value = list(reader.read('!6B'))
672 return obj
673
674 def __eq__(self, other):
675 if type(self) != type(other): return False
676 if self.value != other.value: return False
677 return True
678
679 def pretty_print(self, q):
680 q.text("eth_dst {")
681 with q.group():
682 with q.indent(2):
683 q.breakable()
684 q.text("value = ");
685 q.text(util.pretty_mac(self.value))
686 q.breakable()
687 q.text('}')
688
689bsn_tlv.subtypes[33] = eth_dst
690
691class eth_src(bsn_tlv):
692 type = 32
693
694 def __init__(self, value=None):
695 if value != None:
696 self.value = value
697 else:
698 self.value = [0,0,0,0,0,0]
699 return
700
701 def pack(self):
702 packed = []
703 packed.append(struct.pack("!H", self.type))
704 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
705 packed.append(struct.pack("!6B", *self.value))
706 length = sum([len(x) for x in packed])
707 packed[1] = struct.pack("!H", length)
708 return ''.join(packed)
709
710 @staticmethod
711 def unpack(reader):
712 obj = eth_src()
713 _type = reader.read("!H")[0]
714 assert(_type == 32)
715 _length = reader.read("!H")[0]
716 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800717 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800718 obj.value = list(reader.read('!6B'))
719 return obj
720
721 def __eq__(self, other):
722 if type(self) != type(other): return False
723 if self.value != other.value: return False
724 return True
725
726 def pretty_print(self, q):
727 q.text("eth_src {")
728 with q.group():
729 with q.indent(2):
730 q.breakable()
731 q.text("value = ");
732 q.text(util.pretty_mac(self.value))
733 q.breakable()
734 q.text('}')
735
736bsn_tlv.subtypes[32] = eth_src
737
738class external_gateway_ip(bsn_tlv):
739 type = 26
740
741 def __init__(self, value=None):
742 if value != None:
743 self.value = value
744 else:
745 self.value = 0
746 return
747
748 def pack(self):
749 packed = []
750 packed.append(struct.pack("!H", self.type))
751 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
752 packed.append(struct.pack("!L", self.value))
753 length = sum([len(x) for x in packed])
754 packed[1] = struct.pack("!H", length)
755 return ''.join(packed)
756
757 @staticmethod
758 def unpack(reader):
759 obj = external_gateway_ip()
760 _type = reader.read("!H")[0]
761 assert(_type == 26)
762 _length = reader.read("!H")[0]
763 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800764 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800765 obj.value = reader.read("!L")[0]
766 return obj
767
768 def __eq__(self, other):
769 if type(self) != type(other): return False
770 if self.value != other.value: return False
771 return True
772
773 def pretty_print(self, q):
774 q.text("external_gateway_ip {")
775 with q.group():
776 with q.indent(2):
777 q.breakable()
778 q.text("value = ");
779 q.text(util.pretty_ipv4(self.value))
780 q.breakable()
781 q.text('}')
782
783bsn_tlv.subtypes[26] = external_gateway_ip
784
785class external_gateway_mac(bsn_tlv):
786 type = 29
787
788 def __init__(self, value=None):
789 if value != None:
790 self.value = value
791 else:
792 self.value = [0,0,0,0,0,0]
793 return
794
795 def pack(self):
796 packed = []
797 packed.append(struct.pack("!H", self.type))
798 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
799 packed.append(struct.pack("!6B", *self.value))
800 length = sum([len(x) for x in packed])
801 packed[1] = struct.pack("!H", length)
802 return ''.join(packed)
803
804 @staticmethod
805 def unpack(reader):
806 obj = external_gateway_mac()
807 _type = reader.read("!H")[0]
808 assert(_type == 29)
809 _length = reader.read("!H")[0]
810 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800811 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800812 obj.value = list(reader.read('!6B'))
813 return obj
814
815 def __eq__(self, other):
816 if type(self) != type(other): return False
817 if self.value != other.value: return False
818 return True
819
820 def pretty_print(self, q):
821 q.text("external_gateway_mac {")
822 with q.group():
823 with q.indent(2):
824 q.breakable()
825 q.text("value = ");
826 q.text(util.pretty_mac(self.value))
827 q.breakable()
828 q.text('}')
829
830bsn_tlv.subtypes[29] = external_gateway_mac
831
832class external_ip(bsn_tlv):
833 type = 23
834
835 def __init__(self, value=None):
836 if value != None:
837 self.value = value
838 else:
839 self.value = 0
840 return
841
842 def pack(self):
843 packed = []
844 packed.append(struct.pack("!H", self.type))
845 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
846 packed.append(struct.pack("!L", self.value))
847 length = sum([len(x) for x in packed])
848 packed[1] = struct.pack("!H", length)
849 return ''.join(packed)
850
851 @staticmethod
852 def unpack(reader):
853 obj = external_ip()
854 _type = reader.read("!H")[0]
855 assert(_type == 23)
856 _length = reader.read("!H")[0]
857 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800858 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800859 obj.value = reader.read("!L")[0]
860 return obj
861
862 def __eq__(self, other):
863 if type(self) != type(other): return False
864 if self.value != other.value: return False
865 return True
866
867 def pretty_print(self, q):
868 q.text("external_ip {")
869 with q.group():
870 with q.indent(2):
871 q.breakable()
872 q.text("value = ");
873 q.text(util.pretty_ipv4(self.value))
874 q.breakable()
875 q.text('}')
876
877bsn_tlv.subtypes[23] = external_ip
878
879class external_mac(bsn_tlv):
880 type = 24
881
882 def __init__(self, value=None):
883 if value != None:
884 self.value = value
885 else:
886 self.value = [0,0,0,0,0,0]
887 return
888
889 def pack(self):
890 packed = []
891 packed.append(struct.pack("!H", self.type))
892 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
893 packed.append(struct.pack("!6B", *self.value))
894 length = sum([len(x) for x in packed])
895 packed[1] = struct.pack("!H", length)
896 return ''.join(packed)
897
898 @staticmethod
899 def unpack(reader):
900 obj = external_mac()
901 _type = reader.read("!H")[0]
902 assert(_type == 24)
903 _length = reader.read("!H")[0]
904 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800905 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800906 obj.value = list(reader.read('!6B'))
907 return obj
908
909 def __eq__(self, other):
910 if type(self) != type(other): return False
911 if self.value != other.value: return False
912 return True
913
914 def pretty_print(self, q):
915 q.text("external_mac {")
916 with q.group():
917 with q.indent(2):
918 q.breakable()
919 q.text("value = ");
920 q.text(util.pretty_mac(self.value))
921 q.breakable()
922 q.text('}')
923
924bsn_tlv.subtypes[24] = external_mac
925
926class external_netmask(bsn_tlv):
927 type = 25
928
929 def __init__(self, value=None):
930 if value != None:
931 self.value = value
932 else:
933 self.value = 0
934 return
935
936 def pack(self):
937 packed = []
938 packed.append(struct.pack("!H", self.type))
939 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
940 packed.append(struct.pack("!L", self.value))
941 length = sum([len(x) for x in packed])
942 packed[1] = struct.pack("!H", length)
943 return ''.join(packed)
944
945 @staticmethod
946 def unpack(reader):
947 obj = external_netmask()
948 _type = reader.read("!H")[0]
949 assert(_type == 25)
950 _length = reader.read("!H")[0]
951 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800952 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800953 obj.value = reader.read("!L")[0]
954 return obj
955
956 def __eq__(self, other):
957 if type(self) != type(other): return False
958 if self.value != other.value: return False
959 return True
960
961 def pretty_print(self, q):
962 q.text("external_netmask {")
963 with q.group():
964 with q.indent(2):
965 q.breakable()
966 q.text("value = ");
967 q.text(util.pretty_ipv4(self.value))
968 q.breakable()
969 q.text('}')
970
971bsn_tlv.subtypes[25] = external_netmask
972
973class header_size(bsn_tlv):
974 type = 31
975
976 def __init__(self, value=None):
977 if value != None:
978 self.value = value
979 else:
980 self.value = 0
981 return
982
983 def pack(self):
984 packed = []
985 packed.append(struct.pack("!H", self.type))
986 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
987 packed.append(struct.pack("!L", self.value))
988 length = sum([len(x) for x in packed])
989 packed[1] = struct.pack("!H", length)
990 return ''.join(packed)
991
992 @staticmethod
993 def unpack(reader):
994 obj = header_size()
995 _type = reader.read("!H")[0]
996 assert(_type == 31)
997 _length = reader.read("!H")[0]
998 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800999 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001000 obj.value = reader.read("!L")[0]
1001 return obj
1002
1003 def __eq__(self, other):
1004 if type(self) != type(other): return False
1005 if self.value != other.value: return False
1006 return True
1007
1008 def pretty_print(self, q):
1009 q.text("header_size {")
1010 with q.group():
1011 with q.indent(2):
1012 q.breakable()
1013 q.text("value = ");
1014 q.text("%#x" % self.value)
1015 q.breakable()
1016 q.text('}')
1017
1018bsn_tlv.subtypes[31] = header_size
1019
Rich Lane474324f2015-01-14 15:22:56 -08001020class icmp_code(bsn_tlv):
1021 type = 69
1022
1023 def __init__(self, value=None):
1024 if value != None:
1025 self.value = value
1026 else:
1027 self.value = 0
1028 return
1029
1030 def pack(self):
1031 packed = []
1032 packed.append(struct.pack("!H", self.type))
1033 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1034 packed.append(struct.pack("!B", self.value))
1035 length = sum([len(x) for x in packed])
1036 packed[1] = struct.pack("!H", length)
1037 return ''.join(packed)
1038
1039 @staticmethod
1040 def unpack(reader):
1041 obj = icmp_code()
1042 _type = reader.read("!H")[0]
1043 assert(_type == 69)
1044 _length = reader.read("!H")[0]
1045 orig_reader = reader
1046 reader = orig_reader.slice(_length, 4)
1047 obj.value = reader.read("!B")[0]
1048 return obj
1049
1050 def __eq__(self, other):
1051 if type(self) != type(other): return False
1052 if self.value != other.value: return False
1053 return True
1054
1055 def pretty_print(self, q):
1056 q.text("icmp_code {")
1057 with q.group():
1058 with q.indent(2):
1059 q.breakable()
1060 q.text("value = ");
1061 q.text("%#x" % self.value)
1062 q.breakable()
1063 q.text('}')
1064
1065bsn_tlv.subtypes[69] = icmp_code
1066
1067class icmp_id(bsn_tlv):
1068 type = 70
1069
1070 def __init__(self, value=None):
1071 if value != None:
1072 self.value = value
1073 else:
1074 self.value = 0
1075 return
1076
1077 def pack(self):
1078 packed = []
1079 packed.append(struct.pack("!H", self.type))
1080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1081 packed.append(struct.pack("!H", self.value))
1082 length = sum([len(x) for x in packed])
1083 packed[1] = struct.pack("!H", length)
1084 return ''.join(packed)
1085
1086 @staticmethod
1087 def unpack(reader):
1088 obj = icmp_id()
1089 _type = reader.read("!H")[0]
1090 assert(_type == 70)
1091 _length = reader.read("!H")[0]
1092 orig_reader = reader
1093 reader = orig_reader.slice(_length, 4)
1094 obj.value = reader.read("!H")[0]
1095 return obj
1096
1097 def __eq__(self, other):
1098 if type(self) != type(other): return False
1099 if self.value != other.value: return False
1100 return True
1101
1102 def pretty_print(self, q):
1103 q.text("icmp_id {")
1104 with q.group():
1105 with q.indent(2):
1106 q.breakable()
1107 q.text("value = ");
1108 q.text("%#x" % self.value)
1109 q.breakable()
1110 q.text('}')
1111
1112bsn_tlv.subtypes[70] = icmp_id
1113
1114class icmp_type(bsn_tlv):
1115 type = 68
1116
1117 def __init__(self, value=None):
1118 if value != None:
1119 self.value = value
1120 else:
1121 self.value = 0
1122 return
1123
1124 def pack(self):
1125 packed = []
1126 packed.append(struct.pack("!H", self.type))
1127 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1128 packed.append(struct.pack("!B", self.value))
1129 length = sum([len(x) for x in packed])
1130 packed[1] = struct.pack("!H", length)
1131 return ''.join(packed)
1132
1133 @staticmethod
1134 def unpack(reader):
1135 obj = icmp_type()
1136 _type = reader.read("!H")[0]
1137 assert(_type == 68)
1138 _length = reader.read("!H")[0]
1139 orig_reader = reader
1140 reader = orig_reader.slice(_length, 4)
1141 obj.value = reader.read("!B")[0]
1142 return obj
1143
1144 def __eq__(self, other):
1145 if type(self) != type(other): return False
1146 if self.value != other.value: return False
1147 return True
1148
1149 def pretty_print(self, q):
1150 q.text("icmp_type {")
1151 with q.group():
1152 with q.indent(2):
1153 q.breakable()
1154 q.text("value = ");
1155 q.text("%#x" % self.value)
1156 q.breakable()
1157 q.text('}')
1158
1159bsn_tlv.subtypes[68] = icmp_type
1160
Rich Laneccd32ed2014-11-10 17:48:24 -08001161class idle_notification(bsn_tlv):
1162 type = 7
1163
1164 def __init__(self):
1165 return
1166
1167 def pack(self):
1168 packed = []
1169 packed.append(struct.pack("!H", self.type))
1170 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1171 length = sum([len(x) for x in packed])
1172 packed[1] = struct.pack("!H", length)
1173 return ''.join(packed)
1174
1175 @staticmethod
1176 def unpack(reader):
1177 obj = idle_notification()
1178 _type = reader.read("!H")[0]
1179 assert(_type == 7)
1180 _length = reader.read("!H")[0]
1181 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001182 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001183 return obj
1184
1185 def __eq__(self, other):
1186 if type(self) != type(other): return False
1187 return True
1188
1189 def pretty_print(self, q):
1190 q.text("idle_notification {")
1191 with q.group():
1192 with q.indent(2):
1193 q.breakable()
1194 q.breakable()
1195 q.text('}')
1196
1197bsn_tlv.subtypes[7] = idle_notification
1198
1199class idle_time(bsn_tlv):
1200 type = 5
1201
1202 def __init__(self, value=None):
1203 if value != None:
1204 self.value = value
1205 else:
1206 self.value = 0
1207 return
1208
1209 def pack(self):
1210 packed = []
1211 packed.append(struct.pack("!H", self.type))
1212 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1213 packed.append(struct.pack("!Q", self.value))
1214 length = sum([len(x) for x in packed])
1215 packed[1] = struct.pack("!H", length)
1216 return ''.join(packed)
1217
1218 @staticmethod
1219 def unpack(reader):
1220 obj = idle_time()
1221 _type = reader.read("!H")[0]
1222 assert(_type == 5)
1223 _length = reader.read("!H")[0]
1224 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001225 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001226 obj.value = reader.read("!Q")[0]
1227 return obj
1228
1229 def __eq__(self, other):
1230 if type(self) != type(other): return False
1231 if self.value != other.value: return False
1232 return True
1233
1234 def pretty_print(self, q):
1235 q.text("idle_time {")
1236 with q.group():
1237 with q.indent(2):
1238 q.breakable()
1239 q.text("value = ");
1240 q.text("%#x" % self.value)
1241 q.breakable()
1242 q.text('}')
1243
1244bsn_tlv.subtypes[5] = idle_time
1245
1246class idle_timeout(bsn_tlv):
1247 type = 8
1248
1249 def __init__(self, value=None):
1250 if value != None:
1251 self.value = value
1252 else:
1253 self.value = 0
1254 return
1255
1256 def pack(self):
1257 packed = []
1258 packed.append(struct.pack("!H", self.type))
1259 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1260 packed.append(struct.pack("!L", self.value))
1261 length = sum([len(x) for x in packed])
1262 packed[1] = struct.pack("!H", length)
1263 return ''.join(packed)
1264
1265 @staticmethod
1266 def unpack(reader):
1267 obj = idle_timeout()
1268 _type = reader.read("!H")[0]
1269 assert(_type == 8)
1270 _length = reader.read("!H")[0]
1271 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001272 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001273 obj.value = reader.read("!L")[0]
1274 return obj
1275
1276 def __eq__(self, other):
1277 if type(self) != type(other): return False
1278 if self.value != other.value: return False
1279 return True
1280
1281 def pretty_print(self, q):
1282 q.text("idle_timeout {")
1283 with q.group():
1284 with q.indent(2):
1285 q.breakable()
1286 q.text("value = ");
1287 q.text("%#x" % self.value)
1288 q.breakable()
1289 q.text('}')
1290
1291bsn_tlv.subtypes[8] = idle_timeout
1292
1293class internal_gateway_mac(bsn_tlv):
1294 type = 28
1295
1296 def __init__(self, value=None):
1297 if value != None:
1298 self.value = value
1299 else:
1300 self.value = [0,0,0,0,0,0]
1301 return
1302
1303 def pack(self):
1304 packed = []
1305 packed.append(struct.pack("!H", self.type))
1306 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1307 packed.append(struct.pack("!6B", *self.value))
1308 length = sum([len(x) for x in packed])
1309 packed[1] = struct.pack("!H", length)
1310 return ''.join(packed)
1311
1312 @staticmethod
1313 def unpack(reader):
1314 obj = internal_gateway_mac()
1315 _type = reader.read("!H")[0]
1316 assert(_type == 28)
1317 _length = reader.read("!H")[0]
1318 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001319 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001320 obj.value = list(reader.read('!6B'))
1321 return obj
1322
1323 def __eq__(self, other):
1324 if type(self) != type(other): return False
1325 if self.value != other.value: return False
1326 return True
1327
1328 def pretty_print(self, q):
1329 q.text("internal_gateway_mac {")
1330 with q.group():
1331 with q.indent(2):
1332 q.breakable()
1333 q.text("value = ");
1334 q.text(util.pretty_mac(self.value))
1335 q.breakable()
1336 q.text('}')
1337
1338bsn_tlv.subtypes[28] = internal_gateway_mac
1339
1340class internal_mac(bsn_tlv):
1341 type = 27
1342
1343 def __init__(self, value=None):
1344 if value != None:
1345 self.value = value
1346 else:
1347 self.value = [0,0,0,0,0,0]
1348 return
1349
1350 def pack(self):
1351 packed = []
1352 packed.append(struct.pack("!H", self.type))
1353 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1354 packed.append(struct.pack("!6B", *self.value))
1355 length = sum([len(x) for x in packed])
1356 packed[1] = struct.pack("!H", length)
1357 return ''.join(packed)
1358
1359 @staticmethod
1360 def unpack(reader):
1361 obj = internal_mac()
1362 _type = reader.read("!H")[0]
1363 assert(_type == 27)
1364 _length = reader.read("!H")[0]
1365 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001366 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001367 obj.value = list(reader.read('!6B'))
1368 return obj
1369
1370 def __eq__(self, other):
1371 if type(self) != type(other): return False
1372 if self.value != other.value: return False
1373 return True
1374
1375 def pretty_print(self, q):
1376 q.text("internal_mac {")
1377 with q.group():
1378 with q.indent(2):
1379 q.breakable()
1380 q.text("value = ");
1381 q.text(util.pretty_mac(self.value))
1382 q.breakable()
1383 q.text('}')
1384
1385bsn_tlv.subtypes[27] = internal_mac
1386
Harshmeet Singh301f7172014-12-08 13:07:29 -08001387class interval(bsn_tlv):
1388 type = 58
1389
1390 def __init__(self, value=None):
1391 if value != None:
1392 self.value = value
1393 else:
1394 self.value = 0
1395 return
1396
1397 def pack(self):
1398 packed = []
1399 packed.append(struct.pack("!H", self.type))
1400 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1401 packed.append(struct.pack("!L", self.value))
1402 length = sum([len(x) for x in packed])
1403 packed[1] = struct.pack("!H", length)
1404 return ''.join(packed)
1405
1406 @staticmethod
1407 def unpack(reader):
1408 obj = interval()
1409 _type = reader.read("!H")[0]
1410 assert(_type == 58)
1411 _length = reader.read("!H")[0]
1412 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001413 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08001414 obj.value = reader.read("!L")[0]
1415 return obj
1416
1417 def __eq__(self, other):
1418 if type(self) != type(other): return False
1419 if self.value != other.value: return False
1420 return True
1421
1422 def pretty_print(self, q):
1423 q.text("interval {")
1424 with q.group():
1425 with q.indent(2):
1426 q.breakable()
1427 q.text("value = ");
1428 q.text("%#x" % self.value)
1429 q.breakable()
1430 q.text('}')
1431
1432bsn_tlv.subtypes[58] = interval
1433
Rich Lane474324f2015-01-14 15:22:56 -08001434class ip_proto(bsn_tlv):
1435 type = 67
1436
1437 def __init__(self, value=None):
1438 if value != None:
1439 self.value = value
1440 else:
1441 self.value = 0
1442 return
1443
1444 def pack(self):
1445 packed = []
1446 packed.append(struct.pack("!H", self.type))
1447 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1448 packed.append(struct.pack("!B", self.value))
1449 length = sum([len(x) for x in packed])
1450 packed[1] = struct.pack("!H", length)
1451 return ''.join(packed)
1452
1453 @staticmethod
1454 def unpack(reader):
1455 obj = ip_proto()
1456 _type = reader.read("!H")[0]
1457 assert(_type == 67)
1458 _length = reader.read("!H")[0]
1459 orig_reader = reader
1460 reader = orig_reader.slice(_length, 4)
1461 obj.value = reader.read("!B")[0]
1462 return obj
1463
1464 def __eq__(self, other):
1465 if type(self) != type(other): return False
1466 if self.value != other.value: return False
1467 return True
1468
1469 def pretty_print(self, q):
1470 q.text("ip_proto {")
1471 with q.group():
1472 with q.indent(2):
1473 q.breakable()
1474 q.text("value = ");
1475 q.text("%#x" % self.value)
1476 q.breakable()
1477 q.text('}')
1478
1479bsn_tlv.subtypes[67] = ip_proto
1480
Rich Laneccd32ed2014-11-10 17:48:24 -08001481class ipv4(bsn_tlv):
1482 type = 4
1483
1484 def __init__(self, value=None):
1485 if value != None:
1486 self.value = value
1487 else:
1488 self.value = 0
1489 return
1490
1491 def pack(self):
1492 packed = []
1493 packed.append(struct.pack("!H", self.type))
1494 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1495 packed.append(struct.pack("!L", self.value))
1496 length = sum([len(x) for x in packed])
1497 packed[1] = struct.pack("!H", length)
1498 return ''.join(packed)
1499
1500 @staticmethod
1501 def unpack(reader):
1502 obj = ipv4()
1503 _type = reader.read("!H")[0]
1504 assert(_type == 4)
1505 _length = reader.read("!H")[0]
1506 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001507 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001508 obj.value = reader.read("!L")[0]
1509 return obj
1510
1511 def __eq__(self, other):
1512 if type(self) != type(other): return False
1513 if self.value != other.value: return False
1514 return True
1515
1516 def pretty_print(self, q):
1517 q.text("ipv4 {")
1518 with q.group():
1519 with q.indent(2):
1520 q.breakable()
1521 q.text("value = ");
1522 q.text(util.pretty_ipv4(self.value))
1523 q.breakable()
1524 q.text('}')
1525
1526bsn_tlv.subtypes[4] = ipv4
1527
1528class ipv4_dst(bsn_tlv):
1529 type = 35
1530
1531 def __init__(self, value=None):
1532 if value != None:
1533 self.value = value
1534 else:
1535 self.value = 0
1536 return
1537
1538 def pack(self):
1539 packed = []
1540 packed.append(struct.pack("!H", self.type))
1541 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1542 packed.append(struct.pack("!L", self.value))
1543 length = sum([len(x) for x in packed])
1544 packed[1] = struct.pack("!H", length)
1545 return ''.join(packed)
1546
1547 @staticmethod
1548 def unpack(reader):
1549 obj = ipv4_dst()
1550 _type = reader.read("!H")[0]
1551 assert(_type == 35)
1552 _length = reader.read("!H")[0]
1553 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001554 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001555 obj.value = reader.read("!L")[0]
1556 return obj
1557
1558 def __eq__(self, other):
1559 if type(self) != type(other): return False
1560 if self.value != other.value: return False
1561 return True
1562
1563 def pretty_print(self, q):
1564 q.text("ipv4_dst {")
1565 with q.group():
1566 with q.indent(2):
1567 q.breakable()
1568 q.text("value = ");
1569 q.text(util.pretty_ipv4(self.value))
1570 q.breakable()
1571 q.text('}')
1572
1573bsn_tlv.subtypes[35] = ipv4_dst
1574
Harshmeet Singh301f7172014-12-08 13:07:29 -08001575class ipv4_netmask(bsn_tlv):
1576 type = 60
1577
1578 def __init__(self, value=None):
1579 if value != None:
1580 self.value = value
1581 else:
1582 self.value = 0
1583 return
1584
1585 def pack(self):
1586 packed = []
1587 packed.append(struct.pack("!H", self.type))
1588 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1589 packed.append(struct.pack("!L", self.value))
1590 length = sum([len(x) for x in packed])
1591 packed[1] = struct.pack("!H", length)
1592 return ''.join(packed)
1593
1594 @staticmethod
1595 def unpack(reader):
1596 obj = ipv4_netmask()
1597 _type = reader.read("!H")[0]
1598 assert(_type == 60)
1599 _length = reader.read("!H")[0]
1600 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001601 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08001602 obj.value = reader.read("!L")[0]
1603 return obj
1604
1605 def __eq__(self, other):
1606 if type(self) != type(other): return False
1607 if self.value != other.value: return False
1608 return True
1609
1610 def pretty_print(self, q):
1611 q.text("ipv4_netmask {")
1612 with q.group():
1613 with q.indent(2):
1614 q.breakable()
1615 q.text("value = ");
1616 q.text(util.pretty_ipv4(self.value))
1617 q.breakable()
1618 q.text('}')
1619
1620bsn_tlv.subtypes[60] = ipv4_netmask
1621
Rich Laneccd32ed2014-11-10 17:48:24 -08001622class ipv4_src(bsn_tlv):
1623 type = 34
1624
1625 def __init__(self, value=None):
1626 if value != None:
1627 self.value = value
1628 else:
1629 self.value = 0
1630 return
1631
1632 def pack(self):
1633 packed = []
1634 packed.append(struct.pack("!H", self.type))
1635 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1636 packed.append(struct.pack("!L", self.value))
1637 length = sum([len(x) for x in packed])
1638 packed[1] = struct.pack("!H", length)
1639 return ''.join(packed)
1640
1641 @staticmethod
1642 def unpack(reader):
1643 obj = ipv4_src()
1644 _type = reader.read("!H")[0]
1645 assert(_type == 34)
1646 _length = reader.read("!H")[0]
1647 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001648 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001649 obj.value = reader.read("!L")[0]
1650 return obj
1651
1652 def __eq__(self, other):
1653 if type(self) != type(other): return False
1654 if self.value != other.value: return False
1655 return True
1656
1657 def pretty_print(self, q):
1658 q.text("ipv4_src {")
1659 with q.group():
1660 with q.indent(2):
1661 q.breakable()
1662 q.text("value = ");
1663 q.text(util.pretty_ipv4(self.value))
1664 q.breakable()
1665 q.text('}')
1666
1667bsn_tlv.subtypes[34] = ipv4_src
1668
1669class mac(bsn_tlv):
1670 type = 1
1671
1672 def __init__(self, value=None):
1673 if value != None:
1674 self.value = value
1675 else:
1676 self.value = [0,0,0,0,0,0]
1677 return
1678
1679 def pack(self):
1680 packed = []
1681 packed.append(struct.pack("!H", self.type))
1682 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1683 packed.append(struct.pack("!6B", *self.value))
1684 length = sum([len(x) for x in packed])
1685 packed[1] = struct.pack("!H", length)
1686 return ''.join(packed)
1687
1688 @staticmethod
1689 def unpack(reader):
1690 obj = mac()
1691 _type = reader.read("!H")[0]
1692 assert(_type == 1)
1693 _length = reader.read("!H")[0]
1694 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001695 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001696 obj.value = list(reader.read('!6B'))
1697 return obj
1698
1699 def __eq__(self, other):
1700 if type(self) != type(other): return False
1701 if self.value != other.value: return False
1702 return True
1703
1704 def pretty_print(self, q):
1705 q.text("mac {")
1706 with q.group():
1707 with q.indent(2):
1708 q.breakable()
1709 q.text("value = ");
1710 q.text(util.pretty_mac(self.value))
1711 q.breakable()
1712 q.text('}')
1713
1714bsn_tlv.subtypes[1] = mac
1715
1716class mac_mask(bsn_tlv):
1717 type = 56
1718
1719 def __init__(self, value=None):
1720 if value != None:
1721 self.value = value
1722 else:
1723 self.value = [0,0,0,0,0,0]
1724 return
1725
1726 def pack(self):
1727 packed = []
1728 packed.append(struct.pack("!H", self.type))
1729 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1730 packed.append(struct.pack("!6B", *self.value))
1731 length = sum([len(x) for x in packed])
1732 packed[1] = struct.pack("!H", length)
1733 return ''.join(packed)
1734
1735 @staticmethod
1736 def unpack(reader):
1737 obj = mac_mask()
1738 _type = reader.read("!H")[0]
1739 assert(_type == 56)
1740 _length = reader.read("!H")[0]
1741 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001742 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001743 obj.value = list(reader.read('!6B'))
1744 return obj
1745
1746 def __eq__(self, other):
1747 if type(self) != type(other): return False
1748 if self.value != other.value: return False
1749 return True
1750
1751 def pretty_print(self, q):
1752 q.text("mac_mask {")
1753 with q.group():
1754 with q.indent(2):
1755 q.breakable()
1756 q.text("value = ");
1757 q.text(util.pretty_mac(self.value))
1758 q.breakable()
1759 q.text('}')
1760
1761bsn_tlv.subtypes[56] = mac_mask
1762
1763class miss_packets(bsn_tlv):
1764 type = 13
1765
1766 def __init__(self, value=None):
1767 if value != None:
1768 self.value = value
1769 else:
1770 self.value = 0
1771 return
1772
1773 def pack(self):
1774 packed = []
1775 packed.append(struct.pack("!H", self.type))
1776 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1777 packed.append(struct.pack("!Q", self.value))
1778 length = sum([len(x) for x in packed])
1779 packed[1] = struct.pack("!H", length)
1780 return ''.join(packed)
1781
1782 @staticmethod
1783 def unpack(reader):
1784 obj = miss_packets()
1785 _type = reader.read("!H")[0]
1786 assert(_type == 13)
1787 _length = reader.read("!H")[0]
1788 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001789 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001790 obj.value = reader.read("!Q")[0]
1791 return obj
1792
1793 def __eq__(self, other):
1794 if type(self) != type(other): return False
1795 if self.value != other.value: return False
1796 return True
1797
1798 def pretty_print(self, q):
1799 q.text("miss_packets {")
1800 with q.group():
1801 with q.indent(2):
1802 q.breakable()
1803 q.text("value = ");
1804 q.text("%#x" % self.value)
1805 q.breakable()
1806 q.text('}')
1807
1808bsn_tlv.subtypes[13] = miss_packets
1809
Rich Lanecb18dbd2014-12-18 10:02:29 -08001810class mpls_control_word(bsn_tlv):
1811 type = 62
1812
1813 def __init__(self, value=None):
1814 if value != None:
1815 self.value = value
1816 else:
1817 self.value = 0
1818 return
1819
1820 def pack(self):
1821 packed = []
1822 packed.append(struct.pack("!H", self.type))
1823 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1824 packed.append(struct.pack("!B", self.value))
1825 length = sum([len(x) for x in packed])
1826 packed[1] = struct.pack("!H", length)
1827 return ''.join(packed)
1828
1829 @staticmethod
1830 def unpack(reader):
1831 obj = mpls_control_word()
1832 _type = reader.read("!H")[0]
1833 assert(_type == 62)
1834 _length = reader.read("!H")[0]
1835 orig_reader = reader
1836 reader = orig_reader.slice(_length, 4)
1837 obj.value = reader.read("!B")[0]
1838 return obj
1839
1840 def __eq__(self, other):
1841 if type(self) != type(other): return False
1842 if self.value != other.value: return False
1843 return True
1844
1845 def pretty_print(self, q):
1846 q.text("mpls_control_word {")
1847 with q.group():
1848 with q.indent(2):
1849 q.breakable()
1850 q.text("value = ");
1851 q.text("%#x" % self.value)
1852 q.breakable()
1853 q.text('}')
1854
1855bsn_tlv.subtypes[62] = mpls_control_word
1856
1857class mpls_label(bsn_tlv):
1858 type = 61
1859
1860 def __init__(self, value=None):
1861 if value != None:
1862 self.value = value
1863 else:
1864 self.value = 0
1865 return
1866
1867 def pack(self):
1868 packed = []
1869 packed.append(struct.pack("!H", self.type))
1870 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1871 packed.append(struct.pack("!L", self.value))
1872 length = sum([len(x) for x in packed])
1873 packed[1] = struct.pack("!H", length)
1874 return ''.join(packed)
1875
1876 @staticmethod
1877 def unpack(reader):
1878 obj = mpls_label()
1879 _type = reader.read("!H")[0]
1880 assert(_type == 61)
1881 _length = reader.read("!H")[0]
1882 orig_reader = reader
1883 reader = orig_reader.slice(_length, 4)
1884 obj.value = reader.read("!L")[0]
1885 return obj
1886
1887 def __eq__(self, other):
1888 if type(self) != type(other): return False
1889 if self.value != other.value: return False
1890 return True
1891
1892 def pretty_print(self, q):
1893 q.text("mpls_label {")
1894 with q.group():
1895 with q.indent(2):
1896 q.breakable()
1897 q.text("value = ");
1898 q.text("%#x" % self.value)
1899 q.breakable()
1900 q.text('}')
1901
1902bsn_tlv.subtypes[61] = mpls_label
1903
1904class mpls_sequenced(bsn_tlv):
1905 type = 63
1906
1907 def __init__(self, value=None):
1908 if value != None:
1909 self.value = value
1910 else:
1911 self.value = 0
1912 return
1913
1914 def pack(self):
1915 packed = []
1916 packed.append(struct.pack("!H", self.type))
1917 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1918 packed.append(struct.pack("!B", self.value))
1919 length = sum([len(x) for x in packed])
1920 packed[1] = struct.pack("!H", length)
1921 return ''.join(packed)
1922
1923 @staticmethod
1924 def unpack(reader):
1925 obj = mpls_sequenced()
1926 _type = reader.read("!H")[0]
1927 assert(_type == 63)
1928 _length = reader.read("!H")[0]
1929 orig_reader = reader
1930 reader = orig_reader.slice(_length, 4)
1931 obj.value = reader.read("!B")[0]
1932 return obj
1933
1934 def __eq__(self, other):
1935 if type(self) != type(other): return False
1936 if self.value != other.value: return False
1937 return True
1938
1939 def pretty_print(self, q):
1940 q.text("mpls_sequenced {")
1941 with q.group():
1942 with q.indent(2):
1943 q.breakable()
1944 q.text("value = ");
1945 q.text("%#x" % self.value)
1946 q.breakable()
1947 q.text('}')
1948
1949bsn_tlv.subtypes[63] = mpls_sequenced
1950
Rich Laneccd32ed2014-11-10 17:48:24 -08001951class name(bsn_tlv):
1952 type = 52
1953
1954 def __init__(self, value=None):
1955 if value != None:
1956 self.value = value
1957 else:
1958 self.value = ''
1959 return
1960
1961 def pack(self):
1962 packed = []
1963 packed.append(struct.pack("!H", self.type))
1964 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1965 packed.append(self.value)
1966 length = sum([len(x) for x in packed])
1967 packed[1] = struct.pack("!H", length)
1968 return ''.join(packed)
1969
1970 @staticmethod
1971 def unpack(reader):
1972 obj = name()
1973 _type = reader.read("!H")[0]
1974 assert(_type == 52)
1975 _length = reader.read("!H")[0]
1976 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001977 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001978 obj.value = str(reader.read_all())
1979 return obj
1980
1981 def __eq__(self, other):
1982 if type(self) != type(other): return False
1983 if self.value != other.value: return False
1984 return True
1985
1986 def pretty_print(self, q):
1987 q.text("name {")
1988 with q.group():
1989 with q.indent(2):
1990 q.breakable()
1991 q.text("value = ");
1992 q.pp(self.value)
1993 q.breakable()
1994 q.text('}')
1995
1996bsn_tlv.subtypes[52] = name
1997
1998class partner_key(bsn_tlv):
1999 type = 51
2000
2001 def __init__(self, value=None):
2002 if value != None:
2003 self.value = value
2004 else:
2005 self.value = 0
2006 return
2007
2008 def pack(self):
2009 packed = []
2010 packed.append(struct.pack("!H", self.type))
2011 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2012 packed.append(struct.pack("!H", self.value))
2013 length = sum([len(x) for x in packed])
2014 packed[1] = struct.pack("!H", length)
2015 return ''.join(packed)
2016
2017 @staticmethod
2018 def unpack(reader):
2019 obj = partner_key()
2020 _type = reader.read("!H")[0]
2021 assert(_type == 51)
2022 _length = reader.read("!H")[0]
2023 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002024 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002025 obj.value = reader.read("!H")[0]
2026 return obj
2027
2028 def __eq__(self, other):
2029 if type(self) != type(other): return False
2030 if self.value != other.value: return False
2031 return True
2032
2033 def pretty_print(self, q):
2034 q.text("partner_key {")
2035 with q.group():
2036 with q.indent(2):
2037 q.breakable()
2038 q.text("value = ");
2039 q.text("%#x" % self.value)
2040 q.breakable()
2041 q.text('}')
2042
2043bsn_tlv.subtypes[51] = partner_key
2044
2045class partner_port_num(bsn_tlv):
2046 type = 50
2047
2048 def __init__(self, value=None):
2049 if value != None:
2050 self.value = value
2051 else:
2052 self.value = 0
2053 return
2054
2055 def pack(self):
2056 packed = []
2057 packed.append(struct.pack("!H", self.type))
2058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2059 packed.append(struct.pack("!H", self.value))
2060 length = sum([len(x) for x in packed])
2061 packed[1] = struct.pack("!H", length)
2062 return ''.join(packed)
2063
2064 @staticmethod
2065 def unpack(reader):
2066 obj = partner_port_num()
2067 _type = reader.read("!H")[0]
2068 assert(_type == 50)
2069 _length = reader.read("!H")[0]
2070 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002071 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002072 obj.value = reader.read("!H")[0]
2073 return obj
2074
2075 def __eq__(self, other):
2076 if type(self) != type(other): return False
2077 if self.value != other.value: return False
2078 return True
2079
2080 def pretty_print(self, q):
2081 q.text("partner_port_num {")
2082 with q.group():
2083 with q.indent(2):
2084 q.breakable()
2085 q.text("value = ");
2086 q.text("%#x" % self.value)
2087 q.breakable()
2088 q.text('}')
2089
2090bsn_tlv.subtypes[50] = partner_port_num
2091
2092class partner_port_priority(bsn_tlv):
2093 type = 49
2094
2095 def __init__(self, value=None):
2096 if value != None:
2097 self.value = value
2098 else:
2099 self.value = 0
2100 return
2101
2102 def pack(self):
2103 packed = []
2104 packed.append(struct.pack("!H", self.type))
2105 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2106 packed.append(struct.pack("!H", self.value))
2107 length = sum([len(x) for x in packed])
2108 packed[1] = struct.pack("!H", length)
2109 return ''.join(packed)
2110
2111 @staticmethod
2112 def unpack(reader):
2113 obj = partner_port_priority()
2114 _type = reader.read("!H")[0]
2115 assert(_type == 49)
2116 _length = reader.read("!H")[0]
2117 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002118 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002119 obj.value = reader.read("!H")[0]
2120 return obj
2121
2122 def __eq__(self, other):
2123 if type(self) != type(other): return False
2124 if self.value != other.value: return False
2125 return True
2126
2127 def pretty_print(self, q):
2128 q.text("partner_port_priority {")
2129 with q.group():
2130 with q.indent(2):
2131 q.breakable()
2132 q.text("value = ");
2133 q.text("%#x" % self.value)
2134 q.breakable()
2135 q.text('}')
2136
2137bsn_tlv.subtypes[49] = partner_port_priority
2138
2139class partner_state(bsn_tlv):
2140 type = 54
2141
2142 def __init__(self, value=None):
2143 if value != None:
2144 self.value = value
2145 else:
2146 self.value = 0
2147 return
2148
2149 def pack(self):
2150 packed = []
2151 packed.append(struct.pack("!H", self.type))
2152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2153 packed.append(struct.pack("!B", self.value))
2154 length = sum([len(x) for x in packed])
2155 packed[1] = struct.pack("!H", length)
2156 return ''.join(packed)
2157
2158 @staticmethod
2159 def unpack(reader):
2160 obj = partner_state()
2161 _type = reader.read("!H")[0]
2162 assert(_type == 54)
2163 _length = reader.read("!H")[0]
2164 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002165 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002166 obj.value = reader.read("!B")[0]
2167 return obj
2168
2169 def __eq__(self, other):
2170 if type(self) != type(other): return False
2171 if self.value != other.value: return False
2172 return True
2173
2174 def pretty_print(self, q):
2175 q.text("partner_state {")
2176 with q.group():
2177 with q.indent(2):
2178 q.breakable()
2179 q.text("value = ");
2180 q.text("%#x" % self.value)
2181 q.breakable()
2182 q.text('}')
2183
2184bsn_tlv.subtypes[54] = partner_state
2185
2186class partner_system_mac(bsn_tlv):
2187 type = 48
2188
2189 def __init__(self, value=None):
2190 if value != None:
2191 self.value = value
2192 else:
2193 self.value = [0,0,0,0,0,0]
2194 return
2195
2196 def pack(self):
2197 packed = []
2198 packed.append(struct.pack("!H", self.type))
2199 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2200 packed.append(struct.pack("!6B", *self.value))
2201 length = sum([len(x) for x in packed])
2202 packed[1] = struct.pack("!H", length)
2203 return ''.join(packed)
2204
2205 @staticmethod
2206 def unpack(reader):
2207 obj = partner_system_mac()
2208 _type = reader.read("!H")[0]
2209 assert(_type == 48)
2210 _length = reader.read("!H")[0]
2211 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002212 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002213 obj.value = list(reader.read('!6B'))
2214 return obj
2215
2216 def __eq__(self, other):
2217 if type(self) != type(other): return False
2218 if self.value != other.value: return False
2219 return True
2220
2221 def pretty_print(self, q):
2222 q.text("partner_system_mac {")
2223 with q.group():
2224 with q.indent(2):
2225 q.breakable()
2226 q.text("value = ");
2227 q.text(util.pretty_mac(self.value))
2228 q.breakable()
2229 q.text('}')
2230
2231bsn_tlv.subtypes[48] = partner_system_mac
2232
2233class partner_system_priority(bsn_tlv):
2234 type = 47
2235
2236 def __init__(self, value=None):
2237 if value != None:
2238 self.value = value
2239 else:
2240 self.value = 0
2241 return
2242
2243 def pack(self):
2244 packed = []
2245 packed.append(struct.pack("!H", self.type))
2246 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2247 packed.append(struct.pack("!H", self.value))
2248 length = sum([len(x) for x in packed])
2249 packed[1] = struct.pack("!H", length)
2250 return ''.join(packed)
2251
2252 @staticmethod
2253 def unpack(reader):
2254 obj = partner_system_priority()
2255 _type = reader.read("!H")[0]
2256 assert(_type == 47)
2257 _length = reader.read("!H")[0]
2258 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002259 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002260 obj.value = reader.read("!H")[0]
2261 return obj
2262
2263 def __eq__(self, other):
2264 if type(self) != type(other): return False
2265 if self.value != other.value: return False
2266 return True
2267
2268 def pretty_print(self, q):
2269 q.text("partner_system_priority {")
2270 with q.group():
2271 with q.indent(2):
2272 q.breakable()
2273 q.text("value = ");
2274 q.text("%#x" % self.value)
2275 q.breakable()
2276 q.text('}')
2277
2278bsn_tlv.subtypes[47] = partner_system_priority
2279
2280class port(bsn_tlv):
2281 type = 0
2282
2283 def __init__(self, value=None):
2284 if value != None:
2285 self.value = value
2286 else:
2287 self.value = 0
2288 return
2289
2290 def pack(self):
2291 packed = []
2292 packed.append(struct.pack("!H", self.type))
2293 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2294 packed.append(util.pack_port_no(self.value))
2295 length = sum([len(x) for x in packed])
2296 packed[1] = struct.pack("!H", length)
2297 return ''.join(packed)
2298
2299 @staticmethod
2300 def unpack(reader):
2301 obj = port()
2302 _type = reader.read("!H")[0]
2303 assert(_type == 0)
2304 _length = reader.read("!H")[0]
2305 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002306 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002307 obj.value = util.unpack_port_no(reader)
2308 return obj
2309
2310 def __eq__(self, other):
2311 if type(self) != type(other): return False
2312 if self.value != other.value: return False
2313 return True
2314
2315 def pretty_print(self, q):
2316 q.text("port {")
2317 with q.group():
2318 with q.indent(2):
2319 q.breakable()
2320 q.text("value = ");
2321 q.text(util.pretty_port(self.value))
2322 q.breakable()
2323 q.text('}')
2324
2325bsn_tlv.subtypes[0] = port
2326
2327class priority(bsn_tlv):
2328 type = 57
2329
2330 def __init__(self, value=None):
2331 if value != None:
2332 self.value = value
2333 else:
2334 self.value = 0
2335 return
2336
2337 def pack(self):
2338 packed = []
2339 packed.append(struct.pack("!H", self.type))
2340 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2341 packed.append(struct.pack("!L", self.value))
2342 length = sum([len(x) for x in packed])
2343 packed[1] = struct.pack("!H", length)
2344 return ''.join(packed)
2345
2346 @staticmethod
2347 def unpack(reader):
2348 obj = priority()
2349 _type = reader.read("!H")[0]
2350 assert(_type == 57)
2351 _length = reader.read("!H")[0]
2352 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002353 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002354 obj.value = reader.read("!L")[0]
2355 return obj
2356
2357 def __eq__(self, other):
2358 if type(self) != type(other): return False
2359 if self.value != other.value: return False
2360 return True
2361
2362 def pretty_print(self, q):
2363 q.text("priority {")
2364 with q.group():
2365 with q.indent(2):
2366 q.breakable()
2367 q.text("value = ");
2368 q.text("%#x" % self.value)
2369 q.breakable()
2370 q.text('}')
2371
2372bsn_tlv.subtypes[57] = priority
2373
2374class queue_id(bsn_tlv):
2375 type = 20
2376
2377 def __init__(self, value=None):
2378 if value != None:
2379 self.value = value
2380 else:
2381 self.value = 0
2382 return
2383
2384 def pack(self):
2385 packed = []
2386 packed.append(struct.pack("!H", self.type))
2387 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2388 packed.append(struct.pack("!L", self.value))
2389 length = sum([len(x) for x in packed])
2390 packed[1] = struct.pack("!H", length)
2391 return ''.join(packed)
2392
2393 @staticmethod
2394 def unpack(reader):
2395 obj = queue_id()
2396 _type = reader.read("!H")[0]
2397 assert(_type == 20)
2398 _length = reader.read("!H")[0]
2399 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002400 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002401 obj.value = reader.read("!L")[0]
2402 return obj
2403
2404 def __eq__(self, other):
2405 if type(self) != type(other): return False
2406 if self.value != other.value: return False
2407 return True
2408
2409 def pretty_print(self, q):
2410 q.text("queue_id {")
2411 with q.group():
2412 with q.indent(2):
2413 q.breakable()
2414 q.text("value = ");
2415 q.text("%#x" % self.value)
2416 q.breakable()
2417 q.text('}')
2418
2419bsn_tlv.subtypes[20] = queue_id
2420
2421class queue_weight(bsn_tlv):
2422 type = 21
2423
2424 def __init__(self, value=None):
2425 if value != None:
2426 self.value = value
2427 else:
2428 self.value = 0
2429 return
2430
2431 def pack(self):
2432 packed = []
2433 packed.append(struct.pack("!H", self.type))
2434 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2435 packed.append(struct.pack("!L", self.value))
2436 length = sum([len(x) for x in packed])
2437 packed[1] = struct.pack("!H", length)
2438 return ''.join(packed)
2439
2440 @staticmethod
2441 def unpack(reader):
2442 obj = queue_weight()
2443 _type = reader.read("!H")[0]
2444 assert(_type == 21)
2445 _length = reader.read("!H")[0]
2446 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002447 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002448 obj.value = reader.read("!L")[0]
2449 return obj
2450
2451 def __eq__(self, other):
2452 if type(self) != type(other): return False
2453 if self.value != other.value: return False
2454 return True
2455
2456 def pretty_print(self, q):
2457 q.text("queue_weight {")
2458 with q.group():
2459 with q.indent(2):
2460 q.breakable()
2461 q.text("value = ");
2462 q.text("%#x" % self.value)
2463 q.breakable()
2464 q.text('}')
2465
2466bsn_tlv.subtypes[21] = queue_weight
2467
Harshmeet Singh301f7172014-12-08 13:07:29 -08002468class reference(bsn_tlv):
2469 type = 59
2470
2471 def __init__(self, table_id=None, key=None):
2472 if table_id != None:
2473 self.table_id = table_id
2474 else:
2475 self.table_id = 0
2476 if key != None:
2477 self.key = key
2478 else:
2479 self.key = []
2480 return
2481
2482 def pack(self):
2483 packed = []
2484 packed.append(struct.pack("!H", self.type))
2485 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2486 packed.append(struct.pack("!H", self.table_id))
2487 packed.append(loxi.generic_util.pack_list(self.key))
2488 length = sum([len(x) for x in packed])
2489 packed[1] = struct.pack("!H", length)
2490 return ''.join(packed)
2491
2492 @staticmethod
2493 def unpack(reader):
2494 obj = reference()
2495 _type = reader.read("!H")[0]
2496 assert(_type == 59)
2497 _length = reader.read("!H")[0]
2498 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002499 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08002500 obj.table_id = reader.read("!H")[0]
2501 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
2502 return obj
2503
2504 def __eq__(self, other):
2505 if type(self) != type(other): return False
2506 if self.table_id != other.table_id: return False
2507 if self.key != other.key: return False
2508 return True
2509
2510 def pretty_print(self, q):
2511 q.text("reference {")
2512 with q.group():
2513 with q.indent(2):
2514 q.breakable()
2515 q.text("table_id = ");
2516 q.text("%#x" % self.table_id)
2517 q.text(","); q.breakable()
2518 q.text("key = ");
2519 q.pp(self.key)
2520 q.breakable()
2521 q.text('}')
2522
2523bsn_tlv.subtypes[59] = reference
2524
Rich Laneccd32ed2014-11-10 17:48:24 -08002525class reply_packets(bsn_tlv):
2526 type = 12
2527
2528 def __init__(self, value=None):
2529 if value != None:
2530 self.value = value
2531 else:
2532 self.value = 0
2533 return
2534
2535 def pack(self):
2536 packed = []
2537 packed.append(struct.pack("!H", self.type))
2538 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2539 packed.append(struct.pack("!Q", self.value))
2540 length = sum([len(x) for x in packed])
2541 packed[1] = struct.pack("!H", length)
2542 return ''.join(packed)
2543
2544 @staticmethod
2545 def unpack(reader):
2546 obj = reply_packets()
2547 _type = reader.read("!H")[0]
2548 assert(_type == 12)
2549 _length = reader.read("!H")[0]
2550 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002551 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002552 obj.value = reader.read("!Q")[0]
2553 return obj
2554
2555 def __eq__(self, other):
2556 if type(self) != type(other): return False
2557 if self.value != other.value: return False
2558 return True
2559
2560 def pretty_print(self, q):
2561 q.text("reply_packets {")
2562 with q.group():
2563 with q.indent(2):
2564 q.breakable()
2565 q.text("value = ");
2566 q.text("%#x" % self.value)
2567 q.breakable()
2568 q.text('}')
2569
2570bsn_tlv.subtypes[12] = reply_packets
2571
2572class request_packets(bsn_tlv):
2573 type = 11
2574
2575 def __init__(self, value=None):
2576 if value != None:
2577 self.value = value
2578 else:
2579 self.value = 0
2580 return
2581
2582 def pack(self):
2583 packed = []
2584 packed.append(struct.pack("!H", self.type))
2585 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2586 packed.append(struct.pack("!Q", self.value))
2587 length = sum([len(x) for x in packed])
2588 packed[1] = struct.pack("!H", length)
2589 return ''.join(packed)
2590
2591 @staticmethod
2592 def unpack(reader):
2593 obj = request_packets()
2594 _type = reader.read("!H")[0]
2595 assert(_type == 11)
2596 _length = reader.read("!H")[0]
2597 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002598 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002599 obj.value = reader.read("!Q")[0]
2600 return obj
2601
2602 def __eq__(self, other):
2603 if type(self) != type(other): return False
2604 if self.value != other.value: return False
2605 return True
2606
2607 def pretty_print(self, q):
2608 q.text("request_packets {")
2609 with q.group():
2610 with q.indent(2):
2611 q.breakable()
2612 q.text("value = ");
2613 q.text("%#x" % self.value)
2614 q.breakable()
2615 q.text('}')
2616
2617bsn_tlv.subtypes[11] = request_packets
2618
2619class rx_packets(bsn_tlv):
2620 type = 2
2621
2622 def __init__(self, value=None):
2623 if value != None:
2624 self.value = value
2625 else:
2626 self.value = 0
2627 return
2628
2629 def pack(self):
2630 packed = []
2631 packed.append(struct.pack("!H", self.type))
2632 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2633 packed.append(struct.pack("!Q", self.value))
2634 length = sum([len(x) for x in packed])
2635 packed[1] = struct.pack("!H", length)
2636 return ''.join(packed)
2637
2638 @staticmethod
2639 def unpack(reader):
2640 obj = rx_packets()
2641 _type = reader.read("!H")[0]
2642 assert(_type == 2)
2643 _length = reader.read("!H")[0]
2644 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002645 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002646 obj.value = reader.read("!Q")[0]
2647 return obj
2648
2649 def __eq__(self, other):
2650 if type(self) != type(other): return False
2651 if self.value != other.value: return False
2652 return True
2653
2654 def pretty_print(self, q):
2655 q.text("rx_packets {")
2656 with q.group():
2657 with q.indent(2):
2658 q.breakable()
2659 q.text("value = ");
2660 q.text("%#x" % self.value)
2661 q.breakable()
2662 q.text('}')
2663
2664bsn_tlv.subtypes[2] = rx_packets
2665
2666class sampling_rate(bsn_tlv):
2667 type = 30
2668
2669 def __init__(self, value=None):
2670 if value != None:
2671 self.value = value
2672 else:
2673 self.value = 0
2674 return
2675
2676 def pack(self):
2677 packed = []
2678 packed.append(struct.pack("!H", self.type))
2679 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2680 packed.append(struct.pack("!L", self.value))
2681 length = sum([len(x) for x in packed])
2682 packed[1] = struct.pack("!H", length)
2683 return ''.join(packed)
2684
2685 @staticmethod
2686 def unpack(reader):
2687 obj = sampling_rate()
2688 _type = reader.read("!H")[0]
2689 assert(_type == 30)
2690 _length = reader.read("!H")[0]
2691 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002692 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002693 obj.value = reader.read("!L")[0]
2694 return obj
2695
2696 def __eq__(self, other):
2697 if type(self) != type(other): return False
2698 if self.value != other.value: return False
2699 return True
2700
2701 def pretty_print(self, q):
2702 q.text("sampling_rate {")
2703 with q.group():
2704 with q.indent(2):
2705 q.breakable()
2706 q.text("value = ");
2707 q.text("%#x" % self.value)
2708 q.breakable()
2709 q.text('}')
2710
2711bsn_tlv.subtypes[30] = sampling_rate
2712
2713class sub_agent_id(bsn_tlv):
2714 type = 38
2715
2716 def __init__(self, value=None):
2717 if value != None:
2718 self.value = value
2719 else:
2720 self.value = 0
2721 return
2722
2723 def pack(self):
2724 packed = []
2725 packed.append(struct.pack("!H", self.type))
2726 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2727 packed.append(struct.pack("!L", self.value))
2728 length = sum([len(x) for x in packed])
2729 packed[1] = struct.pack("!H", length)
2730 return ''.join(packed)
2731
2732 @staticmethod
2733 def unpack(reader):
2734 obj = sub_agent_id()
2735 _type = reader.read("!H")[0]
2736 assert(_type == 38)
2737 _length = reader.read("!H")[0]
2738 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002739 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002740 obj.value = reader.read("!L")[0]
2741 return obj
2742
2743 def __eq__(self, other):
2744 if type(self) != type(other): return False
2745 if self.value != other.value: return False
2746 return True
2747
2748 def pretty_print(self, q):
2749 q.text("sub_agent_id {")
2750 with q.group():
2751 with q.indent(2):
2752 q.breakable()
2753 q.text("value = ");
2754 q.text("%#x" % self.value)
2755 q.breakable()
2756 q.text('}')
2757
2758bsn_tlv.subtypes[38] = sub_agent_id
2759
Rich Lane474324f2015-01-14 15:22:56 -08002760class tcp_dst(bsn_tlv):
2761 type = 66
2762
2763 def __init__(self, value=None):
2764 if value != None:
2765 self.value = value
2766 else:
2767 self.value = 0
2768 return
2769
2770 def pack(self):
2771 packed = []
2772 packed.append(struct.pack("!H", self.type))
2773 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2774 packed.append(struct.pack("!H", self.value))
2775 length = sum([len(x) for x in packed])
2776 packed[1] = struct.pack("!H", length)
2777 return ''.join(packed)
2778
2779 @staticmethod
2780 def unpack(reader):
2781 obj = tcp_dst()
2782 _type = reader.read("!H")[0]
2783 assert(_type == 66)
2784 _length = reader.read("!H")[0]
2785 orig_reader = reader
2786 reader = orig_reader.slice(_length, 4)
2787 obj.value = reader.read("!H")[0]
2788 return obj
2789
2790 def __eq__(self, other):
2791 if type(self) != type(other): return False
2792 if self.value != other.value: return False
2793 return True
2794
2795 def pretty_print(self, q):
2796 q.text("tcp_dst {")
2797 with q.group():
2798 with q.indent(2):
2799 q.breakable()
2800 q.text("value = ");
2801 q.text("%#x" % self.value)
2802 q.breakable()
2803 q.text('}')
2804
2805bsn_tlv.subtypes[66] = tcp_dst
2806
2807class tcp_src(bsn_tlv):
2808 type = 65
2809
2810 def __init__(self, value=None):
2811 if value != None:
2812 self.value = value
2813 else:
2814 self.value = 0
2815 return
2816
2817 def pack(self):
2818 packed = []
2819 packed.append(struct.pack("!H", self.type))
2820 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2821 packed.append(struct.pack("!H", self.value))
2822 length = sum([len(x) for x in packed])
2823 packed[1] = struct.pack("!H", length)
2824 return ''.join(packed)
2825
2826 @staticmethod
2827 def unpack(reader):
2828 obj = tcp_src()
2829 _type = reader.read("!H")[0]
2830 assert(_type == 65)
2831 _length = reader.read("!H")[0]
2832 orig_reader = reader
2833 reader = orig_reader.slice(_length, 4)
2834 obj.value = reader.read("!H")[0]
2835 return obj
2836
2837 def __eq__(self, other):
2838 if type(self) != type(other): return False
2839 if self.value != other.value: return False
2840 return True
2841
2842 def pretty_print(self, q):
2843 q.text("tcp_src {")
2844 with q.group():
2845 with q.indent(2):
2846 q.breakable()
2847 q.text("value = ");
2848 q.text("%#x" % self.value)
2849 q.breakable()
2850 q.text('}')
2851
2852bsn_tlv.subtypes[65] = tcp_src
2853
Rich Laneccd32ed2014-11-10 17:48:24 -08002854class tx_bytes(bsn_tlv):
2855 type = 39
2856
2857 def __init__(self, value=None):
2858 if value != None:
2859 self.value = value
2860 else:
2861 self.value = 0
2862 return
2863
2864 def pack(self):
2865 packed = []
2866 packed.append(struct.pack("!H", self.type))
2867 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2868 packed.append(struct.pack("!Q", self.value))
2869 length = sum([len(x) for x in packed])
2870 packed[1] = struct.pack("!H", length)
2871 return ''.join(packed)
2872
2873 @staticmethod
2874 def unpack(reader):
2875 obj = tx_bytes()
2876 _type = reader.read("!H")[0]
2877 assert(_type == 39)
2878 _length = reader.read("!H")[0]
2879 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002880 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002881 obj.value = reader.read("!Q")[0]
2882 return obj
2883
2884 def __eq__(self, other):
2885 if type(self) != type(other): return False
2886 if self.value != other.value: return False
2887 return True
2888
2889 def pretty_print(self, q):
2890 q.text("tx_bytes {")
2891 with q.group():
2892 with q.indent(2):
2893 q.breakable()
2894 q.text("value = ");
2895 q.text("%#x" % self.value)
2896 q.breakable()
2897 q.text('}')
2898
2899bsn_tlv.subtypes[39] = tx_bytes
2900
2901class tx_packets(bsn_tlv):
2902 type = 3
2903
2904 def __init__(self, value=None):
2905 if value != None:
2906 self.value = value
2907 else:
2908 self.value = 0
2909 return
2910
2911 def pack(self):
2912 packed = []
2913 packed.append(struct.pack("!H", self.type))
2914 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2915 packed.append(struct.pack("!Q", self.value))
2916 length = sum([len(x) for x in packed])
2917 packed[1] = struct.pack("!H", length)
2918 return ''.join(packed)
2919
2920 @staticmethod
2921 def unpack(reader):
2922 obj = tx_packets()
2923 _type = reader.read("!H")[0]
2924 assert(_type == 3)
2925 _length = reader.read("!H")[0]
2926 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002927 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002928 obj.value = reader.read("!Q")[0]
2929 return obj
2930
2931 def __eq__(self, other):
2932 if type(self) != type(other): return False
2933 if self.value != other.value: return False
2934 return True
2935
2936 def pretty_print(self, q):
2937 q.text("tx_packets {")
2938 with q.group():
2939 with q.indent(2):
2940 q.breakable()
2941 q.text("value = ");
2942 q.text("%#x" % self.value)
2943 q.breakable()
2944 q.text('}')
2945
2946bsn_tlv.subtypes[3] = tx_packets
2947
2948class udf_anchor(bsn_tlv):
2949 type = 16
2950
2951 def __init__(self, value=None):
2952 if value != None:
2953 self.value = value
2954 else:
2955 self.value = 0
2956 return
2957
2958 def pack(self):
2959 packed = []
2960 packed.append(struct.pack("!H", self.type))
2961 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2962 packed.append(struct.pack("!H", self.value))
2963 length = sum([len(x) for x in packed])
2964 packed[1] = struct.pack("!H", length)
2965 return ''.join(packed)
2966
2967 @staticmethod
2968 def unpack(reader):
2969 obj = udf_anchor()
2970 _type = reader.read("!H")[0]
2971 assert(_type == 16)
2972 _length = reader.read("!H")[0]
2973 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002974 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002975 obj.value = reader.read("!H")[0]
2976 return obj
2977
2978 def __eq__(self, other):
2979 if type(self) != type(other): return False
2980 if self.value != other.value: return False
2981 return True
2982
2983 def pretty_print(self, q):
2984 q.text("udf_anchor {")
2985 with q.group():
2986 with q.indent(2):
2987 q.breakable()
2988 q.text("value = ");
2989 q.text("%#x" % self.value)
2990 q.breakable()
2991 q.text('}')
2992
2993bsn_tlv.subtypes[16] = udf_anchor
2994
2995class udf_id(bsn_tlv):
2996 type = 15
2997
2998 def __init__(self, value=None):
2999 if value != None:
3000 self.value = value
3001 else:
3002 self.value = 0
3003 return
3004
3005 def pack(self):
3006 packed = []
3007 packed.append(struct.pack("!H", self.type))
3008 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3009 packed.append(struct.pack("!H", self.value))
3010 length = sum([len(x) for x in packed])
3011 packed[1] = struct.pack("!H", length)
3012 return ''.join(packed)
3013
3014 @staticmethod
3015 def unpack(reader):
3016 obj = udf_id()
3017 _type = reader.read("!H")[0]
3018 assert(_type == 15)
3019 _length = reader.read("!H")[0]
3020 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003021 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003022 obj.value = reader.read("!H")[0]
3023 return obj
3024
3025 def __eq__(self, other):
3026 if type(self) != type(other): return False
3027 if self.value != other.value: return False
3028 return True
3029
3030 def pretty_print(self, q):
3031 q.text("udf_id {")
3032 with q.group():
3033 with q.indent(2):
3034 q.breakable()
3035 q.text("value = ");
3036 q.text("%#x" % self.value)
3037 q.breakable()
3038 q.text('}')
3039
3040bsn_tlv.subtypes[15] = udf_id
3041
3042class udf_length(bsn_tlv):
3043 type = 18
3044
3045 def __init__(self, value=None):
3046 if value != None:
3047 self.value = value
3048 else:
3049 self.value = 0
3050 return
3051
3052 def pack(self):
3053 packed = []
3054 packed.append(struct.pack("!H", self.type))
3055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3056 packed.append(struct.pack("!H", self.value))
3057 length = sum([len(x) for x in packed])
3058 packed[1] = struct.pack("!H", length)
3059 return ''.join(packed)
3060
3061 @staticmethod
3062 def unpack(reader):
3063 obj = udf_length()
3064 _type = reader.read("!H")[0]
3065 assert(_type == 18)
3066 _length = reader.read("!H")[0]
3067 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003068 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003069 obj.value = reader.read("!H")[0]
3070 return obj
3071
3072 def __eq__(self, other):
3073 if type(self) != type(other): return False
3074 if self.value != other.value: return False
3075 return True
3076
3077 def pretty_print(self, q):
3078 q.text("udf_length {")
3079 with q.group():
3080 with q.indent(2):
3081 q.breakable()
3082 q.text("value = ");
3083 q.text("%#x" % self.value)
3084 q.breakable()
3085 q.text('}')
3086
3087bsn_tlv.subtypes[18] = udf_length
3088
3089class udf_offset(bsn_tlv):
3090 type = 17
3091
3092 def __init__(self, value=None):
3093 if value != None:
3094 self.value = value
3095 else:
3096 self.value = 0
3097 return
3098
3099 def pack(self):
3100 packed = []
3101 packed.append(struct.pack("!H", self.type))
3102 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3103 packed.append(struct.pack("!H", self.value))
3104 length = sum([len(x) for x in packed])
3105 packed[1] = struct.pack("!H", length)
3106 return ''.join(packed)
3107
3108 @staticmethod
3109 def unpack(reader):
3110 obj = udf_offset()
3111 _type = reader.read("!H")[0]
3112 assert(_type == 17)
3113 _length = reader.read("!H")[0]
3114 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003115 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003116 obj.value = reader.read("!H")[0]
3117 return obj
3118
3119 def __eq__(self, other):
3120 if type(self) != type(other): return False
3121 if self.value != other.value: return False
3122 return True
3123
3124 def pretty_print(self, q):
3125 q.text("udf_offset {")
3126 with q.group():
3127 with q.indent(2):
3128 q.breakable()
3129 q.text("value = ");
3130 q.text("%#x" % self.value)
3131 q.breakable()
3132 q.text('}')
3133
3134bsn_tlv.subtypes[17] = udf_offset
3135
3136class udp_dst(bsn_tlv):
3137 type = 37
3138
3139 def __init__(self, value=None):
3140 if value != None:
3141 self.value = value
3142 else:
3143 self.value = 0
3144 return
3145
3146 def pack(self):
3147 packed = []
3148 packed.append(struct.pack("!H", self.type))
3149 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3150 packed.append(struct.pack("!H", self.value))
3151 length = sum([len(x) for x in packed])
3152 packed[1] = struct.pack("!H", length)
3153 return ''.join(packed)
3154
3155 @staticmethod
3156 def unpack(reader):
3157 obj = udp_dst()
3158 _type = reader.read("!H")[0]
3159 assert(_type == 37)
3160 _length = reader.read("!H")[0]
3161 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003162 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003163 obj.value = reader.read("!H")[0]
3164 return obj
3165
3166 def __eq__(self, other):
3167 if type(self) != type(other): return False
3168 if self.value != other.value: return False
3169 return True
3170
3171 def pretty_print(self, q):
3172 q.text("udp_dst {")
3173 with q.group():
3174 with q.indent(2):
3175 q.breakable()
3176 q.text("value = ");
3177 q.text("%#x" % self.value)
3178 q.breakable()
3179 q.text('}')
3180
3181bsn_tlv.subtypes[37] = udp_dst
3182
3183class udp_src(bsn_tlv):
3184 type = 36
3185
3186 def __init__(self, value=None):
3187 if value != None:
3188 self.value = value
3189 else:
3190 self.value = 0
3191 return
3192
3193 def pack(self):
3194 packed = []
3195 packed.append(struct.pack("!H", self.type))
3196 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3197 packed.append(struct.pack("!H", self.value))
3198 length = sum([len(x) for x in packed])
3199 packed[1] = struct.pack("!H", length)
3200 return ''.join(packed)
3201
3202 @staticmethod
3203 def unpack(reader):
3204 obj = udp_src()
3205 _type = reader.read("!H")[0]
3206 assert(_type == 36)
3207 _length = reader.read("!H")[0]
3208 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003209 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003210 obj.value = reader.read("!H")[0]
3211 return obj
3212
3213 def __eq__(self, other):
3214 if type(self) != type(other): return False
3215 if self.value != other.value: return False
3216 return True
3217
3218 def pretty_print(self, q):
3219 q.text("udp_src {")
3220 with q.group():
3221 with q.indent(2):
3222 q.breakable()
3223 q.text("value = ");
3224 q.text("%#x" % self.value)
3225 q.breakable()
3226 q.text('}')
3227
3228bsn_tlv.subtypes[36] = udp_src
3229
3230class unicast_query_timeout(bsn_tlv):
3231 type = 9
3232
3233 def __init__(self, value=None):
3234 if value != None:
3235 self.value = value
3236 else:
3237 self.value = 0
3238 return
3239
3240 def pack(self):
3241 packed = []
3242 packed.append(struct.pack("!H", self.type))
3243 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3244 packed.append(struct.pack("!L", self.value))
3245 length = sum([len(x) for x in packed])
3246 packed[1] = struct.pack("!H", length)
3247 return ''.join(packed)
3248
3249 @staticmethod
3250 def unpack(reader):
3251 obj = unicast_query_timeout()
3252 _type = reader.read("!H")[0]
3253 assert(_type == 9)
3254 _length = reader.read("!H")[0]
3255 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003256 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003257 obj.value = reader.read("!L")[0]
3258 return obj
3259
3260 def __eq__(self, other):
3261 if type(self) != type(other): return False
3262 if self.value != other.value: return False
3263 return True
3264
3265 def pretty_print(self, q):
3266 q.text("unicast_query_timeout {")
3267 with q.group():
3268 with q.indent(2):
3269 q.breakable()
3270 q.text("value = ");
3271 q.text("%#x" % self.value)
3272 q.breakable()
3273 q.text('}')
3274
3275bsn_tlv.subtypes[9] = unicast_query_timeout
3276
3277class vlan_vid(bsn_tlv):
3278 type = 6
3279
3280 def __init__(self, value=None):
3281 if value != None:
3282 self.value = value
3283 else:
3284 self.value = 0
3285 return
3286
3287 def pack(self):
3288 packed = []
3289 packed.append(struct.pack("!H", self.type))
3290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3291 packed.append(struct.pack("!H", self.value))
3292 length = sum([len(x) for x in packed])
3293 packed[1] = struct.pack("!H", length)
3294 return ''.join(packed)
3295
3296 @staticmethod
3297 def unpack(reader):
3298 obj = vlan_vid()
3299 _type = reader.read("!H")[0]
3300 assert(_type == 6)
3301 _length = reader.read("!H")[0]
3302 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003303 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003304 obj.value = reader.read("!H")[0]
3305 return obj
3306
3307 def __eq__(self, other):
3308 if type(self) != type(other): return False
3309 if self.value != other.value: return False
3310 return True
3311
3312 def pretty_print(self, q):
3313 q.text("vlan_vid {")
3314 with q.group():
3315 with q.indent(2):
3316 q.breakable()
3317 q.text("value = ");
3318 q.text("%#x" % self.value)
3319 q.breakable()
3320 q.text('}')
3321
3322bsn_tlv.subtypes[6] = vlan_vid
3323
3324class vrf(bsn_tlv):
3325 type = 19
3326
3327 def __init__(self, value=None):
3328 if value != None:
3329 self.value = value
3330 else:
3331 self.value = 0
3332 return
3333
3334 def pack(self):
3335 packed = []
3336 packed.append(struct.pack("!H", self.type))
3337 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3338 packed.append(struct.pack("!L", self.value))
3339 length = sum([len(x) for x in packed])
3340 packed[1] = struct.pack("!H", length)
3341 return ''.join(packed)
3342
3343 @staticmethod
3344 def unpack(reader):
3345 obj = vrf()
3346 _type = reader.read("!H")[0]
3347 assert(_type == 19)
3348 _length = reader.read("!H")[0]
3349 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003350 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08003351 obj.value = reader.read("!L")[0]
3352 return obj
3353
3354 def __eq__(self, other):
3355 if type(self) != type(other): return False
3356 if self.value != other.value: return False
3357 return True
3358
3359 def pretty_print(self, q):
3360 q.text("vrf {")
3361 with q.group():
3362 with q.indent(2):
3363 q.breakable()
3364 q.text("value = ");
3365 q.text("%#x" % self.value)
3366 q.breakable()
3367 q.text('}')
3368
3369bsn_tlv.subtypes[19] = vrf
3370
3371