blob: 66a4839948fd25478048c6c47acd24469978e374 [file] [log] [blame]
Rich Lane5454b682014-01-14 17:07:36 -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
Rich Lane5454b682014-01-14 17:07:36 -080011import util
12import loxi.generic_util
13
Rich Lanee2567702015-01-26 15:04:35 -080014import sys
15ofp = sys.modules['loxi.of13']
16
Rich Lane5454b682014-01-14 17:07:36 -080017class bsn_tlv(loxi.OFObject):
18 subtypes = {}
19
Rich Lane95f7fc92014-01-27 17:08:16 -080020
21 def __init__(self, type=None):
22 if type != None:
23 self.type = type
24 else:
25 self.type = 0
26 return
27
28 def pack(self):
29 packed = []
30 packed.append(struct.pack("!H", self.type))
31 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
32 length = sum([len(x) for x in packed])
33 packed[1] = struct.pack("!H", length)
34 return ''.join(packed)
35
Rich Lane5454b682014-01-14 17:07:36 -080036 @staticmethod
37 def unpack(reader):
38 subtype, = reader.peek('!H', 0)
Rich Lane95f7fc92014-01-27 17:08:16 -080039 subclass = bsn_tlv.subtypes.get(subtype)
40 if subclass:
41 return subclass.unpack(reader)
Rich Lane5454b682014-01-14 17:07:36 -080042
Rich Lane95f7fc92014-01-27 17:08:16 -080043 obj = bsn_tlv()
44 obj.type = reader.read("!H")[0]
45 _length = reader.read("!H")[0]
46 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080047 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -080048 return obj
49
50 def __eq__(self, other):
51 if type(self) != type(other): return False
52 if self.type != other.type: return False
53 return True
54
55 def pretty_print(self, q):
56 q.text("bsn_tlv {")
57 with q.group():
58 with q.indent(2):
59 q.breakable()
60 q.breakable()
61 q.text('}')
62
63
Harshmeet Singh1db46332014-10-14 16:29:13 -070064class actor_key(bsn_tlv):
65 type = 44
66
67 def __init__(self, value=None):
68 if value != None:
69 self.value = value
70 else:
71 self.value = 0
72 return
73
74 def pack(self):
75 packed = []
76 packed.append(struct.pack("!H", self.type))
77 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
78 packed.append(struct.pack("!H", self.value))
79 length = sum([len(x) for x in packed])
80 packed[1] = struct.pack("!H", length)
81 return ''.join(packed)
82
83 @staticmethod
84 def unpack(reader):
85 obj = actor_key()
86 _type = reader.read("!H")[0]
87 assert(_type == 44)
88 _length = reader.read("!H")[0]
89 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -080090 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -070091 obj.value = reader.read("!H")[0]
92 return obj
93
94 def __eq__(self, other):
95 if type(self) != type(other): return False
96 if self.value != other.value: return False
97 return True
98
99 def pretty_print(self, q):
100 q.text("actor_key {")
101 with q.group():
102 with q.indent(2):
103 q.breakable()
104 q.text("value = ");
105 q.text("%#x" % self.value)
106 q.breakable()
107 q.text('}')
108
109bsn_tlv.subtypes[44] = actor_key
110
111class actor_port_num(bsn_tlv):
112 type = 43
113
114 def __init__(self, value=None):
115 if value != None:
116 self.value = value
117 else:
118 self.value = 0
119 return
120
121 def pack(self):
122 packed = []
123 packed.append(struct.pack("!H", self.type))
124 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
125 packed.append(struct.pack("!H", self.value))
126 length = sum([len(x) for x in packed])
127 packed[1] = struct.pack("!H", length)
128 return ''.join(packed)
129
130 @staticmethod
131 def unpack(reader):
132 obj = actor_port_num()
133 _type = reader.read("!H")[0]
134 assert(_type == 43)
135 _length = reader.read("!H")[0]
136 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800137 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700138 obj.value = reader.read("!H")[0]
139 return obj
140
141 def __eq__(self, other):
142 if type(self) != type(other): return False
143 if self.value != other.value: return False
144 return True
145
146 def pretty_print(self, q):
147 q.text("actor_port_num {")
148 with q.group():
149 with q.indent(2):
150 q.breakable()
151 q.text("value = ");
152 q.text("%#x" % self.value)
153 q.breakable()
154 q.text('}')
155
156bsn_tlv.subtypes[43] = actor_port_num
157
158class actor_port_priority(bsn_tlv):
159 type = 42
160
161 def __init__(self, value=None):
162 if value != None:
163 self.value = value
164 else:
165 self.value = 0
166 return
167
168 def pack(self):
169 packed = []
170 packed.append(struct.pack("!H", self.type))
171 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
172 packed.append(struct.pack("!H", self.value))
173 length = sum([len(x) for x in packed])
174 packed[1] = struct.pack("!H", length)
175 return ''.join(packed)
176
177 @staticmethod
178 def unpack(reader):
179 obj = actor_port_priority()
180 _type = reader.read("!H")[0]
181 assert(_type == 42)
182 _length = reader.read("!H")[0]
183 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800184 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700185 obj.value = reader.read("!H")[0]
186 return obj
187
188 def __eq__(self, other):
189 if type(self) != type(other): return False
190 if self.value != other.value: return False
191 return True
192
193 def pretty_print(self, q):
194 q.text("actor_port_priority {")
195 with q.group():
196 with q.indent(2):
197 q.breakable()
198 q.text("value = ");
199 q.text("%#x" % self.value)
200 q.breakable()
201 q.text('}')
202
203bsn_tlv.subtypes[42] = actor_port_priority
204
Rich Lane2e079da2014-10-29 15:30:24 -0700205class actor_state(bsn_tlv):
206 type = 53
207
208 def __init__(self, value=None):
209 if value != None:
210 self.value = value
211 else:
212 self.value = 0
213 return
214
215 def pack(self):
216 packed = []
217 packed.append(struct.pack("!H", self.type))
218 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
219 packed.append(struct.pack("!B", self.value))
220 length = sum([len(x) for x in packed])
221 packed[1] = struct.pack("!H", length)
222 return ''.join(packed)
223
224 @staticmethod
225 def unpack(reader):
226 obj = actor_state()
227 _type = reader.read("!H")[0]
228 assert(_type == 53)
229 _length = reader.read("!H")[0]
230 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800231 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -0700232 obj.value = reader.read("!B")[0]
233 return obj
234
235 def __eq__(self, other):
236 if type(self) != type(other): return False
237 if self.value != other.value: return False
238 return True
239
240 def pretty_print(self, q):
241 q.text("actor_state {")
242 with q.group():
243 with q.indent(2):
244 q.breakable()
245 q.text("value = ");
246 q.text("%#x" % self.value)
247 q.breakable()
248 q.text('}')
249
250bsn_tlv.subtypes[53] = actor_state
251
Harshmeet Singh1db46332014-10-14 16:29:13 -0700252class actor_system_mac(bsn_tlv):
253 type = 41
254
255 def __init__(self, value=None):
256 if value != None:
257 self.value = value
258 else:
259 self.value = [0,0,0,0,0,0]
260 return
261
262 def pack(self):
263 packed = []
264 packed.append(struct.pack("!H", self.type))
265 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
266 packed.append(struct.pack("!6B", *self.value))
267 length = sum([len(x) for x in packed])
268 packed[1] = struct.pack("!H", length)
269 return ''.join(packed)
270
271 @staticmethod
272 def unpack(reader):
273 obj = actor_system_mac()
274 _type = reader.read("!H")[0]
275 assert(_type == 41)
276 _length = reader.read("!H")[0]
277 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800278 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700279 obj.value = list(reader.read('!6B'))
280 return obj
281
282 def __eq__(self, other):
283 if type(self) != type(other): return False
284 if self.value != other.value: return False
285 return True
286
287 def pretty_print(self, q):
288 q.text("actor_system_mac {")
289 with q.group():
290 with q.indent(2):
291 q.breakable()
292 q.text("value = ");
293 q.text(util.pretty_mac(self.value))
294 q.breakable()
295 q.text('}')
296
297bsn_tlv.subtypes[41] = actor_system_mac
298
299class actor_system_priority(bsn_tlv):
300 type = 40
301
302 def __init__(self, value=None):
303 if value != None:
304 self.value = value
305 else:
306 self.value = 0
307 return
308
309 def pack(self):
310 packed = []
311 packed.append(struct.pack("!H", self.type))
312 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
313 packed.append(struct.pack("!H", self.value))
314 length = sum([len(x) for x in packed])
315 packed[1] = struct.pack("!H", length)
316 return ''.join(packed)
317
318 @staticmethod
319 def unpack(reader):
320 obj = actor_system_priority()
321 _type = reader.read("!H")[0]
322 assert(_type == 40)
323 _length = reader.read("!H")[0]
324 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800325 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700326 obj.value = reader.read("!H")[0]
327 return obj
328
329 def __eq__(self, other):
330 if type(self) != type(other): return False
331 if self.value != other.value: return False
332 return True
333
334 def pretty_print(self, q):
335 q.text("actor_system_priority {")
336 with q.group():
337 with q.indent(2):
338 q.breakable()
339 q.text("value = ");
340 q.text("%#x" % self.value)
341 q.breakable()
342 q.text('}')
343
344bsn_tlv.subtypes[40] = actor_system_priority
345
Rich Lane95f7fc92014-01-27 17:08:16 -0800346class broadcast_query_timeout(bsn_tlv):
347 type = 10
348
349 def __init__(self, value=None):
350 if value != None:
351 self.value = value
352 else:
353 self.value = 0
354 return
355
356 def pack(self):
357 packed = []
358 packed.append(struct.pack("!H", self.type))
359 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
360 packed.append(struct.pack("!L", self.value))
361 length = sum([len(x) for x in packed])
362 packed[1] = struct.pack("!H", length)
363 return ''.join(packed)
364
365 @staticmethod
366 def unpack(reader):
367 obj = broadcast_query_timeout()
368 _type = reader.read("!H")[0]
369 assert(_type == 10)
370 _length = reader.read("!H")[0]
371 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800372 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -0800373 obj.value = reader.read("!L")[0]
374 return obj
375
376 def __eq__(self, other):
377 if type(self) != type(other): return False
378 if self.value != other.value: return False
379 return True
380
381 def pretty_print(self, q):
382 q.text("broadcast_query_timeout {")
383 with q.group():
384 with q.indent(2):
385 q.breakable()
386 q.text("value = ");
387 q.text("%#x" % self.value)
388 q.breakable()
389 q.text('}')
390
391bsn_tlv.subtypes[10] = broadcast_query_timeout
Rich Lane5454b682014-01-14 17:07:36 -0800392
Rich Lanecb18dbd2014-12-18 10:02:29 -0800393class bucket(bsn_tlv):
394 type = 64
395
396 def __init__(self, value=None):
397 if value != None:
398 self.value = value
399 else:
400 self.value = []
401 return
402
403 def pack(self):
404 packed = []
405 packed.append(struct.pack("!H", self.type))
406 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
407 packed.append(loxi.generic_util.pack_list(self.value))
408 length = sum([len(x) for x in packed])
409 packed[1] = struct.pack("!H", length)
410 return ''.join(packed)
411
412 @staticmethod
413 def unpack(reader):
414 obj = bucket()
415 _type = reader.read("!H")[0]
416 assert(_type == 64)
417 _length = reader.read("!H")[0]
418 orig_reader = reader
419 reader = orig_reader.slice(_length, 4)
Rich Lanee2567702015-01-26 15:04:35 -0800420 obj.value = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Rich Lanecb18dbd2014-12-18 10:02:29 -0800421 return obj
422
423 def __eq__(self, other):
424 if type(self) != type(other): return False
425 if self.value != other.value: return False
426 return True
427
428 def pretty_print(self, q):
429 q.text("bucket {")
430 with q.group():
431 with q.indent(2):
432 q.breakable()
433 q.text("value = ");
434 q.pp(self.value)
435 q.breakable()
436 q.text('}')
437
438bsn_tlv.subtypes[64] = bucket
439
Rich Lane1b75abf2014-02-05 11:23:20 -0800440class circuit_id(bsn_tlv):
441 type = 14
442
443 def __init__(self, value=None):
444 if value != None:
445 self.value = value
446 else:
447 self.value = ''
448 return
449
450 def pack(self):
451 packed = []
452 packed.append(struct.pack("!H", self.type))
453 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
454 packed.append(self.value)
455 length = sum([len(x) for x in packed])
456 packed[1] = struct.pack("!H", length)
457 return ''.join(packed)
458
459 @staticmethod
460 def unpack(reader):
461 obj = circuit_id()
462 _type = reader.read("!H")[0]
463 assert(_type == 14)
464 _length = reader.read("!H")[0]
465 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800466 reader = orig_reader.slice(_length, 4)
Rich Lane1b75abf2014-02-05 11:23:20 -0800467 obj.value = str(reader.read_all())
468 return obj
469
470 def __eq__(self, other):
471 if type(self) != type(other): return False
472 if self.value != other.value: return False
473 return True
474
475 def pretty_print(self, q):
476 q.text("circuit_id {")
477 with q.group():
478 with q.indent(2):
479 q.breakable()
480 q.text("value = ");
481 q.pp(self.value)
482 q.breakable()
483 q.text('}')
484
485bsn_tlv.subtypes[14] = circuit_id
486
Harshmeet Singh1db46332014-10-14 16:29:13 -0700487class convergence_status(bsn_tlv):
488 type = 45
489
490 def __init__(self, value=None):
491 if value != None:
492 self.value = value
493 else:
494 self.value = 0
495 return
496
497 def pack(self):
498 packed = []
499 packed.append(struct.pack("!H", self.type))
500 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
501 packed.append(struct.pack("!B", self.value))
502 length = sum([len(x) for x in packed])
503 packed[1] = struct.pack("!H", length)
504 return ''.join(packed)
505
506 @staticmethod
507 def unpack(reader):
508 obj = convergence_status()
509 _type = reader.read("!H")[0]
510 assert(_type == 45)
511 _length = reader.read("!H")[0]
512 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800513 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700514 obj.value = reader.read("!B")[0]
515 return obj
516
517 def __eq__(self, other):
518 if type(self) != type(other): return False
519 if self.value != other.value: return False
520 return True
521
522 def pretty_print(self, q):
523 q.text("convergence_status {")
524 with q.group():
525 with q.indent(2):
526 q.breakable()
527 q.text("value = ");
528 q.text("%#x" % self.value)
529 q.breakable()
530 q.text('}')
531
532bsn_tlv.subtypes[45] = convergence_status
533
Rich Lane5587ab12014-06-30 11:19:09 -0700534class crc_enabled(bsn_tlv):
535 type = 22
536
537 def __init__(self, value=None):
538 if value != None:
539 self.value = value
540 else:
541 self.value = 0
542 return
543
544 def pack(self):
545 packed = []
546 packed.append(struct.pack("!H", self.type))
547 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
548 packed.append(struct.pack("!B", self.value))
549 length = sum([len(x) for x in packed])
550 packed[1] = struct.pack("!H", length)
551 return ''.join(packed)
552
553 @staticmethod
554 def unpack(reader):
555 obj = crc_enabled()
556 _type = reader.read("!H")[0]
557 assert(_type == 22)
558 _length = reader.read("!H")[0]
559 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800560 reader = orig_reader.slice(_length, 4)
Rich Lane5587ab12014-06-30 11:19:09 -0700561 obj.value = reader.read("!B")[0]
562 return obj
563
564 def __eq__(self, other):
565 if type(self) != type(other): return False
566 if self.value != other.value: return False
567 return True
568
569 def pretty_print(self, q):
570 q.text("crc_enabled {")
571 with q.group():
572 with q.indent(2):
573 q.breakable()
574 q.text("value = ");
575 q.text("%#x" % self.value)
576 q.breakable()
577 q.text('}')
578
579bsn_tlv.subtypes[22] = crc_enabled
580
Rich Laneccd32ed2014-11-10 17:48:24 -0800581class data(bsn_tlv):
582 type = 55
583
584 def __init__(self, value=None):
585 if value != None:
586 self.value = value
587 else:
588 self.value = ''
589 return
590
591 def pack(self):
592 packed = []
593 packed.append(struct.pack("!H", self.type))
594 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
595 packed.append(self.value)
596 length = sum([len(x) for x in packed])
597 packed[1] = struct.pack("!H", length)
598 return ''.join(packed)
599
600 @staticmethod
601 def unpack(reader):
602 obj = data()
603 _type = reader.read("!H")[0]
604 assert(_type == 55)
605 _length = reader.read("!H")[0]
606 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800607 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -0800608 obj.value = str(reader.read_all())
609 return obj
610
611 def __eq__(self, other):
612 if type(self) != type(other): return False
613 if self.value != other.value: return False
614 return True
615
616 def pretty_print(self, q):
617 q.text("data {")
618 with q.group():
619 with q.indent(2):
620 q.breakable()
621 q.text("value = ");
622 q.pp(self.value)
623 q.breakable()
624 q.text('}')
625
626bsn_tlv.subtypes[55] = data
627
Harshmeet Singh1db46332014-10-14 16:29:13 -0700628class eth_dst(bsn_tlv):
629 type = 33
630
631 def __init__(self, value=None):
632 if value != None:
633 self.value = value
634 else:
635 self.value = [0,0,0,0,0,0]
636 return
637
638 def pack(self):
639 packed = []
640 packed.append(struct.pack("!H", self.type))
641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
642 packed.append(struct.pack("!6B", *self.value))
643 length = sum([len(x) for x in packed])
644 packed[1] = struct.pack("!H", length)
645 return ''.join(packed)
646
647 @staticmethod
648 def unpack(reader):
649 obj = eth_dst()
650 _type = reader.read("!H")[0]
651 assert(_type == 33)
652 _length = reader.read("!H")[0]
653 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800654 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700655 obj.value = list(reader.read('!6B'))
656 return obj
657
658 def __eq__(self, other):
659 if type(self) != type(other): return False
660 if self.value != other.value: return False
661 return True
662
663 def pretty_print(self, q):
664 q.text("eth_dst {")
665 with q.group():
666 with q.indent(2):
667 q.breakable()
668 q.text("value = ");
669 q.text(util.pretty_mac(self.value))
670 q.breakable()
671 q.text('}')
672
673bsn_tlv.subtypes[33] = eth_dst
674
675class eth_src(bsn_tlv):
676 type = 32
677
678 def __init__(self, value=None):
679 if value != None:
680 self.value = value
681 else:
682 self.value = [0,0,0,0,0,0]
683 return
684
685 def pack(self):
686 packed = []
687 packed.append(struct.pack("!H", self.type))
688 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
689 packed.append(struct.pack("!6B", *self.value))
690 length = sum([len(x) for x in packed])
691 packed[1] = struct.pack("!H", length)
692 return ''.join(packed)
693
694 @staticmethod
695 def unpack(reader):
696 obj = eth_src()
697 _type = reader.read("!H")[0]
698 assert(_type == 32)
699 _length = reader.read("!H")[0]
700 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800701 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700702 obj.value = list(reader.read('!6B'))
703 return obj
704
705 def __eq__(self, other):
706 if type(self) != type(other): return False
707 if self.value != other.value: return False
708 return True
709
710 def pretty_print(self, q):
711 q.text("eth_src {")
712 with q.group():
713 with q.indent(2):
714 q.breakable()
715 q.text("value = ");
716 q.text(util.pretty_mac(self.value))
717 q.breakable()
718 q.text('}')
719
720bsn_tlv.subtypes[32] = eth_src
721
Rich Lanecc80d422014-09-24 14:54:09 -0700722class external_gateway_ip(bsn_tlv):
723 type = 26
724
725 def __init__(self, value=None):
726 if value != None:
727 self.value = value
728 else:
729 self.value = 0
730 return
731
732 def pack(self):
733 packed = []
734 packed.append(struct.pack("!H", self.type))
735 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
736 packed.append(struct.pack("!L", self.value))
737 length = sum([len(x) for x in packed])
738 packed[1] = struct.pack("!H", length)
739 return ''.join(packed)
740
741 @staticmethod
742 def unpack(reader):
743 obj = external_gateway_ip()
744 _type = reader.read("!H")[0]
745 assert(_type == 26)
746 _length = reader.read("!H")[0]
747 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800748 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -0700749 obj.value = reader.read("!L")[0]
750 return obj
751
752 def __eq__(self, other):
753 if type(self) != type(other): return False
754 if self.value != other.value: return False
755 return True
756
757 def pretty_print(self, q):
758 q.text("external_gateway_ip {")
759 with q.group():
760 with q.indent(2):
761 q.breakable()
762 q.text("value = ");
763 q.text(util.pretty_ipv4(self.value))
764 q.breakable()
765 q.text('}')
766
767bsn_tlv.subtypes[26] = external_gateway_ip
768
Rich Lane18ec5352014-10-02 09:09:17 -0700769class external_gateway_mac(bsn_tlv):
770 type = 29
771
772 def __init__(self, value=None):
773 if value != None:
774 self.value = value
775 else:
776 self.value = [0,0,0,0,0,0]
777 return
778
779 def pack(self):
780 packed = []
781 packed.append(struct.pack("!H", self.type))
782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
783 packed.append(struct.pack("!6B", *self.value))
784 length = sum([len(x) for x in packed])
785 packed[1] = struct.pack("!H", length)
786 return ''.join(packed)
787
788 @staticmethod
789 def unpack(reader):
790 obj = external_gateway_mac()
791 _type = reader.read("!H")[0]
792 assert(_type == 29)
793 _length = reader.read("!H")[0]
794 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800795 reader = orig_reader.slice(_length, 4)
Rich Lane18ec5352014-10-02 09:09:17 -0700796 obj.value = list(reader.read('!6B'))
797 return obj
798
799 def __eq__(self, other):
800 if type(self) != type(other): return False
801 if self.value != other.value: return False
802 return True
803
804 def pretty_print(self, q):
805 q.text("external_gateway_mac {")
806 with q.group():
807 with q.indent(2):
808 q.breakable()
809 q.text("value = ");
810 q.text(util.pretty_mac(self.value))
811 q.breakable()
812 q.text('}')
813
814bsn_tlv.subtypes[29] = external_gateway_mac
815
Rich Lanecc80d422014-09-24 14:54:09 -0700816class external_ip(bsn_tlv):
817 type = 23
818
819 def __init__(self, value=None):
820 if value != None:
821 self.value = value
822 else:
823 self.value = 0
824 return
825
826 def pack(self):
827 packed = []
828 packed.append(struct.pack("!H", self.type))
829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
830 packed.append(struct.pack("!L", self.value))
831 length = sum([len(x) for x in packed])
832 packed[1] = struct.pack("!H", length)
833 return ''.join(packed)
834
835 @staticmethod
836 def unpack(reader):
837 obj = external_ip()
838 _type = reader.read("!H")[0]
839 assert(_type == 23)
840 _length = reader.read("!H")[0]
841 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800842 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -0700843 obj.value = reader.read("!L")[0]
844 return obj
845
846 def __eq__(self, other):
847 if type(self) != type(other): return False
848 if self.value != other.value: return False
849 return True
850
851 def pretty_print(self, q):
852 q.text("external_ip {")
853 with q.group():
854 with q.indent(2):
855 q.breakable()
856 q.text("value = ");
857 q.text(util.pretty_ipv4(self.value))
858 q.breakable()
859 q.text('}')
860
861bsn_tlv.subtypes[23] = external_ip
862
863class external_mac(bsn_tlv):
864 type = 24
865
866 def __init__(self, value=None):
867 if value != None:
868 self.value = value
869 else:
870 self.value = [0,0,0,0,0,0]
871 return
872
873 def pack(self):
874 packed = []
875 packed.append(struct.pack("!H", self.type))
876 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
877 packed.append(struct.pack("!6B", *self.value))
878 length = sum([len(x) for x in packed])
879 packed[1] = struct.pack("!H", length)
880 return ''.join(packed)
881
882 @staticmethod
883 def unpack(reader):
884 obj = external_mac()
885 _type = reader.read("!H")[0]
886 assert(_type == 24)
887 _length = reader.read("!H")[0]
888 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800889 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -0700890 obj.value = list(reader.read('!6B'))
891 return obj
892
893 def __eq__(self, other):
894 if type(self) != type(other): return False
895 if self.value != other.value: return False
896 return True
897
898 def pretty_print(self, q):
899 q.text("external_mac {")
900 with q.group():
901 with q.indent(2):
902 q.breakable()
903 q.text("value = ");
904 q.text(util.pretty_mac(self.value))
905 q.breakable()
906 q.text('}')
907
908bsn_tlv.subtypes[24] = external_mac
909
910class external_netmask(bsn_tlv):
911 type = 25
912
913 def __init__(self, value=None):
914 if value != None:
915 self.value = value
916 else:
917 self.value = 0
918 return
919
920 def pack(self):
921 packed = []
922 packed.append(struct.pack("!H", self.type))
923 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
924 packed.append(struct.pack("!L", self.value))
925 length = sum([len(x) for x in packed])
926 packed[1] = struct.pack("!H", length)
927 return ''.join(packed)
928
929 @staticmethod
930 def unpack(reader):
931 obj = external_netmask()
932 _type = reader.read("!H")[0]
933 assert(_type == 25)
934 _length = reader.read("!H")[0]
935 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800936 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -0700937 obj.value = reader.read("!L")[0]
938 return obj
939
940 def __eq__(self, other):
941 if type(self) != type(other): return False
942 if self.value != other.value: return False
943 return True
944
945 def pretty_print(self, q):
946 q.text("external_netmask {")
947 with q.group():
948 with q.indent(2):
949 q.breakable()
950 q.text("value = ");
951 q.text(util.pretty_ipv4(self.value))
952 q.breakable()
953 q.text('}')
954
955bsn_tlv.subtypes[25] = external_netmask
956
Harshmeet Singh1db46332014-10-14 16:29:13 -0700957class header_size(bsn_tlv):
958 type = 31
959
960 def __init__(self, value=None):
961 if value != None:
962 self.value = value
963 else:
964 self.value = 0
965 return
966
967 def pack(self):
968 packed = []
969 packed.append(struct.pack("!H", self.type))
970 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
971 packed.append(struct.pack("!L", self.value))
972 length = sum([len(x) for x in packed])
973 packed[1] = struct.pack("!H", length)
974 return ''.join(packed)
975
976 @staticmethod
977 def unpack(reader):
978 obj = header_size()
979 _type = reader.read("!H")[0]
980 assert(_type == 31)
981 _length = reader.read("!H")[0]
982 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -0800983 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -0700984 obj.value = reader.read("!L")[0]
985 return obj
986
987 def __eq__(self, other):
988 if type(self) != type(other): return False
989 if self.value != other.value: return False
990 return True
991
992 def pretty_print(self, q):
993 q.text("header_size {")
994 with q.group():
995 with q.indent(2):
996 q.breakable()
997 q.text("value = ");
998 q.text("%#x" % self.value)
999 q.breakable()
1000 q.text('}')
1001
1002bsn_tlv.subtypes[31] = header_size
1003
Rich Lane474324f2015-01-14 15:22:56 -08001004class icmp_code(bsn_tlv):
1005 type = 69
1006
1007 def __init__(self, value=None):
1008 if value != None:
1009 self.value = value
1010 else:
1011 self.value = 0
1012 return
1013
1014 def pack(self):
1015 packed = []
1016 packed.append(struct.pack("!H", self.type))
1017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1018 packed.append(struct.pack("!B", self.value))
1019 length = sum([len(x) for x in packed])
1020 packed[1] = struct.pack("!H", length)
1021 return ''.join(packed)
1022
1023 @staticmethod
1024 def unpack(reader):
1025 obj = icmp_code()
1026 _type = reader.read("!H")[0]
1027 assert(_type == 69)
1028 _length = reader.read("!H")[0]
1029 orig_reader = reader
1030 reader = orig_reader.slice(_length, 4)
1031 obj.value = reader.read("!B")[0]
1032 return obj
1033
1034 def __eq__(self, other):
1035 if type(self) != type(other): return False
1036 if self.value != other.value: return False
1037 return True
1038
1039 def pretty_print(self, q):
1040 q.text("icmp_code {")
1041 with q.group():
1042 with q.indent(2):
1043 q.breakable()
1044 q.text("value = ");
1045 q.text("%#x" % self.value)
1046 q.breakable()
1047 q.text('}')
1048
1049bsn_tlv.subtypes[69] = icmp_code
1050
1051class icmp_id(bsn_tlv):
1052 type = 70
1053
1054 def __init__(self, value=None):
1055 if value != None:
1056 self.value = value
1057 else:
1058 self.value = 0
1059 return
1060
1061 def pack(self):
1062 packed = []
1063 packed.append(struct.pack("!H", self.type))
1064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1065 packed.append(struct.pack("!H", self.value))
1066 length = sum([len(x) for x in packed])
1067 packed[1] = struct.pack("!H", length)
1068 return ''.join(packed)
1069
1070 @staticmethod
1071 def unpack(reader):
1072 obj = icmp_id()
1073 _type = reader.read("!H")[0]
1074 assert(_type == 70)
1075 _length = reader.read("!H")[0]
1076 orig_reader = reader
1077 reader = orig_reader.slice(_length, 4)
1078 obj.value = reader.read("!H")[0]
1079 return obj
1080
1081 def __eq__(self, other):
1082 if type(self) != type(other): return False
1083 if self.value != other.value: return False
1084 return True
1085
1086 def pretty_print(self, q):
1087 q.text("icmp_id {")
1088 with q.group():
1089 with q.indent(2):
1090 q.breakable()
1091 q.text("value = ");
1092 q.text("%#x" % self.value)
1093 q.breakable()
1094 q.text('}')
1095
1096bsn_tlv.subtypes[70] = icmp_id
1097
1098class icmp_type(bsn_tlv):
1099 type = 68
1100
1101 def __init__(self, value=None):
1102 if value != None:
1103 self.value = value
1104 else:
1105 self.value = 0
1106 return
1107
1108 def pack(self):
1109 packed = []
1110 packed.append(struct.pack("!H", self.type))
1111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1112 packed.append(struct.pack("!B", self.value))
1113 length = sum([len(x) for x in packed])
1114 packed[1] = struct.pack("!H", length)
1115 return ''.join(packed)
1116
1117 @staticmethod
1118 def unpack(reader):
1119 obj = icmp_type()
1120 _type = reader.read("!H")[0]
1121 assert(_type == 68)
1122 _length = reader.read("!H")[0]
1123 orig_reader = reader
1124 reader = orig_reader.slice(_length, 4)
1125 obj.value = reader.read("!B")[0]
1126 return obj
1127
1128 def __eq__(self, other):
1129 if type(self) != type(other): return False
1130 if self.value != other.value: return False
1131 return True
1132
1133 def pretty_print(self, q):
1134 q.text("icmp_type {")
1135 with q.group():
1136 with q.indent(2):
1137 q.breakable()
1138 q.text("value = ");
1139 q.text("%#x" % self.value)
1140 q.breakable()
1141 q.text('}')
1142
1143bsn_tlv.subtypes[68] = icmp_type
1144
Rich Lane5454b682014-01-14 17:07:36 -08001145class idle_notification(bsn_tlv):
1146 type = 7
1147
1148 def __init__(self):
1149 return
1150
1151 def pack(self):
1152 packed = []
1153 packed.append(struct.pack("!H", self.type))
1154 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1155 length = sum([len(x) for x in packed])
1156 packed[1] = struct.pack("!H", length)
1157 return ''.join(packed)
1158
1159 @staticmethod
1160 def unpack(reader):
1161 obj = idle_notification()
1162 _type = reader.read("!H")[0]
1163 assert(_type == 7)
1164 _length = reader.read("!H")[0]
1165 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001166 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08001167 return obj
1168
1169 def __eq__(self, other):
1170 if type(self) != type(other): return False
1171 return True
1172
1173 def pretty_print(self, q):
1174 q.text("idle_notification {")
1175 with q.group():
1176 with q.indent(2):
1177 q.breakable()
1178 q.breakable()
1179 q.text('}')
1180
1181bsn_tlv.subtypes[7] = idle_notification
1182
1183class idle_time(bsn_tlv):
1184 type = 5
1185
1186 def __init__(self, value=None):
1187 if value != None:
1188 self.value = value
1189 else:
1190 self.value = 0
1191 return
1192
1193 def pack(self):
1194 packed = []
1195 packed.append(struct.pack("!H", self.type))
1196 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1197 packed.append(struct.pack("!Q", self.value))
1198 length = sum([len(x) for x in packed])
1199 packed[1] = struct.pack("!H", length)
1200 return ''.join(packed)
1201
1202 @staticmethod
1203 def unpack(reader):
1204 obj = idle_time()
1205 _type = reader.read("!H")[0]
1206 assert(_type == 5)
1207 _length = reader.read("!H")[0]
1208 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001209 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08001210 obj.value = reader.read("!Q")[0]
1211 return obj
1212
1213 def __eq__(self, other):
1214 if type(self) != type(other): return False
1215 if self.value != other.value: return False
1216 return True
1217
1218 def pretty_print(self, q):
1219 q.text("idle_time {")
1220 with q.group():
1221 with q.indent(2):
1222 q.breakable()
1223 q.text("value = ");
1224 q.text("%#x" % self.value)
1225 q.breakable()
1226 q.text('}')
1227
1228bsn_tlv.subtypes[5] = idle_time
1229
Rich Lane95f7fc92014-01-27 17:08:16 -08001230class idle_timeout(bsn_tlv):
1231 type = 8
1232
1233 def __init__(self, value=None):
1234 if value != None:
1235 self.value = value
1236 else:
1237 self.value = 0
1238 return
1239
1240 def pack(self):
1241 packed = []
1242 packed.append(struct.pack("!H", self.type))
1243 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1244 packed.append(struct.pack("!L", self.value))
1245 length = sum([len(x) for x in packed])
1246 packed[1] = struct.pack("!H", length)
1247 return ''.join(packed)
1248
1249 @staticmethod
1250 def unpack(reader):
1251 obj = idle_timeout()
1252 _type = reader.read("!H")[0]
1253 assert(_type == 8)
1254 _length = reader.read("!H")[0]
1255 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001256 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001257 obj.value = reader.read("!L")[0]
1258 return obj
1259
1260 def __eq__(self, other):
1261 if type(self) != type(other): return False
1262 if self.value != other.value: return False
1263 return True
1264
1265 def pretty_print(self, q):
1266 q.text("idle_timeout {")
1267 with q.group():
1268 with q.indent(2):
1269 q.breakable()
1270 q.text("value = ");
1271 q.text("%#x" % self.value)
1272 q.breakable()
1273 q.text('}')
1274
1275bsn_tlv.subtypes[8] = idle_timeout
1276
Rich Lanecc80d422014-09-24 14:54:09 -07001277class internal_gateway_mac(bsn_tlv):
1278 type = 28
1279
1280 def __init__(self, value=None):
1281 if value != None:
1282 self.value = value
1283 else:
1284 self.value = [0,0,0,0,0,0]
1285 return
1286
1287 def pack(self):
1288 packed = []
1289 packed.append(struct.pack("!H", self.type))
1290 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1291 packed.append(struct.pack("!6B", *self.value))
1292 length = sum([len(x) for x in packed])
1293 packed[1] = struct.pack("!H", length)
1294 return ''.join(packed)
1295
1296 @staticmethod
1297 def unpack(reader):
1298 obj = internal_gateway_mac()
1299 _type = reader.read("!H")[0]
1300 assert(_type == 28)
1301 _length = reader.read("!H")[0]
1302 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001303 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -07001304 obj.value = list(reader.read('!6B'))
1305 return obj
1306
1307 def __eq__(self, other):
1308 if type(self) != type(other): return False
1309 if self.value != other.value: return False
1310 return True
1311
1312 def pretty_print(self, q):
1313 q.text("internal_gateway_mac {")
1314 with q.group():
1315 with q.indent(2):
1316 q.breakable()
1317 q.text("value = ");
1318 q.text(util.pretty_mac(self.value))
1319 q.breakable()
1320 q.text('}')
1321
1322bsn_tlv.subtypes[28] = internal_gateway_mac
1323
1324class internal_mac(bsn_tlv):
1325 type = 27
1326
1327 def __init__(self, value=None):
1328 if value != None:
1329 self.value = value
1330 else:
1331 self.value = [0,0,0,0,0,0]
1332 return
1333
1334 def pack(self):
1335 packed = []
1336 packed.append(struct.pack("!H", self.type))
1337 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1338 packed.append(struct.pack("!6B", *self.value))
1339 length = sum([len(x) for x in packed])
1340 packed[1] = struct.pack("!H", length)
1341 return ''.join(packed)
1342
1343 @staticmethod
1344 def unpack(reader):
1345 obj = internal_mac()
1346 _type = reader.read("!H")[0]
1347 assert(_type == 27)
1348 _length = reader.read("!H")[0]
1349 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001350 reader = orig_reader.slice(_length, 4)
Rich Lanecc80d422014-09-24 14:54:09 -07001351 obj.value = list(reader.read('!6B'))
1352 return obj
1353
1354 def __eq__(self, other):
1355 if type(self) != type(other): return False
1356 if self.value != other.value: return False
1357 return True
1358
1359 def pretty_print(self, q):
1360 q.text("internal_mac {")
1361 with q.group():
1362 with q.indent(2):
1363 q.breakable()
1364 q.text("value = ");
1365 q.text(util.pretty_mac(self.value))
1366 q.breakable()
1367 q.text('}')
1368
1369bsn_tlv.subtypes[27] = internal_mac
1370
Harshmeet Singh301f7172014-12-08 13:07:29 -08001371class interval(bsn_tlv):
1372 type = 58
1373
1374 def __init__(self, value=None):
1375 if value != None:
1376 self.value = value
1377 else:
1378 self.value = 0
1379 return
1380
1381 def pack(self):
1382 packed = []
1383 packed.append(struct.pack("!H", self.type))
1384 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1385 packed.append(struct.pack("!L", self.value))
1386 length = sum([len(x) for x in packed])
1387 packed[1] = struct.pack("!H", length)
1388 return ''.join(packed)
1389
1390 @staticmethod
1391 def unpack(reader):
1392 obj = interval()
1393 _type = reader.read("!H")[0]
1394 assert(_type == 58)
1395 _length = reader.read("!H")[0]
1396 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001397 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08001398 obj.value = reader.read("!L")[0]
1399 return obj
1400
1401 def __eq__(self, other):
1402 if type(self) != type(other): return False
1403 if self.value != other.value: return False
1404 return True
1405
1406 def pretty_print(self, q):
1407 q.text("interval {")
1408 with q.group():
1409 with q.indent(2):
1410 q.breakable()
1411 q.text("value = ");
1412 q.text("%#x" % self.value)
1413 q.breakable()
1414 q.text('}')
1415
1416bsn_tlv.subtypes[58] = interval
1417
Rich Lane474324f2015-01-14 15:22:56 -08001418class ip_proto(bsn_tlv):
1419 type = 67
1420
1421 def __init__(self, value=None):
1422 if value != None:
1423 self.value = value
1424 else:
1425 self.value = 0
1426 return
1427
1428 def pack(self):
1429 packed = []
1430 packed.append(struct.pack("!H", self.type))
1431 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1432 packed.append(struct.pack("!B", self.value))
1433 length = sum([len(x) for x in packed])
1434 packed[1] = struct.pack("!H", length)
1435 return ''.join(packed)
1436
1437 @staticmethod
1438 def unpack(reader):
1439 obj = ip_proto()
1440 _type = reader.read("!H")[0]
1441 assert(_type == 67)
1442 _length = reader.read("!H")[0]
1443 orig_reader = reader
1444 reader = orig_reader.slice(_length, 4)
1445 obj.value = reader.read("!B")[0]
1446 return obj
1447
1448 def __eq__(self, other):
1449 if type(self) != type(other): return False
1450 if self.value != other.value: return False
1451 return True
1452
1453 def pretty_print(self, q):
1454 q.text("ip_proto {")
1455 with q.group():
1456 with q.indent(2):
1457 q.breakable()
1458 q.text("value = ");
1459 q.text("%#x" % self.value)
1460 q.breakable()
1461 q.text('}')
1462
1463bsn_tlv.subtypes[67] = ip_proto
1464
Rich Lane5454b682014-01-14 17:07:36 -08001465class ipv4(bsn_tlv):
1466 type = 4
1467
1468 def __init__(self, value=None):
1469 if value != None:
1470 self.value = value
1471 else:
1472 self.value = 0
1473 return
1474
1475 def pack(self):
1476 packed = []
1477 packed.append(struct.pack("!H", self.type))
1478 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1479 packed.append(struct.pack("!L", self.value))
1480 length = sum([len(x) for x in packed])
1481 packed[1] = struct.pack("!H", length)
1482 return ''.join(packed)
1483
1484 @staticmethod
1485 def unpack(reader):
1486 obj = ipv4()
1487 _type = reader.read("!H")[0]
1488 assert(_type == 4)
1489 _length = reader.read("!H")[0]
1490 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001491 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08001492 obj.value = reader.read("!L")[0]
1493 return obj
1494
1495 def __eq__(self, other):
1496 if type(self) != type(other): return False
1497 if self.value != other.value: return False
1498 return True
1499
1500 def pretty_print(self, q):
1501 q.text("ipv4 {")
1502 with q.group():
1503 with q.indent(2):
1504 q.breakable()
1505 q.text("value = ");
1506 q.text(util.pretty_ipv4(self.value))
1507 q.breakable()
1508 q.text('}')
1509
1510bsn_tlv.subtypes[4] = ipv4
1511
Harshmeet Singh1db46332014-10-14 16:29:13 -07001512class ipv4_dst(bsn_tlv):
1513 type = 35
1514
1515 def __init__(self, value=None):
1516 if value != None:
1517 self.value = value
1518 else:
1519 self.value = 0
1520 return
1521
1522 def pack(self):
1523 packed = []
1524 packed.append(struct.pack("!H", self.type))
1525 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1526 packed.append(struct.pack("!L", self.value))
1527 length = sum([len(x) for x in packed])
1528 packed[1] = struct.pack("!H", length)
1529 return ''.join(packed)
1530
1531 @staticmethod
1532 def unpack(reader):
1533 obj = ipv4_dst()
1534 _type = reader.read("!H")[0]
1535 assert(_type == 35)
1536 _length = reader.read("!H")[0]
1537 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001538 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07001539 obj.value = reader.read("!L")[0]
1540 return obj
1541
1542 def __eq__(self, other):
1543 if type(self) != type(other): return False
1544 if self.value != other.value: return False
1545 return True
1546
1547 def pretty_print(self, q):
1548 q.text("ipv4_dst {")
1549 with q.group():
1550 with q.indent(2):
1551 q.breakable()
1552 q.text("value = ");
1553 q.text(util.pretty_ipv4(self.value))
1554 q.breakable()
1555 q.text('}')
1556
1557bsn_tlv.subtypes[35] = ipv4_dst
1558
Harshmeet Singh301f7172014-12-08 13:07:29 -08001559class ipv4_netmask(bsn_tlv):
1560 type = 60
1561
1562 def __init__(self, value=None):
1563 if value != None:
1564 self.value = value
1565 else:
1566 self.value = 0
1567 return
1568
1569 def pack(self):
1570 packed = []
1571 packed.append(struct.pack("!H", self.type))
1572 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1573 packed.append(struct.pack("!L", self.value))
1574 length = sum([len(x) for x in packed])
1575 packed[1] = struct.pack("!H", length)
1576 return ''.join(packed)
1577
1578 @staticmethod
1579 def unpack(reader):
1580 obj = ipv4_netmask()
1581 _type = reader.read("!H")[0]
1582 assert(_type == 60)
1583 _length = reader.read("!H")[0]
1584 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001585 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08001586 obj.value = reader.read("!L")[0]
1587 return obj
1588
1589 def __eq__(self, other):
1590 if type(self) != type(other): return False
1591 if self.value != other.value: return False
1592 return True
1593
1594 def pretty_print(self, q):
1595 q.text("ipv4_netmask {")
1596 with q.group():
1597 with q.indent(2):
1598 q.breakable()
1599 q.text("value = ");
1600 q.text(util.pretty_ipv4(self.value))
1601 q.breakable()
1602 q.text('}')
1603
1604bsn_tlv.subtypes[60] = ipv4_netmask
1605
Harshmeet Singh1db46332014-10-14 16:29:13 -07001606class ipv4_src(bsn_tlv):
1607 type = 34
1608
1609 def __init__(self, value=None):
1610 if value != None:
1611 self.value = value
1612 else:
1613 self.value = 0
1614 return
1615
1616 def pack(self):
1617 packed = []
1618 packed.append(struct.pack("!H", self.type))
1619 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1620 packed.append(struct.pack("!L", self.value))
1621 length = sum([len(x) for x in packed])
1622 packed[1] = struct.pack("!H", length)
1623 return ''.join(packed)
1624
1625 @staticmethod
1626 def unpack(reader):
1627 obj = ipv4_src()
1628 _type = reader.read("!H")[0]
1629 assert(_type == 34)
1630 _length = reader.read("!H")[0]
1631 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001632 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07001633 obj.value = reader.read("!L")[0]
1634 return obj
1635
1636 def __eq__(self, other):
1637 if type(self) != type(other): return False
1638 if self.value != other.value: return False
1639 return True
1640
1641 def pretty_print(self, q):
1642 q.text("ipv4_src {")
1643 with q.group():
1644 with q.indent(2):
1645 q.breakable()
1646 q.text("value = ");
1647 q.text(util.pretty_ipv4(self.value))
1648 q.breakable()
1649 q.text('}')
1650
1651bsn_tlv.subtypes[34] = ipv4_src
1652
Rich Lane5454b682014-01-14 17:07:36 -08001653class mac(bsn_tlv):
1654 type = 1
1655
1656 def __init__(self, value=None):
1657 if value != None:
1658 self.value = value
1659 else:
1660 self.value = [0,0,0,0,0,0]
1661 return
1662
1663 def pack(self):
1664 packed = []
1665 packed.append(struct.pack("!H", self.type))
1666 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1667 packed.append(struct.pack("!6B", *self.value))
1668 length = sum([len(x) for x in packed])
1669 packed[1] = struct.pack("!H", length)
1670 return ''.join(packed)
1671
1672 @staticmethod
1673 def unpack(reader):
1674 obj = mac()
1675 _type = reader.read("!H")[0]
1676 assert(_type == 1)
1677 _length = reader.read("!H")[0]
1678 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001679 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08001680 obj.value = list(reader.read('!6B'))
1681 return obj
1682
1683 def __eq__(self, other):
1684 if type(self) != type(other): return False
1685 if self.value != other.value: return False
1686 return True
1687
1688 def pretty_print(self, q):
1689 q.text("mac {")
1690 with q.group():
1691 with q.indent(2):
1692 q.breakable()
1693 q.text("value = ");
1694 q.text(util.pretty_mac(self.value))
1695 q.breakable()
1696 q.text('}')
1697
1698bsn_tlv.subtypes[1] = mac
1699
Rich Laneccd32ed2014-11-10 17:48:24 -08001700class mac_mask(bsn_tlv):
1701 type = 56
1702
1703 def __init__(self, value=None):
1704 if value != None:
1705 self.value = value
1706 else:
1707 self.value = [0,0,0,0,0,0]
1708 return
1709
1710 def pack(self):
1711 packed = []
1712 packed.append(struct.pack("!H", self.type))
1713 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1714 packed.append(struct.pack("!6B", *self.value))
1715 length = sum([len(x) for x in packed])
1716 packed[1] = struct.pack("!H", length)
1717 return ''.join(packed)
1718
1719 @staticmethod
1720 def unpack(reader):
1721 obj = mac_mask()
1722 _type = reader.read("!H")[0]
1723 assert(_type == 56)
1724 _length = reader.read("!H")[0]
1725 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001726 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08001727 obj.value = list(reader.read('!6B'))
1728 return obj
1729
1730 def __eq__(self, other):
1731 if type(self) != type(other): return False
1732 if self.value != other.value: return False
1733 return True
1734
1735 def pretty_print(self, q):
1736 q.text("mac_mask {")
1737 with q.group():
1738 with q.indent(2):
1739 q.breakable()
1740 q.text("value = ");
1741 q.text(util.pretty_mac(self.value))
1742 q.breakable()
1743 q.text('}')
1744
1745bsn_tlv.subtypes[56] = mac_mask
1746
Rich Lane95f7fc92014-01-27 17:08:16 -08001747class miss_packets(bsn_tlv):
1748 type = 13
1749
1750 def __init__(self, value=None):
1751 if value != None:
1752 self.value = value
1753 else:
1754 self.value = 0
1755 return
1756
1757 def pack(self):
1758 packed = []
1759 packed.append(struct.pack("!H", self.type))
1760 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1761 packed.append(struct.pack("!Q", self.value))
1762 length = sum([len(x) for x in packed])
1763 packed[1] = struct.pack("!H", length)
1764 return ''.join(packed)
1765
1766 @staticmethod
1767 def unpack(reader):
1768 obj = miss_packets()
1769 _type = reader.read("!H")[0]
1770 assert(_type == 13)
1771 _length = reader.read("!H")[0]
1772 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001773 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08001774 obj.value = reader.read("!Q")[0]
1775 return obj
1776
1777 def __eq__(self, other):
1778 if type(self) != type(other): return False
1779 if self.value != other.value: return False
1780 return True
1781
1782 def pretty_print(self, q):
1783 q.text("miss_packets {")
1784 with q.group():
1785 with q.indent(2):
1786 q.breakable()
1787 q.text("value = ");
1788 q.text("%#x" % self.value)
1789 q.breakable()
1790 q.text('}')
1791
1792bsn_tlv.subtypes[13] = miss_packets
1793
Rich Lanecb18dbd2014-12-18 10:02:29 -08001794class mpls_control_word(bsn_tlv):
1795 type = 62
1796
1797 def __init__(self, value=None):
1798 if value != None:
1799 self.value = value
1800 else:
1801 self.value = 0
1802 return
1803
1804 def pack(self):
1805 packed = []
1806 packed.append(struct.pack("!H", self.type))
1807 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1808 packed.append(struct.pack("!B", self.value))
1809 length = sum([len(x) for x in packed])
1810 packed[1] = struct.pack("!H", length)
1811 return ''.join(packed)
1812
1813 @staticmethod
1814 def unpack(reader):
1815 obj = mpls_control_word()
1816 _type = reader.read("!H")[0]
1817 assert(_type == 62)
1818 _length = reader.read("!H")[0]
1819 orig_reader = reader
1820 reader = orig_reader.slice(_length, 4)
1821 obj.value = reader.read("!B")[0]
1822 return obj
1823
1824 def __eq__(self, other):
1825 if type(self) != type(other): return False
1826 if self.value != other.value: return False
1827 return True
1828
1829 def pretty_print(self, q):
1830 q.text("mpls_control_word {")
1831 with q.group():
1832 with q.indent(2):
1833 q.breakable()
1834 q.text("value = ");
1835 q.text("%#x" % self.value)
1836 q.breakable()
1837 q.text('}')
1838
1839bsn_tlv.subtypes[62] = mpls_control_word
1840
1841class mpls_label(bsn_tlv):
1842 type = 61
1843
1844 def __init__(self, value=None):
1845 if value != None:
1846 self.value = value
1847 else:
1848 self.value = 0
1849 return
1850
1851 def pack(self):
1852 packed = []
1853 packed.append(struct.pack("!H", self.type))
1854 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1855 packed.append(struct.pack("!L", self.value))
1856 length = sum([len(x) for x in packed])
1857 packed[1] = struct.pack("!H", length)
1858 return ''.join(packed)
1859
1860 @staticmethod
1861 def unpack(reader):
1862 obj = mpls_label()
1863 _type = reader.read("!H")[0]
1864 assert(_type == 61)
1865 _length = reader.read("!H")[0]
1866 orig_reader = reader
1867 reader = orig_reader.slice(_length, 4)
1868 obj.value = reader.read("!L")[0]
1869 return obj
1870
1871 def __eq__(self, other):
1872 if type(self) != type(other): return False
1873 if self.value != other.value: return False
1874 return True
1875
1876 def pretty_print(self, q):
1877 q.text("mpls_label {")
1878 with q.group():
1879 with q.indent(2):
1880 q.breakable()
1881 q.text("value = ");
1882 q.text("%#x" % self.value)
1883 q.breakable()
1884 q.text('}')
1885
1886bsn_tlv.subtypes[61] = mpls_label
1887
1888class mpls_sequenced(bsn_tlv):
1889 type = 63
1890
1891 def __init__(self, value=None):
1892 if value != None:
1893 self.value = value
1894 else:
1895 self.value = 0
1896 return
1897
1898 def pack(self):
1899 packed = []
1900 packed.append(struct.pack("!H", self.type))
1901 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1902 packed.append(struct.pack("!B", self.value))
1903 length = sum([len(x) for x in packed])
1904 packed[1] = struct.pack("!H", length)
1905 return ''.join(packed)
1906
1907 @staticmethod
1908 def unpack(reader):
1909 obj = mpls_sequenced()
1910 _type = reader.read("!H")[0]
1911 assert(_type == 63)
1912 _length = reader.read("!H")[0]
1913 orig_reader = reader
1914 reader = orig_reader.slice(_length, 4)
1915 obj.value = reader.read("!B")[0]
1916 return obj
1917
1918 def __eq__(self, other):
1919 if type(self) != type(other): return False
1920 if self.value != other.value: return False
1921 return True
1922
1923 def pretty_print(self, q):
1924 q.text("mpls_sequenced {")
1925 with q.group():
1926 with q.indent(2):
1927 q.breakable()
1928 q.text("value = ");
1929 q.text("%#x" % self.value)
1930 q.breakable()
1931 q.text('}')
1932
1933bsn_tlv.subtypes[63] = mpls_sequenced
1934
Rich Laned0be7552014-10-23 12:52:35 -07001935class name(bsn_tlv):
1936 type = 52
1937
1938 def __init__(self, value=None):
1939 if value != None:
1940 self.value = value
1941 else:
1942 self.value = ''
1943 return
1944
1945 def pack(self):
1946 packed = []
1947 packed.append(struct.pack("!H", self.type))
1948 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1949 packed.append(self.value)
1950 length = sum([len(x) for x in packed])
1951 packed[1] = struct.pack("!H", length)
1952 return ''.join(packed)
1953
1954 @staticmethod
1955 def unpack(reader):
1956 obj = name()
1957 _type = reader.read("!H")[0]
1958 assert(_type == 52)
1959 _length = reader.read("!H")[0]
1960 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08001961 reader = orig_reader.slice(_length, 4)
Rich Laned0be7552014-10-23 12:52:35 -07001962 obj.value = str(reader.read_all())
1963 return obj
1964
1965 def __eq__(self, other):
1966 if type(self) != type(other): return False
1967 if self.value != other.value: return False
1968 return True
1969
1970 def pretty_print(self, q):
1971 q.text("name {")
1972 with q.group():
1973 with q.indent(2):
1974 q.breakable()
1975 q.text("value = ");
1976 q.pp(self.value)
1977 q.breakable()
1978 q.text('}')
1979
1980bsn_tlv.subtypes[52] = name
1981
Harshmeet Singh1db46332014-10-14 16:29:13 -07001982class partner_key(bsn_tlv):
1983 type = 51
1984
1985 def __init__(self, value=None):
1986 if value != None:
1987 self.value = value
1988 else:
1989 self.value = 0
1990 return
1991
1992 def pack(self):
1993 packed = []
1994 packed.append(struct.pack("!H", self.type))
1995 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
1996 packed.append(struct.pack("!H", self.value))
1997 length = sum([len(x) for x in packed])
1998 packed[1] = struct.pack("!H", length)
1999 return ''.join(packed)
2000
2001 @staticmethod
2002 def unpack(reader):
2003 obj = partner_key()
2004 _type = reader.read("!H")[0]
2005 assert(_type == 51)
2006 _length = reader.read("!H")[0]
2007 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002008 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002009 obj.value = reader.read("!H")[0]
2010 return obj
2011
2012 def __eq__(self, other):
2013 if type(self) != type(other): return False
2014 if self.value != other.value: return False
2015 return True
2016
2017 def pretty_print(self, q):
2018 q.text("partner_key {")
2019 with q.group():
2020 with q.indent(2):
2021 q.breakable()
2022 q.text("value = ");
2023 q.text("%#x" % self.value)
2024 q.breakable()
2025 q.text('}')
2026
2027bsn_tlv.subtypes[51] = partner_key
2028
2029class partner_port_num(bsn_tlv):
2030 type = 50
2031
2032 def __init__(self, value=None):
2033 if value != None:
2034 self.value = value
2035 else:
2036 self.value = 0
2037 return
2038
2039 def pack(self):
2040 packed = []
2041 packed.append(struct.pack("!H", self.type))
2042 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2043 packed.append(struct.pack("!H", self.value))
2044 length = sum([len(x) for x in packed])
2045 packed[1] = struct.pack("!H", length)
2046 return ''.join(packed)
2047
2048 @staticmethod
2049 def unpack(reader):
2050 obj = partner_port_num()
2051 _type = reader.read("!H")[0]
2052 assert(_type == 50)
2053 _length = reader.read("!H")[0]
2054 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002055 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002056 obj.value = reader.read("!H")[0]
2057 return obj
2058
2059 def __eq__(self, other):
2060 if type(self) != type(other): return False
2061 if self.value != other.value: return False
2062 return True
2063
2064 def pretty_print(self, q):
2065 q.text("partner_port_num {")
2066 with q.group():
2067 with q.indent(2):
2068 q.breakable()
2069 q.text("value = ");
2070 q.text("%#x" % self.value)
2071 q.breakable()
2072 q.text('}')
2073
2074bsn_tlv.subtypes[50] = partner_port_num
2075
2076class partner_port_priority(bsn_tlv):
2077 type = 49
2078
2079 def __init__(self, value=None):
2080 if value != None:
2081 self.value = value
2082 else:
2083 self.value = 0
2084 return
2085
2086 def pack(self):
2087 packed = []
2088 packed.append(struct.pack("!H", self.type))
2089 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2090 packed.append(struct.pack("!H", self.value))
2091 length = sum([len(x) for x in packed])
2092 packed[1] = struct.pack("!H", length)
2093 return ''.join(packed)
2094
2095 @staticmethod
2096 def unpack(reader):
2097 obj = partner_port_priority()
2098 _type = reader.read("!H")[0]
2099 assert(_type == 49)
2100 _length = reader.read("!H")[0]
2101 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002102 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002103 obj.value = reader.read("!H")[0]
2104 return obj
2105
2106 def __eq__(self, other):
2107 if type(self) != type(other): return False
2108 if self.value != other.value: return False
2109 return True
2110
2111 def pretty_print(self, q):
2112 q.text("partner_port_priority {")
2113 with q.group():
2114 with q.indent(2):
2115 q.breakable()
2116 q.text("value = ");
2117 q.text("%#x" % self.value)
2118 q.breakable()
2119 q.text('}')
2120
2121bsn_tlv.subtypes[49] = partner_port_priority
2122
Rich Lane2e079da2014-10-29 15:30:24 -07002123class partner_state(bsn_tlv):
2124 type = 54
2125
2126 def __init__(self, value=None):
2127 if value != None:
2128 self.value = value
2129 else:
2130 self.value = 0
2131 return
2132
2133 def pack(self):
2134 packed = []
2135 packed.append(struct.pack("!H", self.type))
2136 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2137 packed.append(struct.pack("!B", self.value))
2138 length = sum([len(x) for x in packed])
2139 packed[1] = struct.pack("!H", length)
2140 return ''.join(packed)
2141
2142 @staticmethod
2143 def unpack(reader):
2144 obj = partner_state()
2145 _type = reader.read("!H")[0]
2146 assert(_type == 54)
2147 _length = reader.read("!H")[0]
2148 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002149 reader = orig_reader.slice(_length, 4)
Rich Lane2e079da2014-10-29 15:30:24 -07002150 obj.value = reader.read("!B")[0]
2151 return obj
2152
2153 def __eq__(self, other):
2154 if type(self) != type(other): return False
2155 if self.value != other.value: return False
2156 return True
2157
2158 def pretty_print(self, q):
2159 q.text("partner_state {")
2160 with q.group():
2161 with q.indent(2):
2162 q.breakable()
2163 q.text("value = ");
2164 q.text("%#x" % self.value)
2165 q.breakable()
2166 q.text('}')
2167
2168bsn_tlv.subtypes[54] = partner_state
2169
Harshmeet Singh1db46332014-10-14 16:29:13 -07002170class partner_system_mac(bsn_tlv):
2171 type = 48
2172
2173 def __init__(self, value=None):
2174 if value != None:
2175 self.value = value
2176 else:
2177 self.value = [0,0,0,0,0,0]
2178 return
2179
2180 def pack(self):
2181 packed = []
2182 packed.append(struct.pack("!H", self.type))
2183 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2184 packed.append(struct.pack("!6B", *self.value))
2185 length = sum([len(x) for x in packed])
2186 packed[1] = struct.pack("!H", length)
2187 return ''.join(packed)
2188
2189 @staticmethod
2190 def unpack(reader):
2191 obj = partner_system_mac()
2192 _type = reader.read("!H")[0]
2193 assert(_type == 48)
2194 _length = reader.read("!H")[0]
2195 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002196 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002197 obj.value = list(reader.read('!6B'))
2198 return obj
2199
2200 def __eq__(self, other):
2201 if type(self) != type(other): return False
2202 if self.value != other.value: return False
2203 return True
2204
2205 def pretty_print(self, q):
2206 q.text("partner_system_mac {")
2207 with q.group():
2208 with q.indent(2):
2209 q.breakable()
2210 q.text("value = ");
2211 q.text(util.pretty_mac(self.value))
2212 q.breakable()
2213 q.text('}')
2214
2215bsn_tlv.subtypes[48] = partner_system_mac
2216
2217class partner_system_priority(bsn_tlv):
2218 type = 47
2219
2220 def __init__(self, value=None):
2221 if value != None:
2222 self.value = value
2223 else:
2224 self.value = 0
2225 return
2226
2227 def pack(self):
2228 packed = []
2229 packed.append(struct.pack("!H", self.type))
2230 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2231 packed.append(struct.pack("!H", self.value))
2232 length = sum([len(x) for x in packed])
2233 packed[1] = struct.pack("!H", length)
2234 return ''.join(packed)
2235
2236 @staticmethod
2237 def unpack(reader):
2238 obj = partner_system_priority()
2239 _type = reader.read("!H")[0]
2240 assert(_type == 47)
2241 _length = reader.read("!H")[0]
2242 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002243 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002244 obj.value = reader.read("!H")[0]
2245 return obj
2246
2247 def __eq__(self, other):
2248 if type(self) != type(other): return False
2249 if self.value != other.value: return False
2250 return True
2251
2252 def pretty_print(self, q):
2253 q.text("partner_system_priority {")
2254 with q.group():
2255 with q.indent(2):
2256 q.breakable()
2257 q.text("value = ");
2258 q.text("%#x" % self.value)
2259 q.breakable()
2260 q.text('}')
2261
2262bsn_tlv.subtypes[47] = partner_system_priority
2263
Rich Lane5454b682014-01-14 17:07:36 -08002264class port(bsn_tlv):
2265 type = 0
2266
2267 def __init__(self, value=None):
2268 if value != None:
2269 self.value = value
2270 else:
2271 self.value = 0
2272 return
2273
2274 def pack(self):
2275 packed = []
2276 packed.append(struct.pack("!H", self.type))
2277 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2278 packed.append(util.pack_port_no(self.value))
2279 length = sum([len(x) for x in packed])
2280 packed[1] = struct.pack("!H", length)
2281 return ''.join(packed)
2282
2283 @staticmethod
2284 def unpack(reader):
2285 obj = port()
2286 _type = reader.read("!H")[0]
2287 assert(_type == 0)
2288 _length = reader.read("!H")[0]
2289 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002290 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002291 obj.value = util.unpack_port_no(reader)
2292 return obj
2293
2294 def __eq__(self, other):
2295 if type(self) != type(other): return False
2296 if self.value != other.value: return False
2297 return True
2298
2299 def pretty_print(self, q):
2300 q.text("port {")
2301 with q.group():
2302 with q.indent(2):
2303 q.breakable()
2304 q.text("value = ");
2305 q.text(util.pretty_port(self.value))
2306 q.breakable()
2307 q.text('}')
2308
2309bsn_tlv.subtypes[0] = port
2310
Rich Laneccd32ed2014-11-10 17:48:24 -08002311class priority(bsn_tlv):
2312 type = 57
2313
2314 def __init__(self, value=None):
2315 if value != None:
2316 self.value = value
2317 else:
2318 self.value = 0
2319 return
2320
2321 def pack(self):
2322 packed = []
2323 packed.append(struct.pack("!H", self.type))
2324 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2325 packed.append(struct.pack("!L", self.value))
2326 length = sum([len(x) for x in packed])
2327 packed[1] = struct.pack("!H", length)
2328 return ''.join(packed)
2329
2330 @staticmethod
2331 def unpack(reader):
2332 obj = priority()
2333 _type = reader.read("!H")[0]
2334 assert(_type == 57)
2335 _length = reader.read("!H")[0]
2336 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002337 reader = orig_reader.slice(_length, 4)
Rich Laneccd32ed2014-11-10 17:48:24 -08002338 obj.value = reader.read("!L")[0]
2339 return obj
2340
2341 def __eq__(self, other):
2342 if type(self) != type(other): return False
2343 if self.value != other.value: return False
2344 return True
2345
2346 def pretty_print(self, q):
2347 q.text("priority {")
2348 with q.group():
2349 with q.indent(2):
2350 q.breakable()
2351 q.text("value = ");
2352 q.text("%#x" % self.value)
2353 q.breakable()
2354 q.text('}')
2355
2356bsn_tlv.subtypes[57] = priority
2357
Rich Lane78d9bcb2014-05-12 13:27:44 -07002358class queue_id(bsn_tlv):
2359 type = 20
2360
2361 def __init__(self, value=None):
2362 if value != None:
2363 self.value = value
2364 else:
2365 self.value = 0
2366 return
2367
2368 def pack(self):
2369 packed = []
2370 packed.append(struct.pack("!H", self.type))
2371 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2372 packed.append(struct.pack("!L", self.value))
2373 length = sum([len(x) for x in packed])
2374 packed[1] = struct.pack("!H", length)
2375 return ''.join(packed)
2376
2377 @staticmethod
2378 def unpack(reader):
2379 obj = queue_id()
2380 _type = reader.read("!H")[0]
2381 assert(_type == 20)
2382 _length = reader.read("!H")[0]
2383 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002384 reader = orig_reader.slice(_length, 4)
Rich Lane78d9bcb2014-05-12 13:27:44 -07002385 obj.value = reader.read("!L")[0]
2386 return obj
2387
2388 def __eq__(self, other):
2389 if type(self) != type(other): return False
2390 if self.value != other.value: return False
2391 return True
2392
2393 def pretty_print(self, q):
2394 q.text("queue_id {")
2395 with q.group():
2396 with q.indent(2):
2397 q.breakable()
2398 q.text("value = ");
2399 q.text("%#x" % self.value)
2400 q.breakable()
2401 q.text('}')
2402
2403bsn_tlv.subtypes[20] = queue_id
2404
2405class queue_weight(bsn_tlv):
2406 type = 21
2407
2408 def __init__(self, value=None):
2409 if value != None:
2410 self.value = value
2411 else:
2412 self.value = 0
2413 return
2414
2415 def pack(self):
2416 packed = []
2417 packed.append(struct.pack("!H", self.type))
2418 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2419 packed.append(struct.pack("!L", self.value))
2420 length = sum([len(x) for x in packed])
2421 packed[1] = struct.pack("!H", length)
2422 return ''.join(packed)
2423
2424 @staticmethod
2425 def unpack(reader):
2426 obj = queue_weight()
2427 _type = reader.read("!H")[0]
2428 assert(_type == 21)
2429 _length = reader.read("!H")[0]
2430 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002431 reader = orig_reader.slice(_length, 4)
Rich Lane78d9bcb2014-05-12 13:27:44 -07002432 obj.value = reader.read("!L")[0]
2433 return obj
2434
2435 def __eq__(self, other):
2436 if type(self) != type(other): return False
2437 if self.value != other.value: return False
2438 return True
2439
2440 def pretty_print(self, q):
2441 q.text("queue_weight {")
2442 with q.group():
2443 with q.indent(2):
2444 q.breakable()
2445 q.text("value = ");
2446 q.text("%#x" % self.value)
2447 q.breakable()
2448 q.text('}')
2449
2450bsn_tlv.subtypes[21] = queue_weight
2451
Harshmeet Singh301f7172014-12-08 13:07:29 -08002452class reference(bsn_tlv):
2453 type = 59
2454
2455 def __init__(self, table_id=None, key=None):
2456 if table_id != None:
2457 self.table_id = table_id
2458 else:
2459 self.table_id = 0
2460 if key != None:
2461 self.key = key
2462 else:
2463 self.key = []
2464 return
2465
2466 def pack(self):
2467 packed = []
2468 packed.append(struct.pack("!H", self.type))
2469 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2470 packed.append(struct.pack("!H", self.table_id))
2471 packed.append(loxi.generic_util.pack_list(self.key))
2472 length = sum([len(x) for x in packed])
2473 packed[1] = struct.pack("!H", length)
2474 return ''.join(packed)
2475
2476 @staticmethod
2477 def unpack(reader):
2478 obj = reference()
2479 _type = reader.read("!H")[0]
2480 assert(_type == 59)
2481 _length = reader.read("!H")[0]
2482 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002483 reader = orig_reader.slice(_length, 4)
Harshmeet Singh301f7172014-12-08 13:07:29 -08002484 obj.table_id = reader.read("!H")[0]
Rich Lanee2567702015-01-26 15:04:35 -08002485 obj.key = loxi.generic_util.unpack_list(reader, ofp.bsn_tlv.bsn_tlv.unpack)
Harshmeet Singh301f7172014-12-08 13:07:29 -08002486 return obj
2487
2488 def __eq__(self, other):
2489 if type(self) != type(other): return False
2490 if self.table_id != other.table_id: return False
2491 if self.key != other.key: return False
2492 return True
2493
2494 def pretty_print(self, q):
2495 q.text("reference {")
2496 with q.group():
2497 with q.indent(2):
2498 q.breakable()
2499 q.text("table_id = ");
2500 q.text("%#x" % self.table_id)
2501 q.text(","); q.breakable()
2502 q.text("key = ");
2503 q.pp(self.key)
2504 q.breakable()
2505 q.text('}')
2506
2507bsn_tlv.subtypes[59] = reference
2508
Rich Lane95f7fc92014-01-27 17:08:16 -08002509class reply_packets(bsn_tlv):
2510 type = 12
2511
2512 def __init__(self, value=None):
2513 if value != None:
2514 self.value = value
2515 else:
2516 self.value = 0
2517 return
2518
2519 def pack(self):
2520 packed = []
2521 packed.append(struct.pack("!H", self.type))
2522 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2523 packed.append(struct.pack("!Q", self.value))
2524 length = sum([len(x) for x in packed])
2525 packed[1] = struct.pack("!H", length)
2526 return ''.join(packed)
2527
2528 @staticmethod
2529 def unpack(reader):
2530 obj = reply_packets()
2531 _type = reader.read("!H")[0]
2532 assert(_type == 12)
2533 _length = reader.read("!H")[0]
2534 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002535 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002536 obj.value = reader.read("!Q")[0]
2537 return obj
2538
2539 def __eq__(self, other):
2540 if type(self) != type(other): return False
2541 if self.value != other.value: return False
2542 return True
2543
2544 def pretty_print(self, q):
2545 q.text("reply_packets {")
2546 with q.group():
2547 with q.indent(2):
2548 q.breakable()
2549 q.text("value = ");
2550 q.text("%#x" % self.value)
2551 q.breakable()
2552 q.text('}')
2553
2554bsn_tlv.subtypes[12] = reply_packets
2555
2556class request_packets(bsn_tlv):
2557 type = 11
2558
2559 def __init__(self, value=None):
2560 if value != None:
2561 self.value = value
2562 else:
2563 self.value = 0
2564 return
2565
2566 def pack(self):
2567 packed = []
2568 packed.append(struct.pack("!H", self.type))
2569 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2570 packed.append(struct.pack("!Q", self.value))
2571 length = sum([len(x) for x in packed])
2572 packed[1] = struct.pack("!H", length)
2573 return ''.join(packed)
2574
2575 @staticmethod
2576 def unpack(reader):
2577 obj = request_packets()
2578 _type = reader.read("!H")[0]
2579 assert(_type == 11)
2580 _length = reader.read("!H")[0]
2581 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002582 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08002583 obj.value = reader.read("!Q")[0]
2584 return obj
2585
2586 def __eq__(self, other):
2587 if type(self) != type(other): return False
2588 if self.value != other.value: return False
2589 return True
2590
2591 def pretty_print(self, q):
2592 q.text("request_packets {")
2593 with q.group():
2594 with q.indent(2):
2595 q.breakable()
2596 q.text("value = ");
2597 q.text("%#x" % self.value)
2598 q.breakable()
2599 q.text('}')
2600
2601bsn_tlv.subtypes[11] = request_packets
2602
Rich Lanee2567702015-01-26 15:04:35 -08002603class rx_bytes(bsn_tlv):
2604 type = 71
2605
2606 def __init__(self, value=None):
2607 if value != None:
2608 self.value = value
2609 else:
2610 self.value = 0
2611 return
2612
2613 def pack(self):
2614 packed = []
2615 packed.append(struct.pack("!H", self.type))
2616 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2617 packed.append(struct.pack("!Q", self.value))
2618 length = sum([len(x) for x in packed])
2619 packed[1] = struct.pack("!H", length)
2620 return ''.join(packed)
2621
2622 @staticmethod
2623 def unpack(reader):
2624 obj = rx_bytes()
2625 _type = reader.read("!H")[0]
2626 assert(_type == 71)
2627 _length = reader.read("!H")[0]
2628 orig_reader = reader
2629 reader = orig_reader.slice(_length, 4)
2630 obj.value = reader.read("!Q")[0]
2631 return obj
2632
2633 def __eq__(self, other):
2634 if type(self) != type(other): return False
2635 if self.value != other.value: return False
2636 return True
2637
2638 def pretty_print(self, q):
2639 q.text("rx_bytes {")
2640 with q.group():
2641 with q.indent(2):
2642 q.breakable()
2643 q.text("value = ");
2644 q.text("%#x" % self.value)
2645 q.breakable()
2646 q.text('}')
2647
2648bsn_tlv.subtypes[71] = rx_bytes
2649
Rich Lane5454b682014-01-14 17:07:36 -08002650class rx_packets(bsn_tlv):
2651 type = 2
2652
2653 def __init__(self, value=None):
2654 if value != None:
2655 self.value = value
2656 else:
2657 self.value = 0
2658 return
2659
2660 def pack(self):
2661 packed = []
2662 packed.append(struct.pack("!H", self.type))
2663 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2664 packed.append(struct.pack("!Q", self.value))
2665 length = sum([len(x) for x in packed])
2666 packed[1] = struct.pack("!H", length)
2667 return ''.join(packed)
2668
2669 @staticmethod
2670 def unpack(reader):
2671 obj = rx_packets()
2672 _type = reader.read("!H")[0]
2673 assert(_type == 2)
2674 _length = reader.read("!H")[0]
2675 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002676 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08002677 obj.value = reader.read("!Q")[0]
2678 return obj
2679
2680 def __eq__(self, other):
2681 if type(self) != type(other): return False
2682 if self.value != other.value: return False
2683 return True
2684
2685 def pretty_print(self, q):
2686 q.text("rx_packets {")
2687 with q.group():
2688 with q.indent(2):
2689 q.breakable()
2690 q.text("value = ");
2691 q.text("%#x" % self.value)
2692 q.breakable()
2693 q.text('}')
2694
2695bsn_tlv.subtypes[2] = rx_packets
2696
Harshmeet Singh1db46332014-10-14 16:29:13 -07002697class sampling_rate(bsn_tlv):
2698 type = 30
2699
2700 def __init__(self, value=None):
2701 if value != None:
2702 self.value = value
2703 else:
2704 self.value = 0
2705 return
2706
2707 def pack(self):
2708 packed = []
2709 packed.append(struct.pack("!H", self.type))
2710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2711 packed.append(struct.pack("!L", self.value))
2712 length = sum([len(x) for x in packed])
2713 packed[1] = struct.pack("!H", length)
2714 return ''.join(packed)
2715
2716 @staticmethod
2717 def unpack(reader):
2718 obj = sampling_rate()
2719 _type = reader.read("!H")[0]
2720 assert(_type == 30)
2721 _length = reader.read("!H")[0]
2722 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002723 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002724 obj.value = reader.read("!L")[0]
2725 return obj
2726
2727 def __eq__(self, other):
2728 if type(self) != type(other): return False
2729 if self.value != other.value: return False
2730 return True
2731
2732 def pretty_print(self, q):
2733 q.text("sampling_rate {")
2734 with q.group():
2735 with q.indent(2):
2736 q.breakable()
2737 q.text("value = ");
2738 q.text("%#x" % self.value)
2739 q.breakable()
2740 q.text('}')
2741
2742bsn_tlv.subtypes[30] = sampling_rate
2743
Kiran Poola36a302c2015-04-22 11:20:16 -07002744class set_loopback_mode(bsn_tlv):
2745 type = 74
2746
2747 def __init__(self):
2748 return
2749
2750 def pack(self):
2751 packed = []
2752 packed.append(struct.pack("!H", self.type))
2753 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2754 length = sum([len(x) for x in packed])
2755 packed[1] = struct.pack("!H", length)
2756 return ''.join(packed)
2757
2758 @staticmethod
2759 def unpack(reader):
2760 obj = set_loopback_mode()
2761 _type = reader.read("!H")[0]
2762 assert(_type == 74)
2763 _length = reader.read("!H")[0]
2764 orig_reader = reader
2765 reader = orig_reader.slice(_length, 4)
2766 return obj
2767
2768 def __eq__(self, other):
2769 if type(self) != type(other): return False
2770 return True
2771
2772 def pretty_print(self, q):
2773 q.text("set_loopback_mode {")
2774 with q.group():
2775 with q.indent(2):
2776 q.breakable()
2777 q.breakable()
2778 q.text('}')
2779
2780bsn_tlv.subtypes[74] = set_loopback_mode
2781
2782class strip_mpls_l2_on_ingress(bsn_tlv):
2783 type = 75
2784
2785 def __init__(self):
2786 return
2787
2788 def pack(self):
2789 packed = []
2790 packed.append(struct.pack("!H", self.type))
2791 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2792 length = sum([len(x) for x in packed])
2793 packed[1] = struct.pack("!H", length)
2794 return ''.join(packed)
2795
2796 @staticmethod
2797 def unpack(reader):
2798 obj = strip_mpls_l2_on_ingress()
2799 _type = reader.read("!H")[0]
2800 assert(_type == 75)
2801 _length = reader.read("!H")[0]
2802 orig_reader = reader
2803 reader = orig_reader.slice(_length, 4)
2804 return obj
2805
2806 def __eq__(self, other):
2807 if type(self) != type(other): return False
2808 return True
2809
2810 def pretty_print(self, q):
2811 q.text("strip_mpls_l2_on_ingress {")
2812 with q.group():
2813 with q.indent(2):
2814 q.breakable()
2815 q.breakable()
2816 q.text('}')
2817
2818bsn_tlv.subtypes[75] = strip_mpls_l2_on_ingress
2819
2820class strip_mpls_l3_on_ingress(bsn_tlv):
2821 type = 76
2822
2823 def __init__(self):
2824 return
2825
2826 def pack(self):
2827 packed = []
2828 packed.append(struct.pack("!H", self.type))
2829 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2830 length = sum([len(x) for x in packed])
2831 packed[1] = struct.pack("!H", length)
2832 return ''.join(packed)
2833
2834 @staticmethod
2835 def unpack(reader):
2836 obj = strip_mpls_l3_on_ingress()
2837 _type = reader.read("!H")[0]
2838 assert(_type == 76)
2839 _length = reader.read("!H")[0]
2840 orig_reader = reader
2841 reader = orig_reader.slice(_length, 4)
2842 return obj
2843
2844 def __eq__(self, other):
2845 if type(self) != type(other): return False
2846 return True
2847
2848 def pretty_print(self, q):
2849 q.text("strip_mpls_l3_on_ingress {")
2850 with q.group():
2851 with q.indent(2):
2852 q.breakable()
2853 q.breakable()
2854 q.text('}')
2855
2856bsn_tlv.subtypes[76] = strip_mpls_l3_on_ingress
2857
2858class strip_vlan_on_egress(bsn_tlv):
2859 type = 73
2860
2861 def __init__(self):
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 length = sum([len(x) for x in packed])
2869 packed[1] = struct.pack("!H", length)
2870 return ''.join(packed)
2871
2872 @staticmethod
2873 def unpack(reader):
2874 obj = strip_vlan_on_egress()
2875 _type = reader.read("!H")[0]
2876 assert(_type == 73)
2877 _length = reader.read("!H")[0]
2878 orig_reader = reader
2879 reader = orig_reader.slice(_length, 4)
2880 return obj
2881
2882 def __eq__(self, other):
2883 if type(self) != type(other): return False
2884 return True
2885
2886 def pretty_print(self, q):
2887 q.text("strip_vlan_on_egress {")
2888 with q.group():
2889 with q.indent(2):
2890 q.breakable()
2891 q.breakable()
2892 q.text('}')
2893
2894bsn_tlv.subtypes[73] = strip_vlan_on_egress
2895
Harshmeet Singh1db46332014-10-14 16:29:13 -07002896class sub_agent_id(bsn_tlv):
2897 type = 38
2898
2899 def __init__(self, value=None):
2900 if value != None:
2901 self.value = value
2902 else:
2903 self.value = 0
2904 return
2905
2906 def pack(self):
2907 packed = []
2908 packed.append(struct.pack("!H", self.type))
2909 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2910 packed.append(struct.pack("!L", self.value))
2911 length = sum([len(x) for x in packed])
2912 packed[1] = struct.pack("!H", length)
2913 return ''.join(packed)
2914
2915 @staticmethod
2916 def unpack(reader):
2917 obj = sub_agent_id()
2918 _type = reader.read("!H")[0]
2919 assert(_type == 38)
2920 _length = reader.read("!H")[0]
2921 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08002922 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07002923 obj.value = reader.read("!L")[0]
2924 return obj
2925
2926 def __eq__(self, other):
2927 if type(self) != type(other): return False
2928 if self.value != other.value: return False
2929 return True
2930
2931 def pretty_print(self, q):
2932 q.text("sub_agent_id {")
2933 with q.group():
2934 with q.indent(2):
2935 q.breakable()
2936 q.text("value = ");
2937 q.text("%#x" % self.value)
2938 q.breakable()
2939 q.text('}')
2940
2941bsn_tlv.subtypes[38] = sub_agent_id
2942
Rich Lane474324f2015-01-14 15:22:56 -08002943class tcp_dst(bsn_tlv):
2944 type = 66
2945
2946 def __init__(self, value=None):
2947 if value != None:
2948 self.value = value
2949 else:
2950 self.value = 0
2951 return
2952
2953 def pack(self):
2954 packed = []
2955 packed.append(struct.pack("!H", self.type))
2956 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
2957 packed.append(struct.pack("!H", self.value))
2958 length = sum([len(x) for x in packed])
2959 packed[1] = struct.pack("!H", length)
2960 return ''.join(packed)
2961
2962 @staticmethod
2963 def unpack(reader):
2964 obj = tcp_dst()
2965 _type = reader.read("!H")[0]
2966 assert(_type == 66)
2967 _length = reader.read("!H")[0]
2968 orig_reader = reader
2969 reader = orig_reader.slice(_length, 4)
2970 obj.value = reader.read("!H")[0]
2971 return obj
2972
2973 def __eq__(self, other):
2974 if type(self) != type(other): return False
2975 if self.value != other.value: return False
2976 return True
2977
2978 def pretty_print(self, q):
2979 q.text("tcp_dst {")
2980 with q.group():
2981 with q.indent(2):
2982 q.breakable()
2983 q.text("value = ");
2984 q.text("%#x" % self.value)
2985 q.breakable()
2986 q.text('}')
2987
2988bsn_tlv.subtypes[66] = tcp_dst
2989
2990class tcp_src(bsn_tlv):
2991 type = 65
2992
2993 def __init__(self, value=None):
2994 if value != None:
2995 self.value = value
2996 else:
2997 self.value = 0
2998 return
2999
3000 def pack(self):
3001 packed = []
3002 packed.append(struct.pack("!H", self.type))
3003 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3004 packed.append(struct.pack("!H", self.value))
3005 length = sum([len(x) for x in packed])
3006 packed[1] = struct.pack("!H", length)
3007 return ''.join(packed)
3008
3009 @staticmethod
3010 def unpack(reader):
3011 obj = tcp_src()
3012 _type = reader.read("!H")[0]
3013 assert(_type == 65)
3014 _length = reader.read("!H")[0]
3015 orig_reader = reader
3016 reader = orig_reader.slice(_length, 4)
3017 obj.value = reader.read("!H")[0]
3018 return obj
3019
3020 def __eq__(self, other):
3021 if type(self) != type(other): return False
3022 if self.value != other.value: return False
3023 return True
3024
3025 def pretty_print(self, q):
3026 q.text("tcp_src {")
3027 with q.group():
3028 with q.indent(2):
3029 q.breakable()
3030 q.text("value = ");
3031 q.text("%#x" % self.value)
3032 q.breakable()
3033 q.text('}')
3034
3035bsn_tlv.subtypes[65] = tcp_src
3036
Harshmeet Singh1db46332014-10-14 16:29:13 -07003037class tx_bytes(bsn_tlv):
3038 type = 39
3039
3040 def __init__(self, value=None):
3041 if value != None:
3042 self.value = value
3043 else:
3044 self.value = 0
3045 return
3046
3047 def pack(self):
3048 packed = []
3049 packed.append(struct.pack("!H", self.type))
3050 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3051 packed.append(struct.pack("!Q", self.value))
3052 length = sum([len(x) for x in packed])
3053 packed[1] = struct.pack("!H", length)
3054 return ''.join(packed)
3055
3056 @staticmethod
3057 def unpack(reader):
3058 obj = tx_bytes()
3059 _type = reader.read("!H")[0]
3060 assert(_type == 39)
3061 _length = reader.read("!H")[0]
3062 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003063 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07003064 obj.value = reader.read("!Q")[0]
3065 return obj
3066
3067 def __eq__(self, other):
3068 if type(self) != type(other): return False
3069 if self.value != other.value: return False
3070 return True
3071
3072 def pretty_print(self, q):
3073 q.text("tx_bytes {")
3074 with q.group():
3075 with q.indent(2):
3076 q.breakable()
3077 q.text("value = ");
3078 q.text("%#x" % self.value)
3079 q.breakable()
3080 q.text('}')
3081
3082bsn_tlv.subtypes[39] = tx_bytes
3083
Rich Lane5454b682014-01-14 17:07:36 -08003084class tx_packets(bsn_tlv):
3085 type = 3
3086
3087 def __init__(self, value=None):
3088 if value != None:
3089 self.value = value
3090 else:
3091 self.value = 0
3092 return
3093
3094 def pack(self):
3095 packed = []
3096 packed.append(struct.pack("!H", self.type))
3097 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3098 packed.append(struct.pack("!Q", self.value))
3099 length = sum([len(x) for x in packed])
3100 packed[1] = struct.pack("!H", length)
3101 return ''.join(packed)
3102
3103 @staticmethod
3104 def unpack(reader):
3105 obj = tx_packets()
3106 _type = reader.read("!H")[0]
3107 assert(_type == 3)
3108 _length = reader.read("!H")[0]
3109 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003110 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003111 obj.value = reader.read("!Q")[0]
3112 return obj
3113
3114 def __eq__(self, other):
3115 if type(self) != type(other): return False
3116 if self.value != other.value: return False
3117 return True
3118
3119 def pretty_print(self, q):
3120 q.text("tx_packets {")
3121 with q.group():
3122 with q.indent(2):
3123 q.breakable()
3124 q.text("value = ");
3125 q.text("%#x" % self.value)
3126 q.breakable()
3127 q.text('}')
3128
3129bsn_tlv.subtypes[3] = tx_packets
3130
Rich Lane93b33132014-04-21 12:20:58 -07003131class udf_anchor(bsn_tlv):
3132 type = 16
3133
3134 def __init__(self, value=None):
3135 if value != None:
3136 self.value = value
3137 else:
3138 self.value = 0
3139 return
3140
3141 def pack(self):
3142 packed = []
3143 packed.append(struct.pack("!H", self.type))
3144 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3145 packed.append(struct.pack("!H", self.value))
3146 length = sum([len(x) for x in packed])
3147 packed[1] = struct.pack("!H", length)
3148 return ''.join(packed)
3149
3150 @staticmethod
3151 def unpack(reader):
3152 obj = udf_anchor()
3153 _type = reader.read("!H")[0]
3154 assert(_type == 16)
3155 _length = reader.read("!H")[0]
3156 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003157 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07003158 obj.value = reader.read("!H")[0]
3159 return obj
3160
3161 def __eq__(self, other):
3162 if type(self) != type(other): return False
3163 if self.value != other.value: return False
3164 return True
3165
3166 def pretty_print(self, q):
3167 q.text("udf_anchor {")
3168 with q.group():
3169 with q.indent(2):
3170 q.breakable()
3171 q.text("value = ");
3172 q.text("%#x" % self.value)
3173 q.breakable()
3174 q.text('}')
3175
3176bsn_tlv.subtypes[16] = udf_anchor
3177
3178class udf_id(bsn_tlv):
3179 type = 15
3180
3181 def __init__(self, value=None):
3182 if value != None:
3183 self.value = value
3184 else:
3185 self.value = 0
3186 return
3187
3188 def pack(self):
3189 packed = []
3190 packed.append(struct.pack("!H", self.type))
3191 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3192 packed.append(struct.pack("!H", self.value))
3193 length = sum([len(x) for x in packed])
3194 packed[1] = struct.pack("!H", length)
3195 return ''.join(packed)
3196
3197 @staticmethod
3198 def unpack(reader):
3199 obj = udf_id()
3200 _type = reader.read("!H")[0]
3201 assert(_type == 15)
3202 _length = reader.read("!H")[0]
3203 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003204 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07003205 obj.value = reader.read("!H")[0]
3206 return obj
3207
3208 def __eq__(self, other):
3209 if type(self) != type(other): return False
3210 if self.value != other.value: return False
3211 return True
3212
3213 def pretty_print(self, q):
3214 q.text("udf_id {")
3215 with q.group():
3216 with q.indent(2):
3217 q.breakable()
3218 q.text("value = ");
3219 q.text("%#x" % self.value)
3220 q.breakable()
3221 q.text('}')
3222
3223bsn_tlv.subtypes[15] = udf_id
3224
3225class udf_length(bsn_tlv):
3226 type = 18
3227
3228 def __init__(self, value=None):
3229 if value != None:
3230 self.value = value
3231 else:
3232 self.value = 0
3233 return
3234
3235 def pack(self):
3236 packed = []
3237 packed.append(struct.pack("!H", self.type))
3238 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3239 packed.append(struct.pack("!H", self.value))
3240 length = sum([len(x) for x in packed])
3241 packed[1] = struct.pack("!H", length)
3242 return ''.join(packed)
3243
3244 @staticmethod
3245 def unpack(reader):
3246 obj = udf_length()
3247 _type = reader.read("!H")[0]
3248 assert(_type == 18)
3249 _length = reader.read("!H")[0]
3250 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003251 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07003252 obj.value = reader.read("!H")[0]
3253 return obj
3254
3255 def __eq__(self, other):
3256 if type(self) != type(other): return False
3257 if self.value != other.value: return False
3258 return True
3259
3260 def pretty_print(self, q):
3261 q.text("udf_length {")
3262 with q.group():
3263 with q.indent(2):
3264 q.breakable()
3265 q.text("value = ");
3266 q.text("%#x" % self.value)
3267 q.breakable()
3268 q.text('}')
3269
3270bsn_tlv.subtypes[18] = udf_length
3271
3272class udf_offset(bsn_tlv):
3273 type = 17
3274
3275 def __init__(self, value=None):
3276 if value != None:
3277 self.value = value
3278 else:
3279 self.value = 0
3280 return
3281
3282 def pack(self):
3283 packed = []
3284 packed.append(struct.pack("!H", self.type))
3285 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3286 packed.append(struct.pack("!H", self.value))
3287 length = sum([len(x) for x in packed])
3288 packed[1] = struct.pack("!H", length)
3289 return ''.join(packed)
3290
3291 @staticmethod
3292 def unpack(reader):
3293 obj = udf_offset()
3294 _type = reader.read("!H")[0]
3295 assert(_type == 17)
3296 _length = reader.read("!H")[0]
3297 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003298 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07003299 obj.value = reader.read("!H")[0]
3300 return obj
3301
3302 def __eq__(self, other):
3303 if type(self) != type(other): return False
3304 if self.value != other.value: return False
3305 return True
3306
3307 def pretty_print(self, q):
3308 q.text("udf_offset {")
3309 with q.group():
3310 with q.indent(2):
3311 q.breakable()
3312 q.text("value = ");
3313 q.text("%#x" % self.value)
3314 q.breakable()
3315 q.text('}')
3316
3317bsn_tlv.subtypes[17] = udf_offset
3318
Harshmeet Singh1db46332014-10-14 16:29:13 -07003319class udp_dst(bsn_tlv):
3320 type = 37
3321
3322 def __init__(self, value=None):
3323 if value != None:
3324 self.value = value
3325 else:
3326 self.value = 0
3327 return
3328
3329 def pack(self):
3330 packed = []
3331 packed.append(struct.pack("!H", self.type))
3332 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3333 packed.append(struct.pack("!H", self.value))
3334 length = sum([len(x) for x in packed])
3335 packed[1] = struct.pack("!H", length)
3336 return ''.join(packed)
3337
3338 @staticmethod
3339 def unpack(reader):
3340 obj = udp_dst()
3341 _type = reader.read("!H")[0]
3342 assert(_type == 37)
3343 _length = reader.read("!H")[0]
3344 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003345 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07003346 obj.value = reader.read("!H")[0]
3347 return obj
3348
3349 def __eq__(self, other):
3350 if type(self) != type(other): return False
3351 if self.value != other.value: return False
3352 return True
3353
3354 def pretty_print(self, q):
3355 q.text("udp_dst {")
3356 with q.group():
3357 with q.indent(2):
3358 q.breakable()
3359 q.text("value = ");
3360 q.text("%#x" % self.value)
3361 q.breakable()
3362 q.text('}')
3363
3364bsn_tlv.subtypes[37] = udp_dst
3365
3366class udp_src(bsn_tlv):
3367 type = 36
3368
3369 def __init__(self, value=None):
3370 if value != None:
3371 self.value = value
3372 else:
3373 self.value = 0
3374 return
3375
3376 def pack(self):
3377 packed = []
3378 packed.append(struct.pack("!H", self.type))
3379 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3380 packed.append(struct.pack("!H", self.value))
3381 length = sum([len(x) for x in packed])
3382 packed[1] = struct.pack("!H", length)
3383 return ''.join(packed)
3384
3385 @staticmethod
3386 def unpack(reader):
3387 obj = udp_src()
3388 _type = reader.read("!H")[0]
3389 assert(_type == 36)
3390 _length = reader.read("!H")[0]
3391 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003392 reader = orig_reader.slice(_length, 4)
Harshmeet Singh1db46332014-10-14 16:29:13 -07003393 obj.value = reader.read("!H")[0]
3394 return obj
3395
3396 def __eq__(self, other):
3397 if type(self) != type(other): return False
3398 if self.value != other.value: return False
3399 return True
3400
3401 def pretty_print(self, q):
3402 q.text("udp_src {")
3403 with q.group():
3404 with q.indent(2):
3405 q.breakable()
3406 q.text("value = ");
3407 q.text("%#x" % self.value)
3408 q.breakable()
3409 q.text('}')
3410
3411bsn_tlv.subtypes[36] = udp_src
3412
Rich Lane95f7fc92014-01-27 17:08:16 -08003413class unicast_query_timeout(bsn_tlv):
3414 type = 9
3415
3416 def __init__(self, value=None):
3417 if value != None:
3418 self.value = value
3419 else:
3420 self.value = 0
3421 return
3422
3423 def pack(self):
3424 packed = []
3425 packed.append(struct.pack("!H", self.type))
3426 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3427 packed.append(struct.pack("!L", self.value))
3428 length = sum([len(x) for x in packed])
3429 packed[1] = struct.pack("!H", length)
3430 return ''.join(packed)
3431
3432 @staticmethod
3433 def unpack(reader):
3434 obj = unicast_query_timeout()
3435 _type = reader.read("!H")[0]
3436 assert(_type == 9)
3437 _length = reader.read("!H")[0]
3438 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003439 reader = orig_reader.slice(_length, 4)
Rich Lane95f7fc92014-01-27 17:08:16 -08003440 obj.value = reader.read("!L")[0]
3441 return obj
3442
3443 def __eq__(self, other):
3444 if type(self) != type(other): return False
3445 if self.value != other.value: return False
3446 return True
3447
3448 def pretty_print(self, q):
3449 q.text("unicast_query_timeout {")
3450 with q.group():
3451 with q.indent(2):
3452 q.breakable()
3453 q.text("value = ");
3454 q.text("%#x" % self.value)
3455 q.breakable()
3456 q.text('}')
3457
3458bsn_tlv.subtypes[9] = unicast_query_timeout
3459
Harshmeet Singhe6323402015-04-02 14:38:52 -07003460class vlan_pcp(bsn_tlv):
3461 type = 72
3462
3463 def __init__(self, value=None):
3464 if value != None:
3465 self.value = value
3466 else:
3467 self.value = 0
3468 return
3469
3470 def pack(self):
3471 packed = []
3472 packed.append(struct.pack("!H", self.type))
3473 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3474 packed.append(struct.pack("!B", self.value))
3475 length = sum([len(x) for x in packed])
3476 packed[1] = struct.pack("!H", length)
3477 return ''.join(packed)
3478
3479 @staticmethod
3480 def unpack(reader):
3481 obj = vlan_pcp()
3482 _type = reader.read("!H")[0]
3483 assert(_type == 72)
3484 _length = reader.read("!H")[0]
3485 orig_reader = reader
3486 reader = orig_reader.slice(_length, 4)
3487 obj.value = reader.read("!B")[0]
3488 return obj
3489
3490 def __eq__(self, other):
3491 if type(self) != type(other): return False
3492 if self.value != other.value: return False
3493 return True
3494
3495 def pretty_print(self, q):
3496 q.text("vlan_pcp {")
3497 with q.group():
3498 with q.indent(2):
3499 q.breakable()
3500 q.text("value = ");
3501 q.text("%#x" % self.value)
3502 q.breakable()
3503 q.text('}')
3504
3505bsn_tlv.subtypes[72] = vlan_pcp
3506
Rich Lane5454b682014-01-14 17:07:36 -08003507class vlan_vid(bsn_tlv):
3508 type = 6
3509
3510 def __init__(self, value=None):
3511 if value != None:
3512 self.value = value
3513 else:
3514 self.value = 0
3515 return
3516
3517 def pack(self):
3518 packed = []
3519 packed.append(struct.pack("!H", self.type))
3520 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3521 packed.append(struct.pack("!H", self.value))
3522 length = sum([len(x) for x in packed])
3523 packed[1] = struct.pack("!H", length)
3524 return ''.join(packed)
3525
3526 @staticmethod
3527 def unpack(reader):
3528 obj = vlan_vid()
3529 _type = reader.read("!H")[0]
3530 assert(_type == 6)
3531 _length = reader.read("!H")[0]
3532 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003533 reader = orig_reader.slice(_length, 4)
Rich Lane5454b682014-01-14 17:07:36 -08003534 obj.value = reader.read("!H")[0]
3535 return obj
3536
3537 def __eq__(self, other):
3538 if type(self) != type(other): return False
3539 if self.value != other.value: return False
3540 return True
3541
3542 def pretty_print(self, q):
3543 q.text("vlan_vid {")
3544 with q.group():
3545 with q.indent(2):
3546 q.breakable()
3547 q.text("value = ");
3548 q.text("%#x" % self.value)
3549 q.breakable()
3550 q.text('}')
3551
3552bsn_tlv.subtypes[6] = vlan_vid
3553
Rich Lane93b33132014-04-21 12:20:58 -07003554class vrf(bsn_tlv):
3555 type = 19
3556
3557 def __init__(self, value=None):
3558 if value != None:
3559 self.value = value
3560 else:
3561 self.value = 0
3562 return
3563
3564 def pack(self):
3565 packed = []
3566 packed.append(struct.pack("!H", self.type))
3567 packed.append(struct.pack("!H", 0)) # placeholder for length at index 1
3568 packed.append(struct.pack("!L", self.value))
3569 length = sum([len(x) for x in packed])
3570 packed[1] = struct.pack("!H", length)
3571 return ''.join(packed)
3572
3573 @staticmethod
3574 def unpack(reader):
3575 obj = vrf()
3576 _type = reader.read("!H")[0]
3577 assert(_type == 19)
3578 _length = reader.read("!H")[0]
3579 orig_reader = reader
Rich Lanecb18dbd2014-12-18 10:02:29 -08003580 reader = orig_reader.slice(_length, 4)
Rich Lane93b33132014-04-21 12:20:58 -07003581 obj.value = reader.read("!L")[0]
3582 return obj
3583
3584 def __eq__(self, other):
3585 if type(self) != type(other): return False
3586 if self.value != other.value: return False
3587 return True
3588
3589 def pretty_print(self, q):
3590 q.text("vrf {")
3591 with q.group():
3592 with q.indent(2):
3593 q.breakable()
3594 q.text("value = ");
3595 q.text("%#x" % self.value)
3596 q.breakable()
3597 q.text('}')
3598
3599bsn_tlv.subtypes[19] = vrf
3600
Rich Lane5454b682014-01-14 17:07:36 -08003601