blob: 67c8f9a17e62643fa68692a9e941cb9b099763af [file] [log] [blame]
Rich Lane2e079da2014-10-29 15:30:24 -07001# Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
2# Copyright (c) 2011, 2012 Open Networking Foundation
3# Copyright (c) 2012, 2013 Big Switch Networks, Inc.
4# See the file LICENSE.pyloxi which should have been included in the source distribution
5
6# Automatically generated by LOXI from template module.py
7# Do not modify
8
9import struct
10import loxi
11import const
12import port_desc_prop
Rich Laneccd32ed2014-11-10 17:48:24 -080013import bsn_tlv
Rich Lane2e079da2014-10-29 15:30:24 -070014import meter_band
15import table_mod_prop
16import instruction
17import queue_desc_prop
18import oxm
19import bundle_prop
20import common
21import instruction_id
22import action
23import role_prop
24import message
25import queue_stats_prop
26import port_stats_prop
27import port_mod_prop
28import async_config_prop
29import action_id
30import util
31import loxi.generic_util
32
33class message(loxi.OFObject):
34 subtypes = {}
35
36 version = 5
37
38 def __init__(self, type=None, xid=None):
39 if type != None:
40 self.type = type
41 else:
42 self.type = 0
43 if xid != None:
44 self.xid = xid
45 else:
46 self.xid = None
47 return
48
49 def pack(self):
50 packed = []
51 packed.append(struct.pack("!B", self.version))
52 packed.append(struct.pack("!B", self.type))
53 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
54 packed.append(struct.pack("!L", self.xid))
55 length = sum([len(x) for x in packed])
56 packed[2] = struct.pack("!H", length)
57 return ''.join(packed)
58
59 @staticmethod
60 def unpack(reader):
61 subtype, = reader.peek('B', 1)
62 subclass = message.subtypes.get(subtype)
63 if subclass:
64 return subclass.unpack(reader)
65
66 obj = message()
67 _version = reader.read("!B")[0]
68 assert(_version == 5)
69 obj.type = reader.read("!B")[0]
70 _length = reader.read("!H")[0]
71 orig_reader = reader
72 reader = orig_reader.slice(_length - (2 + 2))
73 obj.xid = reader.read("!L")[0]
74 return obj
75
76 def __eq__(self, other):
77 if type(self) != type(other): return False
78 if self.type != other.type: return False
79 if self.xid != other.xid: return False
80 return True
81
82 def pretty_print(self, q):
83 q.text("message {")
84 with q.group():
85 with q.indent(2):
86 q.breakable()
87 q.text("xid = ");
88 if self.xid != None:
89 q.text("%#x" % self.xid)
90 else:
91 q.text('None')
92 q.breakable()
93 q.text('}')
94
95
96class stats_reply(message):
97 subtypes = {}
98
99 version = 5
100 type = 19
101
102 def __init__(self, xid=None, stats_type=None, flags=None):
103 if xid != None:
104 self.xid = xid
105 else:
106 self.xid = None
107 if stats_type != None:
108 self.stats_type = stats_type
109 else:
110 self.stats_type = 0
111 if flags != None:
112 self.flags = flags
113 else:
114 self.flags = 0
115 return
116
117 def pack(self):
118 packed = []
119 packed.append(struct.pack("!B", self.version))
120 packed.append(struct.pack("!B", self.type))
121 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
122 packed.append(struct.pack("!L", self.xid))
123 packed.append(struct.pack("!H", self.stats_type))
124 packed.append(struct.pack("!H", self.flags))
125 packed.append('\x00' * 4)
126 length = sum([len(x) for x in packed])
127 packed[2] = struct.pack("!H", length)
128 return ''.join(packed)
129
130 @staticmethod
131 def unpack(reader):
132 subtype, = reader.peek('!H', 8)
133 subclass = stats_reply.subtypes.get(subtype)
134 if subclass:
135 return subclass.unpack(reader)
136
137 obj = stats_reply()
138 _version = reader.read("!B")[0]
139 assert(_version == 5)
140 _type = reader.read("!B")[0]
141 assert(_type == 19)
142 _length = reader.read("!H")[0]
143 orig_reader = reader
144 reader = orig_reader.slice(_length - (2 + 2))
145 obj.xid = reader.read("!L")[0]
146 obj.stats_type = reader.read("!H")[0]
147 obj.flags = reader.read("!H")[0]
148 reader.skip(4)
149 return obj
150
151 def __eq__(self, other):
152 if type(self) != type(other): return False
153 if self.xid != other.xid: return False
154 if self.stats_type != other.stats_type: return False
155 if self.flags != other.flags: return False
156 return True
157
158 def pretty_print(self, q):
159 q.text("stats_reply {")
160 with q.group():
161 with q.indent(2):
162 q.breakable()
163 q.text("xid = ");
164 if self.xid != None:
165 q.text("%#x" % self.xid)
166 else:
167 q.text('None')
168 q.text(","); q.breakable()
169 q.text("flags = ");
170 q.text("%#x" % self.flags)
171 q.breakable()
172 q.text('}')
173
174message.subtypes[19] = stats_reply
175
176class aggregate_stats_reply(stats_reply):
177 version = 5
178 type = 19
179 stats_type = 2
180
181 def __init__(self, xid=None, flags=None, packet_count=None, byte_count=None, flow_count=None):
182 if xid != None:
183 self.xid = xid
184 else:
185 self.xid = None
186 if flags != None:
187 self.flags = flags
188 else:
189 self.flags = 0
190 if packet_count != None:
191 self.packet_count = packet_count
192 else:
193 self.packet_count = 0
194 if byte_count != None:
195 self.byte_count = byte_count
196 else:
197 self.byte_count = 0
198 if flow_count != None:
199 self.flow_count = flow_count
200 else:
201 self.flow_count = 0
202 return
203
204 def pack(self):
205 packed = []
206 packed.append(struct.pack("!B", self.version))
207 packed.append(struct.pack("!B", self.type))
208 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
209 packed.append(struct.pack("!L", self.xid))
210 packed.append(struct.pack("!H", self.stats_type))
211 packed.append(struct.pack("!H", self.flags))
212 packed.append('\x00' * 4)
213 packed.append(struct.pack("!Q", self.packet_count))
214 packed.append(struct.pack("!Q", self.byte_count))
215 packed.append(struct.pack("!L", self.flow_count))
216 packed.append('\x00' * 4)
217 length = sum([len(x) for x in packed])
218 packed[2] = struct.pack("!H", length)
219 return ''.join(packed)
220
221 @staticmethod
222 def unpack(reader):
223 obj = aggregate_stats_reply()
224 _version = reader.read("!B")[0]
225 assert(_version == 5)
226 _type = reader.read("!B")[0]
227 assert(_type == 19)
228 _length = reader.read("!H")[0]
229 orig_reader = reader
230 reader = orig_reader.slice(_length - (2 + 2))
231 obj.xid = reader.read("!L")[0]
232 _stats_type = reader.read("!H")[0]
233 assert(_stats_type == 2)
234 obj.flags = reader.read("!H")[0]
235 reader.skip(4)
236 obj.packet_count = reader.read("!Q")[0]
237 obj.byte_count = reader.read("!Q")[0]
238 obj.flow_count = reader.read("!L")[0]
239 reader.skip(4)
240 return obj
241
242 def __eq__(self, other):
243 if type(self) != type(other): return False
244 if self.xid != other.xid: return False
245 if self.flags != other.flags: return False
246 if self.packet_count != other.packet_count: return False
247 if self.byte_count != other.byte_count: return False
248 if self.flow_count != other.flow_count: return False
249 return True
250
251 def pretty_print(self, q):
252 q.text("aggregate_stats_reply {")
253 with q.group():
254 with q.indent(2):
255 q.breakable()
256 q.text("xid = ");
257 if self.xid != None:
258 q.text("%#x" % self.xid)
259 else:
260 q.text('None')
261 q.text(","); q.breakable()
262 q.text("flags = ");
263 q.text("%#x" % self.flags)
264 q.text(","); q.breakable()
265 q.text("packet_count = ");
266 q.text("%#x" % self.packet_count)
267 q.text(","); q.breakable()
268 q.text("byte_count = ");
269 q.text("%#x" % self.byte_count)
270 q.text(","); q.breakable()
271 q.text("flow_count = ");
272 q.text("%#x" % self.flow_count)
273 q.breakable()
274 q.text('}')
275
276stats_reply.subtypes[2] = aggregate_stats_reply
277
278class stats_request(message):
279 subtypes = {}
280
281 version = 5
282 type = 18
283
284 def __init__(self, xid=None, stats_type=None, flags=None):
285 if xid != None:
286 self.xid = xid
287 else:
288 self.xid = None
289 if stats_type != None:
290 self.stats_type = stats_type
291 else:
292 self.stats_type = 0
293 if flags != None:
294 self.flags = flags
295 else:
296 self.flags = 0
297 return
298
299 def pack(self):
300 packed = []
301 packed.append(struct.pack("!B", self.version))
302 packed.append(struct.pack("!B", self.type))
303 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
304 packed.append(struct.pack("!L", self.xid))
305 packed.append(struct.pack("!H", self.stats_type))
306 packed.append(struct.pack("!H", self.flags))
307 packed.append('\x00' * 4)
308 length = sum([len(x) for x in packed])
309 packed[2] = struct.pack("!H", length)
310 return ''.join(packed)
311
312 @staticmethod
313 def unpack(reader):
314 subtype, = reader.peek('!H', 8)
315 subclass = stats_request.subtypes.get(subtype)
316 if subclass:
317 return subclass.unpack(reader)
318
319 obj = stats_request()
320 _version = reader.read("!B")[0]
321 assert(_version == 5)
322 _type = reader.read("!B")[0]
323 assert(_type == 18)
324 _length = reader.read("!H")[0]
325 orig_reader = reader
326 reader = orig_reader.slice(_length - (2 + 2))
327 obj.xid = reader.read("!L")[0]
328 obj.stats_type = reader.read("!H")[0]
329 obj.flags = reader.read("!H")[0]
330 reader.skip(4)
331 return obj
332
333 def __eq__(self, other):
334 if type(self) != type(other): return False
335 if self.xid != other.xid: return False
336 if self.stats_type != other.stats_type: return False
337 if self.flags != other.flags: return False
338 return True
339
340 def pretty_print(self, q):
341 q.text("stats_request {")
342 with q.group():
343 with q.indent(2):
344 q.breakable()
345 q.text("xid = ");
346 if self.xid != None:
347 q.text("%#x" % self.xid)
348 else:
349 q.text('None')
350 q.text(","); q.breakable()
351 q.text("flags = ");
352 q.text("%#x" % self.flags)
353 q.breakable()
354 q.text('}')
355
356message.subtypes[18] = stats_request
357
358class aggregate_stats_request(stats_request):
359 version = 5
360 type = 18
361 stats_type = 2
362
363 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
364 if xid != None:
365 self.xid = xid
366 else:
367 self.xid = None
368 if flags != None:
369 self.flags = flags
370 else:
371 self.flags = 0
372 if table_id != None:
373 self.table_id = table_id
374 else:
375 self.table_id = 0
376 if out_port != None:
377 self.out_port = out_port
378 else:
379 self.out_port = 0
380 if out_group != None:
381 self.out_group = out_group
382 else:
383 self.out_group = 0
384 if cookie != None:
385 self.cookie = cookie
386 else:
387 self.cookie = 0
388 if cookie_mask != None:
389 self.cookie_mask = cookie_mask
390 else:
391 self.cookie_mask = 0
392 if match != None:
393 self.match = match
394 else:
395 self.match = common.match()
396 return
397
398 def pack(self):
399 packed = []
400 packed.append(struct.pack("!B", self.version))
401 packed.append(struct.pack("!B", self.type))
402 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
403 packed.append(struct.pack("!L", self.xid))
404 packed.append(struct.pack("!H", self.stats_type))
405 packed.append(struct.pack("!H", self.flags))
406 packed.append('\x00' * 4)
407 packed.append(struct.pack("!B", self.table_id))
408 packed.append('\x00' * 3)
409 packed.append(util.pack_port_no(self.out_port))
410 packed.append(struct.pack("!L", self.out_group))
411 packed.append('\x00' * 4)
412 packed.append(struct.pack("!Q", self.cookie))
413 packed.append(struct.pack("!Q", self.cookie_mask))
414 packed.append(self.match.pack())
415 length = sum([len(x) for x in packed])
416 packed[2] = struct.pack("!H", length)
417 return ''.join(packed)
418
419 @staticmethod
420 def unpack(reader):
421 obj = aggregate_stats_request()
422 _version = reader.read("!B")[0]
423 assert(_version == 5)
424 _type = reader.read("!B")[0]
425 assert(_type == 18)
426 _length = reader.read("!H")[0]
427 orig_reader = reader
428 reader = orig_reader.slice(_length - (2 + 2))
429 obj.xid = reader.read("!L")[0]
430 _stats_type = reader.read("!H")[0]
431 assert(_stats_type == 2)
432 obj.flags = reader.read("!H")[0]
433 reader.skip(4)
434 obj.table_id = reader.read("!B")[0]
435 reader.skip(3)
436 obj.out_port = util.unpack_port_no(reader)
437 obj.out_group = reader.read("!L")[0]
438 reader.skip(4)
439 obj.cookie = reader.read("!Q")[0]
440 obj.cookie_mask = reader.read("!Q")[0]
441 obj.match = common.match.unpack(reader)
442 return obj
443
444 def __eq__(self, other):
445 if type(self) != type(other): return False
446 if self.xid != other.xid: return False
447 if self.flags != other.flags: return False
448 if self.table_id != other.table_id: return False
449 if self.out_port != other.out_port: return False
450 if self.out_group != other.out_group: return False
451 if self.cookie != other.cookie: return False
452 if self.cookie_mask != other.cookie_mask: return False
453 if self.match != other.match: return False
454 return True
455
456 def pretty_print(self, q):
457 q.text("aggregate_stats_request {")
458 with q.group():
459 with q.indent(2):
460 q.breakable()
461 q.text("xid = ");
462 if self.xid != None:
463 q.text("%#x" % self.xid)
464 else:
465 q.text('None')
466 q.text(","); q.breakable()
467 q.text("flags = ");
468 q.text("%#x" % self.flags)
469 q.text(","); q.breakable()
470 q.text("table_id = ");
471 q.text("%#x" % self.table_id)
472 q.text(","); q.breakable()
473 q.text("out_port = ");
474 q.text(util.pretty_port(self.out_port))
475 q.text(","); q.breakable()
476 q.text("out_group = ");
477 q.text("%#x" % self.out_group)
478 q.text(","); q.breakable()
479 q.text("cookie = ");
480 q.text("%#x" % self.cookie)
481 q.text(","); q.breakable()
482 q.text("cookie_mask = ");
483 q.text("%#x" % self.cookie_mask)
484 q.text(","); q.breakable()
485 q.text("match = ");
486 q.pp(self.match)
487 q.breakable()
488 q.text('}')
489
490stats_request.subtypes[2] = aggregate_stats_request
491
Rich Laneccd32ed2014-11-10 17:48:24 -0800492class error_msg(message):
493 subtypes = {}
494
495 version = 5
496 type = 1
497
498 def __init__(self, xid=None, err_type=None):
499 if xid != None:
500 self.xid = xid
501 else:
502 self.xid = None
503 if err_type != None:
504 self.err_type = err_type
505 else:
506 self.err_type = 0
507 return
508
509 def pack(self):
510 packed = []
511 packed.append(struct.pack("!B", self.version))
512 packed.append(struct.pack("!B", self.type))
513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
514 packed.append(struct.pack("!L", self.xid))
515 packed.append(struct.pack("!H", self.err_type))
516 length = sum([len(x) for x in packed])
517 packed[2] = struct.pack("!H", length)
518 return ''.join(packed)
519
520 @staticmethod
521 def unpack(reader):
522 subtype, = reader.peek('!H', 8)
523 subclass = error_msg.subtypes.get(subtype)
524 if subclass:
525 return subclass.unpack(reader)
526
527 obj = error_msg()
528 _version = reader.read("!B")[0]
529 assert(_version == 5)
530 _type = reader.read("!B")[0]
531 assert(_type == 1)
532 _length = reader.read("!H")[0]
533 orig_reader = reader
534 reader = orig_reader.slice(_length - (2 + 2))
535 obj.xid = reader.read("!L")[0]
536 obj.err_type = reader.read("!H")[0]
537 return obj
538
539 def __eq__(self, other):
540 if type(self) != type(other): return False
541 if self.xid != other.xid: return False
542 if self.err_type != other.err_type: return False
543 return True
544
545 def pretty_print(self, q):
546 q.text("error_msg {")
547 with q.group():
548 with q.indent(2):
549 q.breakable()
550 q.text("xid = ");
551 if self.xid != None:
552 q.text("%#x" % self.xid)
553 else:
554 q.text('None')
555 q.breakable()
556 q.text('}')
557
558message.subtypes[1] = error_msg
559
560class async_config_failed_error_msg(error_msg):
561 version = 5
562 type = 1
563 err_type = 15
564
565 def __init__(self, xid=None, code=None, data=None):
566 if xid != None:
567 self.xid = xid
568 else:
569 self.xid = None
570 if code != None:
571 self.code = code
572 else:
573 self.code = 0
574 if data != None:
575 self.data = data
576 else:
577 self.data = ''
578 return
579
580 def pack(self):
581 packed = []
582 packed.append(struct.pack("!B", self.version))
583 packed.append(struct.pack("!B", self.type))
584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
585 packed.append(struct.pack("!L", self.xid))
586 packed.append(struct.pack("!H", self.err_type))
587 packed.append(struct.pack("!H", self.code))
588 packed.append(self.data)
589 length = sum([len(x) for x in packed])
590 packed[2] = struct.pack("!H", length)
591 return ''.join(packed)
592
593 @staticmethod
594 def unpack(reader):
595 obj = async_config_failed_error_msg()
596 _version = reader.read("!B")[0]
597 assert(_version == 5)
598 _type = reader.read("!B")[0]
599 assert(_type == 1)
600 _length = reader.read("!H")[0]
601 orig_reader = reader
602 reader = orig_reader.slice(_length - (2 + 2))
603 obj.xid = reader.read("!L")[0]
604 _err_type = reader.read("!H")[0]
605 assert(_err_type == 15)
606 obj.code = reader.read("!H")[0]
607 obj.data = str(reader.read_all())
608 return obj
609
610 def __eq__(self, other):
611 if type(self) != type(other): return False
612 if self.xid != other.xid: return False
613 if self.code != other.code: return False
614 if self.data != other.data: return False
615 return True
616
617 def pretty_print(self, q):
618 q.text("async_config_failed_error_msg {")
619 with q.group():
620 with q.indent(2):
621 q.breakable()
622 q.text("xid = ");
623 if self.xid != None:
624 q.text("%#x" % self.xid)
625 else:
626 q.text('None')
627 q.text(","); q.breakable()
628 q.text("code = ");
629 q.text("%#x" % self.code)
630 q.text(","); q.breakable()
631 q.text("data = ");
632 q.pp(self.data)
633 q.breakable()
634 q.text('}')
635
636error_msg.subtypes[15] = async_config_failed_error_msg
637
Rich Lane2e079da2014-10-29 15:30:24 -0700638class async_get_reply(message):
639 version = 5
640 type = 27
641
642 def __init__(self, xid=None, properties=None):
643 if xid != None:
644 self.xid = xid
645 else:
646 self.xid = None
647 if properties != None:
648 self.properties = properties
649 else:
650 self.properties = []
651 return
652
653 def pack(self):
654 packed = []
655 packed.append(struct.pack("!B", self.version))
656 packed.append(struct.pack("!B", self.type))
657 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
658 packed.append(struct.pack("!L", self.xid))
659 packed.append(loxi.generic_util.pack_list(self.properties))
660 length = sum([len(x) for x in packed])
661 packed[2] = struct.pack("!H", length)
662 return ''.join(packed)
663
664 @staticmethod
665 def unpack(reader):
666 obj = async_get_reply()
667 _version = reader.read("!B")[0]
668 assert(_version == 5)
669 _type = reader.read("!B")[0]
670 assert(_type == 27)
671 _length = reader.read("!H")[0]
672 orig_reader = reader
673 reader = orig_reader.slice(_length - (2 + 2))
674 obj.xid = reader.read("!L")[0]
675 obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack)
676 return obj
677
678 def __eq__(self, other):
679 if type(self) != type(other): return False
680 if self.xid != other.xid: return False
681 if self.properties != other.properties: return False
682 return True
683
684 def pretty_print(self, q):
685 q.text("async_get_reply {")
686 with q.group():
687 with q.indent(2):
688 q.breakable()
689 q.text("xid = ");
690 if self.xid != None:
691 q.text("%#x" % self.xid)
692 else:
693 q.text('None')
694 q.text(","); q.breakable()
695 q.text("properties = ");
696 q.pp(self.properties)
697 q.breakable()
698 q.text('}')
699
700message.subtypes[27] = async_get_reply
701
702class async_get_request(message):
703 version = 5
704 type = 26
705
706 def __init__(self, xid=None, properties=None):
707 if xid != None:
708 self.xid = xid
709 else:
710 self.xid = None
711 if properties != None:
712 self.properties = properties
713 else:
714 self.properties = []
715 return
716
717 def pack(self):
718 packed = []
719 packed.append(struct.pack("!B", self.version))
720 packed.append(struct.pack("!B", self.type))
721 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
722 packed.append(struct.pack("!L", self.xid))
723 packed.append(loxi.generic_util.pack_list(self.properties))
724 length = sum([len(x) for x in packed])
725 packed[2] = struct.pack("!H", length)
726 return ''.join(packed)
727
728 @staticmethod
729 def unpack(reader):
730 obj = async_get_request()
731 _version = reader.read("!B")[0]
732 assert(_version == 5)
733 _type = reader.read("!B")[0]
734 assert(_type == 26)
735 _length = reader.read("!H")[0]
736 orig_reader = reader
737 reader = orig_reader.slice(_length - (2 + 2))
738 obj.xid = reader.read("!L")[0]
739 obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack)
740 return obj
741
742 def __eq__(self, other):
743 if type(self) != type(other): return False
744 if self.xid != other.xid: return False
745 if self.properties != other.properties: return False
746 return True
747
748 def pretty_print(self, q):
749 q.text("async_get_request {")
750 with q.group():
751 with q.indent(2):
752 q.breakable()
753 q.text("xid = ");
754 if self.xid != None:
755 q.text("%#x" % self.xid)
756 else:
757 q.text('None')
758 q.text(","); q.breakable()
759 q.text("properties = ");
760 q.pp(self.properties)
761 q.breakable()
762 q.text('}')
763
764message.subtypes[26] = async_get_request
765
766class async_set(message):
767 version = 5
768 type = 28
769
770 def __init__(self, xid=None, properties=None):
771 if xid != None:
772 self.xid = xid
773 else:
774 self.xid = None
775 if properties != None:
776 self.properties = properties
777 else:
778 self.properties = []
779 return
780
781 def pack(self):
782 packed = []
783 packed.append(struct.pack("!B", self.version))
784 packed.append(struct.pack("!B", self.type))
785 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
786 packed.append(struct.pack("!L", self.xid))
787 packed.append(loxi.generic_util.pack_list(self.properties))
788 length = sum([len(x) for x in packed])
789 packed[2] = struct.pack("!H", length)
790 return ''.join(packed)
791
792 @staticmethod
793 def unpack(reader):
794 obj = async_set()
795 _version = reader.read("!B")[0]
796 assert(_version == 5)
797 _type = reader.read("!B")[0]
798 assert(_type == 28)
799 _length = reader.read("!H")[0]
800 orig_reader = reader
801 reader = orig_reader.slice(_length - (2 + 2))
802 obj.xid = reader.read("!L")[0]
803 obj.properties = loxi.generic_util.unpack_list(reader, async_config_prop.async_config_prop.unpack)
804 return obj
805
806 def __eq__(self, other):
807 if type(self) != type(other): return False
808 if self.xid != other.xid: return False
809 if self.properties != other.properties: return False
810 return True
811
812 def pretty_print(self, q):
813 q.text("async_set {")
814 with q.group():
815 with q.indent(2):
816 q.breakable()
817 q.text("xid = ");
818 if self.xid != None:
819 q.text("%#x" % self.xid)
820 else:
821 q.text('None')
822 q.text(","); q.breakable()
823 q.text("properties = ");
824 q.pp(self.properties)
825 q.breakable()
826 q.text('}')
827
828message.subtypes[28] = async_set
829
Rich Lane2e079da2014-10-29 15:30:24 -0700830class bad_action_error_msg(error_msg):
831 version = 5
832 type = 1
833 err_type = 2
834
835 def __init__(self, xid=None, code=None, data=None):
836 if xid != None:
837 self.xid = xid
838 else:
839 self.xid = None
840 if code != None:
841 self.code = code
842 else:
843 self.code = 0
844 if data != None:
845 self.data = data
846 else:
847 self.data = ''
848 return
849
850 def pack(self):
851 packed = []
852 packed.append(struct.pack("!B", self.version))
853 packed.append(struct.pack("!B", self.type))
854 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
855 packed.append(struct.pack("!L", self.xid))
856 packed.append(struct.pack("!H", self.err_type))
857 packed.append(struct.pack("!H", self.code))
858 packed.append(self.data)
859 length = sum([len(x) for x in packed])
860 packed[2] = struct.pack("!H", length)
861 return ''.join(packed)
862
863 @staticmethod
864 def unpack(reader):
865 obj = bad_action_error_msg()
866 _version = reader.read("!B")[0]
867 assert(_version == 5)
868 _type = reader.read("!B")[0]
869 assert(_type == 1)
870 _length = reader.read("!H")[0]
871 orig_reader = reader
872 reader = orig_reader.slice(_length - (2 + 2))
873 obj.xid = reader.read("!L")[0]
874 _err_type = reader.read("!H")[0]
875 assert(_err_type == 2)
876 obj.code = reader.read("!H")[0]
877 obj.data = str(reader.read_all())
878 return obj
879
880 def __eq__(self, other):
881 if type(self) != type(other): return False
882 if self.xid != other.xid: return False
883 if self.code != other.code: return False
884 if self.data != other.data: return False
885 return True
886
887 def pretty_print(self, q):
888 q.text("bad_action_error_msg {")
889 with q.group():
890 with q.indent(2):
891 q.breakable()
892 q.text("xid = ");
893 if self.xid != None:
894 q.text("%#x" % self.xid)
895 else:
896 q.text('None')
897 q.text(","); q.breakable()
898 q.text("code = ");
899 q.text("%#x" % self.code)
900 q.text(","); q.breakable()
901 q.text("data = ");
902 q.pp(self.data)
903 q.breakable()
904 q.text('}')
905
906error_msg.subtypes[2] = bad_action_error_msg
907
908class bad_instruction_error_msg(error_msg):
909 version = 5
910 type = 1
911 err_type = 3
912
913 def __init__(self, xid=None, code=None, data=None):
914 if xid != None:
915 self.xid = xid
916 else:
917 self.xid = None
918 if code != None:
919 self.code = code
920 else:
921 self.code = 0
922 if data != None:
923 self.data = data
924 else:
925 self.data = ''
926 return
927
928 def pack(self):
929 packed = []
930 packed.append(struct.pack("!B", self.version))
931 packed.append(struct.pack("!B", self.type))
932 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
933 packed.append(struct.pack("!L", self.xid))
934 packed.append(struct.pack("!H", self.err_type))
935 packed.append(struct.pack("!H", self.code))
936 packed.append(self.data)
937 length = sum([len(x) for x in packed])
938 packed[2] = struct.pack("!H", length)
939 return ''.join(packed)
940
941 @staticmethod
942 def unpack(reader):
943 obj = bad_instruction_error_msg()
944 _version = reader.read("!B")[0]
945 assert(_version == 5)
946 _type = reader.read("!B")[0]
947 assert(_type == 1)
948 _length = reader.read("!H")[0]
949 orig_reader = reader
950 reader = orig_reader.slice(_length - (2 + 2))
951 obj.xid = reader.read("!L")[0]
952 _err_type = reader.read("!H")[0]
953 assert(_err_type == 3)
954 obj.code = reader.read("!H")[0]
955 obj.data = str(reader.read_all())
956 return obj
957
958 def __eq__(self, other):
959 if type(self) != type(other): return False
960 if self.xid != other.xid: return False
961 if self.code != other.code: return False
962 if self.data != other.data: return False
963 return True
964
965 def pretty_print(self, q):
966 q.text("bad_instruction_error_msg {")
967 with q.group():
968 with q.indent(2):
969 q.breakable()
970 q.text("xid = ");
971 if self.xid != None:
972 q.text("%#x" % self.xid)
973 else:
974 q.text('None')
975 q.text(","); q.breakable()
976 q.text("code = ");
977 q.text("%#x" % self.code)
978 q.text(","); q.breakable()
979 q.text("data = ");
980 q.pp(self.data)
981 q.breakable()
982 q.text('}')
983
984error_msg.subtypes[3] = bad_instruction_error_msg
985
986class bad_match_error_msg(error_msg):
987 version = 5
988 type = 1
989 err_type = 4
990
991 def __init__(self, xid=None, code=None, data=None):
992 if xid != None:
993 self.xid = xid
994 else:
995 self.xid = None
996 if code != None:
997 self.code = code
998 else:
999 self.code = 0
1000 if data != None:
1001 self.data = data
1002 else:
1003 self.data = ''
1004 return
1005
1006 def pack(self):
1007 packed = []
1008 packed.append(struct.pack("!B", self.version))
1009 packed.append(struct.pack("!B", self.type))
1010 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1011 packed.append(struct.pack("!L", self.xid))
1012 packed.append(struct.pack("!H", self.err_type))
1013 packed.append(struct.pack("!H", self.code))
1014 packed.append(self.data)
1015 length = sum([len(x) for x in packed])
1016 packed[2] = struct.pack("!H", length)
1017 return ''.join(packed)
1018
1019 @staticmethod
1020 def unpack(reader):
1021 obj = bad_match_error_msg()
1022 _version = reader.read("!B")[0]
1023 assert(_version == 5)
1024 _type = reader.read("!B")[0]
1025 assert(_type == 1)
1026 _length = reader.read("!H")[0]
1027 orig_reader = reader
1028 reader = orig_reader.slice(_length - (2 + 2))
1029 obj.xid = reader.read("!L")[0]
1030 _err_type = reader.read("!H")[0]
1031 assert(_err_type == 4)
1032 obj.code = reader.read("!H")[0]
1033 obj.data = str(reader.read_all())
1034 return obj
1035
1036 def __eq__(self, other):
1037 if type(self) != type(other): return False
1038 if self.xid != other.xid: return False
1039 if self.code != other.code: return False
1040 if self.data != other.data: return False
1041 return True
1042
1043 def pretty_print(self, q):
1044 q.text("bad_match_error_msg {")
1045 with q.group():
1046 with q.indent(2):
1047 q.breakable()
1048 q.text("xid = ");
1049 if self.xid != None:
1050 q.text("%#x" % self.xid)
1051 else:
1052 q.text('None')
1053 q.text(","); q.breakable()
1054 q.text("code = ");
1055 q.text("%#x" % self.code)
1056 q.text(","); q.breakable()
1057 q.text("data = ");
1058 q.pp(self.data)
1059 q.breakable()
1060 q.text('}')
1061
1062error_msg.subtypes[4] = bad_match_error_msg
1063
Rich Laneccd32ed2014-11-10 17:48:24 -08001064class bad_property_error_msg(error_msg):
1065 version = 5
1066 type = 1
1067 err_type = 14
1068
1069 def __init__(self, xid=None, code=None, data=None):
1070 if xid != None:
1071 self.xid = xid
1072 else:
1073 self.xid = None
1074 if code != None:
1075 self.code = code
1076 else:
1077 self.code = 0
1078 if data != None:
1079 self.data = data
1080 else:
1081 self.data = ''
1082 return
1083
1084 def pack(self):
1085 packed = []
1086 packed.append(struct.pack("!B", self.version))
1087 packed.append(struct.pack("!B", self.type))
1088 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1089 packed.append(struct.pack("!L", self.xid))
1090 packed.append(struct.pack("!H", self.err_type))
1091 packed.append(struct.pack("!H", self.code))
1092 packed.append(self.data)
1093 length = sum([len(x) for x in packed])
1094 packed[2] = struct.pack("!H", length)
1095 return ''.join(packed)
1096
1097 @staticmethod
1098 def unpack(reader):
1099 obj = bad_property_error_msg()
1100 _version = reader.read("!B")[0]
1101 assert(_version == 5)
1102 _type = reader.read("!B")[0]
1103 assert(_type == 1)
1104 _length = reader.read("!H")[0]
1105 orig_reader = reader
1106 reader = orig_reader.slice(_length - (2 + 2))
1107 obj.xid = reader.read("!L")[0]
1108 _err_type = reader.read("!H")[0]
1109 assert(_err_type == 14)
1110 obj.code = reader.read("!H")[0]
1111 obj.data = str(reader.read_all())
1112 return obj
1113
1114 def __eq__(self, other):
1115 if type(self) != type(other): return False
1116 if self.xid != other.xid: return False
1117 if self.code != other.code: return False
1118 if self.data != other.data: return False
1119 return True
1120
1121 def pretty_print(self, q):
1122 q.text("bad_property_error_msg {")
1123 with q.group():
1124 with q.indent(2):
1125 q.breakable()
1126 q.text("xid = ");
1127 if self.xid != None:
1128 q.text("%#x" % self.xid)
1129 else:
1130 q.text('None')
1131 q.text(","); q.breakable()
1132 q.text("code = ");
1133 q.text("%#x" % self.code)
1134 q.text(","); q.breakable()
1135 q.text("data = ");
1136 q.pp(self.data)
1137 q.breakable()
1138 q.text('}')
1139
1140error_msg.subtypes[14] = bad_property_error_msg
1141
Rich Lane2e079da2014-10-29 15:30:24 -07001142class bad_request_error_msg(error_msg):
1143 version = 5
1144 type = 1
1145 err_type = 1
1146
1147 def __init__(self, xid=None, code=None, data=None):
1148 if xid != None:
1149 self.xid = xid
1150 else:
1151 self.xid = None
1152 if code != None:
1153 self.code = code
1154 else:
1155 self.code = 0
1156 if data != None:
1157 self.data = data
1158 else:
1159 self.data = ''
1160 return
1161
1162 def pack(self):
1163 packed = []
1164 packed.append(struct.pack("!B", self.version))
1165 packed.append(struct.pack("!B", self.type))
1166 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1167 packed.append(struct.pack("!L", self.xid))
1168 packed.append(struct.pack("!H", self.err_type))
1169 packed.append(struct.pack("!H", self.code))
1170 packed.append(self.data)
1171 length = sum([len(x) for x in packed])
1172 packed[2] = struct.pack("!H", length)
1173 return ''.join(packed)
1174
1175 @staticmethod
1176 def unpack(reader):
1177 obj = bad_request_error_msg()
1178 _version = reader.read("!B")[0]
1179 assert(_version == 5)
1180 _type = reader.read("!B")[0]
1181 assert(_type == 1)
1182 _length = reader.read("!H")[0]
1183 orig_reader = reader
1184 reader = orig_reader.slice(_length - (2 + 2))
1185 obj.xid = reader.read("!L")[0]
1186 _err_type = reader.read("!H")[0]
1187 assert(_err_type == 1)
1188 obj.code = reader.read("!H")[0]
1189 obj.data = str(reader.read_all())
1190 return obj
1191
1192 def __eq__(self, other):
1193 if type(self) != type(other): return False
1194 if self.xid != other.xid: return False
1195 if self.code != other.code: return False
1196 if self.data != other.data: return False
1197 return True
1198
1199 def pretty_print(self, q):
1200 q.text("bad_request_error_msg {")
1201 with q.group():
1202 with q.indent(2):
1203 q.breakable()
1204 q.text("xid = ");
1205 if self.xid != None:
1206 q.text("%#x" % self.xid)
1207 else:
1208 q.text('None')
1209 q.text(","); q.breakable()
1210 q.text("code = ");
1211 q.text("%#x" % self.code)
1212 q.text(","); q.breakable()
1213 q.text("data = ");
1214 q.pp(self.data)
1215 q.breakable()
1216 q.text('}')
1217
1218error_msg.subtypes[1] = bad_request_error_msg
1219
1220class barrier_reply(message):
1221 version = 5
1222 type = 21
1223
1224 def __init__(self, xid=None):
1225 if xid != None:
1226 self.xid = xid
1227 else:
1228 self.xid = None
1229 return
1230
1231 def pack(self):
1232 packed = []
1233 packed.append(struct.pack("!B", self.version))
1234 packed.append(struct.pack("!B", self.type))
1235 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1236 packed.append(struct.pack("!L", self.xid))
1237 length = sum([len(x) for x in packed])
1238 packed[2] = struct.pack("!H", length)
1239 return ''.join(packed)
1240
1241 @staticmethod
1242 def unpack(reader):
1243 obj = barrier_reply()
1244 _version = reader.read("!B")[0]
1245 assert(_version == 5)
1246 _type = reader.read("!B")[0]
1247 assert(_type == 21)
1248 _length = reader.read("!H")[0]
1249 orig_reader = reader
1250 reader = orig_reader.slice(_length - (2 + 2))
1251 obj.xid = reader.read("!L")[0]
1252 return obj
1253
1254 def __eq__(self, other):
1255 if type(self) != type(other): return False
1256 if self.xid != other.xid: return False
1257 return True
1258
1259 def pretty_print(self, q):
1260 q.text("barrier_reply {")
1261 with q.group():
1262 with q.indent(2):
1263 q.breakable()
1264 q.text("xid = ");
1265 if self.xid != None:
1266 q.text("%#x" % self.xid)
1267 else:
1268 q.text('None')
1269 q.breakable()
1270 q.text('}')
1271
1272message.subtypes[21] = barrier_reply
1273
1274class barrier_request(message):
1275 version = 5
1276 type = 20
1277
1278 def __init__(self, xid=None):
1279 if xid != None:
1280 self.xid = xid
1281 else:
1282 self.xid = None
1283 return
1284
1285 def pack(self):
1286 packed = []
1287 packed.append(struct.pack("!B", self.version))
1288 packed.append(struct.pack("!B", self.type))
1289 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1290 packed.append(struct.pack("!L", self.xid))
1291 length = sum([len(x) for x in packed])
1292 packed[2] = struct.pack("!H", length)
1293 return ''.join(packed)
1294
1295 @staticmethod
1296 def unpack(reader):
1297 obj = barrier_request()
1298 _version = reader.read("!B")[0]
1299 assert(_version == 5)
1300 _type = reader.read("!B")[0]
1301 assert(_type == 20)
1302 _length = reader.read("!H")[0]
1303 orig_reader = reader
1304 reader = orig_reader.slice(_length - (2 + 2))
1305 obj.xid = reader.read("!L")[0]
1306 return obj
1307
1308 def __eq__(self, other):
1309 if type(self) != type(other): return False
1310 if self.xid != other.xid: return False
1311 return True
1312
1313 def pretty_print(self, q):
1314 q.text("barrier_request {")
1315 with q.group():
1316 with q.indent(2):
1317 q.breakable()
1318 q.text("xid = ");
1319 if self.xid != None:
1320 q.text("%#x" % self.xid)
1321 else:
1322 q.text('None')
1323 q.breakable()
1324 q.text('}')
1325
1326message.subtypes[20] = barrier_request
1327
1328class experimenter(message):
1329 subtypes = {}
1330
1331 version = 5
1332 type = 4
1333
1334 def __init__(self, xid=None, experimenter=None, subtype=None, data=None):
1335 if xid != None:
1336 self.xid = xid
1337 else:
1338 self.xid = None
1339 if experimenter != None:
1340 self.experimenter = experimenter
1341 else:
1342 self.experimenter = 0
1343 if subtype != None:
1344 self.subtype = subtype
1345 else:
1346 self.subtype = 0
1347 if data != None:
1348 self.data = data
1349 else:
1350 self.data = ''
1351 return
1352
1353 def pack(self):
1354 packed = []
1355 packed.append(struct.pack("!B", self.version))
1356 packed.append(struct.pack("!B", self.type))
1357 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1358 packed.append(struct.pack("!L", self.xid))
1359 packed.append(struct.pack("!L", self.experimenter))
1360 packed.append(struct.pack("!L", self.subtype))
1361 packed.append(self.data)
1362 length = sum([len(x) for x in packed])
1363 packed[2] = struct.pack("!H", length)
1364 return ''.join(packed)
1365
1366 @staticmethod
1367 def unpack(reader):
1368 subtype, = reader.peek('!L', 8)
1369 subclass = experimenter.subtypes.get(subtype)
1370 if subclass:
1371 return subclass.unpack(reader)
1372
1373 obj = experimenter()
1374 _version = reader.read("!B")[0]
1375 assert(_version == 5)
1376 _type = reader.read("!B")[0]
1377 assert(_type == 4)
1378 _length = reader.read("!H")[0]
1379 orig_reader = reader
1380 reader = orig_reader.slice(_length - (2 + 2))
1381 obj.xid = reader.read("!L")[0]
1382 obj.experimenter = reader.read("!L")[0]
1383 obj.subtype = reader.read("!L")[0]
1384 obj.data = str(reader.read_all())
1385 return obj
1386
1387 def __eq__(self, other):
1388 if type(self) != type(other): return False
1389 if self.xid != other.xid: return False
1390 if self.experimenter != other.experimenter: return False
1391 if self.subtype != other.subtype: return False
1392 if self.data != other.data: return False
1393 return True
1394
1395 def pretty_print(self, q):
1396 q.text("experimenter {")
1397 with q.group():
1398 with q.indent(2):
1399 q.breakable()
1400 q.text("xid = ");
1401 if self.xid != None:
1402 q.text("%#x" % self.xid)
1403 else:
1404 q.text('None')
1405 q.text(","); q.breakable()
1406 q.text("subtype = ");
1407 q.text("%#x" % self.subtype)
1408 q.text(","); q.breakable()
1409 q.text("data = ");
1410 q.pp(self.data)
1411 q.breakable()
1412 q.text('}')
1413
1414message.subtypes[4] = experimenter
1415
1416class bsn_header(experimenter):
1417 subtypes = {}
1418
1419 version = 5
1420 type = 4
1421 experimenter = 6035143
1422
1423 def __init__(self, xid=None, subtype=None):
1424 if xid != None:
1425 self.xid = xid
1426 else:
1427 self.xid = None
1428 if subtype != None:
1429 self.subtype = subtype
1430 else:
1431 self.subtype = 0
1432 return
1433
1434 def pack(self):
1435 packed = []
1436 packed.append(struct.pack("!B", self.version))
1437 packed.append(struct.pack("!B", self.type))
1438 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1439 packed.append(struct.pack("!L", self.xid))
1440 packed.append(struct.pack("!L", self.experimenter))
1441 packed.append(struct.pack("!L", self.subtype))
1442 length = sum([len(x) for x in packed])
1443 packed[2] = struct.pack("!H", length)
1444 return ''.join(packed)
1445
1446 @staticmethod
1447 def unpack(reader):
1448 subtype, = reader.peek('!L', 12)
1449 subclass = bsn_header.subtypes.get(subtype)
1450 if subclass:
1451 return subclass.unpack(reader)
1452
1453 obj = bsn_header()
1454 _version = reader.read("!B")[0]
1455 assert(_version == 5)
1456 _type = reader.read("!B")[0]
1457 assert(_type == 4)
1458 _length = reader.read("!H")[0]
1459 orig_reader = reader
1460 reader = orig_reader.slice(_length - (2 + 2))
1461 obj.xid = reader.read("!L")[0]
1462 _experimenter = reader.read("!L")[0]
1463 assert(_experimenter == 6035143)
1464 obj.subtype = reader.read("!L")[0]
1465 return obj
1466
1467 def __eq__(self, other):
1468 if type(self) != type(other): return False
1469 if self.xid != other.xid: return False
1470 if self.subtype != other.subtype: return False
1471 return True
1472
1473 def pretty_print(self, q):
1474 q.text("bsn_header {")
1475 with q.group():
1476 with q.indent(2):
1477 q.breakable()
1478 q.text("xid = ");
1479 if self.xid != None:
1480 q.text("%#x" % self.xid)
1481 else:
1482 q.text('None')
1483 q.breakable()
1484 q.text('}')
1485
1486experimenter.subtypes[6035143] = bsn_header
1487
Rich Laneccd32ed2014-11-10 17:48:24 -08001488class bsn_arp_idle(bsn_header):
1489 version = 5
1490 type = 4
1491 experimenter = 6035143
1492 subtype = 60
1493
1494 def __init__(self, xid=None, vlan_vid=None, ipv4_addr=None):
1495 if xid != None:
1496 self.xid = xid
1497 else:
1498 self.xid = None
1499 if vlan_vid != None:
1500 self.vlan_vid = vlan_vid
1501 else:
1502 self.vlan_vid = 0
1503 if ipv4_addr != None:
1504 self.ipv4_addr = ipv4_addr
1505 else:
1506 self.ipv4_addr = 0
1507 return
1508
1509 def pack(self):
1510 packed = []
1511 packed.append(struct.pack("!B", self.version))
1512 packed.append(struct.pack("!B", self.type))
1513 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1514 packed.append(struct.pack("!L", self.xid))
1515 packed.append(struct.pack("!L", self.experimenter))
1516 packed.append(struct.pack("!L", self.subtype))
1517 packed.append(struct.pack("!H", self.vlan_vid))
1518 packed.append('\x00' * 2)
1519 packed.append(struct.pack("!L", self.ipv4_addr))
1520 length = sum([len(x) for x in packed])
1521 packed[2] = struct.pack("!H", length)
1522 return ''.join(packed)
1523
1524 @staticmethod
1525 def unpack(reader):
1526 obj = bsn_arp_idle()
1527 _version = reader.read("!B")[0]
1528 assert(_version == 5)
1529 _type = reader.read("!B")[0]
1530 assert(_type == 4)
1531 _length = reader.read("!H")[0]
1532 orig_reader = reader
1533 reader = orig_reader.slice(_length - (2 + 2))
1534 obj.xid = reader.read("!L")[0]
1535 _experimenter = reader.read("!L")[0]
1536 assert(_experimenter == 6035143)
1537 _subtype = reader.read("!L")[0]
1538 assert(_subtype == 60)
1539 obj.vlan_vid = reader.read("!H")[0]
1540 reader.skip(2)
1541 obj.ipv4_addr = reader.read("!L")[0]
1542 return obj
1543
1544 def __eq__(self, other):
1545 if type(self) != type(other): return False
1546 if self.xid != other.xid: return False
1547 if self.vlan_vid != other.vlan_vid: return False
1548 if self.ipv4_addr != other.ipv4_addr: return False
1549 return True
1550
1551 def pretty_print(self, q):
1552 q.text("bsn_arp_idle {")
1553 with q.group():
1554 with q.indent(2):
1555 q.breakable()
1556 q.text("xid = ");
1557 if self.xid != None:
1558 q.text("%#x" % self.xid)
1559 else:
1560 q.text('None')
1561 q.text(","); q.breakable()
1562 q.text("vlan_vid = ");
1563 q.text("%#x" % self.vlan_vid)
1564 q.text(","); q.breakable()
1565 q.text("ipv4_addr = ");
1566 q.text(util.pretty_ipv4(self.ipv4_addr))
1567 q.breakable()
1568 q.text('}')
1569
1570bsn_header.subtypes[60] = bsn_arp_idle
1571
Rich Lane2e079da2014-10-29 15:30:24 -07001572class bsn_bw_clear_data_reply(bsn_header):
1573 version = 5
1574 type = 4
1575 experimenter = 6035143
1576 subtype = 22
1577
1578 def __init__(self, xid=None, status=None):
1579 if xid != None:
1580 self.xid = xid
1581 else:
1582 self.xid = None
1583 if status != None:
1584 self.status = status
1585 else:
1586 self.status = 0
1587 return
1588
1589 def pack(self):
1590 packed = []
1591 packed.append(struct.pack("!B", self.version))
1592 packed.append(struct.pack("!B", self.type))
1593 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1594 packed.append(struct.pack("!L", self.xid))
1595 packed.append(struct.pack("!L", self.experimenter))
1596 packed.append(struct.pack("!L", self.subtype))
1597 packed.append(struct.pack("!L", self.status))
1598 length = sum([len(x) for x in packed])
1599 packed[2] = struct.pack("!H", length)
1600 return ''.join(packed)
1601
1602 @staticmethod
1603 def unpack(reader):
1604 obj = bsn_bw_clear_data_reply()
1605 _version = reader.read("!B")[0]
1606 assert(_version == 5)
1607 _type = reader.read("!B")[0]
1608 assert(_type == 4)
1609 _length = reader.read("!H")[0]
1610 orig_reader = reader
1611 reader = orig_reader.slice(_length - (2 + 2))
1612 obj.xid = reader.read("!L")[0]
1613 _experimenter = reader.read("!L")[0]
1614 assert(_experimenter == 6035143)
1615 _subtype = reader.read("!L")[0]
1616 assert(_subtype == 22)
1617 obj.status = reader.read("!L")[0]
1618 return obj
1619
1620 def __eq__(self, other):
1621 if type(self) != type(other): return False
1622 if self.xid != other.xid: return False
1623 if self.status != other.status: return False
1624 return True
1625
1626 def pretty_print(self, q):
1627 q.text("bsn_bw_clear_data_reply {")
1628 with q.group():
1629 with q.indent(2):
1630 q.breakable()
1631 q.text("xid = ");
1632 if self.xid != None:
1633 q.text("%#x" % self.xid)
1634 else:
1635 q.text('None')
1636 q.text(","); q.breakable()
1637 q.text("status = ");
1638 q.text("%#x" % self.status)
1639 q.breakable()
1640 q.text('}')
1641
1642bsn_header.subtypes[22] = bsn_bw_clear_data_reply
1643
1644class bsn_bw_clear_data_request(bsn_header):
1645 version = 5
1646 type = 4
1647 experimenter = 6035143
1648 subtype = 21
1649
1650 def __init__(self, xid=None):
1651 if xid != None:
1652 self.xid = xid
1653 else:
1654 self.xid = None
1655 return
1656
1657 def pack(self):
1658 packed = []
1659 packed.append(struct.pack("!B", self.version))
1660 packed.append(struct.pack("!B", self.type))
1661 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1662 packed.append(struct.pack("!L", self.xid))
1663 packed.append(struct.pack("!L", self.experimenter))
1664 packed.append(struct.pack("!L", self.subtype))
1665 length = sum([len(x) for x in packed])
1666 packed[2] = struct.pack("!H", length)
1667 return ''.join(packed)
1668
1669 @staticmethod
1670 def unpack(reader):
1671 obj = bsn_bw_clear_data_request()
1672 _version = reader.read("!B")[0]
1673 assert(_version == 5)
1674 _type = reader.read("!B")[0]
1675 assert(_type == 4)
1676 _length = reader.read("!H")[0]
1677 orig_reader = reader
1678 reader = orig_reader.slice(_length - (2 + 2))
1679 obj.xid = reader.read("!L")[0]
1680 _experimenter = reader.read("!L")[0]
1681 assert(_experimenter == 6035143)
1682 _subtype = reader.read("!L")[0]
1683 assert(_subtype == 21)
1684 return obj
1685
1686 def __eq__(self, other):
1687 if type(self) != type(other): return False
1688 if self.xid != other.xid: return False
1689 return True
1690
1691 def pretty_print(self, q):
1692 q.text("bsn_bw_clear_data_request {")
1693 with q.group():
1694 with q.indent(2):
1695 q.breakable()
1696 q.text("xid = ");
1697 if self.xid != None:
1698 q.text("%#x" % self.xid)
1699 else:
1700 q.text('None')
1701 q.breakable()
1702 q.text('}')
1703
1704bsn_header.subtypes[21] = bsn_bw_clear_data_request
1705
1706class bsn_bw_enable_get_reply(bsn_header):
1707 version = 5
1708 type = 4
1709 experimenter = 6035143
1710 subtype = 20
1711
1712 def __init__(self, xid=None, enabled=None):
1713 if xid != None:
1714 self.xid = xid
1715 else:
1716 self.xid = None
1717 if enabled != None:
1718 self.enabled = enabled
1719 else:
1720 self.enabled = 0
1721 return
1722
1723 def pack(self):
1724 packed = []
1725 packed.append(struct.pack("!B", self.version))
1726 packed.append(struct.pack("!B", self.type))
1727 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1728 packed.append(struct.pack("!L", self.xid))
1729 packed.append(struct.pack("!L", self.experimenter))
1730 packed.append(struct.pack("!L", self.subtype))
1731 packed.append(struct.pack("!L", self.enabled))
1732 length = sum([len(x) for x in packed])
1733 packed[2] = struct.pack("!H", length)
1734 return ''.join(packed)
1735
1736 @staticmethod
1737 def unpack(reader):
1738 obj = bsn_bw_enable_get_reply()
1739 _version = reader.read("!B")[0]
1740 assert(_version == 5)
1741 _type = reader.read("!B")[0]
1742 assert(_type == 4)
1743 _length = reader.read("!H")[0]
1744 orig_reader = reader
1745 reader = orig_reader.slice(_length - (2 + 2))
1746 obj.xid = reader.read("!L")[0]
1747 _experimenter = reader.read("!L")[0]
1748 assert(_experimenter == 6035143)
1749 _subtype = reader.read("!L")[0]
1750 assert(_subtype == 20)
1751 obj.enabled = reader.read("!L")[0]
1752 return obj
1753
1754 def __eq__(self, other):
1755 if type(self) != type(other): return False
1756 if self.xid != other.xid: return False
1757 if self.enabled != other.enabled: return False
1758 return True
1759
1760 def pretty_print(self, q):
1761 q.text("bsn_bw_enable_get_reply {")
1762 with q.group():
1763 with q.indent(2):
1764 q.breakable()
1765 q.text("xid = ");
1766 if self.xid != None:
1767 q.text("%#x" % self.xid)
1768 else:
1769 q.text('None')
1770 q.text(","); q.breakable()
1771 q.text("enabled = ");
1772 q.text("%#x" % self.enabled)
1773 q.breakable()
1774 q.text('}')
1775
1776bsn_header.subtypes[20] = bsn_bw_enable_get_reply
1777
1778class bsn_bw_enable_get_request(bsn_header):
1779 version = 5
1780 type = 4
1781 experimenter = 6035143
1782 subtype = 19
1783
1784 def __init__(self, xid=None):
1785 if xid != None:
1786 self.xid = xid
1787 else:
1788 self.xid = None
1789 return
1790
1791 def pack(self):
1792 packed = []
1793 packed.append(struct.pack("!B", self.version))
1794 packed.append(struct.pack("!B", self.type))
1795 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1796 packed.append(struct.pack("!L", self.xid))
1797 packed.append(struct.pack("!L", self.experimenter))
1798 packed.append(struct.pack("!L", self.subtype))
1799 length = sum([len(x) for x in packed])
1800 packed[2] = struct.pack("!H", length)
1801 return ''.join(packed)
1802
1803 @staticmethod
1804 def unpack(reader):
1805 obj = bsn_bw_enable_get_request()
1806 _version = reader.read("!B")[0]
1807 assert(_version == 5)
1808 _type = reader.read("!B")[0]
1809 assert(_type == 4)
1810 _length = reader.read("!H")[0]
1811 orig_reader = reader
1812 reader = orig_reader.slice(_length - (2 + 2))
1813 obj.xid = reader.read("!L")[0]
1814 _experimenter = reader.read("!L")[0]
1815 assert(_experimenter == 6035143)
1816 _subtype = reader.read("!L")[0]
1817 assert(_subtype == 19)
1818 return obj
1819
1820 def __eq__(self, other):
1821 if type(self) != type(other): return False
1822 if self.xid != other.xid: return False
1823 return True
1824
1825 def pretty_print(self, q):
1826 q.text("bsn_bw_enable_get_request {")
1827 with q.group():
1828 with q.indent(2):
1829 q.breakable()
1830 q.text("xid = ");
1831 if self.xid != None:
1832 q.text("%#x" % self.xid)
1833 else:
1834 q.text('None')
1835 q.breakable()
1836 q.text('}')
1837
1838bsn_header.subtypes[19] = bsn_bw_enable_get_request
1839
1840class bsn_bw_enable_set_reply(bsn_header):
1841 version = 5
1842 type = 4
1843 experimenter = 6035143
1844 subtype = 23
1845
1846 def __init__(self, xid=None, enable=None, status=None):
1847 if xid != None:
1848 self.xid = xid
1849 else:
1850 self.xid = None
1851 if enable != None:
1852 self.enable = enable
1853 else:
1854 self.enable = 0
1855 if status != None:
1856 self.status = status
1857 else:
1858 self.status = 0
1859 return
1860
1861 def pack(self):
1862 packed = []
1863 packed.append(struct.pack("!B", self.version))
1864 packed.append(struct.pack("!B", self.type))
1865 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1866 packed.append(struct.pack("!L", self.xid))
1867 packed.append(struct.pack("!L", self.experimenter))
1868 packed.append(struct.pack("!L", self.subtype))
1869 packed.append(struct.pack("!L", self.enable))
1870 packed.append(struct.pack("!L", self.status))
1871 length = sum([len(x) for x in packed])
1872 packed[2] = struct.pack("!H", length)
1873 return ''.join(packed)
1874
1875 @staticmethod
1876 def unpack(reader):
1877 obj = bsn_bw_enable_set_reply()
1878 _version = reader.read("!B")[0]
1879 assert(_version == 5)
1880 _type = reader.read("!B")[0]
1881 assert(_type == 4)
1882 _length = reader.read("!H")[0]
1883 orig_reader = reader
1884 reader = orig_reader.slice(_length - (2 + 2))
1885 obj.xid = reader.read("!L")[0]
1886 _experimenter = reader.read("!L")[0]
1887 assert(_experimenter == 6035143)
1888 _subtype = reader.read("!L")[0]
1889 assert(_subtype == 23)
1890 obj.enable = reader.read("!L")[0]
1891 obj.status = reader.read("!L")[0]
1892 return obj
1893
1894 def __eq__(self, other):
1895 if type(self) != type(other): return False
1896 if self.xid != other.xid: return False
1897 if self.enable != other.enable: return False
1898 if self.status != other.status: return False
1899 return True
1900
1901 def pretty_print(self, q):
1902 q.text("bsn_bw_enable_set_reply {")
1903 with q.group():
1904 with q.indent(2):
1905 q.breakable()
1906 q.text("xid = ");
1907 if self.xid != None:
1908 q.text("%#x" % self.xid)
1909 else:
1910 q.text('None')
1911 q.text(","); q.breakable()
1912 q.text("enable = ");
1913 q.text("%#x" % self.enable)
1914 q.text(","); q.breakable()
1915 q.text("status = ");
1916 q.text("%#x" % self.status)
1917 q.breakable()
1918 q.text('}')
1919
1920bsn_header.subtypes[23] = bsn_bw_enable_set_reply
1921
1922class bsn_bw_enable_set_request(bsn_header):
1923 version = 5
1924 type = 4
1925 experimenter = 6035143
1926 subtype = 18
1927
1928 def __init__(self, xid=None, enable=None):
1929 if xid != None:
1930 self.xid = xid
1931 else:
1932 self.xid = None
1933 if enable != None:
1934 self.enable = enable
1935 else:
1936 self.enable = 0
1937 return
1938
1939 def pack(self):
1940 packed = []
1941 packed.append(struct.pack("!B", self.version))
1942 packed.append(struct.pack("!B", self.type))
1943 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
1944 packed.append(struct.pack("!L", self.xid))
1945 packed.append(struct.pack("!L", self.experimenter))
1946 packed.append(struct.pack("!L", self.subtype))
1947 packed.append(struct.pack("!L", self.enable))
1948 length = sum([len(x) for x in packed])
1949 packed[2] = struct.pack("!H", length)
1950 return ''.join(packed)
1951
1952 @staticmethod
1953 def unpack(reader):
1954 obj = bsn_bw_enable_set_request()
1955 _version = reader.read("!B")[0]
1956 assert(_version == 5)
1957 _type = reader.read("!B")[0]
1958 assert(_type == 4)
1959 _length = reader.read("!H")[0]
1960 orig_reader = reader
1961 reader = orig_reader.slice(_length - (2 + 2))
1962 obj.xid = reader.read("!L")[0]
1963 _experimenter = reader.read("!L")[0]
1964 assert(_experimenter == 6035143)
1965 _subtype = reader.read("!L")[0]
1966 assert(_subtype == 18)
1967 obj.enable = reader.read("!L")[0]
1968 return obj
1969
1970 def __eq__(self, other):
1971 if type(self) != type(other): return False
1972 if self.xid != other.xid: return False
1973 if self.enable != other.enable: return False
1974 return True
1975
1976 def pretty_print(self, q):
1977 q.text("bsn_bw_enable_set_request {")
1978 with q.group():
1979 with q.indent(2):
1980 q.breakable()
1981 q.text("xid = ");
1982 if self.xid != None:
1983 q.text("%#x" % self.xid)
1984 else:
1985 q.text('None')
1986 q.text(","); q.breakable()
1987 q.text("enable = ");
1988 q.text("%#x" % self.enable)
1989 q.breakable()
1990 q.text('}')
1991
1992bsn_header.subtypes[18] = bsn_bw_enable_set_request
1993
Rich Laneccd32ed2014-11-10 17:48:24 -08001994class bsn_controller_connections_reply(bsn_header):
1995 version = 5
1996 type = 4
1997 experimenter = 6035143
1998 subtype = 57
1999
2000 def __init__(self, xid=None, connections=None):
2001 if xid != None:
2002 self.xid = xid
2003 else:
2004 self.xid = None
2005 if connections != None:
2006 self.connections = connections
2007 else:
2008 self.connections = []
2009 return
2010
2011 def pack(self):
2012 packed = []
2013 packed.append(struct.pack("!B", self.version))
2014 packed.append(struct.pack("!B", self.type))
2015 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2016 packed.append(struct.pack("!L", self.xid))
2017 packed.append(struct.pack("!L", self.experimenter))
2018 packed.append(struct.pack("!L", self.subtype))
2019 packed.append(loxi.generic_util.pack_list(self.connections))
2020 length = sum([len(x) for x in packed])
2021 packed[2] = struct.pack("!H", length)
2022 return ''.join(packed)
2023
2024 @staticmethod
2025 def unpack(reader):
2026 obj = bsn_controller_connections_reply()
2027 _version = reader.read("!B")[0]
2028 assert(_version == 5)
2029 _type = reader.read("!B")[0]
2030 assert(_type == 4)
2031 _length = reader.read("!H")[0]
2032 orig_reader = reader
2033 reader = orig_reader.slice(_length - (2 + 2))
2034 obj.xid = reader.read("!L")[0]
2035 _experimenter = reader.read("!L")[0]
2036 assert(_experimenter == 6035143)
2037 _subtype = reader.read("!L")[0]
2038 assert(_subtype == 57)
2039 obj.connections = loxi.generic_util.unpack_list(reader, common.bsn_controller_connection.unpack)
2040 return obj
2041
2042 def __eq__(self, other):
2043 if type(self) != type(other): return False
2044 if self.xid != other.xid: return False
2045 if self.connections != other.connections: return False
2046 return True
2047
2048 def pretty_print(self, q):
2049 q.text("bsn_controller_connections_reply {")
2050 with q.group():
2051 with q.indent(2):
2052 q.breakable()
2053 q.text("xid = ");
2054 if self.xid != None:
2055 q.text("%#x" % self.xid)
2056 else:
2057 q.text('None')
2058 q.text(","); q.breakable()
2059 q.text("connections = ");
2060 q.pp(self.connections)
2061 q.breakable()
2062 q.text('}')
2063
2064bsn_header.subtypes[57] = bsn_controller_connections_reply
2065
2066class bsn_controller_connections_request(bsn_header):
2067 version = 5
2068 type = 4
2069 experimenter = 6035143
2070 subtype = 56
2071
2072 def __init__(self, xid=None):
2073 if xid != None:
2074 self.xid = xid
2075 else:
2076 self.xid = None
2077 return
2078
2079 def pack(self):
2080 packed = []
2081 packed.append(struct.pack("!B", self.version))
2082 packed.append(struct.pack("!B", self.type))
2083 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2084 packed.append(struct.pack("!L", self.xid))
2085 packed.append(struct.pack("!L", self.experimenter))
2086 packed.append(struct.pack("!L", self.subtype))
2087 length = sum([len(x) for x in packed])
2088 packed[2] = struct.pack("!H", length)
2089 return ''.join(packed)
2090
2091 @staticmethod
2092 def unpack(reader):
2093 obj = bsn_controller_connections_request()
2094 _version = reader.read("!B")[0]
2095 assert(_version == 5)
2096 _type = reader.read("!B")[0]
2097 assert(_type == 4)
2098 _length = reader.read("!H")[0]
2099 orig_reader = reader
2100 reader = orig_reader.slice(_length - (2 + 2))
2101 obj.xid = reader.read("!L")[0]
2102 _experimenter = reader.read("!L")[0]
2103 assert(_experimenter == 6035143)
2104 _subtype = reader.read("!L")[0]
2105 assert(_subtype == 56)
2106 return obj
2107
2108 def __eq__(self, other):
2109 if type(self) != type(other): return False
2110 if self.xid != other.xid: return False
2111 return True
2112
2113 def pretty_print(self, q):
2114 q.text("bsn_controller_connections_request {")
2115 with q.group():
2116 with q.indent(2):
2117 q.breakable()
2118 q.text("xid = ");
2119 if self.xid != None:
2120 q.text("%#x" % self.xid)
2121 else:
2122 q.text('None')
2123 q.breakable()
2124 q.text('}')
2125
2126bsn_header.subtypes[56] = bsn_controller_connections_request
2127
2128class experimenter_stats_reply(stats_reply):
2129 subtypes = {}
2130
2131 version = 5
2132 type = 19
2133 stats_type = 65535
2134
2135 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2136 if xid != None:
2137 self.xid = xid
2138 else:
2139 self.xid = None
2140 if flags != None:
2141 self.flags = flags
2142 else:
2143 self.flags = 0
2144 if experimenter != None:
2145 self.experimenter = experimenter
2146 else:
2147 self.experimenter = 0
2148 if subtype != None:
2149 self.subtype = subtype
2150 else:
2151 self.subtype = 0
2152 return
2153
2154 def pack(self):
2155 packed = []
2156 packed.append(struct.pack("!B", self.version))
2157 packed.append(struct.pack("!B", self.type))
2158 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2159 packed.append(struct.pack("!L", self.xid))
2160 packed.append(struct.pack("!H", self.stats_type))
2161 packed.append(struct.pack("!H", self.flags))
2162 packed.append('\x00' * 4)
2163 packed.append(struct.pack("!L", self.experimenter))
2164 packed.append(struct.pack("!L", self.subtype))
2165 length = sum([len(x) for x in packed])
2166 packed[2] = struct.pack("!H", length)
2167 return ''.join(packed)
2168
2169 @staticmethod
2170 def unpack(reader):
2171 subtype, = reader.peek('!L', 16)
2172 subclass = experimenter_stats_reply.subtypes.get(subtype)
2173 if subclass:
2174 return subclass.unpack(reader)
2175
2176 obj = experimenter_stats_reply()
2177 _version = reader.read("!B")[0]
2178 assert(_version == 5)
2179 _type = reader.read("!B")[0]
2180 assert(_type == 19)
2181 _length = reader.read("!H")[0]
2182 orig_reader = reader
2183 reader = orig_reader.slice(_length - (2 + 2))
2184 obj.xid = reader.read("!L")[0]
2185 _stats_type = reader.read("!H")[0]
2186 assert(_stats_type == 65535)
2187 obj.flags = reader.read("!H")[0]
2188 reader.skip(4)
2189 obj.experimenter = reader.read("!L")[0]
2190 obj.subtype = reader.read("!L")[0]
2191 return obj
2192
2193 def __eq__(self, other):
2194 if type(self) != type(other): return False
2195 if self.xid != other.xid: return False
2196 if self.flags != other.flags: return False
2197 if self.experimenter != other.experimenter: return False
2198 if self.subtype != other.subtype: return False
2199 return True
2200
2201 def pretty_print(self, q):
2202 q.text("experimenter_stats_reply {")
2203 with q.group():
2204 with q.indent(2):
2205 q.breakable()
2206 q.text("xid = ");
2207 if self.xid != None:
2208 q.text("%#x" % self.xid)
2209 else:
2210 q.text('None')
2211 q.text(","); q.breakable()
2212 q.text("flags = ");
2213 q.text("%#x" % self.flags)
2214 q.text(","); q.breakable()
2215 q.text("subtype = ");
2216 q.text("%#x" % self.subtype)
2217 q.breakable()
2218 q.text('}')
2219
2220stats_reply.subtypes[65535] = experimenter_stats_reply
2221
2222class bsn_stats_reply(experimenter_stats_reply):
2223 subtypes = {}
2224
2225 version = 5
2226 type = 19
2227 stats_type = 65535
2228 experimenter = 6035143
2229
2230 def __init__(self, xid=None, flags=None, subtype=None):
2231 if xid != None:
2232 self.xid = xid
2233 else:
2234 self.xid = None
2235 if flags != None:
2236 self.flags = flags
2237 else:
2238 self.flags = 0
2239 if subtype != None:
2240 self.subtype = subtype
2241 else:
2242 self.subtype = 0
2243 return
2244
2245 def pack(self):
2246 packed = []
2247 packed.append(struct.pack("!B", self.version))
2248 packed.append(struct.pack("!B", self.type))
2249 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2250 packed.append(struct.pack("!L", self.xid))
2251 packed.append(struct.pack("!H", self.stats_type))
2252 packed.append(struct.pack("!H", self.flags))
2253 packed.append('\x00' * 4)
2254 packed.append(struct.pack("!L", self.experimenter))
2255 packed.append(struct.pack("!L", self.subtype))
2256 length = sum([len(x) for x in packed])
2257 packed[2] = struct.pack("!H", length)
2258 return ''.join(packed)
2259
2260 @staticmethod
2261 def unpack(reader):
2262 subtype, = reader.peek('!L', 20)
2263 subclass = bsn_stats_reply.subtypes.get(subtype)
2264 if subclass:
2265 return subclass.unpack(reader)
2266
2267 obj = bsn_stats_reply()
2268 _version = reader.read("!B")[0]
2269 assert(_version == 5)
2270 _type = reader.read("!B")[0]
2271 assert(_type == 19)
2272 _length = reader.read("!H")[0]
2273 orig_reader = reader
2274 reader = orig_reader.slice(_length - (2 + 2))
2275 obj.xid = reader.read("!L")[0]
2276 _stats_type = reader.read("!H")[0]
2277 assert(_stats_type == 65535)
2278 obj.flags = reader.read("!H")[0]
2279 reader.skip(4)
2280 _experimenter = reader.read("!L")[0]
2281 assert(_experimenter == 6035143)
2282 obj.subtype = reader.read("!L")[0]
2283 return obj
2284
2285 def __eq__(self, other):
2286 if type(self) != type(other): return False
2287 if self.xid != other.xid: return False
2288 if self.flags != other.flags: return False
2289 if self.subtype != other.subtype: return False
2290 return True
2291
2292 def pretty_print(self, q):
2293 q.text("bsn_stats_reply {")
2294 with q.group():
2295 with q.indent(2):
2296 q.breakable()
2297 q.text("xid = ");
2298 if self.xid != None:
2299 q.text("%#x" % self.xid)
2300 else:
2301 q.text('None')
2302 q.text(","); q.breakable()
2303 q.text("flags = ");
2304 q.text("%#x" % self.flags)
2305 q.breakable()
2306 q.text('}')
2307
2308experimenter_stats_reply.subtypes[6035143] = bsn_stats_reply
2309
2310class bsn_debug_counter_desc_stats_reply(bsn_stats_reply):
2311 version = 5
2312 type = 19
2313 stats_type = 65535
2314 experimenter = 6035143
2315 subtype = 13
2316
2317 def __init__(self, xid=None, flags=None, entries=None):
2318 if xid != None:
2319 self.xid = xid
2320 else:
2321 self.xid = None
2322 if flags != None:
2323 self.flags = flags
2324 else:
2325 self.flags = 0
2326 if entries != None:
2327 self.entries = entries
2328 else:
2329 self.entries = []
2330 return
2331
2332 def pack(self):
2333 packed = []
2334 packed.append(struct.pack("!B", self.version))
2335 packed.append(struct.pack("!B", self.type))
2336 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2337 packed.append(struct.pack("!L", self.xid))
2338 packed.append(struct.pack("!H", self.stats_type))
2339 packed.append(struct.pack("!H", self.flags))
2340 packed.append('\x00' * 4)
2341 packed.append(struct.pack("!L", self.experimenter))
2342 packed.append(struct.pack("!L", self.subtype))
2343 packed.append(loxi.generic_util.pack_list(self.entries))
2344 length = sum([len(x) for x in packed])
2345 packed[2] = struct.pack("!H", length)
2346 return ''.join(packed)
2347
2348 @staticmethod
2349 def unpack(reader):
2350 obj = bsn_debug_counter_desc_stats_reply()
2351 _version = reader.read("!B")[0]
2352 assert(_version == 5)
2353 _type = reader.read("!B")[0]
2354 assert(_type == 19)
2355 _length = reader.read("!H")[0]
2356 orig_reader = reader
2357 reader = orig_reader.slice(_length - (2 + 2))
2358 obj.xid = reader.read("!L")[0]
2359 _stats_type = reader.read("!H")[0]
2360 assert(_stats_type == 65535)
2361 obj.flags = reader.read("!H")[0]
2362 reader.skip(4)
2363 _experimenter = reader.read("!L")[0]
2364 assert(_experimenter == 6035143)
2365 _subtype = reader.read("!L")[0]
2366 assert(_subtype == 13)
2367 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_desc_stats_entry.unpack)
2368 return obj
2369
2370 def __eq__(self, other):
2371 if type(self) != type(other): return False
2372 if self.xid != other.xid: return False
2373 if self.flags != other.flags: return False
2374 if self.entries != other.entries: return False
2375 return True
2376
2377 def pretty_print(self, q):
2378 q.text("bsn_debug_counter_desc_stats_reply {")
2379 with q.group():
2380 with q.indent(2):
2381 q.breakable()
2382 q.text("xid = ");
2383 if self.xid != None:
2384 q.text("%#x" % self.xid)
2385 else:
2386 q.text('None')
2387 q.text(","); q.breakable()
2388 q.text("flags = ");
2389 q.text("%#x" % self.flags)
2390 q.text(","); q.breakable()
2391 q.text("entries = ");
2392 q.pp(self.entries)
2393 q.breakable()
2394 q.text('}')
2395
2396bsn_stats_reply.subtypes[13] = bsn_debug_counter_desc_stats_reply
2397
2398class experimenter_stats_request(stats_request):
2399 subtypes = {}
2400
2401 version = 5
2402 type = 18
2403 stats_type = 65535
2404
2405 def __init__(self, xid=None, flags=None, experimenter=None, subtype=None):
2406 if xid != None:
2407 self.xid = xid
2408 else:
2409 self.xid = None
2410 if flags != None:
2411 self.flags = flags
2412 else:
2413 self.flags = 0
2414 if experimenter != None:
2415 self.experimenter = experimenter
2416 else:
2417 self.experimenter = 0
2418 if subtype != None:
2419 self.subtype = subtype
2420 else:
2421 self.subtype = 0
2422 return
2423
2424 def pack(self):
2425 packed = []
2426 packed.append(struct.pack("!B", self.version))
2427 packed.append(struct.pack("!B", self.type))
2428 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2429 packed.append(struct.pack("!L", self.xid))
2430 packed.append(struct.pack("!H", self.stats_type))
2431 packed.append(struct.pack("!H", self.flags))
2432 packed.append('\x00' * 4)
2433 packed.append(struct.pack("!L", self.experimenter))
2434 packed.append(struct.pack("!L", self.subtype))
2435 length = sum([len(x) for x in packed])
2436 packed[2] = struct.pack("!H", length)
2437 return ''.join(packed)
2438
2439 @staticmethod
2440 def unpack(reader):
2441 subtype, = reader.peek('!L', 16)
2442 subclass = experimenter_stats_request.subtypes.get(subtype)
2443 if subclass:
2444 return subclass.unpack(reader)
2445
2446 obj = experimenter_stats_request()
2447 _version = reader.read("!B")[0]
2448 assert(_version == 5)
2449 _type = reader.read("!B")[0]
2450 assert(_type == 18)
2451 _length = reader.read("!H")[0]
2452 orig_reader = reader
2453 reader = orig_reader.slice(_length - (2 + 2))
2454 obj.xid = reader.read("!L")[0]
2455 _stats_type = reader.read("!H")[0]
2456 assert(_stats_type == 65535)
2457 obj.flags = reader.read("!H")[0]
2458 reader.skip(4)
2459 obj.experimenter = reader.read("!L")[0]
2460 obj.subtype = reader.read("!L")[0]
2461 return obj
2462
2463 def __eq__(self, other):
2464 if type(self) != type(other): return False
2465 if self.xid != other.xid: return False
2466 if self.flags != other.flags: return False
2467 if self.experimenter != other.experimenter: return False
2468 if self.subtype != other.subtype: return False
2469 return True
2470
2471 def pretty_print(self, q):
2472 q.text("experimenter_stats_request {")
2473 with q.group():
2474 with q.indent(2):
2475 q.breakable()
2476 q.text("xid = ");
2477 if self.xid != None:
2478 q.text("%#x" % self.xid)
2479 else:
2480 q.text('None')
2481 q.text(","); q.breakable()
2482 q.text("flags = ");
2483 q.text("%#x" % self.flags)
2484 q.text(","); q.breakable()
2485 q.text("subtype = ");
2486 q.text("%#x" % self.subtype)
2487 q.breakable()
2488 q.text('}')
2489
2490stats_request.subtypes[65535] = experimenter_stats_request
2491
2492class bsn_stats_request(experimenter_stats_request):
2493 subtypes = {}
2494
2495 version = 5
2496 type = 18
2497 stats_type = 65535
2498 experimenter = 6035143
2499
2500 def __init__(self, xid=None, flags=None, subtype=None):
2501 if xid != None:
2502 self.xid = xid
2503 else:
2504 self.xid = None
2505 if flags != None:
2506 self.flags = flags
2507 else:
2508 self.flags = 0
2509 if subtype != None:
2510 self.subtype = subtype
2511 else:
2512 self.subtype = 0
2513 return
2514
2515 def pack(self):
2516 packed = []
2517 packed.append(struct.pack("!B", self.version))
2518 packed.append(struct.pack("!B", self.type))
2519 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2520 packed.append(struct.pack("!L", self.xid))
2521 packed.append(struct.pack("!H", self.stats_type))
2522 packed.append(struct.pack("!H", self.flags))
2523 packed.append('\x00' * 4)
2524 packed.append(struct.pack("!L", self.experimenter))
2525 packed.append(struct.pack("!L", self.subtype))
2526 length = sum([len(x) for x in packed])
2527 packed[2] = struct.pack("!H", length)
2528 return ''.join(packed)
2529
2530 @staticmethod
2531 def unpack(reader):
2532 subtype, = reader.peek('!L', 20)
2533 subclass = bsn_stats_request.subtypes.get(subtype)
2534 if subclass:
2535 return subclass.unpack(reader)
2536
2537 obj = bsn_stats_request()
2538 _version = reader.read("!B")[0]
2539 assert(_version == 5)
2540 _type = reader.read("!B")[0]
2541 assert(_type == 18)
2542 _length = reader.read("!H")[0]
2543 orig_reader = reader
2544 reader = orig_reader.slice(_length - (2 + 2))
2545 obj.xid = reader.read("!L")[0]
2546 _stats_type = reader.read("!H")[0]
2547 assert(_stats_type == 65535)
2548 obj.flags = reader.read("!H")[0]
2549 reader.skip(4)
2550 _experimenter = reader.read("!L")[0]
2551 assert(_experimenter == 6035143)
2552 obj.subtype = reader.read("!L")[0]
2553 return obj
2554
2555 def __eq__(self, other):
2556 if type(self) != type(other): return False
2557 if self.xid != other.xid: return False
2558 if self.flags != other.flags: return False
2559 if self.subtype != other.subtype: return False
2560 return True
2561
2562 def pretty_print(self, q):
2563 q.text("bsn_stats_request {")
2564 with q.group():
2565 with q.indent(2):
2566 q.breakable()
2567 q.text("xid = ");
2568 if self.xid != None:
2569 q.text("%#x" % self.xid)
2570 else:
2571 q.text('None')
2572 q.text(","); q.breakable()
2573 q.text("flags = ");
2574 q.text("%#x" % self.flags)
2575 q.breakable()
2576 q.text('}')
2577
2578experimenter_stats_request.subtypes[6035143] = bsn_stats_request
2579
2580class bsn_debug_counter_desc_stats_request(bsn_stats_request):
2581 version = 5
2582 type = 18
2583 stats_type = 65535
2584 experimenter = 6035143
2585 subtype = 13
2586
2587 def __init__(self, xid=None, flags=None):
2588 if xid != None:
2589 self.xid = xid
2590 else:
2591 self.xid = None
2592 if flags != None:
2593 self.flags = flags
2594 else:
2595 self.flags = 0
2596 return
2597
2598 def pack(self):
2599 packed = []
2600 packed.append(struct.pack("!B", self.version))
2601 packed.append(struct.pack("!B", self.type))
2602 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2603 packed.append(struct.pack("!L", self.xid))
2604 packed.append(struct.pack("!H", self.stats_type))
2605 packed.append(struct.pack("!H", self.flags))
2606 packed.append('\x00' * 4)
2607 packed.append(struct.pack("!L", self.experimenter))
2608 packed.append(struct.pack("!L", self.subtype))
2609 length = sum([len(x) for x in packed])
2610 packed[2] = struct.pack("!H", length)
2611 return ''.join(packed)
2612
2613 @staticmethod
2614 def unpack(reader):
2615 obj = bsn_debug_counter_desc_stats_request()
2616 _version = reader.read("!B")[0]
2617 assert(_version == 5)
2618 _type = reader.read("!B")[0]
2619 assert(_type == 18)
2620 _length = reader.read("!H")[0]
2621 orig_reader = reader
2622 reader = orig_reader.slice(_length - (2 + 2))
2623 obj.xid = reader.read("!L")[0]
2624 _stats_type = reader.read("!H")[0]
2625 assert(_stats_type == 65535)
2626 obj.flags = reader.read("!H")[0]
2627 reader.skip(4)
2628 _experimenter = reader.read("!L")[0]
2629 assert(_experimenter == 6035143)
2630 _subtype = reader.read("!L")[0]
2631 assert(_subtype == 13)
2632 return obj
2633
2634 def __eq__(self, other):
2635 if type(self) != type(other): return False
2636 if self.xid != other.xid: return False
2637 if self.flags != other.flags: return False
2638 return True
2639
2640 def pretty_print(self, q):
2641 q.text("bsn_debug_counter_desc_stats_request {")
2642 with q.group():
2643 with q.indent(2):
2644 q.breakable()
2645 q.text("xid = ");
2646 if self.xid != None:
2647 q.text("%#x" % self.xid)
2648 else:
2649 q.text('None')
2650 q.text(","); q.breakable()
2651 q.text("flags = ");
2652 q.text("%#x" % self.flags)
2653 q.breakable()
2654 q.text('}')
2655
2656bsn_stats_request.subtypes[13] = bsn_debug_counter_desc_stats_request
2657
2658class bsn_debug_counter_stats_reply(bsn_stats_reply):
2659 version = 5
2660 type = 19
2661 stats_type = 65535
2662 experimenter = 6035143
2663 subtype = 12
2664
2665 def __init__(self, xid=None, flags=None, entries=None):
2666 if xid != None:
2667 self.xid = xid
2668 else:
2669 self.xid = None
2670 if flags != None:
2671 self.flags = flags
2672 else:
2673 self.flags = 0
2674 if entries != None:
2675 self.entries = entries
2676 else:
2677 self.entries = []
2678 return
2679
2680 def pack(self):
2681 packed = []
2682 packed.append(struct.pack("!B", self.version))
2683 packed.append(struct.pack("!B", self.type))
2684 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2685 packed.append(struct.pack("!L", self.xid))
2686 packed.append(struct.pack("!H", self.stats_type))
2687 packed.append(struct.pack("!H", self.flags))
2688 packed.append('\x00' * 4)
2689 packed.append(struct.pack("!L", self.experimenter))
2690 packed.append(struct.pack("!L", self.subtype))
2691 packed.append(loxi.generic_util.pack_list(self.entries))
2692 length = sum([len(x) for x in packed])
2693 packed[2] = struct.pack("!H", length)
2694 return ''.join(packed)
2695
2696 @staticmethod
2697 def unpack(reader):
2698 obj = bsn_debug_counter_stats_reply()
2699 _version = reader.read("!B")[0]
2700 assert(_version == 5)
2701 _type = reader.read("!B")[0]
2702 assert(_type == 19)
2703 _length = reader.read("!H")[0]
2704 orig_reader = reader
2705 reader = orig_reader.slice(_length - (2 + 2))
2706 obj.xid = reader.read("!L")[0]
2707 _stats_type = reader.read("!H")[0]
2708 assert(_stats_type == 65535)
2709 obj.flags = reader.read("!H")[0]
2710 reader.skip(4)
2711 _experimenter = reader.read("!L")[0]
2712 assert(_experimenter == 6035143)
2713 _subtype = reader.read("!L")[0]
2714 assert(_subtype == 12)
2715 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_debug_counter_stats_entry.unpack)
2716 return obj
2717
2718 def __eq__(self, other):
2719 if type(self) != type(other): return False
2720 if self.xid != other.xid: return False
2721 if self.flags != other.flags: return False
2722 if self.entries != other.entries: return False
2723 return True
2724
2725 def pretty_print(self, q):
2726 q.text("bsn_debug_counter_stats_reply {")
2727 with q.group():
2728 with q.indent(2):
2729 q.breakable()
2730 q.text("xid = ");
2731 if self.xid != None:
2732 q.text("%#x" % self.xid)
2733 else:
2734 q.text('None')
2735 q.text(","); q.breakable()
2736 q.text("flags = ");
2737 q.text("%#x" % self.flags)
2738 q.text(","); q.breakable()
2739 q.text("entries = ");
2740 q.pp(self.entries)
2741 q.breakable()
2742 q.text('}')
2743
2744bsn_stats_reply.subtypes[12] = bsn_debug_counter_stats_reply
2745
2746class bsn_debug_counter_stats_request(bsn_stats_request):
2747 version = 5
2748 type = 18
2749 stats_type = 65535
2750 experimenter = 6035143
2751 subtype = 12
2752
2753 def __init__(self, xid=None, flags=None):
2754 if xid != None:
2755 self.xid = xid
2756 else:
2757 self.xid = None
2758 if flags != None:
2759 self.flags = flags
2760 else:
2761 self.flags = 0
2762 return
2763
2764 def pack(self):
2765 packed = []
2766 packed.append(struct.pack("!B", self.version))
2767 packed.append(struct.pack("!B", self.type))
2768 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2769 packed.append(struct.pack("!L", self.xid))
2770 packed.append(struct.pack("!H", self.stats_type))
2771 packed.append(struct.pack("!H", self.flags))
2772 packed.append('\x00' * 4)
2773 packed.append(struct.pack("!L", self.experimenter))
2774 packed.append(struct.pack("!L", self.subtype))
2775 length = sum([len(x) for x in packed])
2776 packed[2] = struct.pack("!H", length)
2777 return ''.join(packed)
2778
2779 @staticmethod
2780 def unpack(reader):
2781 obj = bsn_debug_counter_stats_request()
2782 _version = reader.read("!B")[0]
2783 assert(_version == 5)
2784 _type = reader.read("!B")[0]
2785 assert(_type == 18)
2786 _length = reader.read("!H")[0]
2787 orig_reader = reader
2788 reader = orig_reader.slice(_length - (2 + 2))
2789 obj.xid = reader.read("!L")[0]
2790 _stats_type = reader.read("!H")[0]
2791 assert(_stats_type == 65535)
2792 obj.flags = reader.read("!H")[0]
2793 reader.skip(4)
2794 _experimenter = reader.read("!L")[0]
2795 assert(_experimenter == 6035143)
2796 _subtype = reader.read("!L")[0]
2797 assert(_subtype == 12)
2798 return obj
2799
2800 def __eq__(self, other):
2801 if type(self) != type(other): return False
2802 if self.xid != other.xid: return False
2803 if self.flags != other.flags: return False
2804 return True
2805
2806 def pretty_print(self, q):
2807 q.text("bsn_debug_counter_stats_request {")
2808 with q.group():
2809 with q.indent(2):
2810 q.breakable()
2811 q.text("xid = ");
2812 if self.xid != None:
2813 q.text("%#x" % self.xid)
2814 else:
2815 q.text('None')
2816 q.text(","); q.breakable()
2817 q.text("flags = ");
2818 q.text("%#x" % self.flags)
2819 q.breakable()
2820 q.text('}')
2821
2822bsn_stats_request.subtypes[12] = bsn_debug_counter_stats_request
2823
2824class bsn_flow_checksum_bucket_stats_reply(bsn_stats_reply):
2825 version = 5
2826 type = 19
2827 stats_type = 65535
2828 experimenter = 6035143
2829 subtype = 10
2830
2831 def __init__(self, xid=None, flags=None, entries=None):
2832 if xid != None:
2833 self.xid = xid
2834 else:
2835 self.xid = None
2836 if flags != None:
2837 self.flags = flags
2838 else:
2839 self.flags = 0
2840 if entries != None:
2841 self.entries = entries
2842 else:
2843 self.entries = []
2844 return
2845
2846 def pack(self):
2847 packed = []
2848 packed.append(struct.pack("!B", self.version))
2849 packed.append(struct.pack("!B", self.type))
2850 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2851 packed.append(struct.pack("!L", self.xid))
2852 packed.append(struct.pack("!H", self.stats_type))
2853 packed.append(struct.pack("!H", self.flags))
2854 packed.append('\x00' * 4)
2855 packed.append(struct.pack("!L", self.experimenter))
2856 packed.append(struct.pack("!L", self.subtype))
2857 packed.append(loxi.generic_util.pack_list(self.entries))
2858 length = sum([len(x) for x in packed])
2859 packed[2] = struct.pack("!H", length)
2860 return ''.join(packed)
2861
2862 @staticmethod
2863 def unpack(reader):
2864 obj = bsn_flow_checksum_bucket_stats_reply()
2865 _version = reader.read("!B")[0]
2866 assert(_version == 5)
2867 _type = reader.read("!B")[0]
2868 assert(_type == 19)
2869 _length = reader.read("!H")[0]
2870 orig_reader = reader
2871 reader = orig_reader.slice(_length - (2 + 2))
2872 obj.xid = reader.read("!L")[0]
2873 _stats_type = reader.read("!H")[0]
2874 assert(_stats_type == 65535)
2875 obj.flags = reader.read("!H")[0]
2876 reader.skip(4)
2877 _experimenter = reader.read("!L")[0]
2878 assert(_experimenter == 6035143)
2879 _subtype = reader.read("!L")[0]
2880 assert(_subtype == 10)
2881 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_flow_checksum_bucket_stats_entry.unpack)
2882 return obj
2883
2884 def __eq__(self, other):
2885 if type(self) != type(other): return False
2886 if self.xid != other.xid: return False
2887 if self.flags != other.flags: return False
2888 if self.entries != other.entries: return False
2889 return True
2890
2891 def pretty_print(self, q):
2892 q.text("bsn_flow_checksum_bucket_stats_reply {")
2893 with q.group():
2894 with q.indent(2):
2895 q.breakable()
2896 q.text("xid = ");
2897 if self.xid != None:
2898 q.text("%#x" % self.xid)
2899 else:
2900 q.text('None')
2901 q.text(","); q.breakable()
2902 q.text("flags = ");
2903 q.text("%#x" % self.flags)
2904 q.text(","); q.breakable()
2905 q.text("entries = ");
2906 q.pp(self.entries)
2907 q.breakable()
2908 q.text('}')
2909
2910bsn_stats_reply.subtypes[10] = bsn_flow_checksum_bucket_stats_reply
2911
2912class bsn_flow_checksum_bucket_stats_request(bsn_stats_request):
2913 version = 5
2914 type = 18
2915 stats_type = 65535
2916 experimenter = 6035143
2917 subtype = 10
2918
2919 def __init__(self, xid=None, flags=None, table_id=None):
2920 if xid != None:
2921 self.xid = xid
2922 else:
2923 self.xid = None
2924 if flags != None:
2925 self.flags = flags
2926 else:
2927 self.flags = 0
2928 if table_id != None:
2929 self.table_id = table_id
2930 else:
2931 self.table_id = 0
2932 return
2933
2934 def pack(self):
2935 packed = []
2936 packed.append(struct.pack("!B", self.version))
2937 packed.append(struct.pack("!B", self.type))
2938 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
2939 packed.append(struct.pack("!L", self.xid))
2940 packed.append(struct.pack("!H", self.stats_type))
2941 packed.append(struct.pack("!H", self.flags))
2942 packed.append('\x00' * 4)
2943 packed.append(struct.pack("!L", self.experimenter))
2944 packed.append(struct.pack("!L", self.subtype))
2945 packed.append(struct.pack("!B", self.table_id))
2946 length = sum([len(x) for x in packed])
2947 packed[2] = struct.pack("!H", length)
2948 return ''.join(packed)
2949
2950 @staticmethod
2951 def unpack(reader):
2952 obj = bsn_flow_checksum_bucket_stats_request()
2953 _version = reader.read("!B")[0]
2954 assert(_version == 5)
2955 _type = reader.read("!B")[0]
2956 assert(_type == 18)
2957 _length = reader.read("!H")[0]
2958 orig_reader = reader
2959 reader = orig_reader.slice(_length - (2 + 2))
2960 obj.xid = reader.read("!L")[0]
2961 _stats_type = reader.read("!H")[0]
2962 assert(_stats_type == 65535)
2963 obj.flags = reader.read("!H")[0]
2964 reader.skip(4)
2965 _experimenter = reader.read("!L")[0]
2966 assert(_experimenter == 6035143)
2967 _subtype = reader.read("!L")[0]
2968 assert(_subtype == 10)
2969 obj.table_id = reader.read("!B")[0]
2970 return obj
2971
2972 def __eq__(self, other):
2973 if type(self) != type(other): return False
2974 if self.xid != other.xid: return False
2975 if self.flags != other.flags: return False
2976 if self.table_id != other.table_id: return False
2977 return True
2978
2979 def pretty_print(self, q):
2980 q.text("bsn_flow_checksum_bucket_stats_request {")
2981 with q.group():
2982 with q.indent(2):
2983 q.breakable()
2984 q.text("xid = ");
2985 if self.xid != None:
2986 q.text("%#x" % self.xid)
2987 else:
2988 q.text('None')
2989 q.text(","); q.breakable()
2990 q.text("flags = ");
2991 q.text("%#x" % self.flags)
2992 q.text(","); q.breakable()
2993 q.text("table_id = ");
2994 q.text("%#x" % self.table_id)
2995 q.breakable()
2996 q.text('}')
2997
2998bsn_stats_request.subtypes[10] = bsn_flow_checksum_bucket_stats_request
2999
3000class bsn_flow_idle(bsn_header):
3001 version = 5
3002 type = 4
3003 experimenter = 6035143
3004 subtype = 40
3005
3006 def __init__(self, xid=None, cookie=None, priority=None, table_id=None, match=None):
3007 if xid != None:
3008 self.xid = xid
3009 else:
3010 self.xid = None
3011 if cookie != None:
3012 self.cookie = cookie
3013 else:
3014 self.cookie = 0
3015 if priority != None:
3016 self.priority = priority
3017 else:
3018 self.priority = 0
3019 if table_id != None:
3020 self.table_id = table_id
3021 else:
3022 self.table_id = 0
3023 if match != None:
3024 self.match = match
3025 else:
3026 self.match = common.match()
3027 return
3028
3029 def pack(self):
3030 packed = []
3031 packed.append(struct.pack("!B", self.version))
3032 packed.append(struct.pack("!B", self.type))
3033 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3034 packed.append(struct.pack("!L", self.xid))
3035 packed.append(struct.pack("!L", self.experimenter))
3036 packed.append(struct.pack("!L", self.subtype))
3037 packed.append(struct.pack("!Q", self.cookie))
3038 packed.append(struct.pack("!H", self.priority))
3039 packed.append(struct.pack("!B", self.table_id))
3040 packed.append('\x00' * 5)
3041 packed.append(self.match.pack())
3042 length = sum([len(x) for x in packed])
3043 packed[2] = struct.pack("!H", length)
3044 return ''.join(packed)
3045
3046 @staticmethod
3047 def unpack(reader):
3048 obj = bsn_flow_idle()
3049 _version = reader.read("!B")[0]
3050 assert(_version == 5)
3051 _type = reader.read("!B")[0]
3052 assert(_type == 4)
3053 _length = reader.read("!H")[0]
3054 orig_reader = reader
3055 reader = orig_reader.slice(_length - (2 + 2))
3056 obj.xid = reader.read("!L")[0]
3057 _experimenter = reader.read("!L")[0]
3058 assert(_experimenter == 6035143)
3059 _subtype = reader.read("!L")[0]
3060 assert(_subtype == 40)
3061 obj.cookie = reader.read("!Q")[0]
3062 obj.priority = reader.read("!H")[0]
3063 obj.table_id = reader.read("!B")[0]
3064 reader.skip(5)
3065 obj.match = common.match.unpack(reader)
3066 return obj
3067
3068 def __eq__(self, other):
3069 if type(self) != type(other): return False
3070 if self.xid != other.xid: return False
3071 if self.cookie != other.cookie: return False
3072 if self.priority != other.priority: return False
3073 if self.table_id != other.table_id: return False
3074 if self.match != other.match: return False
3075 return True
3076
3077 def pretty_print(self, q):
3078 q.text("bsn_flow_idle {")
3079 with q.group():
3080 with q.indent(2):
3081 q.breakable()
3082 q.text("xid = ");
3083 if self.xid != None:
3084 q.text("%#x" % self.xid)
3085 else:
3086 q.text('None')
3087 q.text(","); q.breakable()
3088 q.text("cookie = ");
3089 q.text("%#x" % self.cookie)
3090 q.text(","); q.breakable()
3091 q.text("priority = ");
3092 q.text("%#x" % self.priority)
3093 q.text(","); q.breakable()
3094 q.text("table_id = ");
3095 q.text("%#x" % self.table_id)
3096 q.text(","); q.breakable()
3097 q.text("match = ");
3098 q.pp(self.match)
3099 q.breakable()
3100 q.text('}')
3101
3102bsn_header.subtypes[40] = bsn_flow_idle
3103
3104class bsn_flow_idle_enable_get_reply(bsn_header):
3105 version = 5
3106 type = 4
3107 experimenter = 6035143
3108 subtype = 39
3109
3110 def __init__(self, xid=None, enabled=None):
3111 if xid != None:
3112 self.xid = xid
3113 else:
3114 self.xid = None
3115 if enabled != None:
3116 self.enabled = enabled
3117 else:
3118 self.enabled = 0
3119 return
3120
3121 def pack(self):
3122 packed = []
3123 packed.append(struct.pack("!B", self.version))
3124 packed.append(struct.pack("!B", self.type))
3125 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3126 packed.append(struct.pack("!L", self.xid))
3127 packed.append(struct.pack("!L", self.experimenter))
3128 packed.append(struct.pack("!L", self.subtype))
3129 packed.append(struct.pack("!L", self.enabled))
3130 length = sum([len(x) for x in packed])
3131 packed[2] = struct.pack("!H", length)
3132 return ''.join(packed)
3133
3134 @staticmethod
3135 def unpack(reader):
3136 obj = bsn_flow_idle_enable_get_reply()
3137 _version = reader.read("!B")[0]
3138 assert(_version == 5)
3139 _type = reader.read("!B")[0]
3140 assert(_type == 4)
3141 _length = reader.read("!H")[0]
3142 orig_reader = reader
3143 reader = orig_reader.slice(_length - (2 + 2))
3144 obj.xid = reader.read("!L")[0]
3145 _experimenter = reader.read("!L")[0]
3146 assert(_experimenter == 6035143)
3147 _subtype = reader.read("!L")[0]
3148 assert(_subtype == 39)
3149 obj.enabled = reader.read("!L")[0]
3150 return obj
3151
3152 def __eq__(self, other):
3153 if type(self) != type(other): return False
3154 if self.xid != other.xid: return False
3155 if self.enabled != other.enabled: return False
3156 return True
3157
3158 def pretty_print(self, q):
3159 q.text("bsn_flow_idle_enable_get_reply {")
3160 with q.group():
3161 with q.indent(2):
3162 q.breakable()
3163 q.text("xid = ");
3164 if self.xid != None:
3165 q.text("%#x" % self.xid)
3166 else:
3167 q.text('None')
3168 q.text(","); q.breakable()
3169 q.text("enabled = ");
3170 q.text("%#x" % self.enabled)
3171 q.breakable()
3172 q.text('}')
3173
3174bsn_header.subtypes[39] = bsn_flow_idle_enable_get_reply
3175
3176class bsn_flow_idle_enable_get_request(bsn_header):
3177 version = 5
3178 type = 4
3179 experimenter = 6035143
3180 subtype = 38
3181
3182 def __init__(self, xid=None):
3183 if xid != None:
3184 self.xid = xid
3185 else:
3186 self.xid = None
3187 return
3188
3189 def pack(self):
3190 packed = []
3191 packed.append(struct.pack("!B", self.version))
3192 packed.append(struct.pack("!B", self.type))
3193 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3194 packed.append(struct.pack("!L", self.xid))
3195 packed.append(struct.pack("!L", self.experimenter))
3196 packed.append(struct.pack("!L", self.subtype))
3197 length = sum([len(x) for x in packed])
3198 packed[2] = struct.pack("!H", length)
3199 return ''.join(packed)
3200
3201 @staticmethod
3202 def unpack(reader):
3203 obj = bsn_flow_idle_enable_get_request()
3204 _version = reader.read("!B")[0]
3205 assert(_version == 5)
3206 _type = reader.read("!B")[0]
3207 assert(_type == 4)
3208 _length = reader.read("!H")[0]
3209 orig_reader = reader
3210 reader = orig_reader.slice(_length - (2 + 2))
3211 obj.xid = reader.read("!L")[0]
3212 _experimenter = reader.read("!L")[0]
3213 assert(_experimenter == 6035143)
3214 _subtype = reader.read("!L")[0]
3215 assert(_subtype == 38)
3216 return obj
3217
3218 def __eq__(self, other):
3219 if type(self) != type(other): return False
3220 if self.xid != other.xid: return False
3221 return True
3222
3223 def pretty_print(self, q):
3224 q.text("bsn_flow_idle_enable_get_request {")
3225 with q.group():
3226 with q.indent(2):
3227 q.breakable()
3228 q.text("xid = ");
3229 if self.xid != None:
3230 q.text("%#x" % self.xid)
3231 else:
3232 q.text('None')
3233 q.breakable()
3234 q.text('}')
3235
3236bsn_header.subtypes[38] = bsn_flow_idle_enable_get_request
3237
3238class bsn_flow_idle_enable_set_reply(bsn_header):
3239 version = 5
3240 type = 4
3241 experimenter = 6035143
3242 subtype = 37
3243
3244 def __init__(self, xid=None, enable=None, status=None):
3245 if xid != None:
3246 self.xid = xid
3247 else:
3248 self.xid = None
3249 if enable != None:
3250 self.enable = enable
3251 else:
3252 self.enable = 0
3253 if status != None:
3254 self.status = status
3255 else:
3256 self.status = 0
3257 return
3258
3259 def pack(self):
3260 packed = []
3261 packed.append(struct.pack("!B", self.version))
3262 packed.append(struct.pack("!B", self.type))
3263 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3264 packed.append(struct.pack("!L", self.xid))
3265 packed.append(struct.pack("!L", self.experimenter))
3266 packed.append(struct.pack("!L", self.subtype))
3267 packed.append(struct.pack("!L", self.enable))
3268 packed.append(struct.pack("!L", self.status))
3269 length = sum([len(x) for x in packed])
3270 packed[2] = struct.pack("!H", length)
3271 return ''.join(packed)
3272
3273 @staticmethod
3274 def unpack(reader):
3275 obj = bsn_flow_idle_enable_set_reply()
3276 _version = reader.read("!B")[0]
3277 assert(_version == 5)
3278 _type = reader.read("!B")[0]
3279 assert(_type == 4)
3280 _length = reader.read("!H")[0]
3281 orig_reader = reader
3282 reader = orig_reader.slice(_length - (2 + 2))
3283 obj.xid = reader.read("!L")[0]
3284 _experimenter = reader.read("!L")[0]
3285 assert(_experimenter == 6035143)
3286 _subtype = reader.read("!L")[0]
3287 assert(_subtype == 37)
3288 obj.enable = reader.read("!L")[0]
3289 obj.status = reader.read("!L")[0]
3290 return obj
3291
3292 def __eq__(self, other):
3293 if type(self) != type(other): return False
3294 if self.xid != other.xid: return False
3295 if self.enable != other.enable: return False
3296 if self.status != other.status: return False
3297 return True
3298
3299 def pretty_print(self, q):
3300 q.text("bsn_flow_idle_enable_set_reply {")
3301 with q.group():
3302 with q.indent(2):
3303 q.breakable()
3304 q.text("xid = ");
3305 if self.xid != None:
3306 q.text("%#x" % self.xid)
3307 else:
3308 q.text('None')
3309 q.text(","); q.breakable()
3310 q.text("enable = ");
3311 q.text("%#x" % self.enable)
3312 q.text(","); q.breakable()
3313 q.text("status = ");
3314 q.text("%#x" % self.status)
3315 q.breakable()
3316 q.text('}')
3317
3318bsn_header.subtypes[37] = bsn_flow_idle_enable_set_reply
3319
3320class bsn_flow_idle_enable_set_request(bsn_header):
3321 version = 5
3322 type = 4
3323 experimenter = 6035143
3324 subtype = 36
3325
3326 def __init__(self, xid=None, enable=None):
3327 if xid != None:
3328 self.xid = xid
3329 else:
3330 self.xid = None
3331 if enable != None:
3332 self.enable = enable
3333 else:
3334 self.enable = 0
3335 return
3336
3337 def pack(self):
3338 packed = []
3339 packed.append(struct.pack("!B", self.version))
3340 packed.append(struct.pack("!B", self.type))
3341 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3342 packed.append(struct.pack("!L", self.xid))
3343 packed.append(struct.pack("!L", self.experimenter))
3344 packed.append(struct.pack("!L", self.subtype))
3345 packed.append(struct.pack("!L", self.enable))
3346 length = sum([len(x) for x in packed])
3347 packed[2] = struct.pack("!H", length)
3348 return ''.join(packed)
3349
3350 @staticmethod
3351 def unpack(reader):
3352 obj = bsn_flow_idle_enable_set_request()
3353 _version = reader.read("!B")[0]
3354 assert(_version == 5)
3355 _type = reader.read("!B")[0]
3356 assert(_type == 4)
3357 _length = reader.read("!H")[0]
3358 orig_reader = reader
3359 reader = orig_reader.slice(_length - (2 + 2))
3360 obj.xid = reader.read("!L")[0]
3361 _experimenter = reader.read("!L")[0]
3362 assert(_experimenter == 6035143)
3363 _subtype = reader.read("!L")[0]
3364 assert(_subtype == 36)
3365 obj.enable = reader.read("!L")[0]
3366 return obj
3367
3368 def __eq__(self, other):
3369 if type(self) != type(other): return False
3370 if self.xid != other.xid: return False
3371 if self.enable != other.enable: return False
3372 return True
3373
3374 def pretty_print(self, q):
3375 q.text("bsn_flow_idle_enable_set_request {")
3376 with q.group():
3377 with q.indent(2):
3378 q.breakable()
3379 q.text("xid = ");
3380 if self.xid != None:
3381 q.text("%#x" % self.xid)
3382 else:
3383 q.text('None')
3384 q.text(","); q.breakable()
3385 q.text("enable = ");
3386 q.text("%#x" % self.enable)
3387 q.breakable()
3388 q.text('}')
3389
3390bsn_header.subtypes[36] = bsn_flow_idle_enable_set_request
3391
3392class bsn_gentable_bucket_stats_reply(bsn_stats_reply):
3393 version = 5
3394 type = 19
3395 stats_type = 65535
3396 experimenter = 6035143
3397 subtype = 5
3398
3399 def __init__(self, xid=None, flags=None, entries=None):
3400 if xid != None:
3401 self.xid = xid
3402 else:
3403 self.xid = None
3404 if flags != None:
3405 self.flags = flags
3406 else:
3407 self.flags = 0
3408 if entries != None:
3409 self.entries = entries
3410 else:
3411 self.entries = []
3412 return
3413
3414 def pack(self):
3415 packed = []
3416 packed.append(struct.pack("!B", self.version))
3417 packed.append(struct.pack("!B", self.type))
3418 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3419 packed.append(struct.pack("!L", self.xid))
3420 packed.append(struct.pack("!H", self.stats_type))
3421 packed.append(struct.pack("!H", self.flags))
3422 packed.append('\x00' * 4)
3423 packed.append(struct.pack("!L", self.experimenter))
3424 packed.append(struct.pack("!L", self.subtype))
3425 packed.append(loxi.generic_util.pack_list(self.entries))
3426 length = sum([len(x) for x in packed])
3427 packed[2] = struct.pack("!H", length)
3428 return ''.join(packed)
3429
3430 @staticmethod
3431 def unpack(reader):
3432 obj = bsn_gentable_bucket_stats_reply()
3433 _version = reader.read("!B")[0]
3434 assert(_version == 5)
3435 _type = reader.read("!B")[0]
3436 assert(_type == 19)
3437 _length = reader.read("!H")[0]
3438 orig_reader = reader
3439 reader = orig_reader.slice(_length - (2 + 2))
3440 obj.xid = reader.read("!L")[0]
3441 _stats_type = reader.read("!H")[0]
3442 assert(_stats_type == 65535)
3443 obj.flags = reader.read("!H")[0]
3444 reader.skip(4)
3445 _experimenter = reader.read("!L")[0]
3446 assert(_experimenter == 6035143)
3447 _subtype = reader.read("!L")[0]
3448 assert(_subtype == 5)
3449 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_bucket_stats_entry.unpack)
3450 return obj
3451
3452 def __eq__(self, other):
3453 if type(self) != type(other): return False
3454 if self.xid != other.xid: return False
3455 if self.flags != other.flags: return False
3456 if self.entries != other.entries: return False
3457 return True
3458
3459 def pretty_print(self, q):
3460 q.text("bsn_gentable_bucket_stats_reply {")
3461 with q.group():
3462 with q.indent(2):
3463 q.breakable()
3464 q.text("xid = ");
3465 if self.xid != None:
3466 q.text("%#x" % self.xid)
3467 else:
3468 q.text('None')
3469 q.text(","); q.breakable()
3470 q.text("flags = ");
3471 q.text("%#x" % self.flags)
3472 q.text(","); q.breakable()
3473 q.text("entries = ");
3474 q.pp(self.entries)
3475 q.breakable()
3476 q.text('}')
3477
3478bsn_stats_reply.subtypes[5] = bsn_gentable_bucket_stats_reply
3479
3480class bsn_gentable_bucket_stats_request(bsn_stats_request):
3481 version = 5
3482 type = 18
3483 stats_type = 65535
3484 experimenter = 6035143
3485 subtype = 5
3486
3487 def __init__(self, xid=None, flags=None, table_id=None):
3488 if xid != None:
3489 self.xid = xid
3490 else:
3491 self.xid = None
3492 if flags != None:
3493 self.flags = flags
3494 else:
3495 self.flags = 0
3496 if table_id != None:
3497 self.table_id = table_id
3498 else:
3499 self.table_id = 0
3500 return
3501
3502 def pack(self):
3503 packed = []
3504 packed.append(struct.pack("!B", self.version))
3505 packed.append(struct.pack("!B", self.type))
3506 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3507 packed.append(struct.pack("!L", self.xid))
3508 packed.append(struct.pack("!H", self.stats_type))
3509 packed.append(struct.pack("!H", self.flags))
3510 packed.append('\x00' * 4)
3511 packed.append(struct.pack("!L", self.experimenter))
3512 packed.append(struct.pack("!L", self.subtype))
3513 packed.append(struct.pack("!H", self.table_id))
3514 length = sum([len(x) for x in packed])
3515 packed[2] = struct.pack("!H", length)
3516 return ''.join(packed)
3517
3518 @staticmethod
3519 def unpack(reader):
3520 obj = bsn_gentable_bucket_stats_request()
3521 _version = reader.read("!B")[0]
3522 assert(_version == 5)
3523 _type = reader.read("!B")[0]
3524 assert(_type == 18)
3525 _length = reader.read("!H")[0]
3526 orig_reader = reader
3527 reader = orig_reader.slice(_length - (2 + 2))
3528 obj.xid = reader.read("!L")[0]
3529 _stats_type = reader.read("!H")[0]
3530 assert(_stats_type == 65535)
3531 obj.flags = reader.read("!H")[0]
3532 reader.skip(4)
3533 _experimenter = reader.read("!L")[0]
3534 assert(_experimenter == 6035143)
3535 _subtype = reader.read("!L")[0]
3536 assert(_subtype == 5)
3537 obj.table_id = reader.read("!H")[0]
3538 return obj
3539
3540 def __eq__(self, other):
3541 if type(self) != type(other): return False
3542 if self.xid != other.xid: return False
3543 if self.flags != other.flags: return False
3544 if self.table_id != other.table_id: return False
3545 return True
3546
3547 def pretty_print(self, q):
3548 q.text("bsn_gentable_bucket_stats_request {")
3549 with q.group():
3550 with q.indent(2):
3551 q.breakable()
3552 q.text("xid = ");
3553 if self.xid != None:
3554 q.text("%#x" % self.xid)
3555 else:
3556 q.text('None')
3557 q.text(","); q.breakable()
3558 q.text("flags = ");
3559 q.text("%#x" % self.flags)
3560 q.text(","); q.breakable()
3561 q.text("table_id = ");
3562 q.text("%#x" % self.table_id)
3563 q.breakable()
3564 q.text('}')
3565
3566bsn_stats_request.subtypes[5] = bsn_gentable_bucket_stats_request
3567
3568class bsn_gentable_clear_reply(bsn_header):
3569 version = 5
3570 type = 4
3571 experimenter = 6035143
3572 subtype = 49
3573
3574 def __init__(self, xid=None, table_id=None, deleted_count=None, error_count=None):
3575 if xid != None:
3576 self.xid = xid
3577 else:
3578 self.xid = None
3579 if table_id != None:
3580 self.table_id = table_id
3581 else:
3582 self.table_id = 0
3583 if deleted_count != None:
3584 self.deleted_count = deleted_count
3585 else:
3586 self.deleted_count = 0
3587 if error_count != None:
3588 self.error_count = error_count
3589 else:
3590 self.error_count = 0
3591 return
3592
3593 def pack(self):
3594 packed = []
3595 packed.append(struct.pack("!B", self.version))
3596 packed.append(struct.pack("!B", self.type))
3597 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3598 packed.append(struct.pack("!L", self.xid))
3599 packed.append(struct.pack("!L", self.experimenter))
3600 packed.append(struct.pack("!L", self.subtype))
3601 packed.append(struct.pack("!H", self.table_id))
3602 packed.append('\x00' * 2)
3603 packed.append(struct.pack("!L", self.deleted_count))
3604 packed.append(struct.pack("!L", self.error_count))
3605 length = sum([len(x) for x in packed])
3606 packed[2] = struct.pack("!H", length)
3607 return ''.join(packed)
3608
3609 @staticmethod
3610 def unpack(reader):
3611 obj = bsn_gentable_clear_reply()
3612 _version = reader.read("!B")[0]
3613 assert(_version == 5)
3614 _type = reader.read("!B")[0]
3615 assert(_type == 4)
3616 _length = reader.read("!H")[0]
3617 orig_reader = reader
3618 reader = orig_reader.slice(_length - (2 + 2))
3619 obj.xid = reader.read("!L")[0]
3620 _experimenter = reader.read("!L")[0]
3621 assert(_experimenter == 6035143)
3622 _subtype = reader.read("!L")[0]
3623 assert(_subtype == 49)
3624 obj.table_id = reader.read("!H")[0]
3625 reader.skip(2)
3626 obj.deleted_count = reader.read("!L")[0]
3627 obj.error_count = reader.read("!L")[0]
3628 return obj
3629
3630 def __eq__(self, other):
3631 if type(self) != type(other): return False
3632 if self.xid != other.xid: return False
3633 if self.table_id != other.table_id: return False
3634 if self.deleted_count != other.deleted_count: return False
3635 if self.error_count != other.error_count: return False
3636 return True
3637
3638 def pretty_print(self, q):
3639 q.text("bsn_gentable_clear_reply {")
3640 with q.group():
3641 with q.indent(2):
3642 q.breakable()
3643 q.text("xid = ");
3644 if self.xid != None:
3645 q.text("%#x" % self.xid)
3646 else:
3647 q.text('None')
3648 q.text(","); q.breakable()
3649 q.text("table_id = ");
3650 q.text("%#x" % self.table_id)
3651 q.text(","); q.breakable()
3652 q.text("deleted_count = ");
3653 q.text("%#x" % self.deleted_count)
3654 q.text(","); q.breakable()
3655 q.text("error_count = ");
3656 q.text("%#x" % self.error_count)
3657 q.breakable()
3658 q.text('}')
3659
3660bsn_header.subtypes[49] = bsn_gentable_clear_reply
3661
3662class bsn_gentable_clear_request(bsn_header):
3663 version = 5
3664 type = 4
3665 experimenter = 6035143
3666 subtype = 48
3667
3668 def __init__(self, xid=None, table_id=None, checksum=None, checksum_mask=None):
3669 if xid != None:
3670 self.xid = xid
3671 else:
3672 self.xid = None
3673 if table_id != None:
3674 self.table_id = table_id
3675 else:
3676 self.table_id = 0
3677 if checksum != None:
3678 self.checksum = checksum
3679 else:
3680 self.checksum = 0
3681 if checksum_mask != None:
3682 self.checksum_mask = checksum_mask
3683 else:
3684 self.checksum_mask = 0
3685 return
3686
3687 def pack(self):
3688 packed = []
3689 packed.append(struct.pack("!B", self.version))
3690 packed.append(struct.pack("!B", self.type))
3691 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3692 packed.append(struct.pack("!L", self.xid))
3693 packed.append(struct.pack("!L", self.experimenter))
3694 packed.append(struct.pack("!L", self.subtype))
3695 packed.append(struct.pack("!H", self.table_id))
3696 packed.append('\x00' * 2)
3697 packed.append(util.pack_checksum_128(self.checksum))
3698 packed.append(util.pack_checksum_128(self.checksum_mask))
3699 length = sum([len(x) for x in packed])
3700 packed[2] = struct.pack("!H", length)
3701 return ''.join(packed)
3702
3703 @staticmethod
3704 def unpack(reader):
3705 obj = bsn_gentable_clear_request()
3706 _version = reader.read("!B")[0]
3707 assert(_version == 5)
3708 _type = reader.read("!B")[0]
3709 assert(_type == 4)
3710 _length = reader.read("!H")[0]
3711 orig_reader = reader
3712 reader = orig_reader.slice(_length - (2 + 2))
3713 obj.xid = reader.read("!L")[0]
3714 _experimenter = reader.read("!L")[0]
3715 assert(_experimenter == 6035143)
3716 _subtype = reader.read("!L")[0]
3717 assert(_subtype == 48)
3718 obj.table_id = reader.read("!H")[0]
3719 reader.skip(2)
3720 obj.checksum = util.unpack_checksum_128(reader)
3721 obj.checksum_mask = util.unpack_checksum_128(reader)
3722 return obj
3723
3724 def __eq__(self, other):
3725 if type(self) != type(other): return False
3726 if self.xid != other.xid: return False
3727 if self.table_id != other.table_id: return False
3728 if self.checksum != other.checksum: return False
3729 if self.checksum_mask != other.checksum_mask: return False
3730 return True
3731
3732 def pretty_print(self, q):
3733 q.text("bsn_gentable_clear_request {")
3734 with q.group():
3735 with q.indent(2):
3736 q.breakable()
3737 q.text("xid = ");
3738 if self.xid != None:
3739 q.text("%#x" % self.xid)
3740 else:
3741 q.text('None')
3742 q.text(","); q.breakable()
3743 q.text("table_id = ");
3744 q.text("%#x" % self.table_id)
3745 q.text(","); q.breakable()
3746 q.text("checksum = ");
3747 q.pp(self.checksum)
3748 q.text(","); q.breakable()
3749 q.text("checksum_mask = ");
3750 q.pp(self.checksum_mask)
3751 q.breakable()
3752 q.text('}')
3753
3754bsn_header.subtypes[48] = bsn_gentable_clear_request
3755
3756class bsn_gentable_desc_stats_reply(bsn_stats_reply):
3757 version = 5
3758 type = 19
3759 stats_type = 65535
3760 experimenter = 6035143
3761 subtype = 4
3762
3763 def __init__(self, xid=None, flags=None, entries=None):
3764 if xid != None:
3765 self.xid = xid
3766 else:
3767 self.xid = None
3768 if flags != None:
3769 self.flags = flags
3770 else:
3771 self.flags = 0
3772 if entries != None:
3773 self.entries = entries
3774 else:
3775 self.entries = []
3776 return
3777
3778 def pack(self):
3779 packed = []
3780 packed.append(struct.pack("!B", self.version))
3781 packed.append(struct.pack("!B", self.type))
3782 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3783 packed.append(struct.pack("!L", self.xid))
3784 packed.append(struct.pack("!H", self.stats_type))
3785 packed.append(struct.pack("!H", self.flags))
3786 packed.append('\x00' * 4)
3787 packed.append(struct.pack("!L", self.experimenter))
3788 packed.append(struct.pack("!L", self.subtype))
3789 packed.append(loxi.generic_util.pack_list(self.entries))
3790 length = sum([len(x) for x in packed])
3791 packed[2] = struct.pack("!H", length)
3792 return ''.join(packed)
3793
3794 @staticmethod
3795 def unpack(reader):
3796 obj = bsn_gentable_desc_stats_reply()
3797 _version = reader.read("!B")[0]
3798 assert(_version == 5)
3799 _type = reader.read("!B")[0]
3800 assert(_type == 19)
3801 _length = reader.read("!H")[0]
3802 orig_reader = reader
3803 reader = orig_reader.slice(_length - (2 + 2))
3804 obj.xid = reader.read("!L")[0]
3805 _stats_type = reader.read("!H")[0]
3806 assert(_stats_type == 65535)
3807 obj.flags = reader.read("!H")[0]
3808 reader.skip(4)
3809 _experimenter = reader.read("!L")[0]
3810 assert(_experimenter == 6035143)
3811 _subtype = reader.read("!L")[0]
3812 assert(_subtype == 4)
3813 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_desc_stats_entry.unpack)
3814 return obj
3815
3816 def __eq__(self, other):
3817 if type(self) != type(other): return False
3818 if self.xid != other.xid: return False
3819 if self.flags != other.flags: return False
3820 if self.entries != other.entries: return False
3821 return True
3822
3823 def pretty_print(self, q):
3824 q.text("bsn_gentable_desc_stats_reply {")
3825 with q.group():
3826 with q.indent(2):
3827 q.breakable()
3828 q.text("xid = ");
3829 if self.xid != None:
3830 q.text("%#x" % self.xid)
3831 else:
3832 q.text('None')
3833 q.text(","); q.breakable()
3834 q.text("flags = ");
3835 q.text("%#x" % self.flags)
3836 q.text(","); q.breakable()
3837 q.text("entries = ");
3838 q.pp(self.entries)
3839 q.breakable()
3840 q.text('}')
3841
3842bsn_stats_reply.subtypes[4] = bsn_gentable_desc_stats_reply
3843
3844class bsn_gentable_desc_stats_request(bsn_stats_request):
3845 version = 5
3846 type = 18
3847 stats_type = 65535
3848 experimenter = 6035143
3849 subtype = 4
3850
3851 def __init__(self, xid=None, flags=None):
3852 if xid != None:
3853 self.xid = xid
3854 else:
3855 self.xid = None
3856 if flags != None:
3857 self.flags = flags
3858 else:
3859 self.flags = 0
3860 return
3861
3862 def pack(self):
3863 packed = []
3864 packed.append(struct.pack("!B", self.version))
3865 packed.append(struct.pack("!B", self.type))
3866 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3867 packed.append(struct.pack("!L", self.xid))
3868 packed.append(struct.pack("!H", self.stats_type))
3869 packed.append(struct.pack("!H", self.flags))
3870 packed.append('\x00' * 4)
3871 packed.append(struct.pack("!L", self.experimenter))
3872 packed.append(struct.pack("!L", self.subtype))
3873 length = sum([len(x) for x in packed])
3874 packed[2] = struct.pack("!H", length)
3875 return ''.join(packed)
3876
3877 @staticmethod
3878 def unpack(reader):
3879 obj = bsn_gentable_desc_stats_request()
3880 _version = reader.read("!B")[0]
3881 assert(_version == 5)
3882 _type = reader.read("!B")[0]
3883 assert(_type == 18)
3884 _length = reader.read("!H")[0]
3885 orig_reader = reader
3886 reader = orig_reader.slice(_length - (2 + 2))
3887 obj.xid = reader.read("!L")[0]
3888 _stats_type = reader.read("!H")[0]
3889 assert(_stats_type == 65535)
3890 obj.flags = reader.read("!H")[0]
3891 reader.skip(4)
3892 _experimenter = reader.read("!L")[0]
3893 assert(_experimenter == 6035143)
3894 _subtype = reader.read("!L")[0]
3895 assert(_subtype == 4)
3896 return obj
3897
3898 def __eq__(self, other):
3899 if type(self) != type(other): return False
3900 if self.xid != other.xid: return False
3901 if self.flags != other.flags: return False
3902 return True
3903
3904 def pretty_print(self, q):
3905 q.text("bsn_gentable_desc_stats_request {")
3906 with q.group():
3907 with q.indent(2):
3908 q.breakable()
3909 q.text("xid = ");
3910 if self.xid != None:
3911 q.text("%#x" % self.xid)
3912 else:
3913 q.text('None')
3914 q.text(","); q.breakable()
3915 q.text("flags = ");
3916 q.text("%#x" % self.flags)
3917 q.breakable()
3918 q.text('}')
3919
3920bsn_stats_request.subtypes[4] = bsn_gentable_desc_stats_request
3921
3922class bsn_gentable_entry_add(bsn_header):
3923 version = 5
3924 type = 4
3925 experimenter = 6035143
3926 subtype = 46
3927
3928 def __init__(self, xid=None, table_id=None, checksum=None, key=None, value=None):
3929 if xid != None:
3930 self.xid = xid
3931 else:
3932 self.xid = None
3933 if table_id != None:
3934 self.table_id = table_id
3935 else:
3936 self.table_id = 0
3937 if checksum != None:
3938 self.checksum = checksum
3939 else:
3940 self.checksum = 0
3941 if key != None:
3942 self.key = key
3943 else:
3944 self.key = []
3945 if value != None:
3946 self.value = value
3947 else:
3948 self.value = []
3949 return
3950
3951 def pack(self):
3952 packed = []
3953 packed.append(struct.pack("!B", self.version))
3954 packed.append(struct.pack("!B", self.type))
3955 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
3956 packed.append(struct.pack("!L", self.xid))
3957 packed.append(struct.pack("!L", self.experimenter))
3958 packed.append(struct.pack("!L", self.subtype))
3959 packed.append(struct.pack("!H", self.table_id))
3960 packed.append(struct.pack("!H", 0)) # placeholder for key_length at index 7
3961 packed.append(util.pack_checksum_128(self.checksum))
3962 packed.append(loxi.generic_util.pack_list(self.key))
3963 packed[7] = struct.pack("!H", len(packed[-1]))
3964 packed.append(loxi.generic_util.pack_list(self.value))
3965 length = sum([len(x) for x in packed])
3966 packed[2] = struct.pack("!H", length)
3967 return ''.join(packed)
3968
3969 @staticmethod
3970 def unpack(reader):
3971 obj = bsn_gentable_entry_add()
3972 _version = reader.read("!B")[0]
3973 assert(_version == 5)
3974 _type = reader.read("!B")[0]
3975 assert(_type == 4)
3976 _length = reader.read("!H")[0]
3977 orig_reader = reader
3978 reader = orig_reader.slice(_length - (2 + 2))
3979 obj.xid = reader.read("!L")[0]
3980 _experimenter = reader.read("!L")[0]
3981 assert(_experimenter == 6035143)
3982 _subtype = reader.read("!L")[0]
3983 assert(_subtype == 46)
3984 obj.table_id = reader.read("!H")[0]
3985 _key_length = reader.read("!H")[0]
3986 obj.checksum = util.unpack_checksum_128(reader)
3987 obj.key = loxi.generic_util.unpack_list(reader.slice(_key_length), bsn_tlv.bsn_tlv.unpack)
3988 obj.value = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
3989 return obj
3990
3991 def __eq__(self, other):
3992 if type(self) != type(other): return False
3993 if self.xid != other.xid: return False
3994 if self.table_id != other.table_id: return False
3995 if self.checksum != other.checksum: return False
3996 if self.key != other.key: return False
3997 if self.value != other.value: return False
3998 return True
3999
4000 def pretty_print(self, q):
4001 q.text("bsn_gentable_entry_add {")
4002 with q.group():
4003 with q.indent(2):
4004 q.breakable()
4005 q.text("xid = ");
4006 if self.xid != None:
4007 q.text("%#x" % self.xid)
4008 else:
4009 q.text('None')
4010 q.text(","); q.breakable()
4011 q.text("table_id = ");
4012 q.text("%#x" % self.table_id)
4013 q.text(","); q.breakable()
4014 q.text("checksum = ");
4015 q.pp(self.checksum)
4016 q.text(","); q.breakable()
4017 q.text("key = ");
4018 q.pp(self.key)
4019 q.text(","); q.breakable()
4020 q.text("value = ");
4021 q.pp(self.value)
4022 q.breakable()
4023 q.text('}')
4024
4025bsn_header.subtypes[46] = bsn_gentable_entry_add
4026
4027class bsn_gentable_entry_delete(bsn_header):
4028 version = 5
4029 type = 4
4030 experimenter = 6035143
4031 subtype = 47
4032
4033 def __init__(self, xid=None, table_id=None, key=None):
4034 if xid != None:
4035 self.xid = xid
4036 else:
4037 self.xid = None
4038 if table_id != None:
4039 self.table_id = table_id
4040 else:
4041 self.table_id = 0
4042 if key != None:
4043 self.key = key
4044 else:
4045 self.key = []
4046 return
4047
4048 def pack(self):
4049 packed = []
4050 packed.append(struct.pack("!B", self.version))
4051 packed.append(struct.pack("!B", self.type))
4052 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4053 packed.append(struct.pack("!L", self.xid))
4054 packed.append(struct.pack("!L", self.experimenter))
4055 packed.append(struct.pack("!L", self.subtype))
4056 packed.append(struct.pack("!H", self.table_id))
4057 packed.append(loxi.generic_util.pack_list(self.key))
4058 length = sum([len(x) for x in packed])
4059 packed[2] = struct.pack("!H", length)
4060 return ''.join(packed)
4061
4062 @staticmethod
4063 def unpack(reader):
4064 obj = bsn_gentable_entry_delete()
4065 _version = reader.read("!B")[0]
4066 assert(_version == 5)
4067 _type = reader.read("!B")[0]
4068 assert(_type == 4)
4069 _length = reader.read("!H")[0]
4070 orig_reader = reader
4071 reader = orig_reader.slice(_length - (2 + 2))
4072 obj.xid = reader.read("!L")[0]
4073 _experimenter = reader.read("!L")[0]
4074 assert(_experimenter == 6035143)
4075 _subtype = reader.read("!L")[0]
4076 assert(_subtype == 47)
4077 obj.table_id = reader.read("!H")[0]
4078 obj.key = loxi.generic_util.unpack_list(reader, bsn_tlv.bsn_tlv.unpack)
4079 return obj
4080
4081 def __eq__(self, other):
4082 if type(self) != type(other): return False
4083 if self.xid != other.xid: return False
4084 if self.table_id != other.table_id: return False
4085 if self.key != other.key: return False
4086 return True
4087
4088 def pretty_print(self, q):
4089 q.text("bsn_gentable_entry_delete {")
4090 with q.group():
4091 with q.indent(2):
4092 q.breakable()
4093 q.text("xid = ");
4094 if self.xid != None:
4095 q.text("%#x" % self.xid)
4096 else:
4097 q.text('None')
4098 q.text(","); q.breakable()
4099 q.text("table_id = ");
4100 q.text("%#x" % self.table_id)
4101 q.text(","); q.breakable()
4102 q.text("key = ");
4103 q.pp(self.key)
4104 q.breakable()
4105 q.text('}')
4106
4107bsn_header.subtypes[47] = bsn_gentable_entry_delete
4108
4109class bsn_gentable_entry_desc_stats_reply(bsn_stats_reply):
4110 version = 5
4111 type = 19
4112 stats_type = 65535
4113 experimenter = 6035143
4114 subtype = 2
4115
4116 def __init__(self, xid=None, flags=None, entries=None):
4117 if xid != None:
4118 self.xid = xid
4119 else:
4120 self.xid = None
4121 if flags != None:
4122 self.flags = flags
4123 else:
4124 self.flags = 0
4125 if entries != None:
4126 self.entries = entries
4127 else:
4128 self.entries = []
4129 return
4130
4131 def pack(self):
4132 packed = []
4133 packed.append(struct.pack("!B", self.version))
4134 packed.append(struct.pack("!B", self.type))
4135 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4136 packed.append(struct.pack("!L", self.xid))
4137 packed.append(struct.pack("!H", self.stats_type))
4138 packed.append(struct.pack("!H", self.flags))
4139 packed.append('\x00' * 4)
4140 packed.append(struct.pack("!L", self.experimenter))
4141 packed.append(struct.pack("!L", self.subtype))
4142 packed.append(loxi.generic_util.pack_list(self.entries))
4143 length = sum([len(x) for x in packed])
4144 packed[2] = struct.pack("!H", length)
4145 return ''.join(packed)
4146
4147 @staticmethod
4148 def unpack(reader):
4149 obj = bsn_gentable_entry_desc_stats_reply()
4150 _version = reader.read("!B")[0]
4151 assert(_version == 5)
4152 _type = reader.read("!B")[0]
4153 assert(_type == 19)
4154 _length = reader.read("!H")[0]
4155 orig_reader = reader
4156 reader = orig_reader.slice(_length - (2 + 2))
4157 obj.xid = reader.read("!L")[0]
4158 _stats_type = reader.read("!H")[0]
4159 assert(_stats_type == 65535)
4160 obj.flags = reader.read("!H")[0]
4161 reader.skip(4)
4162 _experimenter = reader.read("!L")[0]
4163 assert(_experimenter == 6035143)
4164 _subtype = reader.read("!L")[0]
4165 assert(_subtype == 2)
4166 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_desc_stats_entry.unpack)
4167 return obj
4168
4169 def __eq__(self, other):
4170 if type(self) != type(other): return False
4171 if self.xid != other.xid: return False
4172 if self.flags != other.flags: return False
4173 if self.entries != other.entries: return False
4174 return True
4175
4176 def pretty_print(self, q):
4177 q.text("bsn_gentable_entry_desc_stats_reply {")
4178 with q.group():
4179 with q.indent(2):
4180 q.breakable()
4181 q.text("xid = ");
4182 if self.xid != None:
4183 q.text("%#x" % self.xid)
4184 else:
4185 q.text('None')
4186 q.text(","); q.breakable()
4187 q.text("flags = ");
4188 q.text("%#x" % self.flags)
4189 q.text(","); q.breakable()
4190 q.text("entries = ");
4191 q.pp(self.entries)
4192 q.breakable()
4193 q.text('}')
4194
4195bsn_stats_reply.subtypes[2] = bsn_gentable_entry_desc_stats_reply
4196
4197class bsn_gentable_entry_desc_stats_request(bsn_stats_request):
4198 version = 5
4199 type = 18
4200 stats_type = 65535
4201 experimenter = 6035143
4202 subtype = 2
4203
4204 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4205 if xid != None:
4206 self.xid = xid
4207 else:
4208 self.xid = None
4209 if flags != None:
4210 self.flags = flags
4211 else:
4212 self.flags = 0
4213 if table_id != None:
4214 self.table_id = table_id
4215 else:
4216 self.table_id = 0
4217 if checksum != None:
4218 self.checksum = checksum
4219 else:
4220 self.checksum = 0
4221 if checksum_mask != None:
4222 self.checksum_mask = checksum_mask
4223 else:
4224 self.checksum_mask = 0
4225 return
4226
4227 def pack(self):
4228 packed = []
4229 packed.append(struct.pack("!B", self.version))
4230 packed.append(struct.pack("!B", self.type))
4231 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4232 packed.append(struct.pack("!L", self.xid))
4233 packed.append(struct.pack("!H", self.stats_type))
4234 packed.append(struct.pack("!H", self.flags))
4235 packed.append('\x00' * 4)
4236 packed.append(struct.pack("!L", self.experimenter))
4237 packed.append(struct.pack("!L", self.subtype))
4238 packed.append(struct.pack("!H", self.table_id))
4239 packed.append('\x00' * 2)
4240 packed.append(util.pack_checksum_128(self.checksum))
4241 packed.append(util.pack_checksum_128(self.checksum_mask))
4242 length = sum([len(x) for x in packed])
4243 packed[2] = struct.pack("!H", length)
4244 return ''.join(packed)
4245
4246 @staticmethod
4247 def unpack(reader):
4248 obj = bsn_gentable_entry_desc_stats_request()
4249 _version = reader.read("!B")[0]
4250 assert(_version == 5)
4251 _type = reader.read("!B")[0]
4252 assert(_type == 18)
4253 _length = reader.read("!H")[0]
4254 orig_reader = reader
4255 reader = orig_reader.slice(_length - (2 + 2))
4256 obj.xid = reader.read("!L")[0]
4257 _stats_type = reader.read("!H")[0]
4258 assert(_stats_type == 65535)
4259 obj.flags = reader.read("!H")[0]
4260 reader.skip(4)
4261 _experimenter = reader.read("!L")[0]
4262 assert(_experimenter == 6035143)
4263 _subtype = reader.read("!L")[0]
4264 assert(_subtype == 2)
4265 obj.table_id = reader.read("!H")[0]
4266 reader.skip(2)
4267 obj.checksum = util.unpack_checksum_128(reader)
4268 obj.checksum_mask = util.unpack_checksum_128(reader)
4269 return obj
4270
4271 def __eq__(self, other):
4272 if type(self) != type(other): return False
4273 if self.xid != other.xid: return False
4274 if self.flags != other.flags: return False
4275 if self.table_id != other.table_id: return False
4276 if self.checksum != other.checksum: return False
4277 if self.checksum_mask != other.checksum_mask: return False
4278 return True
4279
4280 def pretty_print(self, q):
4281 q.text("bsn_gentable_entry_desc_stats_request {")
4282 with q.group():
4283 with q.indent(2):
4284 q.breakable()
4285 q.text("xid = ");
4286 if self.xid != None:
4287 q.text("%#x" % self.xid)
4288 else:
4289 q.text('None')
4290 q.text(","); q.breakable()
4291 q.text("flags = ");
4292 q.text("%#x" % self.flags)
4293 q.text(","); q.breakable()
4294 q.text("table_id = ");
4295 q.text("%#x" % self.table_id)
4296 q.text(","); q.breakable()
4297 q.text("checksum = ");
4298 q.pp(self.checksum)
4299 q.text(","); q.breakable()
4300 q.text("checksum_mask = ");
4301 q.pp(self.checksum_mask)
4302 q.breakable()
4303 q.text('}')
4304
4305bsn_stats_request.subtypes[2] = bsn_gentable_entry_desc_stats_request
4306
4307class bsn_gentable_entry_stats_reply(bsn_stats_reply):
4308 version = 5
4309 type = 19
4310 stats_type = 65535
4311 experimenter = 6035143
4312 subtype = 3
4313
4314 def __init__(self, xid=None, flags=None, entries=None):
4315 if xid != None:
4316 self.xid = xid
4317 else:
4318 self.xid = None
4319 if flags != None:
4320 self.flags = flags
4321 else:
4322 self.flags = 0
4323 if entries != None:
4324 self.entries = entries
4325 else:
4326 self.entries = []
4327 return
4328
4329 def pack(self):
4330 packed = []
4331 packed.append(struct.pack("!B", self.version))
4332 packed.append(struct.pack("!B", self.type))
4333 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4334 packed.append(struct.pack("!L", self.xid))
4335 packed.append(struct.pack("!H", self.stats_type))
4336 packed.append(struct.pack("!H", self.flags))
4337 packed.append('\x00' * 4)
4338 packed.append(struct.pack("!L", self.experimenter))
4339 packed.append(struct.pack("!L", self.subtype))
4340 packed.append(loxi.generic_util.pack_list(self.entries))
4341 length = sum([len(x) for x in packed])
4342 packed[2] = struct.pack("!H", length)
4343 return ''.join(packed)
4344
4345 @staticmethod
4346 def unpack(reader):
4347 obj = bsn_gentable_entry_stats_reply()
4348 _version = reader.read("!B")[0]
4349 assert(_version == 5)
4350 _type = reader.read("!B")[0]
4351 assert(_type == 19)
4352 _length = reader.read("!H")[0]
4353 orig_reader = reader
4354 reader = orig_reader.slice(_length - (2 + 2))
4355 obj.xid = reader.read("!L")[0]
4356 _stats_type = reader.read("!H")[0]
4357 assert(_stats_type == 65535)
4358 obj.flags = reader.read("!H")[0]
4359 reader.skip(4)
4360 _experimenter = reader.read("!L")[0]
4361 assert(_experimenter == 6035143)
4362 _subtype = reader.read("!L")[0]
4363 assert(_subtype == 3)
4364 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_entry_stats_entry.unpack)
4365 return obj
4366
4367 def __eq__(self, other):
4368 if type(self) != type(other): return False
4369 if self.xid != other.xid: return False
4370 if self.flags != other.flags: return False
4371 if self.entries != other.entries: return False
4372 return True
4373
4374 def pretty_print(self, q):
4375 q.text("bsn_gentable_entry_stats_reply {")
4376 with q.group():
4377 with q.indent(2):
4378 q.breakable()
4379 q.text("xid = ");
4380 if self.xid != None:
4381 q.text("%#x" % self.xid)
4382 else:
4383 q.text('None')
4384 q.text(","); q.breakable()
4385 q.text("flags = ");
4386 q.text("%#x" % self.flags)
4387 q.text(","); q.breakable()
4388 q.text("entries = ");
4389 q.pp(self.entries)
4390 q.breakable()
4391 q.text('}')
4392
4393bsn_stats_reply.subtypes[3] = bsn_gentable_entry_stats_reply
4394
4395class bsn_gentable_entry_stats_request(bsn_stats_request):
4396 version = 5
4397 type = 18
4398 stats_type = 65535
4399 experimenter = 6035143
4400 subtype = 3
4401
4402 def __init__(self, xid=None, flags=None, table_id=None, checksum=None, checksum_mask=None):
4403 if xid != None:
4404 self.xid = xid
4405 else:
4406 self.xid = None
4407 if flags != None:
4408 self.flags = flags
4409 else:
4410 self.flags = 0
4411 if table_id != None:
4412 self.table_id = table_id
4413 else:
4414 self.table_id = 0
4415 if checksum != None:
4416 self.checksum = checksum
4417 else:
4418 self.checksum = 0
4419 if checksum_mask != None:
4420 self.checksum_mask = checksum_mask
4421 else:
4422 self.checksum_mask = 0
4423 return
4424
4425 def pack(self):
4426 packed = []
4427 packed.append(struct.pack("!B", self.version))
4428 packed.append(struct.pack("!B", self.type))
4429 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4430 packed.append(struct.pack("!L", self.xid))
4431 packed.append(struct.pack("!H", self.stats_type))
4432 packed.append(struct.pack("!H", self.flags))
4433 packed.append('\x00' * 4)
4434 packed.append(struct.pack("!L", self.experimenter))
4435 packed.append(struct.pack("!L", self.subtype))
4436 packed.append(struct.pack("!H", self.table_id))
4437 packed.append('\x00' * 2)
4438 packed.append(util.pack_checksum_128(self.checksum))
4439 packed.append(util.pack_checksum_128(self.checksum_mask))
4440 length = sum([len(x) for x in packed])
4441 packed[2] = struct.pack("!H", length)
4442 return ''.join(packed)
4443
4444 @staticmethod
4445 def unpack(reader):
4446 obj = bsn_gentable_entry_stats_request()
4447 _version = reader.read("!B")[0]
4448 assert(_version == 5)
4449 _type = reader.read("!B")[0]
4450 assert(_type == 18)
4451 _length = reader.read("!H")[0]
4452 orig_reader = reader
4453 reader = orig_reader.slice(_length - (2 + 2))
4454 obj.xid = reader.read("!L")[0]
4455 _stats_type = reader.read("!H")[0]
4456 assert(_stats_type == 65535)
4457 obj.flags = reader.read("!H")[0]
4458 reader.skip(4)
4459 _experimenter = reader.read("!L")[0]
4460 assert(_experimenter == 6035143)
4461 _subtype = reader.read("!L")[0]
4462 assert(_subtype == 3)
4463 obj.table_id = reader.read("!H")[0]
4464 reader.skip(2)
4465 obj.checksum = util.unpack_checksum_128(reader)
4466 obj.checksum_mask = util.unpack_checksum_128(reader)
4467 return obj
4468
4469 def __eq__(self, other):
4470 if type(self) != type(other): return False
4471 if self.xid != other.xid: return False
4472 if self.flags != other.flags: return False
4473 if self.table_id != other.table_id: return False
4474 if self.checksum != other.checksum: return False
4475 if self.checksum_mask != other.checksum_mask: return False
4476 return True
4477
4478 def pretty_print(self, q):
4479 q.text("bsn_gentable_entry_stats_request {")
4480 with q.group():
4481 with q.indent(2):
4482 q.breakable()
4483 q.text("xid = ");
4484 if self.xid != None:
4485 q.text("%#x" % self.xid)
4486 else:
4487 q.text('None')
4488 q.text(","); q.breakable()
4489 q.text("flags = ");
4490 q.text("%#x" % self.flags)
4491 q.text(","); q.breakable()
4492 q.text("table_id = ");
4493 q.text("%#x" % self.table_id)
4494 q.text(","); q.breakable()
4495 q.text("checksum = ");
4496 q.pp(self.checksum)
4497 q.text(","); q.breakable()
4498 q.text("checksum_mask = ");
4499 q.pp(self.checksum_mask)
4500 q.breakable()
4501 q.text('}')
4502
4503bsn_stats_request.subtypes[3] = bsn_gentable_entry_stats_request
4504
4505class bsn_gentable_set_buckets_size(bsn_header):
4506 version = 5
4507 type = 4
4508 experimenter = 6035143
4509 subtype = 50
4510
4511 def __init__(self, xid=None, table_id=None, buckets_size=None):
4512 if xid != None:
4513 self.xid = xid
4514 else:
4515 self.xid = None
4516 if table_id != None:
4517 self.table_id = table_id
4518 else:
4519 self.table_id = 0
4520 if buckets_size != None:
4521 self.buckets_size = buckets_size
4522 else:
4523 self.buckets_size = 0
4524 return
4525
4526 def pack(self):
4527 packed = []
4528 packed.append(struct.pack("!B", self.version))
4529 packed.append(struct.pack("!B", self.type))
4530 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4531 packed.append(struct.pack("!L", self.xid))
4532 packed.append(struct.pack("!L", self.experimenter))
4533 packed.append(struct.pack("!L", self.subtype))
4534 packed.append(struct.pack("!H", self.table_id))
4535 packed.append('\x00' * 2)
4536 packed.append(struct.pack("!L", self.buckets_size))
4537 length = sum([len(x) for x in packed])
4538 packed[2] = struct.pack("!H", length)
4539 return ''.join(packed)
4540
4541 @staticmethod
4542 def unpack(reader):
4543 obj = bsn_gentable_set_buckets_size()
4544 _version = reader.read("!B")[0]
4545 assert(_version == 5)
4546 _type = reader.read("!B")[0]
4547 assert(_type == 4)
4548 _length = reader.read("!H")[0]
4549 orig_reader = reader
4550 reader = orig_reader.slice(_length - (2 + 2))
4551 obj.xid = reader.read("!L")[0]
4552 _experimenter = reader.read("!L")[0]
4553 assert(_experimenter == 6035143)
4554 _subtype = reader.read("!L")[0]
4555 assert(_subtype == 50)
4556 obj.table_id = reader.read("!H")[0]
4557 reader.skip(2)
4558 obj.buckets_size = reader.read("!L")[0]
4559 return obj
4560
4561 def __eq__(self, other):
4562 if type(self) != type(other): return False
4563 if self.xid != other.xid: return False
4564 if self.table_id != other.table_id: return False
4565 if self.buckets_size != other.buckets_size: return False
4566 return True
4567
4568 def pretty_print(self, q):
4569 q.text("bsn_gentable_set_buckets_size {")
4570 with q.group():
4571 with q.indent(2):
4572 q.breakable()
4573 q.text("xid = ");
4574 if self.xid != None:
4575 q.text("%#x" % self.xid)
4576 else:
4577 q.text('None')
4578 q.text(","); q.breakable()
4579 q.text("table_id = ");
4580 q.text("%#x" % self.table_id)
4581 q.text(","); q.breakable()
4582 q.text("buckets_size = ");
4583 q.text("%#x" % self.buckets_size)
4584 q.breakable()
4585 q.text('}')
4586
4587bsn_header.subtypes[50] = bsn_gentable_set_buckets_size
4588
4589class bsn_gentable_stats_reply(bsn_stats_reply):
4590 version = 5
4591 type = 19
4592 stats_type = 65535
4593 experimenter = 6035143
4594 subtype = 7
4595
4596 def __init__(self, xid=None, flags=None, entries=None):
4597 if xid != None:
4598 self.xid = xid
4599 else:
4600 self.xid = None
4601 if flags != None:
4602 self.flags = flags
4603 else:
4604 self.flags = 0
4605 if entries != None:
4606 self.entries = entries
4607 else:
4608 self.entries = []
4609 return
4610
4611 def pack(self):
4612 packed = []
4613 packed.append(struct.pack("!B", self.version))
4614 packed.append(struct.pack("!B", self.type))
4615 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4616 packed.append(struct.pack("!L", self.xid))
4617 packed.append(struct.pack("!H", self.stats_type))
4618 packed.append(struct.pack("!H", self.flags))
4619 packed.append('\x00' * 4)
4620 packed.append(struct.pack("!L", self.experimenter))
4621 packed.append(struct.pack("!L", self.subtype))
4622 packed.append(loxi.generic_util.pack_list(self.entries))
4623 length = sum([len(x) for x in packed])
4624 packed[2] = struct.pack("!H", length)
4625 return ''.join(packed)
4626
4627 @staticmethod
4628 def unpack(reader):
4629 obj = bsn_gentable_stats_reply()
4630 _version = reader.read("!B")[0]
4631 assert(_version == 5)
4632 _type = reader.read("!B")[0]
4633 assert(_type == 19)
4634 _length = reader.read("!H")[0]
4635 orig_reader = reader
4636 reader = orig_reader.slice(_length - (2 + 2))
4637 obj.xid = reader.read("!L")[0]
4638 _stats_type = reader.read("!H")[0]
4639 assert(_stats_type == 65535)
4640 obj.flags = reader.read("!H")[0]
4641 reader.skip(4)
4642 _experimenter = reader.read("!L")[0]
4643 assert(_experimenter == 6035143)
4644 _subtype = reader.read("!L")[0]
4645 assert(_subtype == 7)
4646 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_gentable_stats_entry.unpack)
4647 return obj
4648
4649 def __eq__(self, other):
4650 if type(self) != type(other): return False
4651 if self.xid != other.xid: return False
4652 if self.flags != other.flags: return False
4653 if self.entries != other.entries: return False
4654 return True
4655
4656 def pretty_print(self, q):
4657 q.text("bsn_gentable_stats_reply {")
4658 with q.group():
4659 with q.indent(2):
4660 q.breakable()
4661 q.text("xid = ");
4662 if self.xid != None:
4663 q.text("%#x" % self.xid)
4664 else:
4665 q.text('None')
4666 q.text(","); q.breakable()
4667 q.text("flags = ");
4668 q.text("%#x" % self.flags)
4669 q.text(","); q.breakable()
4670 q.text("entries = ");
4671 q.pp(self.entries)
4672 q.breakable()
4673 q.text('}')
4674
4675bsn_stats_reply.subtypes[7] = bsn_gentable_stats_reply
4676
4677class bsn_gentable_stats_request(bsn_stats_request):
4678 version = 5
4679 type = 18
4680 stats_type = 65535
4681 experimenter = 6035143
4682 subtype = 7
4683
4684 def __init__(self, xid=None, flags=None):
4685 if xid != None:
4686 self.xid = xid
4687 else:
4688 self.xid = None
4689 if flags != None:
4690 self.flags = flags
4691 else:
4692 self.flags = 0
4693 return
4694
4695 def pack(self):
4696 packed = []
4697 packed.append(struct.pack("!B", self.version))
4698 packed.append(struct.pack("!B", self.type))
4699 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4700 packed.append(struct.pack("!L", self.xid))
4701 packed.append(struct.pack("!H", self.stats_type))
4702 packed.append(struct.pack("!H", self.flags))
4703 packed.append('\x00' * 4)
4704 packed.append(struct.pack("!L", self.experimenter))
4705 packed.append(struct.pack("!L", self.subtype))
4706 length = sum([len(x) for x in packed])
4707 packed[2] = struct.pack("!H", length)
4708 return ''.join(packed)
4709
4710 @staticmethod
4711 def unpack(reader):
4712 obj = bsn_gentable_stats_request()
4713 _version = reader.read("!B")[0]
4714 assert(_version == 5)
4715 _type = reader.read("!B")[0]
4716 assert(_type == 18)
4717 _length = reader.read("!H")[0]
4718 orig_reader = reader
4719 reader = orig_reader.slice(_length - (2 + 2))
4720 obj.xid = reader.read("!L")[0]
4721 _stats_type = reader.read("!H")[0]
4722 assert(_stats_type == 65535)
4723 obj.flags = reader.read("!H")[0]
4724 reader.skip(4)
4725 _experimenter = reader.read("!L")[0]
4726 assert(_experimenter == 6035143)
4727 _subtype = reader.read("!L")[0]
4728 assert(_subtype == 7)
4729 return obj
4730
4731 def __eq__(self, other):
4732 if type(self) != type(other): return False
4733 if self.xid != other.xid: return False
4734 if self.flags != other.flags: return False
4735 return True
4736
4737 def pretty_print(self, q):
4738 q.text("bsn_gentable_stats_request {")
4739 with q.group():
4740 with q.indent(2):
4741 q.breakable()
4742 q.text("xid = ");
4743 if self.xid != None:
4744 q.text("%#x" % self.xid)
4745 else:
4746 q.text('None')
4747 q.text(","); q.breakable()
4748 q.text("flags = ");
4749 q.text("%#x" % self.flags)
4750 q.breakable()
4751 q.text('}')
4752
4753bsn_stats_request.subtypes[7] = bsn_gentable_stats_request
4754
Rich Lane2e079da2014-10-29 15:30:24 -07004755class bsn_get_interfaces_reply(bsn_header):
4756 version = 5
4757 type = 4
4758 experimenter = 6035143
4759 subtype = 10
4760
4761 def __init__(self, xid=None, interfaces=None):
4762 if xid != None:
4763 self.xid = xid
4764 else:
4765 self.xid = None
4766 if interfaces != None:
4767 self.interfaces = interfaces
4768 else:
4769 self.interfaces = []
4770 return
4771
4772 def pack(self):
4773 packed = []
4774 packed.append(struct.pack("!B", self.version))
4775 packed.append(struct.pack("!B", self.type))
4776 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4777 packed.append(struct.pack("!L", self.xid))
4778 packed.append(struct.pack("!L", self.experimenter))
4779 packed.append(struct.pack("!L", self.subtype))
4780 packed.append(loxi.generic_util.pack_list(self.interfaces))
4781 length = sum([len(x) for x in packed])
4782 packed[2] = struct.pack("!H", length)
4783 return ''.join(packed)
4784
4785 @staticmethod
4786 def unpack(reader):
4787 obj = bsn_get_interfaces_reply()
4788 _version = reader.read("!B")[0]
4789 assert(_version == 5)
4790 _type = reader.read("!B")[0]
4791 assert(_type == 4)
4792 _length = reader.read("!H")[0]
4793 orig_reader = reader
4794 reader = orig_reader.slice(_length - (2 + 2))
4795 obj.xid = reader.read("!L")[0]
4796 _experimenter = reader.read("!L")[0]
4797 assert(_experimenter == 6035143)
4798 _subtype = reader.read("!L")[0]
4799 assert(_subtype == 10)
4800 obj.interfaces = loxi.generic_util.unpack_list(reader, common.bsn_interface.unpack)
4801 return obj
4802
4803 def __eq__(self, other):
4804 if type(self) != type(other): return False
4805 if self.xid != other.xid: return False
4806 if self.interfaces != other.interfaces: return False
4807 return True
4808
4809 def pretty_print(self, q):
4810 q.text("bsn_get_interfaces_reply {")
4811 with q.group():
4812 with q.indent(2):
4813 q.breakable()
4814 q.text("xid = ");
4815 if self.xid != None:
4816 q.text("%#x" % self.xid)
4817 else:
4818 q.text('None')
4819 q.text(","); q.breakable()
4820 q.text("interfaces = ");
4821 q.pp(self.interfaces)
4822 q.breakable()
4823 q.text('}')
4824
4825bsn_header.subtypes[10] = bsn_get_interfaces_reply
4826
4827class bsn_get_interfaces_request(bsn_header):
4828 version = 5
4829 type = 4
4830 experimenter = 6035143
4831 subtype = 9
4832
4833 def __init__(self, xid=None):
4834 if xid != None:
4835 self.xid = xid
4836 else:
4837 self.xid = None
4838 return
4839
4840 def pack(self):
4841 packed = []
4842 packed.append(struct.pack("!B", self.version))
4843 packed.append(struct.pack("!B", self.type))
4844 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4845 packed.append(struct.pack("!L", self.xid))
4846 packed.append(struct.pack("!L", self.experimenter))
4847 packed.append(struct.pack("!L", self.subtype))
4848 length = sum([len(x) for x in packed])
4849 packed[2] = struct.pack("!H", length)
4850 return ''.join(packed)
4851
4852 @staticmethod
4853 def unpack(reader):
4854 obj = bsn_get_interfaces_request()
4855 _version = reader.read("!B")[0]
4856 assert(_version == 5)
4857 _type = reader.read("!B")[0]
4858 assert(_type == 4)
4859 _length = reader.read("!H")[0]
4860 orig_reader = reader
4861 reader = orig_reader.slice(_length - (2 + 2))
4862 obj.xid = reader.read("!L")[0]
4863 _experimenter = reader.read("!L")[0]
4864 assert(_experimenter == 6035143)
4865 _subtype = reader.read("!L")[0]
4866 assert(_subtype == 9)
4867 return obj
4868
4869 def __eq__(self, other):
4870 if type(self) != type(other): return False
4871 if self.xid != other.xid: return False
4872 return True
4873
4874 def pretty_print(self, q):
4875 q.text("bsn_get_interfaces_request {")
4876 with q.group():
4877 with q.indent(2):
4878 q.breakable()
4879 q.text("xid = ");
4880 if self.xid != None:
4881 q.text("%#x" % self.xid)
4882 else:
4883 q.text('None')
4884 q.breakable()
4885 q.text('}')
4886
4887bsn_header.subtypes[9] = bsn_get_interfaces_request
4888
4889class bsn_get_mirroring_reply(bsn_header):
4890 version = 5
4891 type = 4
4892 experimenter = 6035143
4893 subtype = 5
4894
4895 def __init__(self, xid=None, report_mirror_ports=None):
4896 if xid != None:
4897 self.xid = xid
4898 else:
4899 self.xid = None
4900 if report_mirror_ports != None:
4901 self.report_mirror_ports = report_mirror_ports
4902 else:
4903 self.report_mirror_ports = 0
4904 return
4905
4906 def pack(self):
4907 packed = []
4908 packed.append(struct.pack("!B", self.version))
4909 packed.append(struct.pack("!B", self.type))
4910 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4911 packed.append(struct.pack("!L", self.xid))
4912 packed.append(struct.pack("!L", self.experimenter))
4913 packed.append(struct.pack("!L", self.subtype))
4914 packed.append(struct.pack("!B", self.report_mirror_ports))
4915 packed.append('\x00' * 3)
4916 length = sum([len(x) for x in packed])
4917 packed[2] = struct.pack("!H", length)
4918 return ''.join(packed)
4919
4920 @staticmethod
4921 def unpack(reader):
4922 obj = bsn_get_mirroring_reply()
4923 _version = reader.read("!B")[0]
4924 assert(_version == 5)
4925 _type = reader.read("!B")[0]
4926 assert(_type == 4)
4927 _length = reader.read("!H")[0]
4928 orig_reader = reader
4929 reader = orig_reader.slice(_length - (2 + 2))
4930 obj.xid = reader.read("!L")[0]
4931 _experimenter = reader.read("!L")[0]
4932 assert(_experimenter == 6035143)
4933 _subtype = reader.read("!L")[0]
4934 assert(_subtype == 5)
4935 obj.report_mirror_ports = reader.read("!B")[0]
4936 reader.skip(3)
4937 return obj
4938
4939 def __eq__(self, other):
4940 if type(self) != type(other): return False
4941 if self.xid != other.xid: return False
4942 if self.report_mirror_ports != other.report_mirror_ports: return False
4943 return True
4944
4945 def pretty_print(self, q):
4946 q.text("bsn_get_mirroring_reply {")
4947 with q.group():
4948 with q.indent(2):
4949 q.breakable()
4950 q.text("xid = ");
4951 if self.xid != None:
4952 q.text("%#x" % self.xid)
4953 else:
4954 q.text('None')
4955 q.text(","); q.breakable()
4956 q.text("report_mirror_ports = ");
4957 q.text("%#x" % self.report_mirror_ports)
4958 q.breakable()
4959 q.text('}')
4960
4961bsn_header.subtypes[5] = bsn_get_mirroring_reply
4962
4963class bsn_get_mirroring_request(bsn_header):
4964 version = 5
4965 type = 4
4966 experimenter = 6035143
4967 subtype = 4
4968
4969 def __init__(self, xid=None, report_mirror_ports=None):
4970 if xid != None:
4971 self.xid = xid
4972 else:
4973 self.xid = None
4974 if report_mirror_ports != None:
4975 self.report_mirror_ports = report_mirror_ports
4976 else:
4977 self.report_mirror_ports = 0
4978 return
4979
4980 def pack(self):
4981 packed = []
4982 packed.append(struct.pack("!B", self.version))
4983 packed.append(struct.pack("!B", self.type))
4984 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
4985 packed.append(struct.pack("!L", self.xid))
4986 packed.append(struct.pack("!L", self.experimenter))
4987 packed.append(struct.pack("!L", self.subtype))
4988 packed.append(struct.pack("!B", self.report_mirror_ports))
4989 packed.append('\x00' * 3)
4990 length = sum([len(x) for x in packed])
4991 packed[2] = struct.pack("!H", length)
4992 return ''.join(packed)
4993
4994 @staticmethod
4995 def unpack(reader):
4996 obj = bsn_get_mirroring_request()
4997 _version = reader.read("!B")[0]
4998 assert(_version == 5)
4999 _type = reader.read("!B")[0]
5000 assert(_type == 4)
5001 _length = reader.read("!H")[0]
5002 orig_reader = reader
5003 reader = orig_reader.slice(_length - (2 + 2))
5004 obj.xid = reader.read("!L")[0]
5005 _experimenter = reader.read("!L")[0]
5006 assert(_experimenter == 6035143)
5007 _subtype = reader.read("!L")[0]
5008 assert(_subtype == 4)
5009 obj.report_mirror_ports = reader.read("!B")[0]
5010 reader.skip(3)
5011 return obj
5012
5013 def __eq__(self, other):
5014 if type(self) != type(other): return False
5015 if self.xid != other.xid: return False
5016 if self.report_mirror_ports != other.report_mirror_ports: return False
5017 return True
5018
5019 def pretty_print(self, q):
5020 q.text("bsn_get_mirroring_request {")
5021 with q.group():
5022 with q.indent(2):
5023 q.breakable()
5024 q.text("xid = ");
5025 if self.xid != None:
5026 q.text("%#x" % self.xid)
5027 else:
5028 q.text('None')
5029 q.text(","); q.breakable()
5030 q.text("report_mirror_ports = ");
5031 q.text("%#x" % self.report_mirror_ports)
5032 q.breakable()
5033 q.text('}')
5034
5035bsn_header.subtypes[4] = bsn_get_mirroring_request
5036
Rich Laneccd32ed2014-11-10 17:48:24 -08005037class bsn_get_switch_pipeline_reply(bsn_header):
5038 version = 5
5039 type = 4
5040 experimenter = 6035143
5041 subtype = 52
5042
5043 def __init__(self, xid=None, pipeline=None):
5044 if xid != None:
5045 self.xid = xid
5046 else:
5047 self.xid = None
5048 if pipeline != None:
5049 self.pipeline = pipeline
5050 else:
5051 self.pipeline = ""
5052 return
5053
5054 def pack(self):
5055 packed = []
5056 packed.append(struct.pack("!B", self.version))
5057 packed.append(struct.pack("!B", self.type))
5058 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5059 packed.append(struct.pack("!L", self.xid))
5060 packed.append(struct.pack("!L", self.experimenter))
5061 packed.append(struct.pack("!L", self.subtype))
5062 packed.append(struct.pack("!256s", self.pipeline))
5063 length = sum([len(x) for x in packed])
5064 packed[2] = struct.pack("!H", length)
5065 return ''.join(packed)
5066
5067 @staticmethod
5068 def unpack(reader):
5069 obj = bsn_get_switch_pipeline_reply()
5070 _version = reader.read("!B")[0]
5071 assert(_version == 5)
5072 _type = reader.read("!B")[0]
5073 assert(_type == 4)
5074 _length = reader.read("!H")[0]
5075 orig_reader = reader
5076 reader = orig_reader.slice(_length - (2 + 2))
5077 obj.xid = reader.read("!L")[0]
5078 _experimenter = reader.read("!L")[0]
5079 assert(_experimenter == 6035143)
5080 _subtype = reader.read("!L")[0]
5081 assert(_subtype == 52)
5082 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
5083 return obj
5084
5085 def __eq__(self, other):
5086 if type(self) != type(other): return False
5087 if self.xid != other.xid: return False
5088 if self.pipeline != other.pipeline: return False
5089 return True
5090
5091 def pretty_print(self, q):
5092 q.text("bsn_get_switch_pipeline_reply {")
5093 with q.group():
5094 with q.indent(2):
5095 q.breakable()
5096 q.text("xid = ");
5097 if self.xid != None:
5098 q.text("%#x" % self.xid)
5099 else:
5100 q.text('None')
5101 q.text(","); q.breakable()
5102 q.text("pipeline = ");
5103 q.pp(self.pipeline)
5104 q.breakable()
5105 q.text('}')
5106
5107bsn_header.subtypes[52] = bsn_get_switch_pipeline_reply
5108
5109class bsn_get_switch_pipeline_request(bsn_header):
5110 version = 5
5111 type = 4
5112 experimenter = 6035143
5113 subtype = 51
5114
5115 def __init__(self, xid=None):
5116 if xid != None:
5117 self.xid = xid
5118 else:
5119 self.xid = None
5120 return
5121
5122 def pack(self):
5123 packed = []
5124 packed.append(struct.pack("!B", self.version))
5125 packed.append(struct.pack("!B", self.type))
5126 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5127 packed.append(struct.pack("!L", self.xid))
5128 packed.append(struct.pack("!L", self.experimenter))
5129 packed.append(struct.pack("!L", self.subtype))
5130 length = sum([len(x) for x in packed])
5131 packed[2] = struct.pack("!H", length)
5132 return ''.join(packed)
5133
5134 @staticmethod
5135 def unpack(reader):
5136 obj = bsn_get_switch_pipeline_request()
5137 _version = reader.read("!B")[0]
5138 assert(_version == 5)
5139 _type = reader.read("!B")[0]
5140 assert(_type == 4)
5141 _length = reader.read("!H")[0]
5142 orig_reader = reader
5143 reader = orig_reader.slice(_length - (2 + 2))
5144 obj.xid = reader.read("!L")[0]
5145 _experimenter = reader.read("!L")[0]
5146 assert(_experimenter == 6035143)
5147 _subtype = reader.read("!L")[0]
5148 assert(_subtype == 51)
5149 return obj
5150
5151 def __eq__(self, other):
5152 if type(self) != type(other): return False
5153 if self.xid != other.xid: return False
5154 return True
5155
5156 def pretty_print(self, q):
5157 q.text("bsn_get_switch_pipeline_request {")
5158 with q.group():
5159 with q.indent(2):
5160 q.breakable()
5161 q.text("xid = ");
5162 if self.xid != None:
5163 q.text("%#x" % self.xid)
5164 else:
5165 q.text('None')
5166 q.breakable()
5167 q.text('}')
5168
5169bsn_header.subtypes[51] = bsn_get_switch_pipeline_request
5170
5171class bsn_image_desc_stats_reply(bsn_stats_reply):
5172 version = 5
5173 type = 19
5174 stats_type = 65535
5175 experimenter = 6035143
5176 subtype = 14
5177
5178 def __init__(self, xid=None, flags=None, image_checksum=None, startup_config_checksum=None):
5179 if xid != None:
5180 self.xid = xid
5181 else:
5182 self.xid = None
5183 if flags != None:
5184 self.flags = flags
5185 else:
5186 self.flags = 0
5187 if image_checksum != None:
5188 self.image_checksum = image_checksum
5189 else:
5190 self.image_checksum = ""
5191 if startup_config_checksum != None:
5192 self.startup_config_checksum = startup_config_checksum
5193 else:
5194 self.startup_config_checksum = ""
5195 return
5196
5197 def pack(self):
5198 packed = []
5199 packed.append(struct.pack("!B", self.version))
5200 packed.append(struct.pack("!B", self.type))
5201 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5202 packed.append(struct.pack("!L", self.xid))
5203 packed.append(struct.pack("!H", self.stats_type))
5204 packed.append(struct.pack("!H", self.flags))
5205 packed.append('\x00' * 4)
5206 packed.append(struct.pack("!L", self.experimenter))
5207 packed.append(struct.pack("!L", self.subtype))
5208 packed.append(struct.pack("!256s", self.image_checksum))
5209 packed.append(struct.pack("!256s", self.startup_config_checksum))
5210 length = sum([len(x) for x in packed])
5211 packed[2] = struct.pack("!H", length)
5212 return ''.join(packed)
5213
5214 @staticmethod
5215 def unpack(reader):
5216 obj = bsn_image_desc_stats_reply()
5217 _version = reader.read("!B")[0]
5218 assert(_version == 5)
5219 _type = reader.read("!B")[0]
5220 assert(_type == 19)
5221 _length = reader.read("!H")[0]
5222 orig_reader = reader
5223 reader = orig_reader.slice(_length - (2 + 2))
5224 obj.xid = reader.read("!L")[0]
5225 _stats_type = reader.read("!H")[0]
5226 assert(_stats_type == 65535)
5227 obj.flags = reader.read("!H")[0]
5228 reader.skip(4)
5229 _experimenter = reader.read("!L")[0]
5230 assert(_experimenter == 6035143)
5231 _subtype = reader.read("!L")[0]
5232 assert(_subtype == 14)
5233 obj.image_checksum = reader.read("!256s")[0].rstrip("\x00")
5234 obj.startup_config_checksum = reader.read("!256s")[0].rstrip("\x00")
5235 return obj
5236
5237 def __eq__(self, other):
5238 if type(self) != type(other): return False
5239 if self.xid != other.xid: return False
5240 if self.flags != other.flags: return False
5241 if self.image_checksum != other.image_checksum: return False
5242 if self.startup_config_checksum != other.startup_config_checksum: return False
5243 return True
5244
5245 def pretty_print(self, q):
5246 q.text("bsn_image_desc_stats_reply {")
5247 with q.group():
5248 with q.indent(2):
5249 q.breakable()
5250 q.text("xid = ");
5251 if self.xid != None:
5252 q.text("%#x" % self.xid)
5253 else:
5254 q.text('None')
5255 q.text(","); q.breakable()
5256 q.text("flags = ");
5257 q.text("%#x" % self.flags)
5258 q.text(","); q.breakable()
5259 q.text("image_checksum = ");
5260 q.pp(self.image_checksum)
5261 q.text(","); q.breakable()
5262 q.text("startup_config_checksum = ");
5263 q.pp(self.startup_config_checksum)
5264 q.breakable()
5265 q.text('}')
5266
5267bsn_stats_reply.subtypes[14] = bsn_image_desc_stats_reply
5268
5269class bsn_image_desc_stats_request(bsn_stats_request):
5270 version = 5
5271 type = 18
5272 stats_type = 65535
5273 experimenter = 6035143
5274 subtype = 14
5275
5276 def __init__(self, xid=None, flags=None):
5277 if xid != None:
5278 self.xid = xid
5279 else:
5280 self.xid = None
5281 if flags != None:
5282 self.flags = flags
5283 else:
5284 self.flags = 0
5285 return
5286
5287 def pack(self):
5288 packed = []
5289 packed.append(struct.pack("!B", self.version))
5290 packed.append(struct.pack("!B", self.type))
5291 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5292 packed.append(struct.pack("!L", self.xid))
5293 packed.append(struct.pack("!H", self.stats_type))
5294 packed.append(struct.pack("!H", self.flags))
5295 packed.append('\x00' * 4)
5296 packed.append(struct.pack("!L", self.experimenter))
5297 packed.append(struct.pack("!L", self.subtype))
5298 length = sum([len(x) for x in packed])
5299 packed[2] = struct.pack("!H", length)
5300 return ''.join(packed)
5301
5302 @staticmethod
5303 def unpack(reader):
5304 obj = bsn_image_desc_stats_request()
5305 _version = reader.read("!B")[0]
5306 assert(_version == 5)
5307 _type = reader.read("!B")[0]
5308 assert(_type == 18)
5309 _length = reader.read("!H")[0]
5310 orig_reader = reader
5311 reader = orig_reader.slice(_length - (2 + 2))
5312 obj.xid = reader.read("!L")[0]
5313 _stats_type = reader.read("!H")[0]
5314 assert(_stats_type == 65535)
5315 obj.flags = reader.read("!H")[0]
5316 reader.skip(4)
5317 _experimenter = reader.read("!L")[0]
5318 assert(_experimenter == 6035143)
5319 _subtype = reader.read("!L")[0]
5320 assert(_subtype == 14)
5321 return obj
5322
5323 def __eq__(self, other):
5324 if type(self) != type(other): return False
5325 if self.xid != other.xid: return False
5326 if self.flags != other.flags: return False
5327 return True
5328
5329 def pretty_print(self, q):
5330 q.text("bsn_image_desc_stats_request {")
5331 with q.group():
5332 with q.indent(2):
5333 q.breakable()
5334 q.text("xid = ");
5335 if self.xid != None:
5336 q.text("%#x" % self.xid)
5337 else:
5338 q.text('None')
5339 q.text(","); q.breakable()
5340 q.text("flags = ");
5341 q.text("%#x" % self.flags)
5342 q.breakable()
5343 q.text('}')
5344
5345bsn_stats_request.subtypes[14] = bsn_image_desc_stats_request
5346
5347class bsn_lacp_convergence_notif(bsn_header):
5348 version = 5
5349 type = 4
5350 experimenter = 6035143
5351 subtype = 43
5352
5353 def __init__(self, xid=None, convergence_status=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None, partner_sys_priority=None, partner_sys_mac=None, partner_port_priority=None, partner_port_num=None, partner_key=None):
5354 if xid != None:
5355 self.xid = xid
5356 else:
5357 self.xid = None
5358 if convergence_status != None:
5359 self.convergence_status = convergence_status
5360 else:
5361 self.convergence_status = 0
5362 if port_no != None:
5363 self.port_no = port_no
5364 else:
5365 self.port_no = 0
5366 if actor_sys_priority != None:
5367 self.actor_sys_priority = actor_sys_priority
5368 else:
5369 self.actor_sys_priority = 0
5370 if actor_sys_mac != None:
5371 self.actor_sys_mac = actor_sys_mac
5372 else:
5373 self.actor_sys_mac = [0,0,0,0,0,0]
5374 if actor_port_priority != None:
5375 self.actor_port_priority = actor_port_priority
5376 else:
5377 self.actor_port_priority = 0
5378 if actor_port_num != None:
5379 self.actor_port_num = actor_port_num
5380 else:
5381 self.actor_port_num = 0
5382 if actor_key != None:
5383 self.actor_key = actor_key
5384 else:
5385 self.actor_key = 0
5386 if partner_sys_priority != None:
5387 self.partner_sys_priority = partner_sys_priority
5388 else:
5389 self.partner_sys_priority = 0
5390 if partner_sys_mac != None:
5391 self.partner_sys_mac = partner_sys_mac
5392 else:
5393 self.partner_sys_mac = [0,0,0,0,0,0]
5394 if partner_port_priority != None:
5395 self.partner_port_priority = partner_port_priority
5396 else:
5397 self.partner_port_priority = 0
5398 if partner_port_num != None:
5399 self.partner_port_num = partner_port_num
5400 else:
5401 self.partner_port_num = 0
5402 if partner_key != None:
5403 self.partner_key = partner_key
5404 else:
5405 self.partner_key = 0
5406 return
5407
5408 def pack(self):
5409 packed = []
5410 packed.append(struct.pack("!B", self.version))
5411 packed.append(struct.pack("!B", self.type))
5412 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5413 packed.append(struct.pack("!L", self.xid))
5414 packed.append(struct.pack("!L", self.experimenter))
5415 packed.append(struct.pack("!L", self.subtype))
5416 packed.append(struct.pack("!B", self.convergence_status))
5417 packed.append('\x00' * 3)
5418 packed.append(util.pack_port_no(self.port_no))
5419 packed.append(struct.pack("!H", self.actor_sys_priority))
5420 packed.append(struct.pack("!6B", *self.actor_sys_mac))
5421 packed.append(struct.pack("!H", self.actor_port_priority))
5422 packed.append(struct.pack("!H", self.actor_port_num))
5423 packed.append(struct.pack("!H", self.actor_key))
5424 packed.append(struct.pack("!H", self.partner_sys_priority))
5425 packed.append(struct.pack("!6B", *self.partner_sys_mac))
5426 packed.append(struct.pack("!H", self.partner_port_priority))
5427 packed.append(struct.pack("!H", self.partner_port_num))
5428 packed.append(struct.pack("!H", self.partner_key))
5429 length = sum([len(x) for x in packed])
5430 packed[2] = struct.pack("!H", length)
5431 return ''.join(packed)
5432
5433 @staticmethod
5434 def unpack(reader):
5435 obj = bsn_lacp_convergence_notif()
5436 _version = reader.read("!B")[0]
5437 assert(_version == 5)
5438 _type = reader.read("!B")[0]
5439 assert(_type == 4)
5440 _length = reader.read("!H")[0]
5441 orig_reader = reader
5442 reader = orig_reader.slice(_length - (2 + 2))
5443 obj.xid = reader.read("!L")[0]
5444 _experimenter = reader.read("!L")[0]
5445 assert(_experimenter == 6035143)
5446 _subtype = reader.read("!L")[0]
5447 assert(_subtype == 43)
5448 obj.convergence_status = reader.read("!B")[0]
5449 reader.skip(3)
5450 obj.port_no = util.unpack_port_no(reader)
5451 obj.actor_sys_priority = reader.read("!H")[0]
5452 obj.actor_sys_mac = list(reader.read('!6B'))
5453 obj.actor_port_priority = reader.read("!H")[0]
5454 obj.actor_port_num = reader.read("!H")[0]
5455 obj.actor_key = reader.read("!H")[0]
5456 obj.partner_sys_priority = reader.read("!H")[0]
5457 obj.partner_sys_mac = list(reader.read('!6B'))
5458 obj.partner_port_priority = reader.read("!H")[0]
5459 obj.partner_port_num = reader.read("!H")[0]
5460 obj.partner_key = reader.read("!H")[0]
5461 return obj
5462
5463 def __eq__(self, other):
5464 if type(self) != type(other): return False
5465 if self.xid != other.xid: return False
5466 if self.convergence_status != other.convergence_status: return False
5467 if self.port_no != other.port_no: return False
5468 if self.actor_sys_priority != other.actor_sys_priority: return False
5469 if self.actor_sys_mac != other.actor_sys_mac: return False
5470 if self.actor_port_priority != other.actor_port_priority: return False
5471 if self.actor_port_num != other.actor_port_num: return False
5472 if self.actor_key != other.actor_key: return False
5473 if self.partner_sys_priority != other.partner_sys_priority: return False
5474 if self.partner_sys_mac != other.partner_sys_mac: return False
5475 if self.partner_port_priority != other.partner_port_priority: return False
5476 if self.partner_port_num != other.partner_port_num: return False
5477 if self.partner_key != other.partner_key: return False
5478 return True
5479
5480 def pretty_print(self, q):
5481 q.text("bsn_lacp_convergence_notif {")
5482 with q.group():
5483 with q.indent(2):
5484 q.breakable()
5485 q.text("xid = ");
5486 if self.xid != None:
5487 q.text("%#x" % self.xid)
5488 else:
5489 q.text('None')
5490 q.text(","); q.breakable()
5491 q.text("convergence_status = ");
5492 q.text("%#x" % self.convergence_status)
5493 q.text(","); q.breakable()
5494 q.text("port_no = ");
5495 q.text(util.pretty_port(self.port_no))
5496 q.text(","); q.breakable()
5497 q.text("actor_sys_priority = ");
5498 q.text("%#x" % self.actor_sys_priority)
5499 q.text(","); q.breakable()
5500 q.text("actor_sys_mac = ");
5501 q.text(util.pretty_mac(self.actor_sys_mac))
5502 q.text(","); q.breakable()
5503 q.text("actor_port_priority = ");
5504 q.text("%#x" % self.actor_port_priority)
5505 q.text(","); q.breakable()
5506 q.text("actor_port_num = ");
5507 q.text("%#x" % self.actor_port_num)
5508 q.text(","); q.breakable()
5509 q.text("actor_key = ");
5510 q.text("%#x" % self.actor_key)
5511 q.text(","); q.breakable()
5512 q.text("partner_sys_priority = ");
5513 q.text("%#x" % self.partner_sys_priority)
5514 q.text(","); q.breakable()
5515 q.text("partner_sys_mac = ");
5516 q.text(util.pretty_mac(self.partner_sys_mac))
5517 q.text(","); q.breakable()
5518 q.text("partner_port_priority = ");
5519 q.text("%#x" % self.partner_port_priority)
5520 q.text(","); q.breakable()
5521 q.text("partner_port_num = ");
5522 q.text("%#x" % self.partner_port_num)
5523 q.text(","); q.breakable()
5524 q.text("partner_key = ");
5525 q.text("%#x" % self.partner_key)
5526 q.breakable()
5527 q.text('}')
5528
5529bsn_header.subtypes[43] = bsn_lacp_convergence_notif
5530
5531class bsn_lacp_stats_reply(bsn_stats_reply):
5532 version = 5
5533 type = 19
5534 stats_type = 65535
5535 experimenter = 6035143
5536 subtype = 1
5537
5538 def __init__(self, xid=None, flags=None, entries=None):
5539 if xid != None:
5540 self.xid = xid
5541 else:
5542 self.xid = None
5543 if flags != None:
5544 self.flags = flags
5545 else:
5546 self.flags = 0
5547 if entries != None:
5548 self.entries = entries
5549 else:
5550 self.entries = []
5551 return
5552
5553 def pack(self):
5554 packed = []
5555 packed.append(struct.pack("!B", self.version))
5556 packed.append(struct.pack("!B", self.type))
5557 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5558 packed.append(struct.pack("!L", self.xid))
5559 packed.append(struct.pack("!H", self.stats_type))
5560 packed.append(struct.pack("!H", self.flags))
5561 packed.append('\x00' * 4)
5562 packed.append(struct.pack("!L", self.experimenter))
5563 packed.append(struct.pack("!L", self.subtype))
5564 packed.append(loxi.generic_util.pack_list(self.entries))
5565 length = sum([len(x) for x in packed])
5566 packed[2] = struct.pack("!H", length)
5567 return ''.join(packed)
5568
5569 @staticmethod
5570 def unpack(reader):
5571 obj = bsn_lacp_stats_reply()
5572 _version = reader.read("!B")[0]
5573 assert(_version == 5)
5574 _type = reader.read("!B")[0]
5575 assert(_type == 19)
5576 _length = reader.read("!H")[0]
5577 orig_reader = reader
5578 reader = orig_reader.slice(_length - (2 + 2))
5579 obj.xid = reader.read("!L")[0]
5580 _stats_type = reader.read("!H")[0]
5581 assert(_stats_type == 65535)
5582 obj.flags = reader.read("!H")[0]
5583 reader.skip(4)
5584 _experimenter = reader.read("!L")[0]
5585 assert(_experimenter == 6035143)
5586 _subtype = reader.read("!L")[0]
5587 assert(_subtype == 1)
5588 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_lacp_stats_entry.unpack)
5589 return obj
5590
5591 def __eq__(self, other):
5592 if type(self) != type(other): return False
5593 if self.xid != other.xid: return False
5594 if self.flags != other.flags: return False
5595 if self.entries != other.entries: return False
5596 return True
5597
5598 def pretty_print(self, q):
5599 q.text("bsn_lacp_stats_reply {")
5600 with q.group():
5601 with q.indent(2):
5602 q.breakable()
5603 q.text("xid = ");
5604 if self.xid != None:
5605 q.text("%#x" % self.xid)
5606 else:
5607 q.text('None')
5608 q.text(","); q.breakable()
5609 q.text("flags = ");
5610 q.text("%#x" % self.flags)
5611 q.text(","); q.breakable()
5612 q.text("entries = ");
5613 q.pp(self.entries)
5614 q.breakable()
5615 q.text('}')
5616
5617bsn_stats_reply.subtypes[1] = bsn_lacp_stats_reply
5618
5619class bsn_lacp_stats_request(bsn_stats_request):
5620 version = 5
5621 type = 18
5622 stats_type = 65535
5623 experimenter = 6035143
5624 subtype = 1
5625
5626 def __init__(self, xid=None, flags=None):
5627 if xid != None:
5628 self.xid = xid
5629 else:
5630 self.xid = None
5631 if flags != None:
5632 self.flags = flags
5633 else:
5634 self.flags = 0
5635 return
5636
5637 def pack(self):
5638 packed = []
5639 packed.append(struct.pack("!B", self.version))
5640 packed.append(struct.pack("!B", self.type))
5641 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5642 packed.append(struct.pack("!L", self.xid))
5643 packed.append(struct.pack("!H", self.stats_type))
5644 packed.append(struct.pack("!H", self.flags))
5645 packed.append('\x00' * 4)
5646 packed.append(struct.pack("!L", self.experimenter))
5647 packed.append(struct.pack("!L", self.subtype))
5648 length = sum([len(x) for x in packed])
5649 packed[2] = struct.pack("!H", length)
5650 return ''.join(packed)
5651
5652 @staticmethod
5653 def unpack(reader):
5654 obj = bsn_lacp_stats_request()
5655 _version = reader.read("!B")[0]
5656 assert(_version == 5)
5657 _type = reader.read("!B")[0]
5658 assert(_type == 18)
5659 _length = reader.read("!H")[0]
5660 orig_reader = reader
5661 reader = orig_reader.slice(_length - (2 + 2))
5662 obj.xid = reader.read("!L")[0]
5663 _stats_type = reader.read("!H")[0]
5664 assert(_stats_type == 65535)
5665 obj.flags = reader.read("!H")[0]
5666 reader.skip(4)
5667 _experimenter = reader.read("!L")[0]
5668 assert(_experimenter == 6035143)
5669 _subtype = reader.read("!L")[0]
5670 assert(_subtype == 1)
5671 return obj
5672
5673 def __eq__(self, other):
5674 if type(self) != type(other): return False
5675 if self.xid != other.xid: return False
5676 if self.flags != other.flags: return False
5677 return True
5678
5679 def pretty_print(self, q):
5680 q.text("bsn_lacp_stats_request {")
5681 with q.group():
5682 with q.indent(2):
5683 q.breakable()
5684 q.text("xid = ");
5685 if self.xid != None:
5686 q.text("%#x" % self.xid)
5687 else:
5688 q.text('None')
5689 q.text(","); q.breakable()
5690 q.text("flags = ");
5691 q.text("%#x" % self.flags)
5692 q.breakable()
5693 q.text('}')
5694
5695bsn_stats_request.subtypes[1] = bsn_lacp_stats_request
5696
5697class bsn_log(bsn_header):
5698 version = 5
5699 type = 4
5700 experimenter = 6035143
5701 subtype = 63
5702
5703 def __init__(self, xid=None, loglevel=None, data=None):
5704 if xid != None:
5705 self.xid = xid
5706 else:
5707 self.xid = None
5708 if loglevel != None:
5709 self.loglevel = loglevel
5710 else:
5711 self.loglevel = 0
5712 if data != None:
5713 self.data = data
5714 else:
5715 self.data = ''
5716 return
5717
5718 def pack(self):
5719 packed = []
5720 packed.append(struct.pack("!B", self.version))
5721 packed.append(struct.pack("!B", self.type))
5722 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5723 packed.append(struct.pack("!L", self.xid))
5724 packed.append(struct.pack("!L", self.experimenter))
5725 packed.append(struct.pack("!L", self.subtype))
5726 packed.append(struct.pack("!B", self.loglevel))
5727 packed.append(self.data)
5728 length = sum([len(x) for x in packed])
5729 packed[2] = struct.pack("!H", length)
5730 return ''.join(packed)
5731
5732 @staticmethod
5733 def unpack(reader):
5734 obj = bsn_log()
5735 _version = reader.read("!B")[0]
5736 assert(_version == 5)
5737 _type = reader.read("!B")[0]
5738 assert(_type == 4)
5739 _length = reader.read("!H")[0]
5740 orig_reader = reader
5741 reader = orig_reader.slice(_length - (2 + 2))
5742 obj.xid = reader.read("!L")[0]
5743 _experimenter = reader.read("!L")[0]
5744 assert(_experimenter == 6035143)
5745 _subtype = reader.read("!L")[0]
5746 assert(_subtype == 63)
5747 obj.loglevel = reader.read("!B")[0]
5748 obj.data = str(reader.read_all())
5749 return obj
5750
5751 def __eq__(self, other):
5752 if type(self) != type(other): return False
5753 if self.xid != other.xid: return False
5754 if self.loglevel != other.loglevel: return False
5755 if self.data != other.data: return False
5756 return True
5757
5758 def pretty_print(self, q):
5759 q.text("bsn_log {")
5760 with q.group():
5761 with q.indent(2):
5762 q.breakable()
5763 q.text("xid = ");
5764 if self.xid != None:
5765 q.text("%#x" % self.xid)
5766 else:
5767 q.text('None')
5768 q.text(","); q.breakable()
5769 q.text("loglevel = ");
5770 q.text("%#x" % self.loglevel)
5771 q.text(","); q.breakable()
5772 q.text("data = ");
5773 q.pp(self.data)
5774 q.breakable()
5775 q.text('}')
5776
5777bsn_header.subtypes[63] = bsn_log
5778
Rich Lane2e079da2014-10-29 15:30:24 -07005779class bsn_pdu_rx_reply(bsn_header):
5780 version = 5
5781 type = 4
5782 experimenter = 6035143
5783 subtype = 34
5784
5785 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
5786 if xid != None:
5787 self.xid = xid
5788 else:
5789 self.xid = None
5790 if status != None:
5791 self.status = status
5792 else:
5793 self.status = 0
5794 if port_no != None:
5795 self.port_no = port_no
5796 else:
5797 self.port_no = 0
5798 if slot_num != None:
5799 self.slot_num = slot_num
5800 else:
5801 self.slot_num = 0
5802 return
5803
5804 def pack(self):
5805 packed = []
5806 packed.append(struct.pack("!B", self.version))
5807 packed.append(struct.pack("!B", self.type))
5808 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5809 packed.append(struct.pack("!L", self.xid))
5810 packed.append(struct.pack("!L", self.experimenter))
5811 packed.append(struct.pack("!L", self.subtype))
5812 packed.append(struct.pack("!L", self.status))
5813 packed.append(util.pack_port_no(self.port_no))
5814 packed.append(struct.pack("!B", self.slot_num))
5815 length = sum([len(x) for x in packed])
5816 packed[2] = struct.pack("!H", length)
5817 return ''.join(packed)
5818
5819 @staticmethod
5820 def unpack(reader):
5821 obj = bsn_pdu_rx_reply()
5822 _version = reader.read("!B")[0]
5823 assert(_version == 5)
5824 _type = reader.read("!B")[0]
5825 assert(_type == 4)
5826 _length = reader.read("!H")[0]
5827 orig_reader = reader
5828 reader = orig_reader.slice(_length - (2 + 2))
5829 obj.xid = reader.read("!L")[0]
5830 _experimenter = reader.read("!L")[0]
5831 assert(_experimenter == 6035143)
5832 _subtype = reader.read("!L")[0]
5833 assert(_subtype == 34)
5834 obj.status = reader.read("!L")[0]
5835 obj.port_no = util.unpack_port_no(reader)
5836 obj.slot_num = reader.read("!B")[0]
5837 return obj
5838
5839 def __eq__(self, other):
5840 if type(self) != type(other): return False
5841 if self.xid != other.xid: return False
5842 if self.status != other.status: return False
5843 if self.port_no != other.port_no: return False
5844 if self.slot_num != other.slot_num: return False
5845 return True
5846
5847 def pretty_print(self, q):
5848 q.text("bsn_pdu_rx_reply {")
5849 with q.group():
5850 with q.indent(2):
5851 q.breakable()
5852 q.text("xid = ");
5853 if self.xid != None:
5854 q.text("%#x" % self.xid)
5855 else:
5856 q.text('None')
5857 q.text(","); q.breakable()
5858 q.text("status = ");
5859 q.text("%#x" % self.status)
5860 q.text(","); q.breakable()
5861 q.text("port_no = ");
5862 q.text(util.pretty_port(self.port_no))
5863 q.text(","); q.breakable()
5864 q.text("slot_num = ");
5865 q.text("%#x" % self.slot_num)
5866 q.breakable()
5867 q.text('}')
5868
5869bsn_header.subtypes[34] = bsn_pdu_rx_reply
5870
5871class bsn_pdu_rx_request(bsn_header):
5872 version = 5
5873 type = 4
5874 experimenter = 6035143
5875 subtype = 33
5876
5877 def __init__(self, xid=None, timeout_ms=None, port_no=None, slot_num=None, data=None):
5878 if xid != None:
5879 self.xid = xid
5880 else:
5881 self.xid = None
5882 if timeout_ms != None:
5883 self.timeout_ms = timeout_ms
5884 else:
5885 self.timeout_ms = 0
5886 if port_no != None:
5887 self.port_no = port_no
5888 else:
5889 self.port_no = 0
5890 if slot_num != None:
5891 self.slot_num = slot_num
5892 else:
5893 self.slot_num = 0
5894 if data != None:
5895 self.data = data
5896 else:
5897 self.data = ''
5898 return
5899
5900 def pack(self):
5901 packed = []
5902 packed.append(struct.pack("!B", self.version))
5903 packed.append(struct.pack("!B", self.type))
5904 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
5905 packed.append(struct.pack("!L", self.xid))
5906 packed.append(struct.pack("!L", self.experimenter))
5907 packed.append(struct.pack("!L", self.subtype))
5908 packed.append(struct.pack("!L", self.timeout_ms))
5909 packed.append(util.pack_port_no(self.port_no))
5910 packed.append(struct.pack("!B", self.slot_num))
5911 packed.append('\x00' * 3)
5912 packed.append(self.data)
5913 length = sum([len(x) for x in packed])
5914 packed[2] = struct.pack("!H", length)
5915 return ''.join(packed)
5916
5917 @staticmethod
5918 def unpack(reader):
5919 obj = bsn_pdu_rx_request()
5920 _version = reader.read("!B")[0]
5921 assert(_version == 5)
5922 _type = reader.read("!B")[0]
5923 assert(_type == 4)
5924 _length = reader.read("!H")[0]
5925 orig_reader = reader
5926 reader = orig_reader.slice(_length - (2 + 2))
5927 obj.xid = reader.read("!L")[0]
5928 _experimenter = reader.read("!L")[0]
5929 assert(_experimenter == 6035143)
5930 _subtype = reader.read("!L")[0]
5931 assert(_subtype == 33)
5932 obj.timeout_ms = reader.read("!L")[0]
5933 obj.port_no = util.unpack_port_no(reader)
5934 obj.slot_num = reader.read("!B")[0]
5935 reader.skip(3)
5936 obj.data = str(reader.read_all())
5937 return obj
5938
5939 def __eq__(self, other):
5940 if type(self) != type(other): return False
5941 if self.xid != other.xid: return False
5942 if self.timeout_ms != other.timeout_ms: return False
5943 if self.port_no != other.port_no: return False
5944 if self.slot_num != other.slot_num: return False
5945 if self.data != other.data: return False
5946 return True
5947
5948 def pretty_print(self, q):
5949 q.text("bsn_pdu_rx_request {")
5950 with q.group():
5951 with q.indent(2):
5952 q.breakable()
5953 q.text("xid = ");
5954 if self.xid != None:
5955 q.text("%#x" % self.xid)
5956 else:
5957 q.text('None')
5958 q.text(","); q.breakable()
5959 q.text("timeout_ms = ");
5960 q.text("%#x" % self.timeout_ms)
5961 q.text(","); q.breakable()
5962 q.text("port_no = ");
5963 q.text(util.pretty_port(self.port_no))
5964 q.text(","); q.breakable()
5965 q.text("slot_num = ");
5966 q.text("%#x" % self.slot_num)
5967 q.text(","); q.breakable()
5968 q.text("data = ");
5969 q.pp(self.data)
5970 q.breakable()
5971 q.text('}')
5972
5973bsn_header.subtypes[33] = bsn_pdu_rx_request
5974
5975class bsn_pdu_rx_timeout(bsn_header):
5976 version = 5
5977 type = 4
5978 experimenter = 6035143
5979 subtype = 35
5980
5981 def __init__(self, xid=None, port_no=None, slot_num=None):
5982 if xid != None:
5983 self.xid = xid
5984 else:
5985 self.xid = None
5986 if port_no != None:
5987 self.port_no = port_no
5988 else:
5989 self.port_no = 0
5990 if slot_num != None:
5991 self.slot_num = slot_num
5992 else:
5993 self.slot_num = 0
5994 return
5995
5996 def pack(self):
5997 packed = []
5998 packed.append(struct.pack("!B", self.version))
5999 packed.append(struct.pack("!B", self.type))
6000 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6001 packed.append(struct.pack("!L", self.xid))
6002 packed.append(struct.pack("!L", self.experimenter))
6003 packed.append(struct.pack("!L", self.subtype))
6004 packed.append(util.pack_port_no(self.port_no))
6005 packed.append(struct.pack("!B", self.slot_num))
6006 length = sum([len(x) for x in packed])
6007 packed[2] = struct.pack("!H", length)
6008 return ''.join(packed)
6009
6010 @staticmethod
6011 def unpack(reader):
6012 obj = bsn_pdu_rx_timeout()
6013 _version = reader.read("!B")[0]
6014 assert(_version == 5)
6015 _type = reader.read("!B")[0]
6016 assert(_type == 4)
6017 _length = reader.read("!H")[0]
6018 orig_reader = reader
6019 reader = orig_reader.slice(_length - (2 + 2))
6020 obj.xid = reader.read("!L")[0]
6021 _experimenter = reader.read("!L")[0]
6022 assert(_experimenter == 6035143)
6023 _subtype = reader.read("!L")[0]
6024 assert(_subtype == 35)
6025 obj.port_no = util.unpack_port_no(reader)
6026 obj.slot_num = reader.read("!B")[0]
6027 return obj
6028
6029 def __eq__(self, other):
6030 if type(self) != type(other): return False
6031 if self.xid != other.xid: return False
6032 if self.port_no != other.port_no: return False
6033 if self.slot_num != other.slot_num: return False
6034 return True
6035
6036 def pretty_print(self, q):
6037 q.text("bsn_pdu_rx_timeout {")
6038 with q.group():
6039 with q.indent(2):
6040 q.breakable()
6041 q.text("xid = ");
6042 if self.xid != None:
6043 q.text("%#x" % self.xid)
6044 else:
6045 q.text('None')
6046 q.text(","); q.breakable()
6047 q.text("port_no = ");
6048 q.text(util.pretty_port(self.port_no))
6049 q.text(","); q.breakable()
6050 q.text("slot_num = ");
6051 q.text("%#x" % self.slot_num)
6052 q.breakable()
6053 q.text('}')
6054
6055bsn_header.subtypes[35] = bsn_pdu_rx_timeout
6056
6057class bsn_pdu_tx_reply(bsn_header):
6058 version = 5
6059 type = 4
6060 experimenter = 6035143
6061 subtype = 32
6062
6063 def __init__(self, xid=None, status=None, port_no=None, slot_num=None):
6064 if xid != None:
6065 self.xid = xid
6066 else:
6067 self.xid = None
6068 if status != None:
6069 self.status = status
6070 else:
6071 self.status = 0
6072 if port_no != None:
6073 self.port_no = port_no
6074 else:
6075 self.port_no = 0
6076 if slot_num != None:
6077 self.slot_num = slot_num
6078 else:
6079 self.slot_num = 0
6080 return
6081
6082 def pack(self):
6083 packed = []
6084 packed.append(struct.pack("!B", self.version))
6085 packed.append(struct.pack("!B", self.type))
6086 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6087 packed.append(struct.pack("!L", self.xid))
6088 packed.append(struct.pack("!L", self.experimenter))
6089 packed.append(struct.pack("!L", self.subtype))
6090 packed.append(struct.pack("!L", self.status))
6091 packed.append(util.pack_port_no(self.port_no))
6092 packed.append(struct.pack("!B", self.slot_num))
6093 length = sum([len(x) for x in packed])
6094 packed[2] = struct.pack("!H", length)
6095 return ''.join(packed)
6096
6097 @staticmethod
6098 def unpack(reader):
6099 obj = bsn_pdu_tx_reply()
6100 _version = reader.read("!B")[0]
6101 assert(_version == 5)
6102 _type = reader.read("!B")[0]
6103 assert(_type == 4)
6104 _length = reader.read("!H")[0]
6105 orig_reader = reader
6106 reader = orig_reader.slice(_length - (2 + 2))
6107 obj.xid = reader.read("!L")[0]
6108 _experimenter = reader.read("!L")[0]
6109 assert(_experimenter == 6035143)
6110 _subtype = reader.read("!L")[0]
6111 assert(_subtype == 32)
6112 obj.status = reader.read("!L")[0]
6113 obj.port_no = util.unpack_port_no(reader)
6114 obj.slot_num = reader.read("!B")[0]
6115 return obj
6116
6117 def __eq__(self, other):
6118 if type(self) != type(other): return False
6119 if self.xid != other.xid: return False
6120 if self.status != other.status: return False
6121 if self.port_no != other.port_no: return False
6122 if self.slot_num != other.slot_num: return False
6123 return True
6124
6125 def pretty_print(self, q):
6126 q.text("bsn_pdu_tx_reply {")
6127 with q.group():
6128 with q.indent(2):
6129 q.breakable()
6130 q.text("xid = ");
6131 if self.xid != None:
6132 q.text("%#x" % self.xid)
6133 else:
6134 q.text('None')
6135 q.text(","); q.breakable()
6136 q.text("status = ");
6137 q.text("%#x" % self.status)
6138 q.text(","); q.breakable()
6139 q.text("port_no = ");
6140 q.text(util.pretty_port(self.port_no))
6141 q.text(","); q.breakable()
6142 q.text("slot_num = ");
6143 q.text("%#x" % self.slot_num)
6144 q.breakable()
6145 q.text('}')
6146
6147bsn_header.subtypes[32] = bsn_pdu_tx_reply
6148
6149class bsn_pdu_tx_request(bsn_header):
6150 version = 5
6151 type = 4
6152 experimenter = 6035143
6153 subtype = 31
6154
6155 def __init__(self, xid=None, tx_interval_ms=None, port_no=None, slot_num=None, data=None):
6156 if xid != None:
6157 self.xid = xid
6158 else:
6159 self.xid = None
6160 if tx_interval_ms != None:
6161 self.tx_interval_ms = tx_interval_ms
6162 else:
6163 self.tx_interval_ms = 0
6164 if port_no != None:
6165 self.port_no = port_no
6166 else:
6167 self.port_no = 0
6168 if slot_num != None:
6169 self.slot_num = slot_num
6170 else:
6171 self.slot_num = 0
6172 if data != None:
6173 self.data = data
6174 else:
6175 self.data = ''
6176 return
6177
6178 def pack(self):
6179 packed = []
6180 packed.append(struct.pack("!B", self.version))
6181 packed.append(struct.pack("!B", self.type))
6182 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6183 packed.append(struct.pack("!L", self.xid))
6184 packed.append(struct.pack("!L", self.experimenter))
6185 packed.append(struct.pack("!L", self.subtype))
6186 packed.append(struct.pack("!L", self.tx_interval_ms))
6187 packed.append(util.pack_port_no(self.port_no))
6188 packed.append(struct.pack("!B", self.slot_num))
6189 packed.append('\x00' * 3)
6190 packed.append(self.data)
6191 length = sum([len(x) for x in packed])
6192 packed[2] = struct.pack("!H", length)
6193 return ''.join(packed)
6194
6195 @staticmethod
6196 def unpack(reader):
6197 obj = bsn_pdu_tx_request()
6198 _version = reader.read("!B")[0]
6199 assert(_version == 5)
6200 _type = reader.read("!B")[0]
6201 assert(_type == 4)
6202 _length = reader.read("!H")[0]
6203 orig_reader = reader
6204 reader = orig_reader.slice(_length - (2 + 2))
6205 obj.xid = reader.read("!L")[0]
6206 _experimenter = reader.read("!L")[0]
6207 assert(_experimenter == 6035143)
6208 _subtype = reader.read("!L")[0]
6209 assert(_subtype == 31)
6210 obj.tx_interval_ms = reader.read("!L")[0]
6211 obj.port_no = util.unpack_port_no(reader)
6212 obj.slot_num = reader.read("!B")[0]
6213 reader.skip(3)
6214 obj.data = str(reader.read_all())
6215 return obj
6216
6217 def __eq__(self, other):
6218 if type(self) != type(other): return False
6219 if self.xid != other.xid: return False
6220 if self.tx_interval_ms != other.tx_interval_ms: return False
6221 if self.port_no != other.port_no: return False
6222 if self.slot_num != other.slot_num: return False
6223 if self.data != other.data: return False
6224 return True
6225
6226 def pretty_print(self, q):
6227 q.text("bsn_pdu_tx_request {")
6228 with q.group():
6229 with q.indent(2):
6230 q.breakable()
6231 q.text("xid = ");
6232 if self.xid != None:
6233 q.text("%#x" % self.xid)
6234 else:
6235 q.text('None')
6236 q.text(","); q.breakable()
6237 q.text("tx_interval_ms = ");
6238 q.text("%#x" % self.tx_interval_ms)
6239 q.text(","); q.breakable()
6240 q.text("port_no = ");
6241 q.text(util.pretty_port(self.port_no))
6242 q.text(","); q.breakable()
6243 q.text("slot_num = ");
6244 q.text("%#x" % self.slot_num)
6245 q.text(","); q.breakable()
6246 q.text("data = ");
6247 q.pp(self.data)
6248 q.breakable()
6249 q.text('}')
6250
6251bsn_header.subtypes[31] = bsn_pdu_tx_request
6252
Rich Laneccd32ed2014-11-10 17:48:24 -08006253class bsn_port_counter_stats_reply(bsn_stats_reply):
6254 version = 5
6255 type = 19
6256 stats_type = 65535
6257 experimenter = 6035143
6258 subtype = 8
6259
6260 def __init__(self, xid=None, flags=None, entries=None):
6261 if xid != None:
6262 self.xid = xid
6263 else:
6264 self.xid = None
6265 if flags != None:
6266 self.flags = flags
6267 else:
6268 self.flags = 0
6269 if entries != None:
6270 self.entries = entries
6271 else:
6272 self.entries = []
6273 return
6274
6275 def pack(self):
6276 packed = []
6277 packed.append(struct.pack("!B", self.version))
6278 packed.append(struct.pack("!B", self.type))
6279 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6280 packed.append(struct.pack("!L", self.xid))
6281 packed.append(struct.pack("!H", self.stats_type))
6282 packed.append(struct.pack("!H", self.flags))
6283 packed.append('\x00' * 4)
6284 packed.append(struct.pack("!L", self.experimenter))
6285 packed.append(struct.pack("!L", self.subtype))
6286 packed.append(loxi.generic_util.pack_list(self.entries))
6287 length = sum([len(x) for x in packed])
6288 packed[2] = struct.pack("!H", length)
6289 return ''.join(packed)
6290
6291 @staticmethod
6292 def unpack(reader):
6293 obj = bsn_port_counter_stats_reply()
6294 _version = reader.read("!B")[0]
6295 assert(_version == 5)
6296 _type = reader.read("!B")[0]
6297 assert(_type == 19)
6298 _length = reader.read("!H")[0]
6299 orig_reader = reader
6300 reader = orig_reader.slice(_length - (2 + 2))
6301 obj.xid = reader.read("!L")[0]
6302 _stats_type = reader.read("!H")[0]
6303 assert(_stats_type == 65535)
6304 obj.flags = reader.read("!H")[0]
6305 reader.skip(4)
6306 _experimenter = reader.read("!L")[0]
6307 assert(_experimenter == 6035143)
6308 _subtype = reader.read("!L")[0]
6309 assert(_subtype == 8)
6310 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_port_counter_stats_entry.unpack)
6311 return obj
6312
6313 def __eq__(self, other):
6314 if type(self) != type(other): return False
6315 if self.xid != other.xid: return False
6316 if self.flags != other.flags: return False
6317 if self.entries != other.entries: return False
6318 return True
6319
6320 def pretty_print(self, q):
6321 q.text("bsn_port_counter_stats_reply {")
6322 with q.group():
6323 with q.indent(2):
6324 q.breakable()
6325 q.text("xid = ");
6326 if self.xid != None:
6327 q.text("%#x" % self.xid)
6328 else:
6329 q.text('None')
6330 q.text(","); q.breakable()
6331 q.text("flags = ");
6332 q.text("%#x" % self.flags)
6333 q.text(","); q.breakable()
6334 q.text("entries = ");
6335 q.pp(self.entries)
6336 q.breakable()
6337 q.text('}')
6338
6339bsn_stats_reply.subtypes[8] = bsn_port_counter_stats_reply
6340
6341class bsn_port_counter_stats_request(bsn_stats_request):
6342 version = 5
6343 type = 18
6344 stats_type = 65535
6345 experimenter = 6035143
6346 subtype = 8
6347
6348 def __init__(self, xid=None, flags=None, port_no=None):
6349 if xid != None:
6350 self.xid = xid
6351 else:
6352 self.xid = None
6353 if flags != None:
6354 self.flags = flags
6355 else:
6356 self.flags = 0
6357 if port_no != None:
6358 self.port_no = port_no
6359 else:
6360 self.port_no = 0
6361 return
6362
6363 def pack(self):
6364 packed = []
6365 packed.append(struct.pack("!B", self.version))
6366 packed.append(struct.pack("!B", self.type))
6367 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6368 packed.append(struct.pack("!L", self.xid))
6369 packed.append(struct.pack("!H", self.stats_type))
6370 packed.append(struct.pack("!H", self.flags))
6371 packed.append('\x00' * 4)
6372 packed.append(struct.pack("!L", self.experimenter))
6373 packed.append(struct.pack("!L", self.subtype))
6374 packed.append(util.pack_port_no(self.port_no))
6375 length = sum([len(x) for x in packed])
6376 packed[2] = struct.pack("!H", length)
6377 return ''.join(packed)
6378
6379 @staticmethod
6380 def unpack(reader):
6381 obj = bsn_port_counter_stats_request()
6382 _version = reader.read("!B")[0]
6383 assert(_version == 5)
6384 _type = reader.read("!B")[0]
6385 assert(_type == 18)
6386 _length = reader.read("!H")[0]
6387 orig_reader = reader
6388 reader = orig_reader.slice(_length - (2 + 2))
6389 obj.xid = reader.read("!L")[0]
6390 _stats_type = reader.read("!H")[0]
6391 assert(_stats_type == 65535)
6392 obj.flags = reader.read("!H")[0]
6393 reader.skip(4)
6394 _experimenter = reader.read("!L")[0]
6395 assert(_experimenter == 6035143)
6396 _subtype = reader.read("!L")[0]
6397 assert(_subtype == 8)
6398 obj.port_no = util.unpack_port_no(reader)
6399 return obj
6400
6401 def __eq__(self, other):
6402 if type(self) != type(other): return False
6403 if self.xid != other.xid: return False
6404 if self.flags != other.flags: return False
6405 if self.port_no != other.port_no: return False
6406 return True
6407
6408 def pretty_print(self, q):
6409 q.text("bsn_port_counter_stats_request {")
6410 with q.group():
6411 with q.indent(2):
6412 q.breakable()
6413 q.text("xid = ");
6414 if self.xid != None:
6415 q.text("%#x" % self.xid)
6416 else:
6417 q.text('None')
6418 q.text(","); q.breakable()
6419 q.text("flags = ");
6420 q.text("%#x" % self.flags)
6421 q.text(","); q.breakable()
6422 q.text("port_no = ");
6423 q.text(util.pretty_port(self.port_no))
6424 q.breakable()
6425 q.text('}')
6426
6427bsn_stats_request.subtypes[8] = bsn_port_counter_stats_request
6428
6429class bsn_set_aux_cxns_reply(bsn_header):
6430 version = 5
6431 type = 4
6432 experimenter = 6035143
6433 subtype = 59
6434
6435 def __init__(self, xid=None, num_aux=None, status=None):
6436 if xid != None:
6437 self.xid = xid
6438 else:
6439 self.xid = None
6440 if num_aux != None:
6441 self.num_aux = num_aux
6442 else:
6443 self.num_aux = 0
6444 if status != None:
6445 self.status = status
6446 else:
6447 self.status = 0
6448 return
6449
6450 def pack(self):
6451 packed = []
6452 packed.append(struct.pack("!B", self.version))
6453 packed.append(struct.pack("!B", self.type))
6454 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6455 packed.append(struct.pack("!L", self.xid))
6456 packed.append(struct.pack("!L", self.experimenter))
6457 packed.append(struct.pack("!L", self.subtype))
6458 packed.append(struct.pack("!L", self.num_aux))
6459 packed.append(struct.pack("!L", self.status))
6460 length = sum([len(x) for x in packed])
6461 packed[2] = struct.pack("!H", length)
6462 return ''.join(packed)
6463
6464 @staticmethod
6465 def unpack(reader):
6466 obj = bsn_set_aux_cxns_reply()
6467 _version = reader.read("!B")[0]
6468 assert(_version == 5)
6469 _type = reader.read("!B")[0]
6470 assert(_type == 4)
6471 _length = reader.read("!H")[0]
6472 orig_reader = reader
6473 reader = orig_reader.slice(_length - (2 + 2))
6474 obj.xid = reader.read("!L")[0]
6475 _experimenter = reader.read("!L")[0]
6476 assert(_experimenter == 6035143)
6477 _subtype = reader.read("!L")[0]
6478 assert(_subtype == 59)
6479 obj.num_aux = reader.read("!L")[0]
6480 obj.status = reader.read("!L")[0]
6481 return obj
6482
6483 def __eq__(self, other):
6484 if type(self) != type(other): return False
6485 if self.xid != other.xid: return False
6486 if self.num_aux != other.num_aux: return False
6487 if self.status != other.status: return False
6488 return True
6489
6490 def pretty_print(self, q):
6491 q.text("bsn_set_aux_cxns_reply {")
6492 with q.group():
6493 with q.indent(2):
6494 q.breakable()
6495 q.text("xid = ");
6496 if self.xid != None:
6497 q.text("%#x" % self.xid)
6498 else:
6499 q.text('None')
6500 q.text(","); q.breakable()
6501 q.text("num_aux = ");
6502 q.text("%#x" % self.num_aux)
6503 q.text(","); q.breakable()
6504 q.text("status = ");
6505 q.text("%#x" % self.status)
6506 q.breakable()
6507 q.text('}')
6508
6509bsn_header.subtypes[59] = bsn_set_aux_cxns_reply
6510
6511class bsn_set_aux_cxns_request(bsn_header):
6512 version = 5
6513 type = 4
6514 experimenter = 6035143
6515 subtype = 58
6516
6517 def __init__(self, xid=None, num_aux=None):
6518 if xid != None:
6519 self.xid = xid
6520 else:
6521 self.xid = None
6522 if num_aux != None:
6523 self.num_aux = num_aux
6524 else:
6525 self.num_aux = 0
6526 return
6527
6528 def pack(self):
6529 packed = []
6530 packed.append(struct.pack("!B", self.version))
6531 packed.append(struct.pack("!B", self.type))
6532 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6533 packed.append(struct.pack("!L", self.xid))
6534 packed.append(struct.pack("!L", self.experimenter))
6535 packed.append(struct.pack("!L", self.subtype))
6536 packed.append(struct.pack("!L", self.num_aux))
6537 length = sum([len(x) for x in packed])
6538 packed[2] = struct.pack("!H", length)
6539 return ''.join(packed)
6540
6541 @staticmethod
6542 def unpack(reader):
6543 obj = bsn_set_aux_cxns_request()
6544 _version = reader.read("!B")[0]
6545 assert(_version == 5)
6546 _type = reader.read("!B")[0]
6547 assert(_type == 4)
6548 _length = reader.read("!H")[0]
6549 orig_reader = reader
6550 reader = orig_reader.slice(_length - (2 + 2))
6551 obj.xid = reader.read("!L")[0]
6552 _experimenter = reader.read("!L")[0]
6553 assert(_experimenter == 6035143)
6554 _subtype = reader.read("!L")[0]
6555 assert(_subtype == 58)
6556 obj.num_aux = reader.read("!L")[0]
6557 return obj
6558
6559 def __eq__(self, other):
6560 if type(self) != type(other): return False
6561 if self.xid != other.xid: return False
6562 if self.num_aux != other.num_aux: return False
6563 return True
6564
6565 def pretty_print(self, q):
6566 q.text("bsn_set_aux_cxns_request {")
6567 with q.group():
6568 with q.indent(2):
6569 q.breakable()
6570 q.text("xid = ");
6571 if self.xid != None:
6572 q.text("%#x" % self.xid)
6573 else:
6574 q.text('None')
6575 q.text(","); q.breakable()
6576 q.text("num_aux = ");
6577 q.text("%#x" % self.num_aux)
6578 q.breakable()
6579 q.text('}')
6580
6581bsn_header.subtypes[58] = bsn_set_aux_cxns_request
6582
6583class bsn_set_lacp_reply(bsn_header):
6584 version = 5
6585 type = 4
6586 experimenter = 6035143
6587 subtype = 42
6588
6589 def __init__(self, xid=None, status=None, port_no=None):
6590 if xid != None:
6591 self.xid = xid
6592 else:
6593 self.xid = None
6594 if status != None:
6595 self.status = status
6596 else:
6597 self.status = 0
6598 if port_no != None:
6599 self.port_no = port_no
6600 else:
6601 self.port_no = 0
6602 return
6603
6604 def pack(self):
6605 packed = []
6606 packed.append(struct.pack("!B", self.version))
6607 packed.append(struct.pack("!B", self.type))
6608 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6609 packed.append(struct.pack("!L", self.xid))
6610 packed.append(struct.pack("!L", self.experimenter))
6611 packed.append(struct.pack("!L", self.subtype))
6612 packed.append(struct.pack("!L", self.status))
6613 packed.append(util.pack_port_no(self.port_no))
6614 length = sum([len(x) for x in packed])
6615 packed[2] = struct.pack("!H", length)
6616 return ''.join(packed)
6617
6618 @staticmethod
6619 def unpack(reader):
6620 obj = bsn_set_lacp_reply()
6621 _version = reader.read("!B")[0]
6622 assert(_version == 5)
6623 _type = reader.read("!B")[0]
6624 assert(_type == 4)
6625 _length = reader.read("!H")[0]
6626 orig_reader = reader
6627 reader = orig_reader.slice(_length - (2 + 2))
6628 obj.xid = reader.read("!L")[0]
6629 _experimenter = reader.read("!L")[0]
6630 assert(_experimenter == 6035143)
6631 _subtype = reader.read("!L")[0]
6632 assert(_subtype == 42)
6633 obj.status = reader.read("!L")[0]
6634 obj.port_no = util.unpack_port_no(reader)
6635 return obj
6636
6637 def __eq__(self, other):
6638 if type(self) != type(other): return False
6639 if self.xid != other.xid: return False
6640 if self.status != other.status: return False
6641 if self.port_no != other.port_no: return False
6642 return True
6643
6644 def pretty_print(self, q):
6645 q.text("bsn_set_lacp_reply {")
6646 with q.group():
6647 with q.indent(2):
6648 q.breakable()
6649 q.text("xid = ");
6650 if self.xid != None:
6651 q.text("%#x" % self.xid)
6652 else:
6653 q.text('None')
6654 q.text(","); q.breakable()
6655 q.text("status = ");
6656 q.text("%#x" % self.status)
6657 q.text(","); q.breakable()
6658 q.text("port_no = ");
6659 q.text(util.pretty_port(self.port_no))
6660 q.breakable()
6661 q.text('}')
6662
6663bsn_header.subtypes[42] = bsn_set_lacp_reply
6664
6665class bsn_set_lacp_request(bsn_header):
6666 version = 5
6667 type = 4
6668 experimenter = 6035143
6669 subtype = 41
6670
6671 def __init__(self, xid=None, enabled=None, port_no=None, actor_sys_priority=None, actor_sys_mac=None, actor_port_priority=None, actor_port_num=None, actor_key=None):
6672 if xid != None:
6673 self.xid = xid
6674 else:
6675 self.xid = None
6676 if enabled != None:
6677 self.enabled = enabled
6678 else:
6679 self.enabled = 0
6680 if port_no != None:
6681 self.port_no = port_no
6682 else:
6683 self.port_no = 0
6684 if actor_sys_priority != None:
6685 self.actor_sys_priority = actor_sys_priority
6686 else:
6687 self.actor_sys_priority = 0
6688 if actor_sys_mac != None:
6689 self.actor_sys_mac = actor_sys_mac
6690 else:
6691 self.actor_sys_mac = [0,0,0,0,0,0]
6692 if actor_port_priority != None:
6693 self.actor_port_priority = actor_port_priority
6694 else:
6695 self.actor_port_priority = 0
6696 if actor_port_num != None:
6697 self.actor_port_num = actor_port_num
6698 else:
6699 self.actor_port_num = 0
6700 if actor_key != None:
6701 self.actor_key = actor_key
6702 else:
6703 self.actor_key = 0
6704 return
6705
6706 def pack(self):
6707 packed = []
6708 packed.append(struct.pack("!B", self.version))
6709 packed.append(struct.pack("!B", self.type))
6710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6711 packed.append(struct.pack("!L", self.xid))
6712 packed.append(struct.pack("!L", self.experimenter))
6713 packed.append(struct.pack("!L", self.subtype))
6714 packed.append(struct.pack("!B", self.enabled))
6715 packed.append('\x00' * 3)
6716 packed.append(util.pack_port_no(self.port_no))
6717 packed.append(struct.pack("!H", self.actor_sys_priority))
6718 packed.append(struct.pack("!6B", *self.actor_sys_mac))
6719 packed.append(struct.pack("!H", self.actor_port_priority))
6720 packed.append(struct.pack("!H", self.actor_port_num))
6721 packed.append(struct.pack("!H", self.actor_key))
6722 length = sum([len(x) for x in packed])
6723 packed[2] = struct.pack("!H", length)
6724 return ''.join(packed)
6725
6726 @staticmethod
6727 def unpack(reader):
6728 obj = bsn_set_lacp_request()
6729 _version = reader.read("!B")[0]
6730 assert(_version == 5)
6731 _type = reader.read("!B")[0]
6732 assert(_type == 4)
6733 _length = reader.read("!H")[0]
6734 orig_reader = reader
6735 reader = orig_reader.slice(_length - (2 + 2))
6736 obj.xid = reader.read("!L")[0]
6737 _experimenter = reader.read("!L")[0]
6738 assert(_experimenter == 6035143)
6739 _subtype = reader.read("!L")[0]
6740 assert(_subtype == 41)
6741 obj.enabled = reader.read("!B")[0]
6742 reader.skip(3)
6743 obj.port_no = util.unpack_port_no(reader)
6744 obj.actor_sys_priority = reader.read("!H")[0]
6745 obj.actor_sys_mac = list(reader.read('!6B'))
6746 obj.actor_port_priority = reader.read("!H")[0]
6747 obj.actor_port_num = reader.read("!H")[0]
6748 obj.actor_key = reader.read("!H")[0]
6749 return obj
6750
6751 def __eq__(self, other):
6752 if type(self) != type(other): return False
6753 if self.xid != other.xid: return False
6754 if self.enabled != other.enabled: return False
6755 if self.port_no != other.port_no: return False
6756 if self.actor_sys_priority != other.actor_sys_priority: return False
6757 if self.actor_sys_mac != other.actor_sys_mac: return False
6758 if self.actor_port_priority != other.actor_port_priority: return False
6759 if self.actor_port_num != other.actor_port_num: return False
6760 if self.actor_key != other.actor_key: return False
6761 return True
6762
6763 def pretty_print(self, q):
6764 q.text("bsn_set_lacp_request {")
6765 with q.group():
6766 with q.indent(2):
6767 q.breakable()
6768 q.text("xid = ");
6769 if self.xid != None:
6770 q.text("%#x" % self.xid)
6771 else:
6772 q.text('None')
6773 q.text(","); q.breakable()
6774 q.text("enabled = ");
6775 q.text("%#x" % self.enabled)
6776 q.text(","); q.breakable()
6777 q.text("port_no = ");
6778 q.text(util.pretty_port(self.port_no))
6779 q.text(","); q.breakable()
6780 q.text("actor_sys_priority = ");
6781 q.text("%#x" % self.actor_sys_priority)
6782 q.text(","); q.breakable()
6783 q.text("actor_sys_mac = ");
6784 q.text(util.pretty_mac(self.actor_sys_mac))
6785 q.text(","); q.breakable()
6786 q.text("actor_port_priority = ");
6787 q.text("%#x" % self.actor_port_priority)
6788 q.text(","); q.breakable()
6789 q.text("actor_port_num = ");
6790 q.text("%#x" % self.actor_port_num)
6791 q.text(","); q.breakable()
6792 q.text("actor_key = ");
6793 q.text("%#x" % self.actor_key)
6794 q.breakable()
6795 q.text('}')
6796
6797bsn_header.subtypes[41] = bsn_set_lacp_request
6798
Rich Lane2e079da2014-10-29 15:30:24 -07006799class bsn_set_mirroring(bsn_header):
6800 version = 5
6801 type = 4
6802 experimenter = 6035143
6803 subtype = 3
6804
6805 def __init__(self, xid=None, report_mirror_ports=None):
6806 if xid != None:
6807 self.xid = xid
6808 else:
6809 self.xid = None
6810 if report_mirror_ports != None:
6811 self.report_mirror_ports = report_mirror_ports
6812 else:
6813 self.report_mirror_ports = 0
6814 return
6815
6816 def pack(self):
6817 packed = []
6818 packed.append(struct.pack("!B", self.version))
6819 packed.append(struct.pack("!B", self.type))
6820 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6821 packed.append(struct.pack("!L", self.xid))
6822 packed.append(struct.pack("!L", self.experimenter))
6823 packed.append(struct.pack("!L", self.subtype))
6824 packed.append(struct.pack("!B", self.report_mirror_ports))
6825 packed.append('\x00' * 3)
6826 length = sum([len(x) for x in packed])
6827 packed[2] = struct.pack("!H", length)
6828 return ''.join(packed)
6829
6830 @staticmethod
6831 def unpack(reader):
6832 obj = bsn_set_mirroring()
6833 _version = reader.read("!B")[0]
6834 assert(_version == 5)
6835 _type = reader.read("!B")[0]
6836 assert(_type == 4)
6837 _length = reader.read("!H")[0]
6838 orig_reader = reader
6839 reader = orig_reader.slice(_length - (2 + 2))
6840 obj.xid = reader.read("!L")[0]
6841 _experimenter = reader.read("!L")[0]
6842 assert(_experimenter == 6035143)
6843 _subtype = reader.read("!L")[0]
6844 assert(_subtype == 3)
6845 obj.report_mirror_ports = reader.read("!B")[0]
6846 reader.skip(3)
6847 return obj
6848
6849 def __eq__(self, other):
6850 if type(self) != type(other): return False
6851 if self.xid != other.xid: return False
6852 if self.report_mirror_ports != other.report_mirror_ports: return False
6853 return True
6854
6855 def pretty_print(self, q):
6856 q.text("bsn_set_mirroring {")
6857 with q.group():
6858 with q.indent(2):
6859 q.breakable()
6860 q.text("xid = ");
6861 if self.xid != None:
6862 q.text("%#x" % self.xid)
6863 else:
6864 q.text('None')
6865 q.text(","); q.breakable()
6866 q.text("report_mirror_ports = ");
6867 q.text("%#x" % self.report_mirror_ports)
6868 q.breakable()
6869 q.text('}')
6870
6871bsn_header.subtypes[3] = bsn_set_mirroring
6872
6873class bsn_set_pktin_suppression_reply(bsn_header):
6874 version = 5
6875 type = 4
6876 experimenter = 6035143
6877 subtype = 25
6878
6879 def __init__(self, xid=None, status=None):
6880 if xid != None:
6881 self.xid = xid
6882 else:
6883 self.xid = None
6884 if status != None:
6885 self.status = status
6886 else:
6887 self.status = 0
6888 return
6889
6890 def pack(self):
6891 packed = []
6892 packed.append(struct.pack("!B", self.version))
6893 packed.append(struct.pack("!B", self.type))
6894 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6895 packed.append(struct.pack("!L", self.xid))
6896 packed.append(struct.pack("!L", self.experimenter))
6897 packed.append(struct.pack("!L", self.subtype))
6898 packed.append(struct.pack("!L", self.status))
6899 length = sum([len(x) for x in packed])
6900 packed[2] = struct.pack("!H", length)
6901 return ''.join(packed)
6902
6903 @staticmethod
6904 def unpack(reader):
6905 obj = bsn_set_pktin_suppression_reply()
6906 _version = reader.read("!B")[0]
6907 assert(_version == 5)
6908 _type = reader.read("!B")[0]
6909 assert(_type == 4)
6910 _length = reader.read("!H")[0]
6911 orig_reader = reader
6912 reader = orig_reader.slice(_length - (2 + 2))
6913 obj.xid = reader.read("!L")[0]
6914 _experimenter = reader.read("!L")[0]
6915 assert(_experimenter == 6035143)
6916 _subtype = reader.read("!L")[0]
6917 assert(_subtype == 25)
6918 obj.status = reader.read("!L")[0]
6919 return obj
6920
6921 def __eq__(self, other):
6922 if type(self) != type(other): return False
6923 if self.xid != other.xid: return False
6924 if self.status != other.status: return False
6925 return True
6926
6927 def pretty_print(self, q):
6928 q.text("bsn_set_pktin_suppression_reply {")
6929 with q.group():
6930 with q.indent(2):
6931 q.breakable()
6932 q.text("xid = ");
6933 if self.xid != None:
6934 q.text("%#x" % self.xid)
6935 else:
6936 q.text('None')
6937 q.text(","); q.breakable()
6938 q.text("status = ");
6939 q.text("%#x" % self.status)
6940 q.breakable()
6941 q.text('}')
6942
6943bsn_header.subtypes[25] = bsn_set_pktin_suppression_reply
6944
6945class bsn_set_pktin_suppression_request(bsn_header):
6946 version = 5
6947 type = 4
6948 experimenter = 6035143
6949 subtype = 11
6950
6951 def __init__(self, xid=None, enabled=None, idle_timeout=None, hard_timeout=None, priority=None, cookie=None):
6952 if xid != None:
6953 self.xid = xid
6954 else:
6955 self.xid = None
6956 if enabled != None:
6957 self.enabled = enabled
6958 else:
6959 self.enabled = 0
6960 if idle_timeout != None:
6961 self.idle_timeout = idle_timeout
6962 else:
6963 self.idle_timeout = 0
6964 if hard_timeout != None:
6965 self.hard_timeout = hard_timeout
6966 else:
6967 self.hard_timeout = 0
6968 if priority != None:
6969 self.priority = priority
6970 else:
6971 self.priority = 0
6972 if cookie != None:
6973 self.cookie = cookie
6974 else:
6975 self.cookie = 0
6976 return
6977
6978 def pack(self):
6979 packed = []
6980 packed.append(struct.pack("!B", self.version))
6981 packed.append(struct.pack("!B", self.type))
6982 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
6983 packed.append(struct.pack("!L", self.xid))
6984 packed.append(struct.pack("!L", self.experimenter))
6985 packed.append(struct.pack("!L", self.subtype))
6986 packed.append(struct.pack("!B", self.enabled))
6987 packed.append('\x00' * 1)
6988 packed.append(struct.pack("!H", self.idle_timeout))
6989 packed.append(struct.pack("!H", self.hard_timeout))
6990 packed.append(struct.pack("!H", self.priority))
6991 packed.append(struct.pack("!Q", self.cookie))
6992 length = sum([len(x) for x in packed])
6993 packed[2] = struct.pack("!H", length)
6994 return ''.join(packed)
6995
6996 @staticmethod
6997 def unpack(reader):
6998 obj = bsn_set_pktin_suppression_request()
6999 _version = reader.read("!B")[0]
7000 assert(_version == 5)
7001 _type = reader.read("!B")[0]
7002 assert(_type == 4)
7003 _length = reader.read("!H")[0]
7004 orig_reader = reader
7005 reader = orig_reader.slice(_length - (2 + 2))
7006 obj.xid = reader.read("!L")[0]
7007 _experimenter = reader.read("!L")[0]
7008 assert(_experimenter == 6035143)
7009 _subtype = reader.read("!L")[0]
7010 assert(_subtype == 11)
7011 obj.enabled = reader.read("!B")[0]
7012 reader.skip(1)
7013 obj.idle_timeout = reader.read("!H")[0]
7014 obj.hard_timeout = reader.read("!H")[0]
7015 obj.priority = reader.read("!H")[0]
7016 obj.cookie = reader.read("!Q")[0]
7017 return obj
7018
7019 def __eq__(self, other):
7020 if type(self) != type(other): return False
7021 if self.xid != other.xid: return False
7022 if self.enabled != other.enabled: return False
7023 if self.idle_timeout != other.idle_timeout: return False
7024 if self.hard_timeout != other.hard_timeout: return False
7025 if self.priority != other.priority: return False
7026 if self.cookie != other.cookie: return False
7027 return True
7028
7029 def pretty_print(self, q):
7030 q.text("bsn_set_pktin_suppression_request {")
7031 with q.group():
7032 with q.indent(2):
7033 q.breakable()
7034 q.text("xid = ");
7035 if self.xid != None:
7036 q.text("%#x" % self.xid)
7037 else:
7038 q.text('None')
7039 q.text(","); q.breakable()
7040 q.text("enabled = ");
7041 q.text("%#x" % self.enabled)
7042 q.text(","); q.breakable()
7043 q.text("idle_timeout = ");
7044 q.text("%#x" % self.idle_timeout)
7045 q.text(","); q.breakable()
7046 q.text("hard_timeout = ");
7047 q.text("%#x" % self.hard_timeout)
7048 q.text(","); q.breakable()
7049 q.text("priority = ");
7050 q.text("%#x" % self.priority)
7051 q.text(","); q.breakable()
7052 q.text("cookie = ");
7053 q.text("%#x" % self.cookie)
7054 q.breakable()
7055 q.text('}')
7056
7057bsn_header.subtypes[11] = bsn_set_pktin_suppression_request
7058
Rich Laneccd32ed2014-11-10 17:48:24 -08007059class bsn_set_switch_pipeline_reply(bsn_header):
Rich Lane2e079da2014-10-29 15:30:24 -07007060 version = 5
Rich Laneccd32ed2014-11-10 17:48:24 -08007061 type = 4
7062 experimenter = 6035143
7063 subtype = 54
Rich Lane2e079da2014-10-29 15:30:24 -07007064
Rich Laneccd32ed2014-11-10 17:48:24 -08007065 def __init__(self, xid=None, status=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007066 if xid != None:
7067 self.xid = xid
7068 else:
7069 self.xid = None
Rich Laneccd32ed2014-11-10 17:48:24 -08007070 if status != None:
7071 self.status = status
Rich Lane2e079da2014-10-29 15:30:24 -07007072 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007073 self.status = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007074 return
7075
7076 def pack(self):
7077 packed = []
7078 packed.append(struct.pack("!B", self.version))
7079 packed.append(struct.pack("!B", self.type))
7080 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7081 packed.append(struct.pack("!L", self.xid))
Rich Lane2e079da2014-10-29 15:30:24 -07007082 packed.append(struct.pack("!L", self.experimenter))
7083 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007084 packed.append(struct.pack("!L", self.status))
Rich Lane2e079da2014-10-29 15:30:24 -07007085 length = sum([len(x) for x in packed])
7086 packed[2] = struct.pack("!H", length)
7087 return ''.join(packed)
7088
7089 @staticmethod
7090 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007091 obj = bsn_set_switch_pipeline_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007092 _version = reader.read("!B")[0]
7093 assert(_version == 5)
7094 _type = reader.read("!B")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007095 assert(_type == 4)
Rich Lane2e079da2014-10-29 15:30:24 -07007096 _length = reader.read("!H")[0]
7097 orig_reader = reader
7098 reader = orig_reader.slice(_length - (2 + 2))
7099 obj.xid = reader.read("!L")[0]
Rich Laneccd32ed2014-11-10 17:48:24 -08007100 _experimenter = reader.read("!L")[0]
7101 assert(_experimenter == 6035143)
7102 _subtype = reader.read("!L")[0]
7103 assert(_subtype == 54)
7104 obj.status = reader.read("!L")[0]
Rich Lane2e079da2014-10-29 15:30:24 -07007105 return obj
7106
7107 def __eq__(self, other):
7108 if type(self) != type(other): return False
7109 if self.xid != other.xid: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007110 if self.status != other.status: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007111 return True
7112
7113 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007114 q.text("bsn_set_switch_pipeline_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007115 with q.group():
7116 with q.indent(2):
7117 q.breakable()
7118 q.text("xid = ");
7119 if self.xid != None:
7120 q.text("%#x" % self.xid)
7121 else:
7122 q.text('None')
7123 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007124 q.text("status = ");
7125 q.text("%#x" % self.status)
Rich Lane2e079da2014-10-29 15:30:24 -07007126 q.breakable()
7127 q.text('}')
7128
Rich Laneccd32ed2014-11-10 17:48:24 -08007129bsn_header.subtypes[54] = bsn_set_switch_pipeline_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007130
Rich Laneccd32ed2014-11-10 17:48:24 -08007131class bsn_set_switch_pipeline_request(bsn_header):
7132 version = 5
7133 type = 4
7134 experimenter = 6035143
7135 subtype = 53
Rich Lane2e079da2014-10-29 15:30:24 -07007136
Rich Laneccd32ed2014-11-10 17:48:24 -08007137 def __init__(self, xid=None, pipeline=None):
7138 if xid != None:
7139 self.xid = xid
7140 else:
7141 self.xid = None
7142 if pipeline != None:
7143 self.pipeline = pipeline
7144 else:
7145 self.pipeline = ""
7146 return
7147
7148 def pack(self):
7149 packed = []
7150 packed.append(struct.pack("!B", self.version))
7151 packed.append(struct.pack("!B", self.type))
7152 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7153 packed.append(struct.pack("!L", self.xid))
7154 packed.append(struct.pack("!L", self.experimenter))
7155 packed.append(struct.pack("!L", self.subtype))
7156 packed.append(struct.pack("!256s", self.pipeline))
7157 length = sum([len(x) for x in packed])
7158 packed[2] = struct.pack("!H", length)
7159 return ''.join(packed)
7160
7161 @staticmethod
7162 def unpack(reader):
7163 obj = bsn_set_switch_pipeline_request()
7164 _version = reader.read("!B")[0]
7165 assert(_version == 5)
7166 _type = reader.read("!B")[0]
7167 assert(_type == 4)
7168 _length = reader.read("!H")[0]
7169 orig_reader = reader
7170 reader = orig_reader.slice(_length - (2 + 2))
7171 obj.xid = reader.read("!L")[0]
7172 _experimenter = reader.read("!L")[0]
7173 assert(_experimenter == 6035143)
7174 _subtype = reader.read("!L")[0]
7175 assert(_subtype == 53)
7176 obj.pipeline = reader.read("!256s")[0].rstrip("\x00")
7177 return obj
7178
7179 def __eq__(self, other):
7180 if type(self) != type(other): return False
7181 if self.xid != other.xid: return False
7182 if self.pipeline != other.pipeline: return False
7183 return True
7184
7185 def pretty_print(self, q):
7186 q.text("bsn_set_switch_pipeline_request {")
7187 with q.group():
7188 with q.indent(2):
7189 q.breakable()
7190 q.text("xid = ");
7191 if self.xid != None:
7192 q.text("%#x" % self.xid)
7193 else:
7194 q.text('None')
7195 q.text(","); q.breakable()
7196 q.text("pipeline = ");
7197 q.pp(self.pipeline)
7198 q.breakable()
7199 q.text('}')
7200
7201bsn_header.subtypes[53] = bsn_set_switch_pipeline_request
7202
7203class bsn_switch_pipeline_stats_reply(bsn_stats_reply):
Rich Lane2e079da2014-10-29 15:30:24 -07007204 version = 5
7205 type = 19
7206 stats_type = 65535
7207 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007208 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007209
Rich Laneccd32ed2014-11-10 17:48:24 -08007210 def __init__(self, xid=None, flags=None, entries=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007211 if xid != None:
7212 self.xid = xid
7213 else:
7214 self.xid = None
7215 if flags != None:
7216 self.flags = flags
7217 else:
7218 self.flags = 0
Rich Laneccd32ed2014-11-10 17:48:24 -08007219 if entries != None:
7220 self.entries = entries
Rich Lane2e079da2014-10-29 15:30:24 -07007221 else:
Rich Laneccd32ed2014-11-10 17:48:24 -08007222 self.entries = []
Rich Lane2e079da2014-10-29 15:30:24 -07007223 return
7224
7225 def pack(self):
7226 packed = []
7227 packed.append(struct.pack("!B", self.version))
7228 packed.append(struct.pack("!B", self.type))
7229 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7230 packed.append(struct.pack("!L", self.xid))
7231 packed.append(struct.pack("!H", self.stats_type))
7232 packed.append(struct.pack("!H", self.flags))
7233 packed.append('\x00' * 4)
7234 packed.append(struct.pack("!L", self.experimenter))
7235 packed.append(struct.pack("!L", self.subtype))
Rich Laneccd32ed2014-11-10 17:48:24 -08007236 packed.append(loxi.generic_util.pack_list(self.entries))
Rich Lane2e079da2014-10-29 15:30:24 -07007237 length = sum([len(x) for x in packed])
7238 packed[2] = struct.pack("!H", length)
7239 return ''.join(packed)
7240
7241 @staticmethod
7242 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007243 obj = bsn_switch_pipeline_stats_reply()
Rich Lane2e079da2014-10-29 15:30:24 -07007244 _version = reader.read("!B")[0]
7245 assert(_version == 5)
7246 _type = reader.read("!B")[0]
7247 assert(_type == 19)
7248 _length = reader.read("!H")[0]
7249 orig_reader = reader
7250 reader = orig_reader.slice(_length - (2 + 2))
7251 obj.xid = reader.read("!L")[0]
7252 _stats_type = reader.read("!H")[0]
7253 assert(_stats_type == 65535)
7254 obj.flags = reader.read("!H")[0]
7255 reader.skip(4)
7256 _experimenter = reader.read("!L")[0]
7257 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007258 _subtype = reader.read("!L")[0]
7259 assert(_subtype == 6)
7260 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_switch_pipeline_stats_entry.unpack)
Rich Lane2e079da2014-10-29 15:30:24 -07007261 return obj
7262
7263 def __eq__(self, other):
7264 if type(self) != type(other): return False
7265 if self.xid != other.xid: return False
7266 if self.flags != other.flags: return False
Rich Laneccd32ed2014-11-10 17:48:24 -08007267 if self.entries != other.entries: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007268 return True
7269
7270 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007271 q.text("bsn_switch_pipeline_stats_reply {")
Rich Lane2e079da2014-10-29 15:30:24 -07007272 with q.group():
7273 with q.indent(2):
7274 q.breakable()
7275 q.text("xid = ");
7276 if self.xid != None:
7277 q.text("%#x" % self.xid)
7278 else:
7279 q.text('None')
7280 q.text(","); q.breakable()
7281 q.text("flags = ");
7282 q.text("%#x" % self.flags)
7283 q.text(","); q.breakable()
Rich Laneccd32ed2014-11-10 17:48:24 -08007284 q.text("entries = ");
7285 q.pp(self.entries)
Rich Lane2e079da2014-10-29 15:30:24 -07007286 q.breakable()
7287 q.text('}')
7288
Rich Laneccd32ed2014-11-10 17:48:24 -08007289bsn_stats_reply.subtypes[6] = bsn_switch_pipeline_stats_reply
Rich Lane2e079da2014-10-29 15:30:24 -07007290
Rich Laneccd32ed2014-11-10 17:48:24 -08007291class bsn_switch_pipeline_stats_request(bsn_stats_request):
Rich Lane2e079da2014-10-29 15:30:24 -07007292 version = 5
7293 type = 18
7294 stats_type = 65535
7295 experimenter = 6035143
Rich Laneccd32ed2014-11-10 17:48:24 -08007296 subtype = 6
Rich Lane2e079da2014-10-29 15:30:24 -07007297
Rich Laneccd32ed2014-11-10 17:48:24 -08007298 def __init__(self, xid=None, flags=None):
Rich Lane2e079da2014-10-29 15:30:24 -07007299 if xid != None:
7300 self.xid = xid
7301 else:
7302 self.xid = None
7303 if flags != None:
7304 self.flags = flags
7305 else:
7306 self.flags = 0
Rich Lane2e079da2014-10-29 15:30:24 -07007307 return
7308
7309 def pack(self):
7310 packed = []
7311 packed.append(struct.pack("!B", self.version))
7312 packed.append(struct.pack("!B", self.type))
7313 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7314 packed.append(struct.pack("!L", self.xid))
7315 packed.append(struct.pack("!H", self.stats_type))
7316 packed.append(struct.pack("!H", self.flags))
7317 packed.append('\x00' * 4)
7318 packed.append(struct.pack("!L", self.experimenter))
7319 packed.append(struct.pack("!L", self.subtype))
7320 length = sum([len(x) for x in packed])
7321 packed[2] = struct.pack("!H", length)
7322 return ''.join(packed)
7323
7324 @staticmethod
7325 def unpack(reader):
Rich Laneccd32ed2014-11-10 17:48:24 -08007326 obj = bsn_switch_pipeline_stats_request()
Rich Lane2e079da2014-10-29 15:30:24 -07007327 _version = reader.read("!B")[0]
7328 assert(_version == 5)
7329 _type = reader.read("!B")[0]
7330 assert(_type == 18)
7331 _length = reader.read("!H")[0]
7332 orig_reader = reader
7333 reader = orig_reader.slice(_length - (2 + 2))
7334 obj.xid = reader.read("!L")[0]
7335 _stats_type = reader.read("!H")[0]
7336 assert(_stats_type == 65535)
7337 obj.flags = reader.read("!H")[0]
7338 reader.skip(4)
7339 _experimenter = reader.read("!L")[0]
7340 assert(_experimenter == 6035143)
Rich Laneccd32ed2014-11-10 17:48:24 -08007341 _subtype = reader.read("!L")[0]
7342 assert(_subtype == 6)
Rich Lane2e079da2014-10-29 15:30:24 -07007343 return obj
7344
7345 def __eq__(self, other):
7346 if type(self) != type(other): return False
7347 if self.xid != other.xid: return False
7348 if self.flags != other.flags: return False
Rich Lane2e079da2014-10-29 15:30:24 -07007349 return True
7350
7351 def pretty_print(self, q):
Rich Laneccd32ed2014-11-10 17:48:24 -08007352 q.text("bsn_switch_pipeline_stats_request {")
Rich Lane2e079da2014-10-29 15:30:24 -07007353 with q.group():
7354 with q.indent(2):
7355 q.breakable()
7356 q.text("xid = ");
7357 if self.xid != None:
7358 q.text("%#x" % self.xid)
7359 else:
7360 q.text('None')
7361 q.text(","); q.breakable()
7362 q.text("flags = ");
7363 q.text("%#x" % self.flags)
7364 q.breakable()
7365 q.text('}')
7366
Rich Laneccd32ed2014-11-10 17:48:24 -08007367bsn_stats_request.subtypes[6] = bsn_switch_pipeline_stats_request
7368
7369class bsn_table_checksum_stats_reply(bsn_stats_reply):
7370 version = 5
7371 type = 19
7372 stats_type = 65535
7373 experimenter = 6035143
7374 subtype = 11
7375
7376 def __init__(self, xid=None, flags=None, entries=None):
7377 if xid != None:
7378 self.xid = xid
7379 else:
7380 self.xid = None
7381 if flags != None:
7382 self.flags = flags
7383 else:
7384 self.flags = 0
7385 if entries != None:
7386 self.entries = entries
7387 else:
7388 self.entries = []
7389 return
7390
7391 def pack(self):
7392 packed = []
7393 packed.append(struct.pack("!B", self.version))
7394 packed.append(struct.pack("!B", self.type))
7395 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7396 packed.append(struct.pack("!L", self.xid))
7397 packed.append(struct.pack("!H", self.stats_type))
7398 packed.append(struct.pack("!H", self.flags))
7399 packed.append('\x00' * 4)
7400 packed.append(struct.pack("!L", self.experimenter))
7401 packed.append(struct.pack("!L", self.subtype))
7402 packed.append(loxi.generic_util.pack_list(self.entries))
7403 length = sum([len(x) for x in packed])
7404 packed[2] = struct.pack("!H", length)
7405 return ''.join(packed)
7406
7407 @staticmethod
7408 def unpack(reader):
7409 obj = bsn_table_checksum_stats_reply()
7410 _version = reader.read("!B")[0]
7411 assert(_version == 5)
7412 _type = reader.read("!B")[0]
7413 assert(_type == 19)
7414 _length = reader.read("!H")[0]
7415 orig_reader = reader
7416 reader = orig_reader.slice(_length - (2 + 2))
7417 obj.xid = reader.read("!L")[0]
7418 _stats_type = reader.read("!H")[0]
7419 assert(_stats_type == 65535)
7420 obj.flags = reader.read("!H")[0]
7421 reader.skip(4)
7422 _experimenter = reader.read("!L")[0]
7423 assert(_experimenter == 6035143)
7424 _subtype = reader.read("!L")[0]
7425 assert(_subtype == 11)
7426 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_table_checksum_stats_entry.unpack)
7427 return obj
7428
7429 def __eq__(self, other):
7430 if type(self) != type(other): return False
7431 if self.xid != other.xid: return False
7432 if self.flags != other.flags: return False
7433 if self.entries != other.entries: return False
7434 return True
7435
7436 def pretty_print(self, q):
7437 q.text("bsn_table_checksum_stats_reply {")
7438 with q.group():
7439 with q.indent(2):
7440 q.breakable()
7441 q.text("xid = ");
7442 if self.xid != None:
7443 q.text("%#x" % self.xid)
7444 else:
7445 q.text('None')
7446 q.text(","); q.breakable()
7447 q.text("flags = ");
7448 q.text("%#x" % self.flags)
7449 q.text(","); q.breakable()
7450 q.text("entries = ");
7451 q.pp(self.entries)
7452 q.breakable()
7453 q.text('}')
7454
7455bsn_stats_reply.subtypes[11] = bsn_table_checksum_stats_reply
7456
7457class bsn_table_checksum_stats_request(bsn_stats_request):
7458 version = 5
7459 type = 18
7460 stats_type = 65535
7461 experimenter = 6035143
7462 subtype = 11
7463
7464 def __init__(self, xid=None, flags=None):
7465 if xid != None:
7466 self.xid = xid
7467 else:
7468 self.xid = None
7469 if flags != None:
7470 self.flags = flags
7471 else:
7472 self.flags = 0
7473 return
7474
7475 def pack(self):
7476 packed = []
7477 packed.append(struct.pack("!B", self.version))
7478 packed.append(struct.pack("!B", self.type))
7479 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7480 packed.append(struct.pack("!L", self.xid))
7481 packed.append(struct.pack("!H", self.stats_type))
7482 packed.append(struct.pack("!H", self.flags))
7483 packed.append('\x00' * 4)
7484 packed.append(struct.pack("!L", self.experimenter))
7485 packed.append(struct.pack("!L", self.subtype))
7486 length = sum([len(x) for x in packed])
7487 packed[2] = struct.pack("!H", length)
7488 return ''.join(packed)
7489
7490 @staticmethod
7491 def unpack(reader):
7492 obj = bsn_table_checksum_stats_request()
7493 _version = reader.read("!B")[0]
7494 assert(_version == 5)
7495 _type = reader.read("!B")[0]
7496 assert(_type == 18)
7497 _length = reader.read("!H")[0]
7498 orig_reader = reader
7499 reader = orig_reader.slice(_length - (2 + 2))
7500 obj.xid = reader.read("!L")[0]
7501 _stats_type = reader.read("!H")[0]
7502 assert(_stats_type == 65535)
7503 obj.flags = reader.read("!H")[0]
7504 reader.skip(4)
7505 _experimenter = reader.read("!L")[0]
7506 assert(_experimenter == 6035143)
7507 _subtype = reader.read("!L")[0]
7508 assert(_subtype == 11)
7509 return obj
7510
7511 def __eq__(self, other):
7512 if type(self) != type(other): return False
7513 if self.xid != other.xid: return False
7514 if self.flags != other.flags: return False
7515 return True
7516
7517 def pretty_print(self, q):
7518 q.text("bsn_table_checksum_stats_request {")
7519 with q.group():
7520 with q.indent(2):
7521 q.breakable()
7522 q.text("xid = ");
7523 if self.xid != None:
7524 q.text("%#x" % self.xid)
7525 else:
7526 q.text('None')
7527 q.text(","); q.breakable()
7528 q.text("flags = ");
7529 q.text("%#x" % self.flags)
7530 q.breakable()
7531 q.text('}')
7532
7533bsn_stats_request.subtypes[11] = bsn_table_checksum_stats_request
7534
7535class bsn_table_set_buckets_size(bsn_header):
7536 version = 5
7537 type = 4
7538 experimenter = 6035143
7539 subtype = 61
7540
7541 def __init__(self, xid=None, table_id=None, buckets_size=None):
7542 if xid != None:
7543 self.xid = xid
7544 else:
7545 self.xid = None
7546 if table_id != None:
7547 self.table_id = table_id
7548 else:
7549 self.table_id = 0
7550 if buckets_size != None:
7551 self.buckets_size = buckets_size
7552 else:
7553 self.buckets_size = 0
7554 return
7555
7556 def pack(self):
7557 packed = []
7558 packed.append(struct.pack("!B", self.version))
7559 packed.append(struct.pack("!B", self.type))
7560 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7561 packed.append(struct.pack("!L", self.xid))
7562 packed.append(struct.pack("!L", self.experimenter))
7563 packed.append(struct.pack("!L", self.subtype))
7564 packed.append('\x00' * 1)
7565 packed.append(struct.pack("!B", self.table_id))
7566 packed.append('\x00' * 2)
7567 packed.append(struct.pack("!L", self.buckets_size))
7568 length = sum([len(x) for x in packed])
7569 packed[2] = struct.pack("!H", length)
7570 return ''.join(packed)
7571
7572 @staticmethod
7573 def unpack(reader):
7574 obj = bsn_table_set_buckets_size()
7575 _version = reader.read("!B")[0]
7576 assert(_version == 5)
7577 _type = reader.read("!B")[0]
7578 assert(_type == 4)
7579 _length = reader.read("!H")[0]
7580 orig_reader = reader
7581 reader = orig_reader.slice(_length - (2 + 2))
7582 obj.xid = reader.read("!L")[0]
7583 _experimenter = reader.read("!L")[0]
7584 assert(_experimenter == 6035143)
7585 _subtype = reader.read("!L")[0]
7586 assert(_subtype == 61)
7587 reader.skip(1)
7588 obj.table_id = reader.read("!B")[0]
7589 reader.skip(2)
7590 obj.buckets_size = reader.read("!L")[0]
7591 return obj
7592
7593 def __eq__(self, other):
7594 if type(self) != type(other): return False
7595 if self.xid != other.xid: return False
7596 if self.table_id != other.table_id: return False
7597 if self.buckets_size != other.buckets_size: return False
7598 return True
7599
7600 def pretty_print(self, q):
7601 q.text("bsn_table_set_buckets_size {")
7602 with q.group():
7603 with q.indent(2):
7604 q.breakable()
7605 q.text("xid = ");
7606 if self.xid != None:
7607 q.text("%#x" % self.xid)
7608 else:
7609 q.text('None')
7610 q.text(","); q.breakable()
7611 q.text("table_id = ");
7612 q.text("%#x" % self.table_id)
7613 q.text(","); q.breakable()
7614 q.text("buckets_size = ");
7615 q.text("%#x" % self.buckets_size)
7616 q.breakable()
7617 q.text('}')
7618
7619bsn_header.subtypes[61] = bsn_table_set_buckets_size
7620
7621class bsn_time_reply(bsn_header):
7622 version = 5
7623 type = 4
7624 experimenter = 6035143
7625 subtype = 45
7626
7627 def __init__(self, xid=None, time_ms=None):
7628 if xid != None:
7629 self.xid = xid
7630 else:
7631 self.xid = None
7632 if time_ms != None:
7633 self.time_ms = time_ms
7634 else:
7635 self.time_ms = 0
7636 return
7637
7638 def pack(self):
7639 packed = []
7640 packed.append(struct.pack("!B", self.version))
7641 packed.append(struct.pack("!B", self.type))
7642 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7643 packed.append(struct.pack("!L", self.xid))
7644 packed.append(struct.pack("!L", self.experimenter))
7645 packed.append(struct.pack("!L", self.subtype))
7646 packed.append(struct.pack("!Q", self.time_ms))
7647 length = sum([len(x) for x in packed])
7648 packed[2] = struct.pack("!H", length)
7649 return ''.join(packed)
7650
7651 @staticmethod
7652 def unpack(reader):
7653 obj = bsn_time_reply()
7654 _version = reader.read("!B")[0]
7655 assert(_version == 5)
7656 _type = reader.read("!B")[0]
7657 assert(_type == 4)
7658 _length = reader.read("!H")[0]
7659 orig_reader = reader
7660 reader = orig_reader.slice(_length - (2 + 2))
7661 obj.xid = reader.read("!L")[0]
7662 _experimenter = reader.read("!L")[0]
7663 assert(_experimenter == 6035143)
7664 _subtype = reader.read("!L")[0]
7665 assert(_subtype == 45)
7666 obj.time_ms = reader.read("!Q")[0]
7667 return obj
7668
7669 def __eq__(self, other):
7670 if type(self) != type(other): return False
7671 if self.xid != other.xid: return False
7672 if self.time_ms != other.time_ms: return False
7673 return True
7674
7675 def pretty_print(self, q):
7676 q.text("bsn_time_reply {")
7677 with q.group():
7678 with q.indent(2):
7679 q.breakable()
7680 q.text("xid = ");
7681 if self.xid != None:
7682 q.text("%#x" % self.xid)
7683 else:
7684 q.text('None')
7685 q.text(","); q.breakable()
7686 q.text("time_ms = ");
7687 q.text("%#x" % self.time_ms)
7688 q.breakable()
7689 q.text('}')
7690
7691bsn_header.subtypes[45] = bsn_time_reply
7692
7693class bsn_time_request(bsn_header):
7694 version = 5
7695 type = 4
7696 experimenter = 6035143
7697 subtype = 44
7698
7699 def __init__(self, xid=None):
7700 if xid != None:
7701 self.xid = xid
7702 else:
7703 self.xid = None
7704 return
7705
7706 def pack(self):
7707 packed = []
7708 packed.append(struct.pack("!B", self.version))
7709 packed.append(struct.pack("!B", self.type))
7710 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7711 packed.append(struct.pack("!L", self.xid))
7712 packed.append(struct.pack("!L", self.experimenter))
7713 packed.append(struct.pack("!L", self.subtype))
7714 length = sum([len(x) for x in packed])
7715 packed[2] = struct.pack("!H", length)
7716 return ''.join(packed)
7717
7718 @staticmethod
7719 def unpack(reader):
7720 obj = bsn_time_request()
7721 _version = reader.read("!B")[0]
7722 assert(_version == 5)
7723 _type = reader.read("!B")[0]
7724 assert(_type == 4)
7725 _length = reader.read("!H")[0]
7726 orig_reader = reader
7727 reader = orig_reader.slice(_length - (2 + 2))
7728 obj.xid = reader.read("!L")[0]
7729 _experimenter = reader.read("!L")[0]
7730 assert(_experimenter == 6035143)
7731 _subtype = reader.read("!L")[0]
7732 assert(_subtype == 44)
7733 return obj
7734
7735 def __eq__(self, other):
7736 if type(self) != type(other): return False
7737 if self.xid != other.xid: return False
7738 return True
7739
7740 def pretty_print(self, q):
7741 q.text("bsn_time_request {")
7742 with q.group():
7743 with q.indent(2):
7744 q.breakable()
7745 q.text("xid = ");
7746 if self.xid != None:
7747 q.text("%#x" % self.xid)
7748 else:
7749 q.text('None')
7750 q.breakable()
7751 q.text('}')
7752
7753bsn_header.subtypes[44] = bsn_time_request
Rich Lane2e079da2014-10-29 15:30:24 -07007754
7755class bsn_virtual_port_create_reply(bsn_header):
7756 version = 5
7757 type = 4
7758 experimenter = 6035143
7759 subtype = 16
7760
7761 def __init__(self, xid=None, status=None, vport_no=None):
7762 if xid != None:
7763 self.xid = xid
7764 else:
7765 self.xid = None
7766 if status != None:
7767 self.status = status
7768 else:
7769 self.status = 0
7770 if vport_no != None:
7771 self.vport_no = vport_no
7772 else:
7773 self.vport_no = 0
7774 return
7775
7776 def pack(self):
7777 packed = []
7778 packed.append(struct.pack("!B", self.version))
7779 packed.append(struct.pack("!B", self.type))
7780 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7781 packed.append(struct.pack("!L", self.xid))
7782 packed.append(struct.pack("!L", self.experimenter))
7783 packed.append(struct.pack("!L", self.subtype))
7784 packed.append(struct.pack("!L", self.status))
7785 packed.append(struct.pack("!L", self.vport_no))
7786 length = sum([len(x) for x in packed])
7787 packed[2] = struct.pack("!H", length)
7788 return ''.join(packed)
7789
7790 @staticmethod
7791 def unpack(reader):
7792 obj = bsn_virtual_port_create_reply()
7793 _version = reader.read("!B")[0]
7794 assert(_version == 5)
7795 _type = reader.read("!B")[0]
7796 assert(_type == 4)
7797 _length = reader.read("!H")[0]
7798 orig_reader = reader
7799 reader = orig_reader.slice(_length - (2 + 2))
7800 obj.xid = reader.read("!L")[0]
7801 _experimenter = reader.read("!L")[0]
7802 assert(_experimenter == 6035143)
7803 _subtype = reader.read("!L")[0]
7804 assert(_subtype == 16)
7805 obj.status = reader.read("!L")[0]
7806 obj.vport_no = reader.read("!L")[0]
7807 return obj
7808
7809 def __eq__(self, other):
7810 if type(self) != type(other): return False
7811 if self.xid != other.xid: return False
7812 if self.status != other.status: return False
7813 if self.vport_no != other.vport_no: return False
7814 return True
7815
7816 def pretty_print(self, q):
7817 q.text("bsn_virtual_port_create_reply {")
7818 with q.group():
7819 with q.indent(2):
7820 q.breakable()
7821 q.text("xid = ");
7822 if self.xid != None:
7823 q.text("%#x" % self.xid)
7824 else:
7825 q.text('None')
7826 q.text(","); q.breakable()
7827 q.text("status = ");
7828 q.text("%#x" % self.status)
7829 q.text(","); q.breakable()
7830 q.text("vport_no = ");
7831 q.text("%#x" % self.vport_no)
7832 q.breakable()
7833 q.text('}')
7834
7835bsn_header.subtypes[16] = bsn_virtual_port_create_reply
7836
7837class bsn_virtual_port_create_request(bsn_header):
7838 version = 5
7839 type = 4
7840 experimenter = 6035143
7841 subtype = 15
7842
7843 def __init__(self, xid=None, vport=None):
7844 if xid != None:
7845 self.xid = xid
7846 else:
7847 self.xid = None
7848 if vport != None:
7849 self.vport = vport
7850 else:
7851 self.vport = common.bsn_vport()
7852 return
7853
7854 def pack(self):
7855 packed = []
7856 packed.append(struct.pack("!B", self.version))
7857 packed.append(struct.pack("!B", self.type))
7858 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7859 packed.append(struct.pack("!L", self.xid))
7860 packed.append(struct.pack("!L", self.experimenter))
7861 packed.append(struct.pack("!L", self.subtype))
7862 packed.append(self.vport.pack())
7863 length = sum([len(x) for x in packed])
7864 packed[2] = struct.pack("!H", length)
7865 return ''.join(packed)
7866
7867 @staticmethod
7868 def unpack(reader):
7869 obj = bsn_virtual_port_create_request()
7870 _version = reader.read("!B")[0]
7871 assert(_version == 5)
7872 _type = reader.read("!B")[0]
7873 assert(_type == 4)
7874 _length = reader.read("!H")[0]
7875 orig_reader = reader
7876 reader = orig_reader.slice(_length - (2 + 2))
7877 obj.xid = reader.read("!L")[0]
7878 _experimenter = reader.read("!L")[0]
7879 assert(_experimenter == 6035143)
7880 _subtype = reader.read("!L")[0]
7881 assert(_subtype == 15)
7882 obj.vport = common.bsn_vport.unpack(reader)
7883 return obj
7884
7885 def __eq__(self, other):
7886 if type(self) != type(other): return False
7887 if self.xid != other.xid: return False
7888 if self.vport != other.vport: return False
7889 return True
7890
7891 def pretty_print(self, q):
7892 q.text("bsn_virtual_port_create_request {")
7893 with q.group():
7894 with q.indent(2):
7895 q.breakable()
7896 q.text("xid = ");
7897 if self.xid != None:
7898 q.text("%#x" % self.xid)
7899 else:
7900 q.text('None')
7901 q.text(","); q.breakable()
7902 q.text("vport = ");
7903 q.pp(self.vport)
7904 q.breakable()
7905 q.text('}')
7906
7907bsn_header.subtypes[15] = bsn_virtual_port_create_request
7908
7909class bsn_virtual_port_remove_reply(bsn_header):
7910 version = 5
7911 type = 4
7912 experimenter = 6035143
7913 subtype = 26
7914
7915 def __init__(self, xid=None, status=None):
7916 if xid != None:
7917 self.xid = xid
7918 else:
7919 self.xid = None
7920 if status != None:
7921 self.status = status
7922 else:
7923 self.status = 0
7924 return
7925
7926 def pack(self):
7927 packed = []
7928 packed.append(struct.pack("!B", self.version))
7929 packed.append(struct.pack("!B", self.type))
7930 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
7931 packed.append(struct.pack("!L", self.xid))
7932 packed.append(struct.pack("!L", self.experimenter))
7933 packed.append(struct.pack("!L", self.subtype))
7934 packed.append(struct.pack("!L", self.status))
7935 length = sum([len(x) for x in packed])
7936 packed[2] = struct.pack("!H", length)
7937 return ''.join(packed)
7938
7939 @staticmethod
7940 def unpack(reader):
7941 obj = bsn_virtual_port_remove_reply()
7942 _version = reader.read("!B")[0]
7943 assert(_version == 5)
7944 _type = reader.read("!B")[0]
7945 assert(_type == 4)
7946 _length = reader.read("!H")[0]
7947 orig_reader = reader
7948 reader = orig_reader.slice(_length - (2 + 2))
7949 obj.xid = reader.read("!L")[0]
7950 _experimenter = reader.read("!L")[0]
7951 assert(_experimenter == 6035143)
7952 _subtype = reader.read("!L")[0]
7953 assert(_subtype == 26)
7954 obj.status = reader.read("!L")[0]
7955 return obj
7956
7957 def __eq__(self, other):
7958 if type(self) != type(other): return False
7959 if self.xid != other.xid: return False
7960 if self.status != other.status: return False
7961 return True
7962
7963 def pretty_print(self, q):
7964 q.text("bsn_virtual_port_remove_reply {")
7965 with q.group():
7966 with q.indent(2):
7967 q.breakable()
7968 q.text("xid = ");
7969 if self.xid != None:
7970 q.text("%#x" % self.xid)
7971 else:
7972 q.text('None')
7973 q.text(","); q.breakable()
7974 q.text("status = ");
7975 q.text("%#x" % self.status)
7976 q.breakable()
7977 q.text('}')
7978
7979bsn_header.subtypes[26] = bsn_virtual_port_remove_reply
7980
7981class bsn_virtual_port_remove_request(bsn_header):
7982 version = 5
7983 type = 4
7984 experimenter = 6035143
7985 subtype = 17
7986
7987 def __init__(self, xid=None, vport_no=None):
7988 if xid != None:
7989 self.xid = xid
7990 else:
7991 self.xid = None
7992 if vport_no != None:
7993 self.vport_no = vport_no
7994 else:
7995 self.vport_no = 0
7996 return
7997
7998 def pack(self):
7999 packed = []
8000 packed.append(struct.pack("!B", self.version))
8001 packed.append(struct.pack("!B", self.type))
8002 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8003 packed.append(struct.pack("!L", self.xid))
8004 packed.append(struct.pack("!L", self.experimenter))
8005 packed.append(struct.pack("!L", self.subtype))
8006 packed.append(struct.pack("!L", self.vport_no))
8007 length = sum([len(x) for x in packed])
8008 packed[2] = struct.pack("!H", length)
8009 return ''.join(packed)
8010
8011 @staticmethod
8012 def unpack(reader):
8013 obj = bsn_virtual_port_remove_request()
8014 _version = reader.read("!B")[0]
8015 assert(_version == 5)
8016 _type = reader.read("!B")[0]
8017 assert(_type == 4)
8018 _length = reader.read("!H")[0]
8019 orig_reader = reader
8020 reader = orig_reader.slice(_length - (2 + 2))
8021 obj.xid = reader.read("!L")[0]
8022 _experimenter = reader.read("!L")[0]
8023 assert(_experimenter == 6035143)
8024 _subtype = reader.read("!L")[0]
8025 assert(_subtype == 17)
8026 obj.vport_no = reader.read("!L")[0]
8027 return obj
8028
8029 def __eq__(self, other):
8030 if type(self) != type(other): return False
8031 if self.xid != other.xid: return False
8032 if self.vport_no != other.vport_no: return False
8033 return True
8034
8035 def pretty_print(self, q):
8036 q.text("bsn_virtual_port_remove_request {")
8037 with q.group():
8038 with q.indent(2):
8039 q.breakable()
8040 q.text("xid = ");
8041 if self.xid != None:
8042 q.text("%#x" % self.xid)
8043 else:
8044 q.text('None')
8045 q.text(","); q.breakable()
8046 q.text("vport_no = ");
8047 q.text("%#x" % self.vport_no)
8048 q.breakable()
8049 q.text('}')
8050
8051bsn_header.subtypes[17] = bsn_virtual_port_remove_request
8052
Rich Laneccd32ed2014-11-10 17:48:24 -08008053class bsn_vlan_counter_stats_reply(bsn_stats_reply):
8054 version = 5
8055 type = 19
8056 stats_type = 65535
8057 experimenter = 6035143
8058 subtype = 9
8059
8060 def __init__(self, xid=None, flags=None, entries=None):
8061 if xid != None:
8062 self.xid = xid
8063 else:
8064 self.xid = None
8065 if flags != None:
8066 self.flags = flags
8067 else:
8068 self.flags = 0
8069 if entries != None:
8070 self.entries = entries
8071 else:
8072 self.entries = []
8073 return
8074
8075 def pack(self):
8076 packed = []
8077 packed.append(struct.pack("!B", self.version))
8078 packed.append(struct.pack("!B", self.type))
8079 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8080 packed.append(struct.pack("!L", self.xid))
8081 packed.append(struct.pack("!H", self.stats_type))
8082 packed.append(struct.pack("!H", self.flags))
8083 packed.append('\x00' * 4)
8084 packed.append(struct.pack("!L", self.experimenter))
8085 packed.append(struct.pack("!L", self.subtype))
8086 packed.append(loxi.generic_util.pack_list(self.entries))
8087 length = sum([len(x) for x in packed])
8088 packed[2] = struct.pack("!H", length)
8089 return ''.join(packed)
8090
8091 @staticmethod
8092 def unpack(reader):
8093 obj = bsn_vlan_counter_stats_reply()
8094 _version = reader.read("!B")[0]
8095 assert(_version == 5)
8096 _type = reader.read("!B")[0]
8097 assert(_type == 19)
8098 _length = reader.read("!H")[0]
8099 orig_reader = reader
8100 reader = orig_reader.slice(_length - (2 + 2))
8101 obj.xid = reader.read("!L")[0]
8102 _stats_type = reader.read("!H")[0]
8103 assert(_stats_type == 65535)
8104 obj.flags = reader.read("!H")[0]
8105 reader.skip(4)
8106 _experimenter = reader.read("!L")[0]
8107 assert(_experimenter == 6035143)
8108 _subtype = reader.read("!L")[0]
8109 assert(_subtype == 9)
8110 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vlan_counter_stats_entry.unpack)
8111 return obj
8112
8113 def __eq__(self, other):
8114 if type(self) != type(other): return False
8115 if self.xid != other.xid: return False
8116 if self.flags != other.flags: return False
8117 if self.entries != other.entries: return False
8118 return True
8119
8120 def pretty_print(self, q):
8121 q.text("bsn_vlan_counter_stats_reply {")
8122 with q.group():
8123 with q.indent(2):
8124 q.breakable()
8125 q.text("xid = ");
8126 if self.xid != None:
8127 q.text("%#x" % self.xid)
8128 else:
8129 q.text('None')
8130 q.text(","); q.breakable()
8131 q.text("flags = ");
8132 q.text("%#x" % self.flags)
8133 q.text(","); q.breakable()
8134 q.text("entries = ");
8135 q.pp(self.entries)
8136 q.breakable()
8137 q.text('}')
8138
8139bsn_stats_reply.subtypes[9] = bsn_vlan_counter_stats_reply
8140
8141class bsn_vlan_counter_stats_request(bsn_stats_request):
8142 version = 5
8143 type = 18
8144 stats_type = 65535
8145 experimenter = 6035143
8146 subtype = 9
8147
8148 def __init__(self, xid=None, flags=None, vlan_vid=None):
8149 if xid != None:
8150 self.xid = xid
8151 else:
8152 self.xid = None
8153 if flags != None:
8154 self.flags = flags
8155 else:
8156 self.flags = 0
8157 if vlan_vid != None:
8158 self.vlan_vid = vlan_vid
8159 else:
8160 self.vlan_vid = 0
8161 return
8162
8163 def pack(self):
8164 packed = []
8165 packed.append(struct.pack("!B", self.version))
8166 packed.append(struct.pack("!B", self.type))
8167 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8168 packed.append(struct.pack("!L", self.xid))
8169 packed.append(struct.pack("!H", self.stats_type))
8170 packed.append(struct.pack("!H", self.flags))
8171 packed.append('\x00' * 4)
8172 packed.append(struct.pack("!L", self.experimenter))
8173 packed.append(struct.pack("!L", self.subtype))
8174 packed.append(struct.pack("!H", self.vlan_vid))
8175 length = sum([len(x) for x in packed])
8176 packed[2] = struct.pack("!H", length)
8177 return ''.join(packed)
8178
8179 @staticmethod
8180 def unpack(reader):
8181 obj = bsn_vlan_counter_stats_request()
8182 _version = reader.read("!B")[0]
8183 assert(_version == 5)
8184 _type = reader.read("!B")[0]
8185 assert(_type == 18)
8186 _length = reader.read("!H")[0]
8187 orig_reader = reader
8188 reader = orig_reader.slice(_length - (2 + 2))
8189 obj.xid = reader.read("!L")[0]
8190 _stats_type = reader.read("!H")[0]
8191 assert(_stats_type == 65535)
8192 obj.flags = reader.read("!H")[0]
8193 reader.skip(4)
8194 _experimenter = reader.read("!L")[0]
8195 assert(_experimenter == 6035143)
8196 _subtype = reader.read("!L")[0]
8197 assert(_subtype == 9)
8198 obj.vlan_vid = reader.read("!H")[0]
8199 return obj
8200
8201 def __eq__(self, other):
8202 if type(self) != type(other): return False
8203 if self.xid != other.xid: return False
8204 if self.flags != other.flags: return False
8205 if self.vlan_vid != other.vlan_vid: return False
8206 return True
8207
8208 def pretty_print(self, q):
8209 q.text("bsn_vlan_counter_stats_request {")
8210 with q.group():
8211 with q.indent(2):
8212 q.breakable()
8213 q.text("xid = ");
8214 if self.xid != None:
8215 q.text("%#x" % self.xid)
8216 else:
8217 q.text('None')
8218 q.text(","); q.breakable()
8219 q.text("flags = ");
8220 q.text("%#x" % self.flags)
8221 q.text(","); q.breakable()
8222 q.text("vlan_vid = ");
8223 q.text("%#x" % self.vlan_vid)
8224 q.breakable()
8225 q.text('}')
8226
8227bsn_stats_request.subtypes[9] = bsn_vlan_counter_stats_request
8228
8229class bsn_vrf_counter_stats_reply(bsn_stats_reply):
8230 version = 5
8231 type = 19
8232 stats_type = 65535
8233 experimenter = 6035143
8234 subtype = 15
8235
8236 def __init__(self, xid=None, flags=None, entries=None):
8237 if xid != None:
8238 self.xid = xid
8239 else:
8240 self.xid = None
8241 if flags != None:
8242 self.flags = flags
8243 else:
8244 self.flags = 0
8245 if entries != None:
8246 self.entries = entries
8247 else:
8248 self.entries = []
8249 return
8250
8251 def pack(self):
8252 packed = []
8253 packed.append(struct.pack("!B", self.version))
8254 packed.append(struct.pack("!B", self.type))
8255 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8256 packed.append(struct.pack("!L", self.xid))
8257 packed.append(struct.pack("!H", self.stats_type))
8258 packed.append(struct.pack("!H", self.flags))
8259 packed.append('\x00' * 4)
8260 packed.append(struct.pack("!L", self.experimenter))
8261 packed.append(struct.pack("!L", self.subtype))
8262 packed.append(loxi.generic_util.pack_list(self.entries))
8263 length = sum([len(x) for x in packed])
8264 packed[2] = struct.pack("!H", length)
8265 return ''.join(packed)
8266
8267 @staticmethod
8268 def unpack(reader):
8269 obj = bsn_vrf_counter_stats_reply()
8270 _version = reader.read("!B")[0]
8271 assert(_version == 5)
8272 _type = reader.read("!B")[0]
8273 assert(_type == 19)
8274 _length = reader.read("!H")[0]
8275 orig_reader = reader
8276 reader = orig_reader.slice(_length - (2 + 2))
8277 obj.xid = reader.read("!L")[0]
8278 _stats_type = reader.read("!H")[0]
8279 assert(_stats_type == 65535)
8280 obj.flags = reader.read("!H")[0]
8281 reader.skip(4)
8282 _experimenter = reader.read("!L")[0]
8283 assert(_experimenter == 6035143)
8284 _subtype = reader.read("!L")[0]
8285 assert(_subtype == 15)
8286 obj.entries = loxi.generic_util.unpack_list(reader, common.bsn_vrf_counter_stats_entry.unpack)
8287 return obj
8288
8289 def __eq__(self, other):
8290 if type(self) != type(other): return False
8291 if self.xid != other.xid: return False
8292 if self.flags != other.flags: return False
8293 if self.entries != other.entries: return False
8294 return True
8295
8296 def pretty_print(self, q):
8297 q.text("bsn_vrf_counter_stats_reply {")
8298 with q.group():
8299 with q.indent(2):
8300 q.breakable()
8301 q.text("xid = ");
8302 if self.xid != None:
8303 q.text("%#x" % self.xid)
8304 else:
8305 q.text('None')
8306 q.text(","); q.breakable()
8307 q.text("flags = ");
8308 q.text("%#x" % self.flags)
8309 q.text(","); q.breakable()
8310 q.text("entries = ");
8311 q.pp(self.entries)
8312 q.breakable()
8313 q.text('}')
8314
8315bsn_stats_reply.subtypes[15] = bsn_vrf_counter_stats_reply
8316
8317class bsn_vrf_counter_stats_request(bsn_stats_request):
8318 version = 5
8319 type = 18
8320 stats_type = 65535
8321 experimenter = 6035143
8322 subtype = 15
8323
8324 def __init__(self, xid=None, flags=None, vrf=None):
8325 if xid != None:
8326 self.xid = xid
8327 else:
8328 self.xid = None
8329 if flags != None:
8330 self.flags = flags
8331 else:
8332 self.flags = 0
8333 if vrf != None:
8334 self.vrf = vrf
8335 else:
8336 self.vrf = 0
8337 return
8338
8339 def pack(self):
8340 packed = []
8341 packed.append(struct.pack("!B", self.version))
8342 packed.append(struct.pack("!B", self.type))
8343 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8344 packed.append(struct.pack("!L", self.xid))
8345 packed.append(struct.pack("!H", self.stats_type))
8346 packed.append(struct.pack("!H", self.flags))
8347 packed.append('\x00' * 4)
8348 packed.append(struct.pack("!L", self.experimenter))
8349 packed.append(struct.pack("!L", self.subtype))
8350 packed.append(struct.pack("!L", self.vrf))
8351 length = sum([len(x) for x in packed])
8352 packed[2] = struct.pack("!H", length)
8353 return ''.join(packed)
8354
8355 @staticmethod
8356 def unpack(reader):
8357 obj = bsn_vrf_counter_stats_request()
8358 _version = reader.read("!B")[0]
8359 assert(_version == 5)
8360 _type = reader.read("!B")[0]
8361 assert(_type == 18)
8362 _length = reader.read("!H")[0]
8363 orig_reader = reader
8364 reader = orig_reader.slice(_length - (2 + 2))
8365 obj.xid = reader.read("!L")[0]
8366 _stats_type = reader.read("!H")[0]
8367 assert(_stats_type == 65535)
8368 obj.flags = reader.read("!H")[0]
8369 reader.skip(4)
8370 _experimenter = reader.read("!L")[0]
8371 assert(_experimenter == 6035143)
8372 _subtype = reader.read("!L")[0]
8373 assert(_subtype == 15)
8374 obj.vrf = reader.read("!L")[0]
8375 return obj
8376
8377 def __eq__(self, other):
8378 if type(self) != type(other): return False
8379 if self.xid != other.xid: return False
8380 if self.flags != other.flags: return False
8381 if self.vrf != other.vrf: return False
8382 return True
8383
8384 def pretty_print(self, q):
8385 q.text("bsn_vrf_counter_stats_request {")
8386 with q.group():
8387 with q.indent(2):
8388 q.breakable()
8389 q.text("xid = ");
8390 if self.xid != None:
8391 q.text("%#x" % self.xid)
8392 else:
8393 q.text('None')
8394 q.text(","); q.breakable()
8395 q.text("flags = ");
8396 q.text("%#x" % self.flags)
8397 q.text(","); q.breakable()
8398 q.text("vrf = ");
8399 q.text("%#x" % self.vrf)
8400 q.breakable()
8401 q.text('}')
8402
8403bsn_stats_request.subtypes[15] = bsn_vrf_counter_stats_request
8404
Rich Lane2e079da2014-10-29 15:30:24 -07008405class bundle_add_msg(message):
8406 version = 5
8407 type = 34
8408
8409 def __init__(self, xid=None, bundle_id=None, flags=None, data=None):
8410 if xid != None:
8411 self.xid = xid
8412 else:
8413 self.xid = None
8414 if bundle_id != None:
8415 self.bundle_id = bundle_id
8416 else:
8417 self.bundle_id = 0
8418 if flags != None:
8419 self.flags = flags
8420 else:
8421 self.flags = 0
8422 if data != None:
8423 self.data = data
8424 else:
8425 self.data = ''
8426 return
8427
8428 def pack(self):
8429 packed = []
8430 packed.append(struct.pack("!B", self.version))
8431 packed.append(struct.pack("!B", self.type))
8432 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8433 packed.append(struct.pack("!L", self.xid))
8434 packed.append(struct.pack("!L", self.bundle_id))
8435 packed.append('\x00' * 2)
8436 packed.append(struct.pack("!H", self.flags))
8437 packed.append(self.data)
8438 length = sum([len(x) for x in packed])
8439 packed[2] = struct.pack("!H", length)
8440 return ''.join(packed)
8441
8442 @staticmethod
8443 def unpack(reader):
8444 obj = bundle_add_msg()
8445 _version = reader.read("!B")[0]
8446 assert(_version == 5)
8447 _type = reader.read("!B")[0]
8448 assert(_type == 34)
8449 _length = reader.read("!H")[0]
8450 orig_reader = reader
8451 reader = orig_reader.slice(_length - (2 + 2))
8452 obj.xid = reader.read("!L")[0]
8453 obj.bundle_id = reader.read("!L")[0]
8454 reader.skip(2)
8455 obj.flags = reader.read("!H")[0]
8456 obj.data = str(reader.read_all())
8457 return obj
8458
8459 def __eq__(self, other):
8460 if type(self) != type(other): return False
8461 if self.xid != other.xid: return False
8462 if self.bundle_id != other.bundle_id: return False
8463 if self.flags != other.flags: return False
8464 if self.data != other.data: return False
8465 return True
8466
8467 def pretty_print(self, q):
8468 q.text("bundle_add_msg {")
8469 with q.group():
8470 with q.indent(2):
8471 q.breakable()
8472 q.text("xid = ");
8473 if self.xid != None:
8474 q.text("%#x" % self.xid)
8475 else:
8476 q.text('None')
8477 q.text(","); q.breakable()
8478 q.text("bundle_id = ");
8479 q.text("%#x" % self.bundle_id)
8480 q.text(","); q.breakable()
8481 q.text("flags = ");
8482 q.text("%#x" % self.flags)
8483 q.text(","); q.breakable()
8484 q.text("data = ");
8485 q.pp(self.data)
8486 q.breakable()
8487 q.text('}')
8488
8489message.subtypes[34] = bundle_add_msg
8490
8491class bundle_ctrl_msg(message):
8492 version = 5
8493 type = 33
8494
8495 def __init__(self, xid=None, bundle_id=None, bundle_ctrl_type=None, flags=None, properties=None):
8496 if xid != None:
8497 self.xid = xid
8498 else:
8499 self.xid = None
8500 if bundle_id != None:
8501 self.bundle_id = bundle_id
8502 else:
8503 self.bundle_id = 0
8504 if bundle_ctrl_type != None:
8505 self.bundle_ctrl_type = bundle_ctrl_type
8506 else:
8507 self.bundle_ctrl_type = 0
8508 if flags != None:
8509 self.flags = flags
8510 else:
8511 self.flags = 0
8512 if properties != None:
8513 self.properties = properties
8514 else:
8515 self.properties = []
8516 return
8517
8518 def pack(self):
8519 packed = []
8520 packed.append(struct.pack("!B", self.version))
8521 packed.append(struct.pack("!B", self.type))
8522 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8523 packed.append(struct.pack("!L", self.xid))
8524 packed.append(struct.pack("!L", self.bundle_id))
8525 packed.append(struct.pack("!H", self.bundle_ctrl_type))
8526 packed.append(struct.pack("!H", self.flags))
8527 packed.append(loxi.generic_util.pack_list(self.properties))
8528 length = sum([len(x) for x in packed])
8529 packed[2] = struct.pack("!H", length)
8530 return ''.join(packed)
8531
8532 @staticmethod
8533 def unpack(reader):
8534 obj = bundle_ctrl_msg()
8535 _version = reader.read("!B")[0]
8536 assert(_version == 5)
8537 _type = reader.read("!B")[0]
8538 assert(_type == 33)
8539 _length = reader.read("!H")[0]
8540 orig_reader = reader
8541 reader = orig_reader.slice(_length - (2 + 2))
8542 obj.xid = reader.read("!L")[0]
8543 obj.bundle_id = reader.read("!L")[0]
8544 obj.bundle_ctrl_type = reader.read("!H")[0]
8545 obj.flags = reader.read("!H")[0]
8546 obj.properties = loxi.generic_util.unpack_list(reader, bundle_prop.bundle_prop.unpack)
8547 return obj
8548
8549 def __eq__(self, other):
8550 if type(self) != type(other): return False
8551 if self.xid != other.xid: return False
8552 if self.bundle_id != other.bundle_id: return False
8553 if self.bundle_ctrl_type != other.bundle_ctrl_type: return False
8554 if self.flags != other.flags: return False
8555 if self.properties != other.properties: return False
8556 return True
8557
8558 def pretty_print(self, q):
8559 q.text("bundle_ctrl_msg {")
8560 with q.group():
8561 with q.indent(2):
8562 q.breakable()
8563 q.text("xid = ");
8564 if self.xid != None:
8565 q.text("%#x" % self.xid)
8566 else:
8567 q.text('None')
8568 q.text(","); q.breakable()
8569 q.text("bundle_id = ");
8570 q.text("%#x" % self.bundle_id)
8571 q.text(","); q.breakable()
8572 q.text("bundle_ctrl_type = ");
8573 q.text("%#x" % self.bundle_ctrl_type)
8574 q.text(","); q.breakable()
8575 q.text("flags = ");
8576 q.text("%#x" % self.flags)
8577 q.text(","); q.breakable()
8578 q.text("properties = ");
8579 q.pp(self.properties)
8580 q.breakable()
8581 q.text('}')
8582
8583message.subtypes[33] = bundle_ctrl_msg
8584
Rich Laneccd32ed2014-11-10 17:48:24 -08008585class bundle_failed_error_msg(error_msg):
8586 version = 5
8587 type = 1
8588 err_type = 17
8589
8590 def __init__(self, xid=None, code=None, data=None):
8591 if xid != None:
8592 self.xid = xid
8593 else:
8594 self.xid = None
8595 if code != None:
8596 self.code = code
8597 else:
8598 self.code = 0
8599 if data != None:
8600 self.data = data
8601 else:
8602 self.data = ''
8603 return
8604
8605 def pack(self):
8606 packed = []
8607 packed.append(struct.pack("!B", self.version))
8608 packed.append(struct.pack("!B", self.type))
8609 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8610 packed.append(struct.pack("!L", self.xid))
8611 packed.append(struct.pack("!H", self.err_type))
8612 packed.append(struct.pack("!H", self.code))
8613 packed.append(self.data)
8614 length = sum([len(x) for x in packed])
8615 packed[2] = struct.pack("!H", length)
8616 return ''.join(packed)
8617
8618 @staticmethod
8619 def unpack(reader):
8620 obj = bundle_failed_error_msg()
8621 _version = reader.read("!B")[0]
8622 assert(_version == 5)
8623 _type = reader.read("!B")[0]
8624 assert(_type == 1)
8625 _length = reader.read("!H")[0]
8626 orig_reader = reader
8627 reader = orig_reader.slice(_length - (2 + 2))
8628 obj.xid = reader.read("!L")[0]
8629 _err_type = reader.read("!H")[0]
8630 assert(_err_type == 17)
8631 obj.code = reader.read("!H")[0]
8632 obj.data = str(reader.read_all())
8633 return obj
8634
8635 def __eq__(self, other):
8636 if type(self) != type(other): return False
8637 if self.xid != other.xid: return False
8638 if self.code != other.code: return False
8639 if self.data != other.data: return False
8640 return True
8641
8642 def pretty_print(self, q):
8643 q.text("bundle_failed_error_msg {")
8644 with q.group():
8645 with q.indent(2):
8646 q.breakable()
8647 q.text("xid = ");
8648 if self.xid != None:
8649 q.text("%#x" % self.xid)
8650 else:
8651 q.text('None')
8652 q.text(","); q.breakable()
8653 q.text("code = ");
8654 q.text("%#x" % self.code)
8655 q.text(","); q.breakable()
8656 q.text("data = ");
8657 q.pp(self.data)
8658 q.breakable()
8659 q.text('}')
8660
8661error_msg.subtypes[17] = bundle_failed_error_msg
8662
Rich Lane2e079da2014-10-29 15:30:24 -07008663class desc_stats_reply(stats_reply):
8664 version = 5
8665 type = 19
8666 stats_type = 0
8667
8668 def __init__(self, xid=None, flags=None, mfr_desc=None, hw_desc=None, sw_desc=None, serial_num=None, dp_desc=None):
8669 if xid != None:
8670 self.xid = xid
8671 else:
8672 self.xid = None
8673 if flags != None:
8674 self.flags = flags
8675 else:
8676 self.flags = 0
8677 if mfr_desc != None:
8678 self.mfr_desc = mfr_desc
8679 else:
8680 self.mfr_desc = ""
8681 if hw_desc != None:
8682 self.hw_desc = hw_desc
8683 else:
8684 self.hw_desc = ""
8685 if sw_desc != None:
8686 self.sw_desc = sw_desc
8687 else:
8688 self.sw_desc = ""
8689 if serial_num != None:
8690 self.serial_num = serial_num
8691 else:
8692 self.serial_num = ""
8693 if dp_desc != None:
8694 self.dp_desc = dp_desc
8695 else:
8696 self.dp_desc = ""
8697 return
8698
8699 def pack(self):
8700 packed = []
8701 packed.append(struct.pack("!B", self.version))
8702 packed.append(struct.pack("!B", self.type))
8703 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8704 packed.append(struct.pack("!L", self.xid))
8705 packed.append(struct.pack("!H", self.stats_type))
8706 packed.append(struct.pack("!H", self.flags))
8707 packed.append('\x00' * 4)
8708 packed.append(struct.pack("!256s", self.mfr_desc))
8709 packed.append(struct.pack("!256s", self.hw_desc))
8710 packed.append(struct.pack("!256s", self.sw_desc))
8711 packed.append(struct.pack("!32s", self.serial_num))
8712 packed.append(struct.pack("!256s", self.dp_desc))
8713 length = sum([len(x) for x in packed])
8714 packed[2] = struct.pack("!H", length)
8715 return ''.join(packed)
8716
8717 @staticmethod
8718 def unpack(reader):
8719 obj = desc_stats_reply()
8720 _version = reader.read("!B")[0]
8721 assert(_version == 5)
8722 _type = reader.read("!B")[0]
8723 assert(_type == 19)
8724 _length = reader.read("!H")[0]
8725 orig_reader = reader
8726 reader = orig_reader.slice(_length - (2 + 2))
8727 obj.xid = reader.read("!L")[0]
8728 _stats_type = reader.read("!H")[0]
8729 assert(_stats_type == 0)
8730 obj.flags = reader.read("!H")[0]
8731 reader.skip(4)
8732 obj.mfr_desc = reader.read("!256s")[0].rstrip("\x00")
8733 obj.hw_desc = reader.read("!256s")[0].rstrip("\x00")
8734 obj.sw_desc = reader.read("!256s")[0].rstrip("\x00")
8735 obj.serial_num = reader.read("!32s")[0].rstrip("\x00")
8736 obj.dp_desc = reader.read("!256s")[0].rstrip("\x00")
8737 return obj
8738
8739 def __eq__(self, other):
8740 if type(self) != type(other): return False
8741 if self.xid != other.xid: return False
8742 if self.flags != other.flags: return False
8743 if self.mfr_desc != other.mfr_desc: return False
8744 if self.hw_desc != other.hw_desc: return False
8745 if self.sw_desc != other.sw_desc: return False
8746 if self.serial_num != other.serial_num: return False
8747 if self.dp_desc != other.dp_desc: return False
8748 return True
8749
8750 def pretty_print(self, q):
8751 q.text("desc_stats_reply {")
8752 with q.group():
8753 with q.indent(2):
8754 q.breakable()
8755 q.text("xid = ");
8756 if self.xid != None:
8757 q.text("%#x" % self.xid)
8758 else:
8759 q.text('None')
8760 q.text(","); q.breakable()
8761 q.text("flags = ");
8762 q.text("%#x" % self.flags)
8763 q.text(","); q.breakable()
8764 q.text("mfr_desc = ");
8765 q.pp(self.mfr_desc)
8766 q.text(","); q.breakable()
8767 q.text("hw_desc = ");
8768 q.pp(self.hw_desc)
8769 q.text(","); q.breakable()
8770 q.text("sw_desc = ");
8771 q.pp(self.sw_desc)
8772 q.text(","); q.breakable()
8773 q.text("serial_num = ");
8774 q.pp(self.serial_num)
8775 q.text(","); q.breakable()
8776 q.text("dp_desc = ");
8777 q.pp(self.dp_desc)
8778 q.breakable()
8779 q.text('}')
8780
8781stats_reply.subtypes[0] = desc_stats_reply
8782
8783class desc_stats_request(stats_request):
8784 version = 5
8785 type = 18
8786 stats_type = 0
8787
8788 def __init__(self, xid=None, flags=None):
8789 if xid != None:
8790 self.xid = xid
8791 else:
8792 self.xid = None
8793 if flags != None:
8794 self.flags = flags
8795 else:
8796 self.flags = 0
8797 return
8798
8799 def pack(self):
8800 packed = []
8801 packed.append(struct.pack("!B", self.version))
8802 packed.append(struct.pack("!B", self.type))
8803 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8804 packed.append(struct.pack("!L", self.xid))
8805 packed.append(struct.pack("!H", self.stats_type))
8806 packed.append(struct.pack("!H", self.flags))
8807 packed.append('\x00' * 4)
8808 length = sum([len(x) for x in packed])
8809 packed[2] = struct.pack("!H", length)
8810 return ''.join(packed)
8811
8812 @staticmethod
8813 def unpack(reader):
8814 obj = desc_stats_request()
8815 _version = reader.read("!B")[0]
8816 assert(_version == 5)
8817 _type = reader.read("!B")[0]
8818 assert(_type == 18)
8819 _length = reader.read("!H")[0]
8820 orig_reader = reader
8821 reader = orig_reader.slice(_length - (2 + 2))
8822 obj.xid = reader.read("!L")[0]
8823 _stats_type = reader.read("!H")[0]
8824 assert(_stats_type == 0)
8825 obj.flags = reader.read("!H")[0]
8826 reader.skip(4)
8827 return obj
8828
8829 def __eq__(self, other):
8830 if type(self) != type(other): return False
8831 if self.xid != other.xid: return False
8832 if self.flags != other.flags: return False
8833 return True
8834
8835 def pretty_print(self, q):
8836 q.text("desc_stats_request {")
8837 with q.group():
8838 with q.indent(2):
8839 q.breakable()
8840 q.text("xid = ");
8841 if self.xid != None:
8842 q.text("%#x" % self.xid)
8843 else:
8844 q.text('None')
8845 q.text(","); q.breakable()
8846 q.text("flags = ");
8847 q.text("%#x" % self.flags)
8848 q.breakable()
8849 q.text('}')
8850
8851stats_request.subtypes[0] = desc_stats_request
8852
8853class echo_reply(message):
8854 version = 5
8855 type = 3
8856
8857 def __init__(self, xid=None, data=None):
8858 if xid != None:
8859 self.xid = xid
8860 else:
8861 self.xid = None
8862 if data != None:
8863 self.data = data
8864 else:
8865 self.data = ''
8866 return
8867
8868 def pack(self):
8869 packed = []
8870 packed.append(struct.pack("!B", self.version))
8871 packed.append(struct.pack("!B", self.type))
8872 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8873 packed.append(struct.pack("!L", self.xid))
8874 packed.append(self.data)
8875 length = sum([len(x) for x in packed])
8876 packed[2] = struct.pack("!H", length)
8877 return ''.join(packed)
8878
8879 @staticmethod
8880 def unpack(reader):
8881 obj = echo_reply()
8882 _version = reader.read("!B")[0]
8883 assert(_version == 5)
8884 _type = reader.read("!B")[0]
8885 assert(_type == 3)
8886 _length = reader.read("!H")[0]
8887 orig_reader = reader
8888 reader = orig_reader.slice(_length - (2 + 2))
8889 obj.xid = reader.read("!L")[0]
8890 obj.data = str(reader.read_all())
8891 return obj
8892
8893 def __eq__(self, other):
8894 if type(self) != type(other): return False
8895 if self.xid != other.xid: return False
8896 if self.data != other.data: return False
8897 return True
8898
8899 def pretty_print(self, q):
8900 q.text("echo_reply {")
8901 with q.group():
8902 with q.indent(2):
8903 q.breakable()
8904 q.text("xid = ");
8905 if self.xid != None:
8906 q.text("%#x" % self.xid)
8907 else:
8908 q.text('None')
8909 q.text(","); q.breakable()
8910 q.text("data = ");
8911 q.pp(self.data)
8912 q.breakable()
8913 q.text('}')
8914
8915message.subtypes[3] = echo_reply
8916
8917class echo_request(message):
8918 version = 5
8919 type = 2
8920
8921 def __init__(self, xid=None, data=None):
8922 if xid != None:
8923 self.xid = xid
8924 else:
8925 self.xid = None
8926 if data != None:
8927 self.data = data
8928 else:
8929 self.data = ''
8930 return
8931
8932 def pack(self):
8933 packed = []
8934 packed.append(struct.pack("!B", self.version))
8935 packed.append(struct.pack("!B", self.type))
8936 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
8937 packed.append(struct.pack("!L", self.xid))
8938 packed.append(self.data)
8939 length = sum([len(x) for x in packed])
8940 packed[2] = struct.pack("!H", length)
8941 return ''.join(packed)
8942
8943 @staticmethod
8944 def unpack(reader):
8945 obj = echo_request()
8946 _version = reader.read("!B")[0]
8947 assert(_version == 5)
8948 _type = reader.read("!B")[0]
8949 assert(_type == 2)
8950 _length = reader.read("!H")[0]
8951 orig_reader = reader
8952 reader = orig_reader.slice(_length - (2 + 2))
8953 obj.xid = reader.read("!L")[0]
8954 obj.data = str(reader.read_all())
8955 return obj
8956
8957 def __eq__(self, other):
8958 if type(self) != type(other): return False
8959 if self.xid != other.xid: return False
8960 if self.data != other.data: return False
8961 return True
8962
8963 def pretty_print(self, q):
8964 q.text("echo_request {")
8965 with q.group():
8966 with q.indent(2):
8967 q.breakable()
8968 q.text("xid = ");
8969 if self.xid != None:
8970 q.text("%#x" % self.xid)
8971 else:
8972 q.text('None')
8973 q.text(","); q.breakable()
8974 q.text("data = ");
8975 q.pp(self.data)
8976 q.breakable()
8977 q.text('}')
8978
8979message.subtypes[2] = echo_request
8980
8981class experimenter_error_msg(error_msg):
8982 version = 5
8983 type = 1
8984 err_type = 65535
8985
8986 def __init__(self, xid=None, subtype=None, experimenter=None, data=None):
8987 if xid != None:
8988 self.xid = xid
8989 else:
8990 self.xid = None
8991 if subtype != None:
8992 self.subtype = subtype
8993 else:
8994 self.subtype = 0
8995 if experimenter != None:
8996 self.experimenter = experimenter
8997 else:
8998 self.experimenter = 0
8999 if data != None:
9000 self.data = data
9001 else:
9002 self.data = ''
9003 return
9004
9005 def pack(self):
9006 packed = []
9007 packed.append(struct.pack("!B", self.version))
9008 packed.append(struct.pack("!B", self.type))
9009 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9010 packed.append(struct.pack("!L", self.xid))
9011 packed.append(struct.pack("!H", self.err_type))
9012 packed.append(struct.pack("!H", self.subtype))
9013 packed.append(struct.pack("!L", self.experimenter))
9014 packed.append(self.data)
9015 length = sum([len(x) for x in packed])
9016 packed[2] = struct.pack("!H", length)
9017 return ''.join(packed)
9018
9019 @staticmethod
9020 def unpack(reader):
9021 obj = experimenter_error_msg()
9022 _version = reader.read("!B")[0]
9023 assert(_version == 5)
9024 _type = reader.read("!B")[0]
9025 assert(_type == 1)
9026 _length = reader.read("!H")[0]
9027 orig_reader = reader
9028 reader = orig_reader.slice(_length - (2 + 2))
9029 obj.xid = reader.read("!L")[0]
9030 _err_type = reader.read("!H")[0]
9031 assert(_err_type == 65535)
9032 obj.subtype = reader.read("!H")[0]
9033 obj.experimenter = reader.read("!L")[0]
9034 obj.data = str(reader.read_all())
9035 return obj
9036
9037 def __eq__(self, other):
9038 if type(self) != type(other): return False
9039 if self.xid != other.xid: return False
9040 if self.subtype != other.subtype: return False
9041 if self.experimenter != other.experimenter: return False
9042 if self.data != other.data: return False
9043 return True
9044
9045 def pretty_print(self, q):
9046 q.text("experimenter_error_msg {")
9047 with q.group():
9048 with q.indent(2):
9049 q.breakable()
9050 q.text("xid = ");
9051 if self.xid != None:
9052 q.text("%#x" % self.xid)
9053 else:
9054 q.text('None')
9055 q.text(","); q.breakable()
9056 q.text("subtype = ");
9057 q.text("%#x" % self.subtype)
9058 q.text(","); q.breakable()
9059 q.text("experimenter = ");
9060 q.text("%#x" % self.experimenter)
9061 q.text(","); q.breakable()
9062 q.text("data = ");
9063 q.pp(self.data)
9064 q.breakable()
9065 q.text('}')
9066
9067error_msg.subtypes[65535] = experimenter_error_msg
9068
9069class features_reply(message):
9070 version = 5
9071 type = 6
9072
9073 def __init__(self, xid=None, datapath_id=None, n_buffers=None, n_tables=None, auxiliary_id=None, capabilities=None, reserved=None):
9074 if xid != None:
9075 self.xid = xid
9076 else:
9077 self.xid = None
9078 if datapath_id != None:
9079 self.datapath_id = datapath_id
9080 else:
9081 self.datapath_id = 0
9082 if n_buffers != None:
9083 self.n_buffers = n_buffers
9084 else:
9085 self.n_buffers = 0
9086 if n_tables != None:
9087 self.n_tables = n_tables
9088 else:
9089 self.n_tables = 0
9090 if auxiliary_id != None:
9091 self.auxiliary_id = auxiliary_id
9092 else:
9093 self.auxiliary_id = 0
9094 if capabilities != None:
9095 self.capabilities = capabilities
9096 else:
9097 self.capabilities = 0
9098 if reserved != None:
9099 self.reserved = reserved
9100 else:
9101 self.reserved = 0
9102 return
9103
9104 def pack(self):
9105 packed = []
9106 packed.append(struct.pack("!B", self.version))
9107 packed.append(struct.pack("!B", self.type))
9108 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9109 packed.append(struct.pack("!L", self.xid))
9110 packed.append(struct.pack("!Q", self.datapath_id))
9111 packed.append(struct.pack("!L", self.n_buffers))
9112 packed.append(struct.pack("!B", self.n_tables))
9113 packed.append(struct.pack("!B", self.auxiliary_id))
9114 packed.append('\x00' * 2)
9115 packed.append(struct.pack("!L", self.capabilities))
9116 packed.append(struct.pack("!L", self.reserved))
9117 length = sum([len(x) for x in packed])
9118 packed[2] = struct.pack("!H", length)
9119 return ''.join(packed)
9120
9121 @staticmethod
9122 def unpack(reader):
9123 obj = features_reply()
9124 _version = reader.read("!B")[0]
9125 assert(_version == 5)
9126 _type = reader.read("!B")[0]
9127 assert(_type == 6)
9128 _length = reader.read("!H")[0]
9129 orig_reader = reader
9130 reader = orig_reader.slice(_length - (2 + 2))
9131 obj.xid = reader.read("!L")[0]
9132 obj.datapath_id = reader.read("!Q")[0]
9133 obj.n_buffers = reader.read("!L")[0]
9134 obj.n_tables = reader.read("!B")[0]
9135 obj.auxiliary_id = reader.read("!B")[0]
9136 reader.skip(2)
9137 obj.capabilities = reader.read("!L")[0]
9138 obj.reserved = reader.read("!L")[0]
9139 return obj
9140
9141 def __eq__(self, other):
9142 if type(self) != type(other): return False
9143 if self.xid != other.xid: return False
9144 if self.datapath_id != other.datapath_id: return False
9145 if self.n_buffers != other.n_buffers: return False
9146 if self.n_tables != other.n_tables: return False
9147 if self.auxiliary_id != other.auxiliary_id: return False
9148 if self.capabilities != other.capabilities: return False
9149 if self.reserved != other.reserved: return False
9150 return True
9151
9152 def pretty_print(self, q):
9153 q.text("features_reply {")
9154 with q.group():
9155 with q.indent(2):
9156 q.breakable()
9157 q.text("xid = ");
9158 if self.xid != None:
9159 q.text("%#x" % self.xid)
9160 else:
9161 q.text('None')
9162 q.text(","); q.breakable()
9163 q.text("datapath_id = ");
9164 q.text("%#x" % self.datapath_id)
9165 q.text(","); q.breakable()
9166 q.text("n_buffers = ");
9167 q.text("%#x" % self.n_buffers)
9168 q.text(","); q.breakable()
9169 q.text("n_tables = ");
9170 q.text("%#x" % self.n_tables)
9171 q.text(","); q.breakable()
9172 q.text("auxiliary_id = ");
9173 q.text("%#x" % self.auxiliary_id)
9174 q.text(","); q.breakable()
9175 q.text("capabilities = ");
9176 q.text("%#x" % self.capabilities)
9177 q.text(","); q.breakable()
9178 q.text("reserved = ");
9179 q.text("%#x" % self.reserved)
9180 q.breakable()
9181 q.text('}')
9182
9183message.subtypes[6] = features_reply
9184
9185class features_request(message):
9186 version = 5
9187 type = 5
9188
9189 def __init__(self, xid=None):
9190 if xid != None:
9191 self.xid = xid
9192 else:
9193 self.xid = None
9194 return
9195
9196 def pack(self):
9197 packed = []
9198 packed.append(struct.pack("!B", self.version))
9199 packed.append(struct.pack("!B", self.type))
9200 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9201 packed.append(struct.pack("!L", self.xid))
9202 length = sum([len(x) for x in packed])
9203 packed[2] = struct.pack("!H", length)
9204 return ''.join(packed)
9205
9206 @staticmethod
9207 def unpack(reader):
9208 obj = features_request()
9209 _version = reader.read("!B")[0]
9210 assert(_version == 5)
9211 _type = reader.read("!B")[0]
9212 assert(_type == 5)
9213 _length = reader.read("!H")[0]
9214 orig_reader = reader
9215 reader = orig_reader.slice(_length - (2 + 2))
9216 obj.xid = reader.read("!L")[0]
9217 return obj
9218
9219 def __eq__(self, other):
9220 if type(self) != type(other): return False
9221 if self.xid != other.xid: return False
9222 return True
9223
9224 def pretty_print(self, q):
9225 q.text("features_request {")
9226 with q.group():
9227 with q.indent(2):
9228 q.breakable()
9229 q.text("xid = ");
9230 if self.xid != None:
9231 q.text("%#x" % self.xid)
9232 else:
9233 q.text('None')
9234 q.breakable()
9235 q.text('}')
9236
9237message.subtypes[5] = features_request
9238
9239class flow_mod(message):
9240 subtypes = {}
9241
9242 version = 5
9243 type = 14
9244
9245 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, _command=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, match=None, instructions=None):
9246 if xid != None:
9247 self.xid = xid
9248 else:
9249 self.xid = None
9250 if cookie != None:
9251 self.cookie = cookie
9252 else:
9253 self.cookie = 0
9254 if cookie_mask != None:
9255 self.cookie_mask = cookie_mask
9256 else:
9257 self.cookie_mask = 0
9258 if table_id != None:
9259 self.table_id = table_id
9260 else:
9261 self.table_id = 0
9262 if _command != None:
9263 self._command = _command
9264 else:
9265 self._command = 0
9266 if idle_timeout != None:
9267 self.idle_timeout = idle_timeout
9268 else:
9269 self.idle_timeout = 0
9270 if hard_timeout != None:
9271 self.hard_timeout = hard_timeout
9272 else:
9273 self.hard_timeout = 0
9274 if priority != None:
9275 self.priority = priority
9276 else:
9277 self.priority = 0
9278 if buffer_id != None:
9279 self.buffer_id = buffer_id
9280 else:
9281 self.buffer_id = 0
9282 if out_port != None:
9283 self.out_port = out_port
9284 else:
9285 self.out_port = 0
9286 if out_group != None:
9287 self.out_group = out_group
9288 else:
9289 self.out_group = 0
9290 if flags != None:
9291 self.flags = flags
9292 else:
9293 self.flags = 0
9294 if match != None:
9295 self.match = match
9296 else:
9297 self.match = common.match()
9298 if instructions != None:
9299 self.instructions = instructions
9300 else:
9301 self.instructions = []
9302 return
9303
9304 def pack(self):
9305 packed = []
9306 packed.append(struct.pack("!B", self.version))
9307 packed.append(struct.pack("!B", self.type))
9308 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9309 packed.append(struct.pack("!L", self.xid))
9310 packed.append(struct.pack("!Q", self.cookie))
9311 packed.append(struct.pack("!Q", self.cookie_mask))
9312 packed.append(struct.pack("!B", self.table_id))
9313 packed.append(util.pack_fm_cmd(self._command))
9314 packed.append(struct.pack("!H", self.idle_timeout))
9315 packed.append(struct.pack("!H", self.hard_timeout))
9316 packed.append(struct.pack("!H", self.priority))
9317 packed.append(struct.pack("!L", self.buffer_id))
9318 packed.append(util.pack_port_no(self.out_port))
9319 packed.append(struct.pack("!L", self.out_group))
9320 packed.append(struct.pack("!H", self.flags))
9321 packed.append('\x00' * 2)
9322 packed.append(self.match.pack())
9323 packed.append(loxi.generic_util.pack_list(self.instructions))
9324 length = sum([len(x) for x in packed])
9325 packed[2] = struct.pack("!H", length)
9326 return ''.join(packed)
9327
9328 @staticmethod
9329 def unpack(reader):
9330 subtype, = reader.peek('B', 25)
9331 subclass = flow_mod.subtypes.get(subtype)
9332 if subclass:
9333 return subclass.unpack(reader)
9334
9335 obj = flow_mod()
9336 _version = reader.read("!B")[0]
9337 assert(_version == 5)
9338 _type = reader.read("!B")[0]
9339 assert(_type == 14)
9340 _length = reader.read("!H")[0]
9341 orig_reader = reader
9342 reader = orig_reader.slice(_length - (2 + 2))
9343 obj.xid = reader.read("!L")[0]
9344 obj.cookie = reader.read("!Q")[0]
9345 obj.cookie_mask = reader.read("!Q")[0]
9346 obj.table_id = reader.read("!B")[0]
9347 obj._command = util.unpack_fm_cmd(reader)
9348 obj.idle_timeout = reader.read("!H")[0]
9349 obj.hard_timeout = reader.read("!H")[0]
9350 obj.priority = reader.read("!H")[0]
9351 obj.buffer_id = reader.read("!L")[0]
9352 obj.out_port = util.unpack_port_no(reader)
9353 obj.out_group = reader.read("!L")[0]
9354 obj.flags = reader.read("!H")[0]
9355 reader.skip(2)
9356 obj.match = common.match.unpack(reader)
9357 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9358 return obj
9359
9360 def __eq__(self, other):
9361 if type(self) != type(other): return False
9362 if self.xid != other.xid: return False
9363 if self.cookie != other.cookie: return False
9364 if self.cookie_mask != other.cookie_mask: return False
9365 if self.table_id != other.table_id: return False
9366 if self._command != other._command: return False
9367 if self.idle_timeout != other.idle_timeout: return False
9368 if self.hard_timeout != other.hard_timeout: return False
9369 if self.priority != other.priority: return False
9370 if self.buffer_id != other.buffer_id: return False
9371 if self.out_port != other.out_port: return False
9372 if self.out_group != other.out_group: return False
9373 if self.flags != other.flags: return False
9374 if self.match != other.match: return False
9375 if self.instructions != other.instructions: return False
9376 return True
9377
9378 def pretty_print(self, q):
9379 q.text("flow_mod {")
9380 with q.group():
9381 with q.indent(2):
9382 q.breakable()
9383 q.text("xid = ");
9384 if self.xid != None:
9385 q.text("%#x" % self.xid)
9386 else:
9387 q.text('None')
9388 q.text(","); q.breakable()
9389 q.text("cookie = ");
9390 q.text("%#x" % self.cookie)
9391 q.text(","); q.breakable()
9392 q.text("cookie_mask = ");
9393 q.text("%#x" % self.cookie_mask)
9394 q.text(","); q.breakable()
9395 q.text("table_id = ");
9396 q.text("%#x" % self.table_id)
9397 q.text(","); q.breakable()
9398 q.text("idle_timeout = ");
9399 q.text("%#x" % self.idle_timeout)
9400 q.text(","); q.breakable()
9401 q.text("hard_timeout = ");
9402 q.text("%#x" % self.hard_timeout)
9403 q.text(","); q.breakable()
9404 q.text("priority = ");
9405 q.text("%#x" % self.priority)
9406 q.text(","); q.breakable()
9407 q.text("buffer_id = ");
9408 q.text("%#x" % self.buffer_id)
9409 q.text(","); q.breakable()
9410 q.text("out_port = ");
9411 q.text(util.pretty_port(self.out_port))
9412 q.text(","); q.breakable()
9413 q.text("out_group = ");
9414 q.text("%#x" % self.out_group)
9415 q.text(","); q.breakable()
9416 q.text("flags = ");
9417 q.text("%#x" % self.flags)
9418 q.text(","); q.breakable()
9419 q.text("match = ");
9420 q.pp(self.match)
9421 q.text(","); q.breakable()
9422 q.text("instructions = ");
9423 q.pp(self.instructions)
9424 q.breakable()
9425 q.text('}')
9426
9427message.subtypes[14] = flow_mod
9428
9429class flow_add(flow_mod):
9430 version = 5
9431 type = 14
9432 _command = 0
9433
9434 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
9435 if xid != None:
9436 self.xid = xid
9437 else:
9438 self.xid = None
9439 if cookie != None:
9440 self.cookie = cookie
9441 else:
9442 self.cookie = 0
9443 if cookie_mask != None:
9444 self.cookie_mask = cookie_mask
9445 else:
9446 self.cookie_mask = 0
9447 if table_id != None:
9448 self.table_id = table_id
9449 else:
9450 self.table_id = 0
9451 if idle_timeout != None:
9452 self.idle_timeout = idle_timeout
9453 else:
9454 self.idle_timeout = 0
9455 if hard_timeout != None:
9456 self.hard_timeout = hard_timeout
9457 else:
9458 self.hard_timeout = 0
9459 if priority != None:
9460 self.priority = priority
9461 else:
9462 self.priority = 0
9463 if buffer_id != None:
9464 self.buffer_id = buffer_id
9465 else:
9466 self.buffer_id = 0
9467 if out_port != None:
9468 self.out_port = out_port
9469 else:
9470 self.out_port = 0
9471 if out_group != None:
9472 self.out_group = out_group
9473 else:
9474 self.out_group = 0
9475 if flags != None:
9476 self.flags = flags
9477 else:
9478 self.flags = 0
9479 if importance != None:
9480 self.importance = importance
9481 else:
9482 self.importance = 0
9483 if match != None:
9484 self.match = match
9485 else:
9486 self.match = common.match()
9487 if instructions != None:
9488 self.instructions = instructions
9489 else:
9490 self.instructions = []
9491 return
9492
9493 def pack(self):
9494 packed = []
9495 packed.append(struct.pack("!B", self.version))
9496 packed.append(struct.pack("!B", self.type))
9497 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9498 packed.append(struct.pack("!L", self.xid))
9499 packed.append(struct.pack("!Q", self.cookie))
9500 packed.append(struct.pack("!Q", self.cookie_mask))
9501 packed.append(struct.pack("!B", self.table_id))
9502 packed.append(util.pack_fm_cmd(self._command))
9503 packed.append(struct.pack("!H", self.idle_timeout))
9504 packed.append(struct.pack("!H", self.hard_timeout))
9505 packed.append(struct.pack("!H", self.priority))
9506 packed.append(struct.pack("!L", self.buffer_id))
9507 packed.append(util.pack_port_no(self.out_port))
9508 packed.append(struct.pack("!L", self.out_group))
9509 packed.append(struct.pack("!H", self.flags))
9510 packed.append(struct.pack("!H", self.importance))
9511 packed.append(self.match.pack())
9512 packed.append(loxi.generic_util.pack_list(self.instructions))
9513 length = sum([len(x) for x in packed])
9514 packed[2] = struct.pack("!H", length)
9515 return ''.join(packed)
9516
9517 @staticmethod
9518 def unpack(reader):
9519 obj = flow_add()
9520 _version = reader.read("!B")[0]
9521 assert(_version == 5)
9522 _type = reader.read("!B")[0]
9523 assert(_type == 14)
9524 _length = reader.read("!H")[0]
9525 orig_reader = reader
9526 reader = orig_reader.slice(_length - (2 + 2))
9527 obj.xid = reader.read("!L")[0]
9528 obj.cookie = reader.read("!Q")[0]
9529 obj.cookie_mask = reader.read("!Q")[0]
9530 obj.table_id = reader.read("!B")[0]
9531 __command = util.unpack_fm_cmd(reader)
9532 assert(__command == 0)
9533 obj.idle_timeout = reader.read("!H")[0]
9534 obj.hard_timeout = reader.read("!H")[0]
9535 obj.priority = reader.read("!H")[0]
9536 obj.buffer_id = reader.read("!L")[0]
9537 obj.out_port = util.unpack_port_no(reader)
9538 obj.out_group = reader.read("!L")[0]
9539 obj.flags = reader.read("!H")[0]
9540 obj.importance = reader.read("!H")[0]
9541 obj.match = common.match.unpack(reader)
9542 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9543 return obj
9544
9545 def __eq__(self, other):
9546 if type(self) != type(other): return False
9547 if self.xid != other.xid: return False
9548 if self.cookie != other.cookie: return False
9549 if self.cookie_mask != other.cookie_mask: return False
9550 if self.table_id != other.table_id: return False
9551 if self.idle_timeout != other.idle_timeout: return False
9552 if self.hard_timeout != other.hard_timeout: return False
9553 if self.priority != other.priority: return False
9554 if self.buffer_id != other.buffer_id: return False
9555 if self.out_port != other.out_port: return False
9556 if self.out_group != other.out_group: return False
9557 if self.flags != other.flags: return False
9558 if self.importance != other.importance: return False
9559 if self.match != other.match: return False
9560 if self.instructions != other.instructions: return False
9561 return True
9562
9563 def pretty_print(self, q):
9564 q.text("flow_add {")
9565 with q.group():
9566 with q.indent(2):
9567 q.breakable()
9568 q.text("xid = ");
9569 if self.xid != None:
9570 q.text("%#x" % self.xid)
9571 else:
9572 q.text('None')
9573 q.text(","); q.breakable()
9574 q.text("cookie = ");
9575 q.text("%#x" % self.cookie)
9576 q.text(","); q.breakable()
9577 q.text("cookie_mask = ");
9578 q.text("%#x" % self.cookie_mask)
9579 q.text(","); q.breakable()
9580 q.text("table_id = ");
9581 q.text("%#x" % self.table_id)
9582 q.text(","); q.breakable()
9583 q.text("idle_timeout = ");
9584 q.text("%#x" % self.idle_timeout)
9585 q.text(","); q.breakable()
9586 q.text("hard_timeout = ");
9587 q.text("%#x" % self.hard_timeout)
9588 q.text(","); q.breakable()
9589 q.text("priority = ");
9590 q.text("%#x" % self.priority)
9591 q.text(","); q.breakable()
9592 q.text("buffer_id = ");
9593 q.text("%#x" % self.buffer_id)
9594 q.text(","); q.breakable()
9595 q.text("out_port = ");
9596 q.text(util.pretty_port(self.out_port))
9597 q.text(","); q.breakable()
9598 q.text("out_group = ");
9599 q.text("%#x" % self.out_group)
9600 q.text(","); q.breakable()
9601 q.text("flags = ");
9602 q.text("%#x" % self.flags)
9603 q.text(","); q.breakable()
9604 q.text("importance = ");
9605 q.text("%#x" % self.importance)
9606 q.text(","); q.breakable()
9607 q.text("match = ");
9608 q.pp(self.match)
9609 q.text(","); q.breakable()
9610 q.text("instructions = ");
9611 q.pp(self.instructions)
9612 q.breakable()
9613 q.text('}')
9614
9615flow_mod.subtypes[0] = flow_add
9616
9617class flow_delete(flow_mod):
9618 version = 5
9619 type = 14
9620 _command = 3
9621
9622 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
9623 if xid != None:
9624 self.xid = xid
9625 else:
9626 self.xid = None
9627 if cookie != None:
9628 self.cookie = cookie
9629 else:
9630 self.cookie = 0
9631 if cookie_mask != None:
9632 self.cookie_mask = cookie_mask
9633 else:
9634 self.cookie_mask = 0
9635 if table_id != None:
9636 self.table_id = table_id
9637 else:
9638 self.table_id = 0
9639 if idle_timeout != None:
9640 self.idle_timeout = idle_timeout
9641 else:
9642 self.idle_timeout = 0
9643 if hard_timeout != None:
9644 self.hard_timeout = hard_timeout
9645 else:
9646 self.hard_timeout = 0
9647 if priority != None:
9648 self.priority = priority
9649 else:
9650 self.priority = 0
9651 if buffer_id != None:
9652 self.buffer_id = buffer_id
9653 else:
9654 self.buffer_id = 0
9655 if out_port != None:
9656 self.out_port = out_port
9657 else:
9658 self.out_port = 0
9659 if out_group != None:
9660 self.out_group = out_group
9661 else:
9662 self.out_group = 0
9663 if flags != None:
9664 self.flags = flags
9665 else:
9666 self.flags = 0
9667 if importance != None:
9668 self.importance = importance
9669 else:
9670 self.importance = 0
9671 if match != None:
9672 self.match = match
9673 else:
9674 self.match = common.match()
9675 if instructions != None:
9676 self.instructions = instructions
9677 else:
9678 self.instructions = []
9679 return
9680
9681 def pack(self):
9682 packed = []
9683 packed.append(struct.pack("!B", self.version))
9684 packed.append(struct.pack("!B", self.type))
9685 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9686 packed.append(struct.pack("!L", self.xid))
9687 packed.append(struct.pack("!Q", self.cookie))
9688 packed.append(struct.pack("!Q", self.cookie_mask))
9689 packed.append(struct.pack("!B", self.table_id))
9690 packed.append(util.pack_fm_cmd(self._command))
9691 packed.append(struct.pack("!H", self.idle_timeout))
9692 packed.append(struct.pack("!H", self.hard_timeout))
9693 packed.append(struct.pack("!H", self.priority))
9694 packed.append(struct.pack("!L", self.buffer_id))
9695 packed.append(util.pack_port_no(self.out_port))
9696 packed.append(struct.pack("!L", self.out_group))
9697 packed.append(struct.pack("!H", self.flags))
9698 packed.append(struct.pack("!H", self.importance))
9699 packed.append(self.match.pack())
9700 packed.append(loxi.generic_util.pack_list(self.instructions))
9701 length = sum([len(x) for x in packed])
9702 packed[2] = struct.pack("!H", length)
9703 return ''.join(packed)
9704
9705 @staticmethod
9706 def unpack(reader):
9707 obj = flow_delete()
9708 _version = reader.read("!B")[0]
9709 assert(_version == 5)
9710 _type = reader.read("!B")[0]
9711 assert(_type == 14)
9712 _length = reader.read("!H")[0]
9713 orig_reader = reader
9714 reader = orig_reader.slice(_length - (2 + 2))
9715 obj.xid = reader.read("!L")[0]
9716 obj.cookie = reader.read("!Q")[0]
9717 obj.cookie_mask = reader.read("!Q")[0]
9718 obj.table_id = reader.read("!B")[0]
9719 __command = util.unpack_fm_cmd(reader)
9720 assert(__command == 3)
9721 obj.idle_timeout = reader.read("!H")[0]
9722 obj.hard_timeout = reader.read("!H")[0]
9723 obj.priority = reader.read("!H")[0]
9724 obj.buffer_id = reader.read("!L")[0]
9725 obj.out_port = util.unpack_port_no(reader)
9726 obj.out_group = reader.read("!L")[0]
9727 obj.flags = reader.read("!H")[0]
9728 obj.importance = reader.read("!H")[0]
9729 obj.match = common.match.unpack(reader)
9730 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9731 return obj
9732
9733 def __eq__(self, other):
9734 if type(self) != type(other): return False
9735 if self.xid != other.xid: return False
9736 if self.cookie != other.cookie: return False
9737 if self.cookie_mask != other.cookie_mask: return False
9738 if self.table_id != other.table_id: return False
9739 if self.idle_timeout != other.idle_timeout: return False
9740 if self.hard_timeout != other.hard_timeout: return False
9741 if self.priority != other.priority: return False
9742 if self.buffer_id != other.buffer_id: return False
9743 if self.out_port != other.out_port: return False
9744 if self.out_group != other.out_group: return False
9745 if self.flags != other.flags: return False
9746 if self.importance != other.importance: return False
9747 if self.match != other.match: return False
9748 if self.instructions != other.instructions: return False
9749 return True
9750
9751 def pretty_print(self, q):
9752 q.text("flow_delete {")
9753 with q.group():
9754 with q.indent(2):
9755 q.breakable()
9756 q.text("xid = ");
9757 if self.xid != None:
9758 q.text("%#x" % self.xid)
9759 else:
9760 q.text('None')
9761 q.text(","); q.breakable()
9762 q.text("cookie = ");
9763 q.text("%#x" % self.cookie)
9764 q.text(","); q.breakable()
9765 q.text("cookie_mask = ");
9766 q.text("%#x" % self.cookie_mask)
9767 q.text(","); q.breakable()
9768 q.text("table_id = ");
9769 q.text("%#x" % self.table_id)
9770 q.text(","); q.breakable()
9771 q.text("idle_timeout = ");
9772 q.text("%#x" % self.idle_timeout)
9773 q.text(","); q.breakable()
9774 q.text("hard_timeout = ");
9775 q.text("%#x" % self.hard_timeout)
9776 q.text(","); q.breakable()
9777 q.text("priority = ");
9778 q.text("%#x" % self.priority)
9779 q.text(","); q.breakable()
9780 q.text("buffer_id = ");
9781 q.text("%#x" % self.buffer_id)
9782 q.text(","); q.breakable()
9783 q.text("out_port = ");
9784 q.text(util.pretty_port(self.out_port))
9785 q.text(","); q.breakable()
9786 q.text("out_group = ");
9787 q.text("%#x" % self.out_group)
9788 q.text(","); q.breakable()
9789 q.text("flags = ");
9790 q.text("%#x" % self.flags)
9791 q.text(","); q.breakable()
9792 q.text("importance = ");
9793 q.text("%#x" % self.importance)
9794 q.text(","); q.breakable()
9795 q.text("match = ");
9796 q.pp(self.match)
9797 q.text(","); q.breakable()
9798 q.text("instructions = ");
9799 q.pp(self.instructions)
9800 q.breakable()
9801 q.text('}')
9802
9803flow_mod.subtypes[3] = flow_delete
9804
9805class flow_delete_strict(flow_mod):
9806 version = 5
9807 type = 14
9808 _command = 4
9809
9810 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
9811 if xid != None:
9812 self.xid = xid
9813 else:
9814 self.xid = None
9815 if cookie != None:
9816 self.cookie = cookie
9817 else:
9818 self.cookie = 0
9819 if cookie_mask != None:
9820 self.cookie_mask = cookie_mask
9821 else:
9822 self.cookie_mask = 0
9823 if table_id != None:
9824 self.table_id = table_id
9825 else:
9826 self.table_id = 0
9827 if idle_timeout != None:
9828 self.idle_timeout = idle_timeout
9829 else:
9830 self.idle_timeout = 0
9831 if hard_timeout != None:
9832 self.hard_timeout = hard_timeout
9833 else:
9834 self.hard_timeout = 0
9835 if priority != None:
9836 self.priority = priority
9837 else:
9838 self.priority = 0
9839 if buffer_id != None:
9840 self.buffer_id = buffer_id
9841 else:
9842 self.buffer_id = 0
9843 if out_port != None:
9844 self.out_port = out_port
9845 else:
9846 self.out_port = 0
9847 if out_group != None:
9848 self.out_group = out_group
9849 else:
9850 self.out_group = 0
9851 if flags != None:
9852 self.flags = flags
9853 else:
9854 self.flags = 0
9855 if importance != None:
9856 self.importance = importance
9857 else:
9858 self.importance = 0
9859 if match != None:
9860 self.match = match
9861 else:
9862 self.match = common.match()
9863 if instructions != None:
9864 self.instructions = instructions
9865 else:
9866 self.instructions = []
9867 return
9868
9869 def pack(self):
9870 packed = []
9871 packed.append(struct.pack("!B", self.version))
9872 packed.append(struct.pack("!B", self.type))
9873 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
9874 packed.append(struct.pack("!L", self.xid))
9875 packed.append(struct.pack("!Q", self.cookie))
9876 packed.append(struct.pack("!Q", self.cookie_mask))
9877 packed.append(struct.pack("!B", self.table_id))
9878 packed.append(util.pack_fm_cmd(self._command))
9879 packed.append(struct.pack("!H", self.idle_timeout))
9880 packed.append(struct.pack("!H", self.hard_timeout))
9881 packed.append(struct.pack("!H", self.priority))
9882 packed.append(struct.pack("!L", self.buffer_id))
9883 packed.append(util.pack_port_no(self.out_port))
9884 packed.append(struct.pack("!L", self.out_group))
9885 packed.append(struct.pack("!H", self.flags))
9886 packed.append(struct.pack("!H", self.importance))
9887 packed.append(self.match.pack())
9888 packed.append(loxi.generic_util.pack_list(self.instructions))
9889 length = sum([len(x) for x in packed])
9890 packed[2] = struct.pack("!H", length)
9891 return ''.join(packed)
9892
9893 @staticmethod
9894 def unpack(reader):
9895 obj = flow_delete_strict()
9896 _version = reader.read("!B")[0]
9897 assert(_version == 5)
9898 _type = reader.read("!B")[0]
9899 assert(_type == 14)
9900 _length = reader.read("!H")[0]
9901 orig_reader = reader
9902 reader = orig_reader.slice(_length - (2 + 2))
9903 obj.xid = reader.read("!L")[0]
9904 obj.cookie = reader.read("!Q")[0]
9905 obj.cookie_mask = reader.read("!Q")[0]
9906 obj.table_id = reader.read("!B")[0]
9907 __command = util.unpack_fm_cmd(reader)
9908 assert(__command == 4)
9909 obj.idle_timeout = reader.read("!H")[0]
9910 obj.hard_timeout = reader.read("!H")[0]
9911 obj.priority = reader.read("!H")[0]
9912 obj.buffer_id = reader.read("!L")[0]
9913 obj.out_port = util.unpack_port_no(reader)
9914 obj.out_group = reader.read("!L")[0]
9915 obj.flags = reader.read("!H")[0]
9916 obj.importance = reader.read("!H")[0]
9917 obj.match = common.match.unpack(reader)
9918 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
9919 return obj
9920
9921 def __eq__(self, other):
9922 if type(self) != type(other): return False
9923 if self.xid != other.xid: return False
9924 if self.cookie != other.cookie: return False
9925 if self.cookie_mask != other.cookie_mask: return False
9926 if self.table_id != other.table_id: return False
9927 if self.idle_timeout != other.idle_timeout: return False
9928 if self.hard_timeout != other.hard_timeout: return False
9929 if self.priority != other.priority: return False
9930 if self.buffer_id != other.buffer_id: return False
9931 if self.out_port != other.out_port: return False
9932 if self.out_group != other.out_group: return False
9933 if self.flags != other.flags: return False
9934 if self.importance != other.importance: return False
9935 if self.match != other.match: return False
9936 if self.instructions != other.instructions: return False
9937 return True
9938
9939 def pretty_print(self, q):
9940 q.text("flow_delete_strict {")
9941 with q.group():
9942 with q.indent(2):
9943 q.breakable()
9944 q.text("xid = ");
9945 if self.xid != None:
9946 q.text("%#x" % self.xid)
9947 else:
9948 q.text('None')
9949 q.text(","); q.breakable()
9950 q.text("cookie = ");
9951 q.text("%#x" % self.cookie)
9952 q.text(","); q.breakable()
9953 q.text("cookie_mask = ");
9954 q.text("%#x" % self.cookie_mask)
9955 q.text(","); q.breakable()
9956 q.text("table_id = ");
9957 q.text("%#x" % self.table_id)
9958 q.text(","); q.breakable()
9959 q.text("idle_timeout = ");
9960 q.text("%#x" % self.idle_timeout)
9961 q.text(","); q.breakable()
9962 q.text("hard_timeout = ");
9963 q.text("%#x" % self.hard_timeout)
9964 q.text(","); q.breakable()
9965 q.text("priority = ");
9966 q.text("%#x" % self.priority)
9967 q.text(","); q.breakable()
9968 q.text("buffer_id = ");
9969 q.text("%#x" % self.buffer_id)
9970 q.text(","); q.breakable()
9971 q.text("out_port = ");
9972 q.text(util.pretty_port(self.out_port))
9973 q.text(","); q.breakable()
9974 q.text("out_group = ");
9975 q.text("%#x" % self.out_group)
9976 q.text(","); q.breakable()
9977 q.text("flags = ");
9978 q.text("%#x" % self.flags)
9979 q.text(","); q.breakable()
9980 q.text("importance = ");
9981 q.text("%#x" % self.importance)
9982 q.text(","); q.breakable()
9983 q.text("match = ");
9984 q.pp(self.match)
9985 q.text(","); q.breakable()
9986 q.text("instructions = ");
9987 q.pp(self.instructions)
9988 q.breakable()
9989 q.text('}')
9990
9991flow_mod.subtypes[4] = flow_delete_strict
9992
9993class flow_mod_failed_error_msg(error_msg):
9994 version = 5
9995 type = 1
9996 err_type = 5
9997
9998 def __init__(self, xid=None, code=None, data=None):
9999 if xid != None:
10000 self.xid = xid
10001 else:
10002 self.xid = None
10003 if code != None:
10004 self.code = code
10005 else:
10006 self.code = 0
10007 if data != None:
10008 self.data = data
10009 else:
10010 self.data = ''
10011 return
10012
10013 def pack(self):
10014 packed = []
10015 packed.append(struct.pack("!B", self.version))
10016 packed.append(struct.pack("!B", self.type))
10017 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10018 packed.append(struct.pack("!L", self.xid))
10019 packed.append(struct.pack("!H", self.err_type))
10020 packed.append(struct.pack("!H", self.code))
10021 packed.append(self.data)
10022 length = sum([len(x) for x in packed])
10023 packed[2] = struct.pack("!H", length)
10024 return ''.join(packed)
10025
10026 @staticmethod
10027 def unpack(reader):
10028 obj = flow_mod_failed_error_msg()
10029 _version = reader.read("!B")[0]
10030 assert(_version == 5)
10031 _type = reader.read("!B")[0]
10032 assert(_type == 1)
10033 _length = reader.read("!H")[0]
10034 orig_reader = reader
10035 reader = orig_reader.slice(_length - (2 + 2))
10036 obj.xid = reader.read("!L")[0]
10037 _err_type = reader.read("!H")[0]
10038 assert(_err_type == 5)
10039 obj.code = reader.read("!H")[0]
10040 obj.data = str(reader.read_all())
10041 return obj
10042
10043 def __eq__(self, other):
10044 if type(self) != type(other): return False
10045 if self.xid != other.xid: return False
10046 if self.code != other.code: return False
10047 if self.data != other.data: return False
10048 return True
10049
10050 def pretty_print(self, q):
10051 q.text("flow_mod_failed_error_msg {")
10052 with q.group():
10053 with q.indent(2):
10054 q.breakable()
10055 q.text("xid = ");
10056 if self.xid != None:
10057 q.text("%#x" % self.xid)
10058 else:
10059 q.text('None')
10060 q.text(","); q.breakable()
10061 q.text("code = ");
10062 q.text("%#x" % self.code)
10063 q.text(","); q.breakable()
10064 q.text("data = ");
10065 q.pp(self.data)
10066 q.breakable()
10067 q.text('}')
10068
10069error_msg.subtypes[5] = flow_mod_failed_error_msg
10070
10071class flow_modify(flow_mod):
10072 version = 5
10073 type = 14
10074 _command = 1
10075
10076 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10077 if xid != None:
10078 self.xid = xid
10079 else:
10080 self.xid = None
10081 if cookie != None:
10082 self.cookie = cookie
10083 else:
10084 self.cookie = 0
10085 if cookie_mask != None:
10086 self.cookie_mask = cookie_mask
10087 else:
10088 self.cookie_mask = 0
10089 if table_id != None:
10090 self.table_id = table_id
10091 else:
10092 self.table_id = 0
10093 if idle_timeout != None:
10094 self.idle_timeout = idle_timeout
10095 else:
10096 self.idle_timeout = 0
10097 if hard_timeout != None:
10098 self.hard_timeout = hard_timeout
10099 else:
10100 self.hard_timeout = 0
10101 if priority != None:
10102 self.priority = priority
10103 else:
10104 self.priority = 0
10105 if buffer_id != None:
10106 self.buffer_id = buffer_id
10107 else:
10108 self.buffer_id = 0
10109 if out_port != None:
10110 self.out_port = out_port
10111 else:
10112 self.out_port = 0
10113 if out_group != None:
10114 self.out_group = out_group
10115 else:
10116 self.out_group = 0
10117 if flags != None:
10118 self.flags = flags
10119 else:
10120 self.flags = 0
10121 if importance != None:
10122 self.importance = importance
10123 else:
10124 self.importance = 0
10125 if match != None:
10126 self.match = match
10127 else:
10128 self.match = common.match()
10129 if instructions != None:
10130 self.instructions = instructions
10131 else:
10132 self.instructions = []
10133 return
10134
10135 def pack(self):
10136 packed = []
10137 packed.append(struct.pack("!B", self.version))
10138 packed.append(struct.pack("!B", self.type))
10139 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10140 packed.append(struct.pack("!L", self.xid))
10141 packed.append(struct.pack("!Q", self.cookie))
10142 packed.append(struct.pack("!Q", self.cookie_mask))
10143 packed.append(struct.pack("!B", self.table_id))
10144 packed.append(util.pack_fm_cmd(self._command))
10145 packed.append(struct.pack("!H", self.idle_timeout))
10146 packed.append(struct.pack("!H", self.hard_timeout))
10147 packed.append(struct.pack("!H", self.priority))
10148 packed.append(struct.pack("!L", self.buffer_id))
10149 packed.append(util.pack_port_no(self.out_port))
10150 packed.append(struct.pack("!L", self.out_group))
10151 packed.append(struct.pack("!H", self.flags))
10152 packed.append(struct.pack("!H", self.importance))
10153 packed.append(self.match.pack())
10154 packed.append(loxi.generic_util.pack_list(self.instructions))
10155 length = sum([len(x) for x in packed])
10156 packed[2] = struct.pack("!H", length)
10157 return ''.join(packed)
10158
10159 @staticmethod
10160 def unpack(reader):
10161 obj = flow_modify()
10162 _version = reader.read("!B")[0]
10163 assert(_version == 5)
10164 _type = reader.read("!B")[0]
10165 assert(_type == 14)
10166 _length = reader.read("!H")[0]
10167 orig_reader = reader
10168 reader = orig_reader.slice(_length - (2 + 2))
10169 obj.xid = reader.read("!L")[0]
10170 obj.cookie = reader.read("!Q")[0]
10171 obj.cookie_mask = reader.read("!Q")[0]
10172 obj.table_id = reader.read("!B")[0]
10173 __command = util.unpack_fm_cmd(reader)
10174 assert(__command == 1)
10175 obj.idle_timeout = reader.read("!H")[0]
10176 obj.hard_timeout = reader.read("!H")[0]
10177 obj.priority = reader.read("!H")[0]
10178 obj.buffer_id = reader.read("!L")[0]
10179 obj.out_port = util.unpack_port_no(reader)
10180 obj.out_group = reader.read("!L")[0]
10181 obj.flags = reader.read("!H")[0]
10182 obj.importance = reader.read("!H")[0]
10183 obj.match = common.match.unpack(reader)
10184 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10185 return obj
10186
10187 def __eq__(self, other):
10188 if type(self) != type(other): return False
10189 if self.xid != other.xid: return False
10190 if self.cookie != other.cookie: return False
10191 if self.cookie_mask != other.cookie_mask: return False
10192 if self.table_id != other.table_id: return False
10193 if self.idle_timeout != other.idle_timeout: return False
10194 if self.hard_timeout != other.hard_timeout: return False
10195 if self.priority != other.priority: return False
10196 if self.buffer_id != other.buffer_id: return False
10197 if self.out_port != other.out_port: return False
10198 if self.out_group != other.out_group: return False
10199 if self.flags != other.flags: return False
10200 if self.importance != other.importance: return False
10201 if self.match != other.match: return False
10202 if self.instructions != other.instructions: return False
10203 return True
10204
10205 def pretty_print(self, q):
10206 q.text("flow_modify {")
10207 with q.group():
10208 with q.indent(2):
10209 q.breakable()
10210 q.text("xid = ");
10211 if self.xid != None:
10212 q.text("%#x" % self.xid)
10213 else:
10214 q.text('None')
10215 q.text(","); q.breakable()
10216 q.text("cookie = ");
10217 q.text("%#x" % self.cookie)
10218 q.text(","); q.breakable()
10219 q.text("cookie_mask = ");
10220 q.text("%#x" % self.cookie_mask)
10221 q.text(","); q.breakable()
10222 q.text("table_id = ");
10223 q.text("%#x" % self.table_id)
10224 q.text(","); q.breakable()
10225 q.text("idle_timeout = ");
10226 q.text("%#x" % self.idle_timeout)
10227 q.text(","); q.breakable()
10228 q.text("hard_timeout = ");
10229 q.text("%#x" % self.hard_timeout)
10230 q.text(","); q.breakable()
10231 q.text("priority = ");
10232 q.text("%#x" % self.priority)
10233 q.text(","); q.breakable()
10234 q.text("buffer_id = ");
10235 q.text("%#x" % self.buffer_id)
10236 q.text(","); q.breakable()
10237 q.text("out_port = ");
10238 q.text(util.pretty_port(self.out_port))
10239 q.text(","); q.breakable()
10240 q.text("out_group = ");
10241 q.text("%#x" % self.out_group)
10242 q.text(","); q.breakable()
10243 q.text("flags = ");
10244 q.text("%#x" % self.flags)
10245 q.text(","); q.breakable()
10246 q.text("importance = ");
10247 q.text("%#x" % self.importance)
10248 q.text(","); q.breakable()
10249 q.text("match = ");
10250 q.pp(self.match)
10251 q.text(","); q.breakable()
10252 q.text("instructions = ");
10253 q.pp(self.instructions)
10254 q.breakable()
10255 q.text('}')
10256
10257flow_mod.subtypes[1] = flow_modify
10258
10259class flow_modify_strict(flow_mod):
10260 version = 5
10261 type = 14
10262 _command = 2
10263
10264 def __init__(self, xid=None, cookie=None, cookie_mask=None, table_id=None, idle_timeout=None, hard_timeout=None, priority=None, buffer_id=None, out_port=None, out_group=None, flags=None, importance=None, match=None, instructions=None):
10265 if xid != None:
10266 self.xid = xid
10267 else:
10268 self.xid = None
10269 if cookie != None:
10270 self.cookie = cookie
10271 else:
10272 self.cookie = 0
10273 if cookie_mask != None:
10274 self.cookie_mask = cookie_mask
10275 else:
10276 self.cookie_mask = 0
10277 if table_id != None:
10278 self.table_id = table_id
10279 else:
10280 self.table_id = 0
10281 if idle_timeout != None:
10282 self.idle_timeout = idle_timeout
10283 else:
10284 self.idle_timeout = 0
10285 if hard_timeout != None:
10286 self.hard_timeout = hard_timeout
10287 else:
10288 self.hard_timeout = 0
10289 if priority != None:
10290 self.priority = priority
10291 else:
10292 self.priority = 0
10293 if buffer_id != None:
10294 self.buffer_id = buffer_id
10295 else:
10296 self.buffer_id = 0
10297 if out_port != None:
10298 self.out_port = out_port
10299 else:
10300 self.out_port = 0
10301 if out_group != None:
10302 self.out_group = out_group
10303 else:
10304 self.out_group = 0
10305 if flags != None:
10306 self.flags = flags
10307 else:
10308 self.flags = 0
10309 if importance != None:
10310 self.importance = importance
10311 else:
10312 self.importance = 0
10313 if match != None:
10314 self.match = match
10315 else:
10316 self.match = common.match()
10317 if instructions != None:
10318 self.instructions = instructions
10319 else:
10320 self.instructions = []
10321 return
10322
10323 def pack(self):
10324 packed = []
10325 packed.append(struct.pack("!B", self.version))
10326 packed.append(struct.pack("!B", self.type))
10327 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10328 packed.append(struct.pack("!L", self.xid))
10329 packed.append(struct.pack("!Q", self.cookie))
10330 packed.append(struct.pack("!Q", self.cookie_mask))
10331 packed.append(struct.pack("!B", self.table_id))
10332 packed.append(util.pack_fm_cmd(self._command))
10333 packed.append(struct.pack("!H", self.idle_timeout))
10334 packed.append(struct.pack("!H", self.hard_timeout))
10335 packed.append(struct.pack("!H", self.priority))
10336 packed.append(struct.pack("!L", self.buffer_id))
10337 packed.append(util.pack_port_no(self.out_port))
10338 packed.append(struct.pack("!L", self.out_group))
10339 packed.append(struct.pack("!H", self.flags))
10340 packed.append(struct.pack("!H", self.importance))
10341 packed.append(self.match.pack())
10342 packed.append(loxi.generic_util.pack_list(self.instructions))
10343 length = sum([len(x) for x in packed])
10344 packed[2] = struct.pack("!H", length)
10345 return ''.join(packed)
10346
10347 @staticmethod
10348 def unpack(reader):
10349 obj = flow_modify_strict()
10350 _version = reader.read("!B")[0]
10351 assert(_version == 5)
10352 _type = reader.read("!B")[0]
10353 assert(_type == 14)
10354 _length = reader.read("!H")[0]
10355 orig_reader = reader
10356 reader = orig_reader.slice(_length - (2 + 2))
10357 obj.xid = reader.read("!L")[0]
10358 obj.cookie = reader.read("!Q")[0]
10359 obj.cookie_mask = reader.read("!Q")[0]
10360 obj.table_id = reader.read("!B")[0]
10361 __command = util.unpack_fm_cmd(reader)
10362 assert(__command == 2)
10363 obj.idle_timeout = reader.read("!H")[0]
10364 obj.hard_timeout = reader.read("!H")[0]
10365 obj.priority = reader.read("!H")[0]
10366 obj.buffer_id = reader.read("!L")[0]
10367 obj.out_port = util.unpack_port_no(reader)
10368 obj.out_group = reader.read("!L")[0]
10369 obj.flags = reader.read("!H")[0]
10370 obj.importance = reader.read("!H")[0]
10371 obj.match = common.match.unpack(reader)
10372 obj.instructions = loxi.generic_util.unpack_list(reader, instruction.instruction.unpack)
10373 return obj
10374
10375 def __eq__(self, other):
10376 if type(self) != type(other): return False
10377 if self.xid != other.xid: return False
10378 if self.cookie != other.cookie: return False
10379 if self.cookie_mask != other.cookie_mask: return False
10380 if self.table_id != other.table_id: return False
10381 if self.idle_timeout != other.idle_timeout: return False
10382 if self.hard_timeout != other.hard_timeout: return False
10383 if self.priority != other.priority: return False
10384 if self.buffer_id != other.buffer_id: return False
10385 if self.out_port != other.out_port: return False
10386 if self.out_group != other.out_group: return False
10387 if self.flags != other.flags: return False
10388 if self.importance != other.importance: return False
10389 if self.match != other.match: return False
10390 if self.instructions != other.instructions: return False
10391 return True
10392
10393 def pretty_print(self, q):
10394 q.text("flow_modify_strict {")
10395 with q.group():
10396 with q.indent(2):
10397 q.breakable()
10398 q.text("xid = ");
10399 if self.xid != None:
10400 q.text("%#x" % self.xid)
10401 else:
10402 q.text('None')
10403 q.text(","); q.breakable()
10404 q.text("cookie = ");
10405 q.text("%#x" % self.cookie)
10406 q.text(","); q.breakable()
10407 q.text("cookie_mask = ");
10408 q.text("%#x" % self.cookie_mask)
10409 q.text(","); q.breakable()
10410 q.text("table_id = ");
10411 q.text("%#x" % self.table_id)
10412 q.text(","); q.breakable()
10413 q.text("idle_timeout = ");
10414 q.text("%#x" % self.idle_timeout)
10415 q.text(","); q.breakable()
10416 q.text("hard_timeout = ");
10417 q.text("%#x" % self.hard_timeout)
10418 q.text(","); q.breakable()
10419 q.text("priority = ");
10420 q.text("%#x" % self.priority)
10421 q.text(","); q.breakable()
10422 q.text("buffer_id = ");
10423 q.text("%#x" % self.buffer_id)
10424 q.text(","); q.breakable()
10425 q.text("out_port = ");
10426 q.text(util.pretty_port(self.out_port))
10427 q.text(","); q.breakable()
10428 q.text("out_group = ");
10429 q.text("%#x" % self.out_group)
10430 q.text(","); q.breakable()
10431 q.text("flags = ");
10432 q.text("%#x" % self.flags)
10433 q.text(","); q.breakable()
10434 q.text("importance = ");
10435 q.text("%#x" % self.importance)
10436 q.text(","); q.breakable()
10437 q.text("match = ");
10438 q.pp(self.match)
10439 q.text(","); q.breakable()
10440 q.text("instructions = ");
10441 q.pp(self.instructions)
10442 q.breakable()
10443 q.text('}')
10444
10445flow_mod.subtypes[2] = flow_modify_strict
10446
Rich Laneccd32ed2014-11-10 17:48:24 -080010447class flow_monitor_failed_error_msg(error_msg):
10448 version = 5
10449 type = 1
10450 err_type = 16
10451
10452 def __init__(self, xid=None, code=None, data=None):
10453 if xid != None:
10454 self.xid = xid
10455 else:
10456 self.xid = None
10457 if code != None:
10458 self.code = code
10459 else:
10460 self.code = 0
10461 if data != None:
10462 self.data = data
10463 else:
10464 self.data = ''
10465 return
10466
10467 def pack(self):
10468 packed = []
10469 packed.append(struct.pack("!B", self.version))
10470 packed.append(struct.pack("!B", self.type))
10471 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10472 packed.append(struct.pack("!L", self.xid))
10473 packed.append(struct.pack("!H", self.err_type))
10474 packed.append(struct.pack("!H", self.code))
10475 packed.append(self.data)
10476 length = sum([len(x) for x in packed])
10477 packed[2] = struct.pack("!H", length)
10478 return ''.join(packed)
10479
10480 @staticmethod
10481 def unpack(reader):
10482 obj = flow_monitor_failed_error_msg()
10483 _version = reader.read("!B")[0]
10484 assert(_version == 5)
10485 _type = reader.read("!B")[0]
10486 assert(_type == 1)
10487 _length = reader.read("!H")[0]
10488 orig_reader = reader
10489 reader = orig_reader.slice(_length - (2 + 2))
10490 obj.xid = reader.read("!L")[0]
10491 _err_type = reader.read("!H")[0]
10492 assert(_err_type == 16)
10493 obj.code = reader.read("!H")[0]
10494 obj.data = str(reader.read_all())
10495 return obj
10496
10497 def __eq__(self, other):
10498 if type(self) != type(other): return False
10499 if self.xid != other.xid: return False
10500 if self.code != other.code: return False
10501 if self.data != other.data: return False
10502 return True
10503
10504 def pretty_print(self, q):
10505 q.text("flow_monitor_failed_error_msg {")
10506 with q.group():
10507 with q.indent(2):
10508 q.breakable()
10509 q.text("xid = ");
10510 if self.xid != None:
10511 q.text("%#x" % self.xid)
10512 else:
10513 q.text('None')
10514 q.text(","); q.breakable()
10515 q.text("code = ");
10516 q.text("%#x" % self.code)
10517 q.text(","); q.breakable()
10518 q.text("data = ");
10519 q.pp(self.data)
10520 q.breakable()
10521 q.text('}')
10522
10523error_msg.subtypes[16] = flow_monitor_failed_error_msg
10524
Rich Lane2e079da2014-10-29 15:30:24 -070010525class flow_removed(message):
10526 version = 5
10527 type = 11
10528
10529 def __init__(self, xid=None, cookie=None, priority=None, reason=None, table_id=None, duration_sec=None, duration_nsec=None, idle_timeout=None, hard_timeout=None, packet_count=None, byte_count=None, match=None):
10530 if xid != None:
10531 self.xid = xid
10532 else:
10533 self.xid = None
10534 if cookie != None:
10535 self.cookie = cookie
10536 else:
10537 self.cookie = 0
10538 if priority != None:
10539 self.priority = priority
10540 else:
10541 self.priority = 0
10542 if reason != None:
10543 self.reason = reason
10544 else:
10545 self.reason = 0
10546 if table_id != None:
10547 self.table_id = table_id
10548 else:
10549 self.table_id = 0
10550 if duration_sec != None:
10551 self.duration_sec = duration_sec
10552 else:
10553 self.duration_sec = 0
10554 if duration_nsec != None:
10555 self.duration_nsec = duration_nsec
10556 else:
10557 self.duration_nsec = 0
10558 if idle_timeout != None:
10559 self.idle_timeout = idle_timeout
10560 else:
10561 self.idle_timeout = 0
10562 if hard_timeout != None:
10563 self.hard_timeout = hard_timeout
10564 else:
10565 self.hard_timeout = 0
10566 if packet_count != None:
10567 self.packet_count = packet_count
10568 else:
10569 self.packet_count = 0
10570 if byte_count != None:
10571 self.byte_count = byte_count
10572 else:
10573 self.byte_count = 0
10574 if match != None:
10575 self.match = match
10576 else:
10577 self.match = common.match()
10578 return
10579
10580 def pack(self):
10581 packed = []
10582 packed.append(struct.pack("!B", self.version))
10583 packed.append(struct.pack("!B", self.type))
10584 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10585 packed.append(struct.pack("!L", self.xid))
10586 packed.append(struct.pack("!Q", self.cookie))
10587 packed.append(struct.pack("!H", self.priority))
10588 packed.append(struct.pack("!B", self.reason))
10589 packed.append(struct.pack("!B", self.table_id))
10590 packed.append(struct.pack("!L", self.duration_sec))
10591 packed.append(struct.pack("!L", self.duration_nsec))
10592 packed.append(struct.pack("!H", self.idle_timeout))
10593 packed.append(struct.pack("!H", self.hard_timeout))
10594 packed.append(struct.pack("!Q", self.packet_count))
10595 packed.append(struct.pack("!Q", self.byte_count))
10596 packed.append(self.match.pack())
10597 length = sum([len(x) for x in packed])
10598 packed[2] = struct.pack("!H", length)
10599 return ''.join(packed)
10600
10601 @staticmethod
10602 def unpack(reader):
10603 obj = flow_removed()
10604 _version = reader.read("!B")[0]
10605 assert(_version == 5)
10606 _type = reader.read("!B")[0]
10607 assert(_type == 11)
10608 _length = reader.read("!H")[0]
10609 orig_reader = reader
10610 reader = orig_reader.slice(_length - (2 + 2))
10611 obj.xid = reader.read("!L")[0]
10612 obj.cookie = reader.read("!Q")[0]
10613 obj.priority = reader.read("!H")[0]
10614 obj.reason = reader.read("!B")[0]
10615 obj.table_id = reader.read("!B")[0]
10616 obj.duration_sec = reader.read("!L")[0]
10617 obj.duration_nsec = reader.read("!L")[0]
10618 obj.idle_timeout = reader.read("!H")[0]
10619 obj.hard_timeout = reader.read("!H")[0]
10620 obj.packet_count = reader.read("!Q")[0]
10621 obj.byte_count = reader.read("!Q")[0]
10622 obj.match = common.match.unpack(reader)
10623 return obj
10624
10625 def __eq__(self, other):
10626 if type(self) != type(other): return False
10627 if self.xid != other.xid: return False
10628 if self.cookie != other.cookie: return False
10629 if self.priority != other.priority: return False
10630 if self.reason != other.reason: return False
10631 if self.table_id != other.table_id: return False
10632 if self.duration_sec != other.duration_sec: return False
10633 if self.duration_nsec != other.duration_nsec: return False
10634 if self.idle_timeout != other.idle_timeout: return False
10635 if self.hard_timeout != other.hard_timeout: return False
10636 if self.packet_count != other.packet_count: return False
10637 if self.byte_count != other.byte_count: return False
10638 if self.match != other.match: return False
10639 return True
10640
10641 def pretty_print(self, q):
10642 q.text("flow_removed {")
10643 with q.group():
10644 with q.indent(2):
10645 q.breakable()
10646 q.text("xid = ");
10647 if self.xid != None:
10648 q.text("%#x" % self.xid)
10649 else:
10650 q.text('None')
10651 q.text(","); q.breakable()
10652 q.text("cookie = ");
10653 q.text("%#x" % self.cookie)
10654 q.text(","); q.breakable()
10655 q.text("priority = ");
10656 q.text("%#x" % self.priority)
10657 q.text(","); q.breakable()
10658 q.text("reason = ");
10659 q.text("%#x" % self.reason)
10660 q.text(","); q.breakable()
10661 q.text("table_id = ");
10662 q.text("%#x" % self.table_id)
10663 q.text(","); q.breakable()
10664 q.text("duration_sec = ");
10665 q.text("%#x" % self.duration_sec)
10666 q.text(","); q.breakable()
10667 q.text("duration_nsec = ");
10668 q.text("%#x" % self.duration_nsec)
10669 q.text(","); q.breakable()
10670 q.text("idle_timeout = ");
10671 q.text("%#x" % self.idle_timeout)
10672 q.text(","); q.breakable()
10673 q.text("hard_timeout = ");
10674 q.text("%#x" % self.hard_timeout)
10675 q.text(","); q.breakable()
10676 q.text("packet_count = ");
10677 q.text("%#x" % self.packet_count)
10678 q.text(","); q.breakable()
10679 q.text("byte_count = ");
10680 q.text("%#x" % self.byte_count)
10681 q.text(","); q.breakable()
10682 q.text("match = ");
10683 q.pp(self.match)
10684 q.breakable()
10685 q.text('}')
10686
10687message.subtypes[11] = flow_removed
10688
10689class flow_stats_reply(stats_reply):
10690 version = 5
10691 type = 19
10692 stats_type = 1
10693
10694 def __init__(self, xid=None, flags=None, entries=None):
10695 if xid != None:
10696 self.xid = xid
10697 else:
10698 self.xid = None
10699 if flags != None:
10700 self.flags = flags
10701 else:
10702 self.flags = 0
10703 if entries != None:
10704 self.entries = entries
10705 else:
10706 self.entries = []
10707 return
10708
10709 def pack(self):
10710 packed = []
10711 packed.append(struct.pack("!B", self.version))
10712 packed.append(struct.pack("!B", self.type))
10713 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10714 packed.append(struct.pack("!L", self.xid))
10715 packed.append(struct.pack("!H", self.stats_type))
10716 packed.append(struct.pack("!H", self.flags))
10717 packed.append('\x00' * 4)
10718 packed.append(loxi.generic_util.pack_list(self.entries))
10719 length = sum([len(x) for x in packed])
10720 packed[2] = struct.pack("!H", length)
10721 return ''.join(packed)
10722
10723 @staticmethod
10724 def unpack(reader):
10725 obj = flow_stats_reply()
10726 _version = reader.read("!B")[0]
10727 assert(_version == 5)
10728 _type = reader.read("!B")[0]
10729 assert(_type == 19)
10730 _length = reader.read("!H")[0]
10731 orig_reader = reader
10732 reader = orig_reader.slice(_length - (2 + 2))
10733 obj.xid = reader.read("!L")[0]
10734 _stats_type = reader.read("!H")[0]
10735 assert(_stats_type == 1)
10736 obj.flags = reader.read("!H")[0]
10737 reader.skip(4)
10738 obj.entries = loxi.generic_util.unpack_list(reader, common.flow_stats_entry.unpack)
10739 return obj
10740
10741 def __eq__(self, other):
10742 if type(self) != type(other): return False
10743 if self.xid != other.xid: return False
10744 if self.flags != other.flags: return False
10745 if self.entries != other.entries: return False
10746 return True
10747
10748 def pretty_print(self, q):
10749 q.text("flow_stats_reply {")
10750 with q.group():
10751 with q.indent(2):
10752 q.breakable()
10753 q.text("xid = ");
10754 if self.xid != None:
10755 q.text("%#x" % self.xid)
10756 else:
10757 q.text('None')
10758 q.text(","); q.breakable()
10759 q.text("flags = ");
10760 q.text("%#x" % self.flags)
10761 q.text(","); q.breakable()
10762 q.text("entries = ");
10763 q.pp(self.entries)
10764 q.breakable()
10765 q.text('}')
10766
10767stats_reply.subtypes[1] = flow_stats_reply
10768
10769class flow_stats_request(stats_request):
10770 version = 5
10771 type = 18
10772 stats_type = 1
10773
10774 def __init__(self, xid=None, flags=None, table_id=None, out_port=None, out_group=None, cookie=None, cookie_mask=None, match=None):
10775 if xid != None:
10776 self.xid = xid
10777 else:
10778 self.xid = None
10779 if flags != None:
10780 self.flags = flags
10781 else:
10782 self.flags = 0
10783 if table_id != None:
10784 self.table_id = table_id
10785 else:
10786 self.table_id = 0
10787 if out_port != None:
10788 self.out_port = out_port
10789 else:
10790 self.out_port = 0
10791 if out_group != None:
10792 self.out_group = out_group
10793 else:
10794 self.out_group = 0
10795 if cookie != None:
10796 self.cookie = cookie
10797 else:
10798 self.cookie = 0
10799 if cookie_mask != None:
10800 self.cookie_mask = cookie_mask
10801 else:
10802 self.cookie_mask = 0
10803 if match != None:
10804 self.match = match
10805 else:
10806 self.match = common.match()
10807 return
10808
10809 def pack(self):
10810 packed = []
10811 packed.append(struct.pack("!B", self.version))
10812 packed.append(struct.pack("!B", self.type))
10813 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10814 packed.append(struct.pack("!L", self.xid))
10815 packed.append(struct.pack("!H", self.stats_type))
10816 packed.append(struct.pack("!H", self.flags))
10817 packed.append('\x00' * 4)
10818 packed.append(struct.pack("!B", self.table_id))
10819 packed.append('\x00' * 3)
10820 packed.append(util.pack_port_no(self.out_port))
10821 packed.append(struct.pack("!L", self.out_group))
10822 packed.append('\x00' * 4)
10823 packed.append(struct.pack("!Q", self.cookie))
10824 packed.append(struct.pack("!Q", self.cookie_mask))
10825 packed.append(self.match.pack())
10826 length = sum([len(x) for x in packed])
10827 packed[2] = struct.pack("!H", length)
10828 return ''.join(packed)
10829
10830 @staticmethod
10831 def unpack(reader):
10832 obj = flow_stats_request()
10833 _version = reader.read("!B")[0]
10834 assert(_version == 5)
10835 _type = reader.read("!B")[0]
10836 assert(_type == 18)
10837 _length = reader.read("!H")[0]
10838 orig_reader = reader
10839 reader = orig_reader.slice(_length - (2 + 2))
10840 obj.xid = reader.read("!L")[0]
10841 _stats_type = reader.read("!H")[0]
10842 assert(_stats_type == 1)
10843 obj.flags = reader.read("!H")[0]
10844 reader.skip(4)
10845 obj.table_id = reader.read("!B")[0]
10846 reader.skip(3)
10847 obj.out_port = util.unpack_port_no(reader)
10848 obj.out_group = reader.read("!L")[0]
10849 reader.skip(4)
10850 obj.cookie = reader.read("!Q")[0]
10851 obj.cookie_mask = reader.read("!Q")[0]
10852 obj.match = common.match.unpack(reader)
10853 return obj
10854
10855 def __eq__(self, other):
10856 if type(self) != type(other): return False
10857 if self.xid != other.xid: return False
10858 if self.flags != other.flags: return False
10859 if self.table_id != other.table_id: return False
10860 if self.out_port != other.out_port: return False
10861 if self.out_group != other.out_group: return False
10862 if self.cookie != other.cookie: return False
10863 if self.cookie_mask != other.cookie_mask: return False
10864 if self.match != other.match: return False
10865 return True
10866
10867 def pretty_print(self, q):
10868 q.text("flow_stats_request {")
10869 with q.group():
10870 with q.indent(2):
10871 q.breakable()
10872 q.text("xid = ");
10873 if self.xid != None:
10874 q.text("%#x" % self.xid)
10875 else:
10876 q.text('None')
10877 q.text(","); q.breakable()
10878 q.text("flags = ");
10879 q.text("%#x" % self.flags)
10880 q.text(","); q.breakable()
10881 q.text("table_id = ");
10882 q.text("%#x" % self.table_id)
10883 q.text(","); q.breakable()
10884 q.text("out_port = ");
10885 q.text(util.pretty_port(self.out_port))
10886 q.text(","); q.breakable()
10887 q.text("out_group = ");
10888 q.text("%#x" % self.out_group)
10889 q.text(","); q.breakable()
10890 q.text("cookie = ");
10891 q.text("%#x" % self.cookie)
10892 q.text(","); q.breakable()
10893 q.text("cookie_mask = ");
10894 q.text("%#x" % self.cookie_mask)
10895 q.text(","); q.breakable()
10896 q.text("match = ");
10897 q.pp(self.match)
10898 q.breakable()
10899 q.text('}')
10900
10901stats_request.subtypes[1] = flow_stats_request
10902
10903class get_config_reply(message):
10904 version = 5
10905 type = 8
10906
10907 def __init__(self, xid=None, flags=None, miss_send_len=None):
10908 if xid != None:
10909 self.xid = xid
10910 else:
10911 self.xid = None
10912 if flags != None:
10913 self.flags = flags
10914 else:
10915 self.flags = 0
10916 if miss_send_len != None:
10917 self.miss_send_len = miss_send_len
10918 else:
10919 self.miss_send_len = 0
10920 return
10921
10922 def pack(self):
10923 packed = []
10924 packed.append(struct.pack("!B", self.version))
10925 packed.append(struct.pack("!B", self.type))
10926 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10927 packed.append(struct.pack("!L", self.xid))
10928 packed.append(struct.pack("!H", self.flags))
10929 packed.append(struct.pack("!H", self.miss_send_len))
10930 length = sum([len(x) for x in packed])
10931 packed[2] = struct.pack("!H", length)
10932 return ''.join(packed)
10933
10934 @staticmethod
10935 def unpack(reader):
10936 obj = get_config_reply()
10937 _version = reader.read("!B")[0]
10938 assert(_version == 5)
10939 _type = reader.read("!B")[0]
10940 assert(_type == 8)
10941 _length = reader.read("!H")[0]
10942 orig_reader = reader
10943 reader = orig_reader.slice(_length - (2 + 2))
10944 obj.xid = reader.read("!L")[0]
10945 obj.flags = reader.read("!H")[0]
10946 obj.miss_send_len = reader.read("!H")[0]
10947 return obj
10948
10949 def __eq__(self, other):
10950 if type(self) != type(other): return False
10951 if self.xid != other.xid: return False
10952 if self.flags != other.flags: return False
10953 if self.miss_send_len != other.miss_send_len: return False
10954 return True
10955
10956 def pretty_print(self, q):
10957 q.text("get_config_reply {")
10958 with q.group():
10959 with q.indent(2):
10960 q.breakable()
10961 q.text("xid = ");
10962 if self.xid != None:
10963 q.text("%#x" % self.xid)
10964 else:
10965 q.text('None')
10966 q.text(","); q.breakable()
10967 q.text("flags = ");
10968 q.text("%#x" % self.flags)
10969 q.text(","); q.breakable()
10970 q.text("miss_send_len = ");
10971 q.text("%#x" % self.miss_send_len)
10972 q.breakable()
10973 q.text('}')
10974
10975message.subtypes[8] = get_config_reply
10976
10977class get_config_request(message):
10978 version = 5
10979 type = 7
10980
10981 def __init__(self, xid=None):
10982 if xid != None:
10983 self.xid = xid
10984 else:
10985 self.xid = None
10986 return
10987
10988 def pack(self):
10989 packed = []
10990 packed.append(struct.pack("!B", self.version))
10991 packed.append(struct.pack("!B", self.type))
10992 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
10993 packed.append(struct.pack("!L", self.xid))
10994 length = sum([len(x) for x in packed])
10995 packed[2] = struct.pack("!H", length)
10996 return ''.join(packed)
10997
10998 @staticmethod
10999 def unpack(reader):
11000 obj = get_config_request()
11001 _version = reader.read("!B")[0]
11002 assert(_version == 5)
11003 _type = reader.read("!B")[0]
11004 assert(_type == 7)
11005 _length = reader.read("!H")[0]
11006 orig_reader = reader
11007 reader = orig_reader.slice(_length - (2 + 2))
11008 obj.xid = reader.read("!L")[0]
11009 return obj
11010
11011 def __eq__(self, other):
11012 if type(self) != type(other): return False
11013 if self.xid != other.xid: return False
11014 return True
11015
11016 def pretty_print(self, q):
11017 q.text("get_config_request {")
11018 with q.group():
11019 with q.indent(2):
11020 q.breakable()
11021 q.text("xid = ");
11022 if self.xid != None:
11023 q.text("%#x" % self.xid)
11024 else:
11025 q.text('None')
11026 q.breakable()
11027 q.text('}')
11028
11029message.subtypes[7] = get_config_request
11030
11031class group_mod(message):
11032 subtypes = {}
11033
11034 version = 5
11035 type = 15
11036
11037 def __init__(self, xid=None, command=None, group_type=None, group_id=None, buckets=None):
11038 if xid != None:
11039 self.xid = xid
11040 else:
11041 self.xid = None
11042 if command != None:
11043 self.command = command
11044 else:
11045 self.command = 0
11046 if group_type != None:
11047 self.group_type = group_type
11048 else:
11049 self.group_type = 0
11050 if group_id != None:
11051 self.group_id = group_id
11052 else:
11053 self.group_id = 0
11054 if buckets != None:
11055 self.buckets = buckets
11056 else:
11057 self.buckets = []
11058 return
11059
11060 def pack(self):
11061 packed = []
11062 packed.append(struct.pack("!B", self.version))
11063 packed.append(struct.pack("!B", self.type))
11064 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11065 packed.append(struct.pack("!L", self.xid))
11066 packed.append(struct.pack("!H", self.command))
11067 packed.append(struct.pack("!B", self.group_type))
11068 packed.append('\x00' * 1)
11069 packed.append(struct.pack("!L", self.group_id))
11070 packed.append(loxi.generic_util.pack_list(self.buckets))
11071 length = sum([len(x) for x in packed])
11072 packed[2] = struct.pack("!H", length)
11073 return ''.join(packed)
11074
11075 @staticmethod
11076 def unpack(reader):
11077 subtype, = reader.peek('!H', 8)
11078 subclass = group_mod.subtypes.get(subtype)
11079 if subclass:
11080 return subclass.unpack(reader)
11081
11082 obj = group_mod()
11083 _version = reader.read("!B")[0]
11084 assert(_version == 5)
11085 _type = reader.read("!B")[0]
11086 assert(_type == 15)
11087 _length = reader.read("!H")[0]
11088 orig_reader = reader
11089 reader = orig_reader.slice(_length - (2 + 2))
11090 obj.xid = reader.read("!L")[0]
11091 obj.command = reader.read("!H")[0]
11092 obj.group_type = reader.read("!B")[0]
11093 reader.skip(1)
11094 obj.group_id = reader.read("!L")[0]
11095 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11096 return obj
11097
11098 def __eq__(self, other):
11099 if type(self) != type(other): return False
11100 if self.xid != other.xid: return False
11101 if self.command != other.command: return False
11102 if self.group_type != other.group_type: return False
11103 if self.group_id != other.group_id: return False
11104 if self.buckets != other.buckets: return False
11105 return True
11106
11107 def pretty_print(self, q):
11108 q.text("group_mod {")
11109 with q.group():
11110 with q.indent(2):
11111 q.breakable()
11112 q.text("xid = ");
11113 if self.xid != None:
11114 q.text("%#x" % self.xid)
11115 else:
11116 q.text('None')
11117 q.text(","); q.breakable()
11118 q.text("group_type = ");
11119 q.text("%#x" % self.group_type)
11120 q.text(","); q.breakable()
11121 q.text("group_id = ");
11122 q.text("%#x" % self.group_id)
11123 q.text(","); q.breakable()
11124 q.text("buckets = ");
11125 q.pp(self.buckets)
11126 q.breakable()
11127 q.text('}')
11128
11129message.subtypes[15] = group_mod
11130
11131class group_add(group_mod):
11132 version = 5
11133 type = 15
11134 command = 0
11135
11136 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11137 if xid != None:
11138 self.xid = xid
11139 else:
11140 self.xid = None
11141 if group_type != None:
11142 self.group_type = group_type
11143 else:
11144 self.group_type = 0
11145 if group_id != None:
11146 self.group_id = group_id
11147 else:
11148 self.group_id = 0
11149 if buckets != None:
11150 self.buckets = buckets
11151 else:
11152 self.buckets = []
11153 return
11154
11155 def pack(self):
11156 packed = []
11157 packed.append(struct.pack("!B", self.version))
11158 packed.append(struct.pack("!B", self.type))
11159 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11160 packed.append(struct.pack("!L", self.xid))
11161 packed.append(struct.pack("!H", self.command))
11162 packed.append(struct.pack("!B", self.group_type))
11163 packed.append('\x00' * 1)
11164 packed.append(struct.pack("!L", self.group_id))
11165 packed.append(loxi.generic_util.pack_list(self.buckets))
11166 length = sum([len(x) for x in packed])
11167 packed[2] = struct.pack("!H", length)
11168 return ''.join(packed)
11169
11170 @staticmethod
11171 def unpack(reader):
11172 obj = group_add()
11173 _version = reader.read("!B")[0]
11174 assert(_version == 5)
11175 _type = reader.read("!B")[0]
11176 assert(_type == 15)
11177 _length = reader.read("!H")[0]
11178 orig_reader = reader
11179 reader = orig_reader.slice(_length - (2 + 2))
11180 obj.xid = reader.read("!L")[0]
11181 _command = reader.read("!H")[0]
11182 assert(_command == 0)
11183 obj.group_type = reader.read("!B")[0]
11184 reader.skip(1)
11185 obj.group_id = reader.read("!L")[0]
11186 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11187 return obj
11188
11189 def __eq__(self, other):
11190 if type(self) != type(other): return False
11191 if self.xid != other.xid: return False
11192 if self.group_type != other.group_type: return False
11193 if self.group_id != other.group_id: return False
11194 if self.buckets != other.buckets: return False
11195 return True
11196
11197 def pretty_print(self, q):
11198 q.text("group_add {")
11199 with q.group():
11200 with q.indent(2):
11201 q.breakable()
11202 q.text("xid = ");
11203 if self.xid != None:
11204 q.text("%#x" % self.xid)
11205 else:
11206 q.text('None')
11207 q.text(","); q.breakable()
11208 q.text("group_type = ");
11209 q.text("%#x" % self.group_type)
11210 q.text(","); q.breakable()
11211 q.text("group_id = ");
11212 q.text("%#x" % self.group_id)
11213 q.text(","); q.breakable()
11214 q.text("buckets = ");
11215 q.pp(self.buckets)
11216 q.breakable()
11217 q.text('}')
11218
11219group_mod.subtypes[0] = group_add
11220
11221class group_delete(group_mod):
11222 version = 5
11223 type = 15
11224 command = 2
11225
11226 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11227 if xid != None:
11228 self.xid = xid
11229 else:
11230 self.xid = None
11231 if group_type != None:
11232 self.group_type = group_type
11233 else:
11234 self.group_type = 0
11235 if group_id != None:
11236 self.group_id = group_id
11237 else:
11238 self.group_id = 0
11239 if buckets != None:
11240 self.buckets = buckets
11241 else:
11242 self.buckets = []
11243 return
11244
11245 def pack(self):
11246 packed = []
11247 packed.append(struct.pack("!B", self.version))
11248 packed.append(struct.pack("!B", self.type))
11249 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11250 packed.append(struct.pack("!L", self.xid))
11251 packed.append(struct.pack("!H", self.command))
11252 packed.append(struct.pack("!B", self.group_type))
11253 packed.append('\x00' * 1)
11254 packed.append(struct.pack("!L", self.group_id))
11255 packed.append(loxi.generic_util.pack_list(self.buckets))
11256 length = sum([len(x) for x in packed])
11257 packed[2] = struct.pack("!H", length)
11258 return ''.join(packed)
11259
11260 @staticmethod
11261 def unpack(reader):
11262 obj = group_delete()
11263 _version = reader.read("!B")[0]
11264 assert(_version == 5)
11265 _type = reader.read("!B")[0]
11266 assert(_type == 15)
11267 _length = reader.read("!H")[0]
11268 orig_reader = reader
11269 reader = orig_reader.slice(_length - (2 + 2))
11270 obj.xid = reader.read("!L")[0]
11271 _command = reader.read("!H")[0]
11272 assert(_command == 2)
11273 obj.group_type = reader.read("!B")[0]
11274 reader.skip(1)
11275 obj.group_id = reader.read("!L")[0]
11276 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11277 return obj
11278
11279 def __eq__(self, other):
11280 if type(self) != type(other): return False
11281 if self.xid != other.xid: return False
11282 if self.group_type != other.group_type: return False
11283 if self.group_id != other.group_id: return False
11284 if self.buckets != other.buckets: return False
11285 return True
11286
11287 def pretty_print(self, q):
11288 q.text("group_delete {")
11289 with q.group():
11290 with q.indent(2):
11291 q.breakable()
11292 q.text("xid = ");
11293 if self.xid != None:
11294 q.text("%#x" % self.xid)
11295 else:
11296 q.text('None')
11297 q.text(","); q.breakable()
11298 q.text("group_type = ");
11299 q.text("%#x" % self.group_type)
11300 q.text(","); q.breakable()
11301 q.text("group_id = ");
11302 q.text("%#x" % self.group_id)
11303 q.text(","); q.breakable()
11304 q.text("buckets = ");
11305 q.pp(self.buckets)
11306 q.breakable()
11307 q.text('}')
11308
11309group_mod.subtypes[2] = group_delete
11310
11311class group_desc_stats_reply(stats_reply):
11312 version = 5
11313 type = 19
11314 stats_type = 7
11315
11316 def __init__(self, xid=None, flags=None, entries=None):
11317 if xid != None:
11318 self.xid = xid
11319 else:
11320 self.xid = None
11321 if flags != None:
11322 self.flags = flags
11323 else:
11324 self.flags = 0
11325 if entries != None:
11326 self.entries = entries
11327 else:
11328 self.entries = []
11329 return
11330
11331 def pack(self):
11332 packed = []
11333 packed.append(struct.pack("!B", self.version))
11334 packed.append(struct.pack("!B", self.type))
11335 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11336 packed.append(struct.pack("!L", self.xid))
11337 packed.append(struct.pack("!H", self.stats_type))
11338 packed.append(struct.pack("!H", self.flags))
11339 packed.append('\x00' * 4)
11340 packed.append(loxi.generic_util.pack_list(self.entries))
11341 length = sum([len(x) for x in packed])
11342 packed[2] = struct.pack("!H", length)
11343 return ''.join(packed)
11344
11345 @staticmethod
11346 def unpack(reader):
11347 obj = group_desc_stats_reply()
11348 _version = reader.read("!B")[0]
11349 assert(_version == 5)
11350 _type = reader.read("!B")[0]
11351 assert(_type == 19)
11352 _length = reader.read("!H")[0]
11353 orig_reader = reader
11354 reader = orig_reader.slice(_length - (2 + 2))
11355 obj.xid = reader.read("!L")[0]
11356 _stats_type = reader.read("!H")[0]
11357 assert(_stats_type == 7)
11358 obj.flags = reader.read("!H")[0]
11359 reader.skip(4)
11360 obj.entries = loxi.generic_util.unpack_list(reader, common.group_desc_stats_entry.unpack)
11361 return obj
11362
11363 def __eq__(self, other):
11364 if type(self) != type(other): return False
11365 if self.xid != other.xid: return False
11366 if self.flags != other.flags: return False
11367 if self.entries != other.entries: return False
11368 return True
11369
11370 def pretty_print(self, q):
11371 q.text("group_desc_stats_reply {")
11372 with q.group():
11373 with q.indent(2):
11374 q.breakable()
11375 q.text("xid = ");
11376 if self.xid != None:
11377 q.text("%#x" % self.xid)
11378 else:
11379 q.text('None')
11380 q.text(","); q.breakable()
11381 q.text("flags = ");
11382 q.text("%#x" % self.flags)
11383 q.text(","); q.breakable()
11384 q.text("entries = ");
11385 q.pp(self.entries)
11386 q.breakable()
11387 q.text('}')
11388
11389stats_reply.subtypes[7] = group_desc_stats_reply
11390
11391class group_desc_stats_request(stats_request):
11392 version = 5
11393 type = 18
11394 stats_type = 7
11395
11396 def __init__(self, xid=None, flags=None):
11397 if xid != None:
11398 self.xid = xid
11399 else:
11400 self.xid = None
11401 if flags != None:
11402 self.flags = flags
11403 else:
11404 self.flags = 0
11405 return
11406
11407 def pack(self):
11408 packed = []
11409 packed.append(struct.pack("!B", self.version))
11410 packed.append(struct.pack("!B", self.type))
11411 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11412 packed.append(struct.pack("!L", self.xid))
11413 packed.append(struct.pack("!H", self.stats_type))
11414 packed.append(struct.pack("!H", self.flags))
11415 packed.append('\x00' * 4)
11416 length = sum([len(x) for x in packed])
11417 packed[2] = struct.pack("!H", length)
11418 return ''.join(packed)
11419
11420 @staticmethod
11421 def unpack(reader):
11422 obj = group_desc_stats_request()
11423 _version = reader.read("!B")[0]
11424 assert(_version == 5)
11425 _type = reader.read("!B")[0]
11426 assert(_type == 18)
11427 _length = reader.read("!H")[0]
11428 orig_reader = reader
11429 reader = orig_reader.slice(_length - (2 + 2))
11430 obj.xid = reader.read("!L")[0]
11431 _stats_type = reader.read("!H")[0]
11432 assert(_stats_type == 7)
11433 obj.flags = reader.read("!H")[0]
11434 reader.skip(4)
11435 return obj
11436
11437 def __eq__(self, other):
11438 if type(self) != type(other): return False
11439 if self.xid != other.xid: return False
11440 if self.flags != other.flags: return False
11441 return True
11442
11443 def pretty_print(self, q):
11444 q.text("group_desc_stats_request {")
11445 with q.group():
11446 with q.indent(2):
11447 q.breakable()
11448 q.text("xid = ");
11449 if self.xid != None:
11450 q.text("%#x" % self.xid)
11451 else:
11452 q.text('None')
11453 q.text(","); q.breakable()
11454 q.text("flags = ");
11455 q.text("%#x" % self.flags)
11456 q.breakable()
11457 q.text('}')
11458
11459stats_request.subtypes[7] = group_desc_stats_request
11460
11461class group_features_stats_reply(stats_reply):
11462 version = 5
11463 type = 19
11464 stats_type = 8
11465
11466 def __init__(self, xid=None, flags=None, types=None, capabilities=None, max_groups_all=None, max_groups_select=None, max_groups_indirect=None, max_groups_ff=None, actions_all=None, actions_select=None, actions_indirect=None, actions_ff=None):
11467 if xid != None:
11468 self.xid = xid
11469 else:
11470 self.xid = None
11471 if flags != None:
11472 self.flags = flags
11473 else:
11474 self.flags = 0
11475 if types != None:
11476 self.types = types
11477 else:
11478 self.types = 0
11479 if capabilities != None:
11480 self.capabilities = capabilities
11481 else:
11482 self.capabilities = 0
11483 if max_groups_all != None:
11484 self.max_groups_all = max_groups_all
11485 else:
11486 self.max_groups_all = 0
11487 if max_groups_select != None:
11488 self.max_groups_select = max_groups_select
11489 else:
11490 self.max_groups_select = 0
11491 if max_groups_indirect != None:
11492 self.max_groups_indirect = max_groups_indirect
11493 else:
11494 self.max_groups_indirect = 0
11495 if max_groups_ff != None:
11496 self.max_groups_ff = max_groups_ff
11497 else:
11498 self.max_groups_ff = 0
11499 if actions_all != None:
11500 self.actions_all = actions_all
11501 else:
11502 self.actions_all = 0
11503 if actions_select != None:
11504 self.actions_select = actions_select
11505 else:
11506 self.actions_select = 0
11507 if actions_indirect != None:
11508 self.actions_indirect = actions_indirect
11509 else:
11510 self.actions_indirect = 0
11511 if actions_ff != None:
11512 self.actions_ff = actions_ff
11513 else:
11514 self.actions_ff = 0
11515 return
11516
11517 def pack(self):
11518 packed = []
11519 packed.append(struct.pack("!B", self.version))
11520 packed.append(struct.pack("!B", self.type))
11521 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11522 packed.append(struct.pack("!L", self.xid))
11523 packed.append(struct.pack("!H", self.stats_type))
11524 packed.append(struct.pack("!H", self.flags))
11525 packed.append('\x00' * 4)
11526 packed.append(struct.pack("!L", self.types))
11527 packed.append(struct.pack("!L", self.capabilities))
11528 packed.append(struct.pack("!L", self.max_groups_all))
11529 packed.append(struct.pack("!L", self.max_groups_select))
11530 packed.append(struct.pack("!L", self.max_groups_indirect))
11531 packed.append(struct.pack("!L", self.max_groups_ff))
11532 packed.append(struct.pack("!L", self.actions_all))
11533 packed.append(struct.pack("!L", self.actions_select))
11534 packed.append(struct.pack("!L", self.actions_indirect))
11535 packed.append(struct.pack("!L", self.actions_ff))
11536 length = sum([len(x) for x in packed])
11537 packed[2] = struct.pack("!H", length)
11538 return ''.join(packed)
11539
11540 @staticmethod
11541 def unpack(reader):
11542 obj = group_features_stats_reply()
11543 _version = reader.read("!B")[0]
11544 assert(_version == 5)
11545 _type = reader.read("!B")[0]
11546 assert(_type == 19)
11547 _length = reader.read("!H")[0]
11548 orig_reader = reader
11549 reader = orig_reader.slice(_length - (2 + 2))
11550 obj.xid = reader.read("!L")[0]
11551 _stats_type = reader.read("!H")[0]
11552 assert(_stats_type == 8)
11553 obj.flags = reader.read("!H")[0]
11554 reader.skip(4)
11555 obj.types = reader.read("!L")[0]
11556 obj.capabilities = reader.read("!L")[0]
11557 obj.max_groups_all = reader.read("!L")[0]
11558 obj.max_groups_select = reader.read("!L")[0]
11559 obj.max_groups_indirect = reader.read("!L")[0]
11560 obj.max_groups_ff = reader.read("!L")[0]
11561 obj.actions_all = reader.read("!L")[0]
11562 obj.actions_select = reader.read("!L")[0]
11563 obj.actions_indirect = reader.read("!L")[0]
11564 obj.actions_ff = reader.read("!L")[0]
11565 return obj
11566
11567 def __eq__(self, other):
11568 if type(self) != type(other): return False
11569 if self.xid != other.xid: return False
11570 if self.flags != other.flags: return False
11571 if self.types != other.types: return False
11572 if self.capabilities != other.capabilities: return False
11573 if self.max_groups_all != other.max_groups_all: return False
11574 if self.max_groups_select != other.max_groups_select: return False
11575 if self.max_groups_indirect != other.max_groups_indirect: return False
11576 if self.max_groups_ff != other.max_groups_ff: return False
11577 if self.actions_all != other.actions_all: return False
11578 if self.actions_select != other.actions_select: return False
11579 if self.actions_indirect != other.actions_indirect: return False
11580 if self.actions_ff != other.actions_ff: return False
11581 return True
11582
11583 def pretty_print(self, q):
11584 q.text("group_features_stats_reply {")
11585 with q.group():
11586 with q.indent(2):
11587 q.breakable()
11588 q.text("xid = ");
11589 if self.xid != None:
11590 q.text("%#x" % self.xid)
11591 else:
11592 q.text('None')
11593 q.text(","); q.breakable()
11594 q.text("flags = ");
11595 q.text("%#x" % self.flags)
11596 q.text(","); q.breakable()
11597 q.text("types = ");
11598 q.text("%#x" % self.types)
11599 q.text(","); q.breakable()
11600 q.text("capabilities = ");
11601 q.text("%#x" % self.capabilities)
11602 q.text(","); q.breakable()
11603 q.text("max_groups_all = ");
11604 q.text("%#x" % self.max_groups_all)
11605 q.text(","); q.breakable()
11606 q.text("max_groups_select = ");
11607 q.text("%#x" % self.max_groups_select)
11608 q.text(","); q.breakable()
11609 q.text("max_groups_indirect = ");
11610 q.text("%#x" % self.max_groups_indirect)
11611 q.text(","); q.breakable()
11612 q.text("max_groups_ff = ");
11613 q.text("%#x" % self.max_groups_ff)
11614 q.text(","); q.breakable()
11615 q.text("actions_all = ");
11616 q.text("%#x" % self.actions_all)
11617 q.text(","); q.breakable()
11618 q.text("actions_select = ");
11619 q.text("%#x" % self.actions_select)
11620 q.text(","); q.breakable()
11621 q.text("actions_indirect = ");
11622 q.text("%#x" % self.actions_indirect)
11623 q.text(","); q.breakable()
11624 q.text("actions_ff = ");
11625 q.text("%#x" % self.actions_ff)
11626 q.breakable()
11627 q.text('}')
11628
11629stats_reply.subtypes[8] = group_features_stats_reply
11630
11631class group_features_stats_request(stats_request):
11632 version = 5
11633 type = 18
11634 stats_type = 8
11635
11636 def __init__(self, xid=None, flags=None):
11637 if xid != None:
11638 self.xid = xid
11639 else:
11640 self.xid = None
11641 if flags != None:
11642 self.flags = flags
11643 else:
11644 self.flags = 0
11645 return
11646
11647 def pack(self):
11648 packed = []
11649 packed.append(struct.pack("!B", self.version))
11650 packed.append(struct.pack("!B", self.type))
11651 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11652 packed.append(struct.pack("!L", self.xid))
11653 packed.append(struct.pack("!H", self.stats_type))
11654 packed.append(struct.pack("!H", self.flags))
11655 packed.append('\x00' * 4)
11656 length = sum([len(x) for x in packed])
11657 packed[2] = struct.pack("!H", length)
11658 return ''.join(packed)
11659
11660 @staticmethod
11661 def unpack(reader):
11662 obj = group_features_stats_request()
11663 _version = reader.read("!B")[0]
11664 assert(_version == 5)
11665 _type = reader.read("!B")[0]
11666 assert(_type == 18)
11667 _length = reader.read("!H")[0]
11668 orig_reader = reader
11669 reader = orig_reader.slice(_length - (2 + 2))
11670 obj.xid = reader.read("!L")[0]
11671 _stats_type = reader.read("!H")[0]
11672 assert(_stats_type == 8)
11673 obj.flags = reader.read("!H")[0]
11674 reader.skip(4)
11675 return obj
11676
11677 def __eq__(self, other):
11678 if type(self) != type(other): return False
11679 if self.xid != other.xid: return False
11680 if self.flags != other.flags: return False
11681 return True
11682
11683 def pretty_print(self, q):
11684 q.text("group_features_stats_request {")
11685 with q.group():
11686 with q.indent(2):
11687 q.breakable()
11688 q.text("xid = ");
11689 if self.xid != None:
11690 q.text("%#x" % self.xid)
11691 else:
11692 q.text('None')
11693 q.text(","); q.breakable()
11694 q.text("flags = ");
11695 q.text("%#x" % self.flags)
11696 q.breakable()
11697 q.text('}')
11698
11699stats_request.subtypes[8] = group_features_stats_request
11700
11701class group_mod_failed_error_msg(error_msg):
11702 version = 5
11703 type = 1
11704 err_type = 6
11705
11706 def __init__(self, xid=None, code=None, data=None):
11707 if xid != None:
11708 self.xid = xid
11709 else:
11710 self.xid = None
11711 if code != None:
11712 self.code = code
11713 else:
11714 self.code = 0
11715 if data != None:
11716 self.data = data
11717 else:
11718 self.data = ''
11719 return
11720
11721 def pack(self):
11722 packed = []
11723 packed.append(struct.pack("!B", self.version))
11724 packed.append(struct.pack("!B", self.type))
11725 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11726 packed.append(struct.pack("!L", self.xid))
11727 packed.append(struct.pack("!H", self.err_type))
11728 packed.append(struct.pack("!H", self.code))
11729 packed.append(self.data)
11730 length = sum([len(x) for x in packed])
11731 packed[2] = struct.pack("!H", length)
11732 return ''.join(packed)
11733
11734 @staticmethod
11735 def unpack(reader):
11736 obj = group_mod_failed_error_msg()
11737 _version = reader.read("!B")[0]
11738 assert(_version == 5)
11739 _type = reader.read("!B")[0]
11740 assert(_type == 1)
11741 _length = reader.read("!H")[0]
11742 orig_reader = reader
11743 reader = orig_reader.slice(_length - (2 + 2))
11744 obj.xid = reader.read("!L")[0]
11745 _err_type = reader.read("!H")[0]
11746 assert(_err_type == 6)
11747 obj.code = reader.read("!H")[0]
11748 obj.data = str(reader.read_all())
11749 return obj
11750
11751 def __eq__(self, other):
11752 if type(self) != type(other): return False
11753 if self.xid != other.xid: return False
11754 if self.code != other.code: return False
11755 if self.data != other.data: return False
11756 return True
11757
11758 def pretty_print(self, q):
11759 q.text("group_mod_failed_error_msg {")
11760 with q.group():
11761 with q.indent(2):
11762 q.breakable()
11763 q.text("xid = ");
11764 if self.xid != None:
11765 q.text("%#x" % self.xid)
11766 else:
11767 q.text('None')
11768 q.text(","); q.breakable()
11769 q.text("code = ");
11770 q.text("%#x" % self.code)
11771 q.text(","); q.breakable()
11772 q.text("data = ");
11773 q.pp(self.data)
11774 q.breakable()
11775 q.text('}')
11776
11777error_msg.subtypes[6] = group_mod_failed_error_msg
11778
11779class group_modify(group_mod):
11780 version = 5
11781 type = 15
11782 command = 1
11783
11784 def __init__(self, xid=None, group_type=None, group_id=None, buckets=None):
11785 if xid != None:
11786 self.xid = xid
11787 else:
11788 self.xid = None
11789 if group_type != None:
11790 self.group_type = group_type
11791 else:
11792 self.group_type = 0
11793 if group_id != None:
11794 self.group_id = group_id
11795 else:
11796 self.group_id = 0
11797 if buckets != None:
11798 self.buckets = buckets
11799 else:
11800 self.buckets = []
11801 return
11802
11803 def pack(self):
11804 packed = []
11805 packed.append(struct.pack("!B", self.version))
11806 packed.append(struct.pack("!B", self.type))
11807 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11808 packed.append(struct.pack("!L", self.xid))
11809 packed.append(struct.pack("!H", self.command))
11810 packed.append(struct.pack("!B", self.group_type))
11811 packed.append('\x00' * 1)
11812 packed.append(struct.pack("!L", self.group_id))
11813 packed.append(loxi.generic_util.pack_list(self.buckets))
11814 length = sum([len(x) for x in packed])
11815 packed[2] = struct.pack("!H", length)
11816 return ''.join(packed)
11817
11818 @staticmethod
11819 def unpack(reader):
11820 obj = group_modify()
11821 _version = reader.read("!B")[0]
11822 assert(_version == 5)
11823 _type = reader.read("!B")[0]
11824 assert(_type == 15)
11825 _length = reader.read("!H")[0]
11826 orig_reader = reader
11827 reader = orig_reader.slice(_length - (2 + 2))
11828 obj.xid = reader.read("!L")[0]
11829 _command = reader.read("!H")[0]
11830 assert(_command == 1)
11831 obj.group_type = reader.read("!B")[0]
11832 reader.skip(1)
11833 obj.group_id = reader.read("!L")[0]
11834 obj.buckets = loxi.generic_util.unpack_list(reader, common.bucket.unpack)
11835 return obj
11836
11837 def __eq__(self, other):
11838 if type(self) != type(other): return False
11839 if self.xid != other.xid: return False
11840 if self.group_type != other.group_type: return False
11841 if self.group_id != other.group_id: return False
11842 if self.buckets != other.buckets: return False
11843 return True
11844
11845 def pretty_print(self, q):
11846 q.text("group_modify {")
11847 with q.group():
11848 with q.indent(2):
11849 q.breakable()
11850 q.text("xid = ");
11851 if self.xid != None:
11852 q.text("%#x" % self.xid)
11853 else:
11854 q.text('None')
11855 q.text(","); q.breakable()
11856 q.text("group_type = ");
11857 q.text("%#x" % self.group_type)
11858 q.text(","); q.breakable()
11859 q.text("group_id = ");
11860 q.text("%#x" % self.group_id)
11861 q.text(","); q.breakable()
11862 q.text("buckets = ");
11863 q.pp(self.buckets)
11864 q.breakable()
11865 q.text('}')
11866
11867group_mod.subtypes[1] = group_modify
11868
11869class group_stats_reply(stats_reply):
11870 version = 5
11871 type = 19
11872 stats_type = 6
11873
11874 def __init__(self, xid=None, flags=None, entries=None):
11875 if xid != None:
11876 self.xid = xid
11877 else:
11878 self.xid = None
11879 if flags != None:
11880 self.flags = flags
11881 else:
11882 self.flags = 0
11883 if entries != None:
11884 self.entries = entries
11885 else:
11886 self.entries = []
11887 return
11888
11889 def pack(self):
11890 packed = []
11891 packed.append(struct.pack("!B", self.version))
11892 packed.append(struct.pack("!B", self.type))
11893 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11894 packed.append(struct.pack("!L", self.xid))
11895 packed.append(struct.pack("!H", self.stats_type))
11896 packed.append(struct.pack("!H", self.flags))
11897 packed.append('\x00' * 4)
11898 packed.append(loxi.generic_util.pack_list(self.entries))
11899 length = sum([len(x) for x in packed])
11900 packed[2] = struct.pack("!H", length)
11901 return ''.join(packed)
11902
11903 @staticmethod
11904 def unpack(reader):
11905 obj = group_stats_reply()
11906 _version = reader.read("!B")[0]
11907 assert(_version == 5)
11908 _type = reader.read("!B")[0]
11909 assert(_type == 19)
11910 _length = reader.read("!H")[0]
11911 orig_reader = reader
11912 reader = orig_reader.slice(_length - (2 + 2))
11913 obj.xid = reader.read("!L")[0]
11914 _stats_type = reader.read("!H")[0]
11915 assert(_stats_type == 6)
11916 obj.flags = reader.read("!H")[0]
11917 reader.skip(4)
11918 obj.entries = loxi.generic_util.unpack_list(reader, common.group_stats_entry.unpack)
11919 return obj
11920
11921 def __eq__(self, other):
11922 if type(self) != type(other): return False
11923 if self.xid != other.xid: return False
11924 if self.flags != other.flags: return False
11925 if self.entries != other.entries: return False
11926 return True
11927
11928 def pretty_print(self, q):
11929 q.text("group_stats_reply {")
11930 with q.group():
11931 with q.indent(2):
11932 q.breakable()
11933 q.text("xid = ");
11934 if self.xid != None:
11935 q.text("%#x" % self.xid)
11936 else:
11937 q.text('None')
11938 q.text(","); q.breakable()
11939 q.text("flags = ");
11940 q.text("%#x" % self.flags)
11941 q.text(","); q.breakable()
11942 q.text("entries = ");
11943 q.pp(self.entries)
11944 q.breakable()
11945 q.text('}')
11946
11947stats_reply.subtypes[6] = group_stats_reply
11948
11949class group_stats_request(stats_request):
11950 version = 5
11951 type = 18
11952 stats_type = 6
11953
11954 def __init__(self, xid=None, flags=None, group_id=None):
11955 if xid != None:
11956 self.xid = xid
11957 else:
11958 self.xid = None
11959 if flags != None:
11960 self.flags = flags
11961 else:
11962 self.flags = 0
11963 if group_id != None:
11964 self.group_id = group_id
11965 else:
11966 self.group_id = 0
11967 return
11968
11969 def pack(self):
11970 packed = []
11971 packed.append(struct.pack("!B", self.version))
11972 packed.append(struct.pack("!B", self.type))
11973 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
11974 packed.append(struct.pack("!L", self.xid))
11975 packed.append(struct.pack("!H", self.stats_type))
11976 packed.append(struct.pack("!H", self.flags))
11977 packed.append('\x00' * 4)
11978 packed.append(struct.pack("!L", self.group_id))
11979 packed.append('\x00' * 4)
11980 length = sum([len(x) for x in packed])
11981 packed[2] = struct.pack("!H", length)
11982 return ''.join(packed)
11983
11984 @staticmethod
11985 def unpack(reader):
11986 obj = group_stats_request()
11987 _version = reader.read("!B")[0]
11988 assert(_version == 5)
11989 _type = reader.read("!B")[0]
11990 assert(_type == 18)
11991 _length = reader.read("!H")[0]
11992 orig_reader = reader
11993 reader = orig_reader.slice(_length - (2 + 2))
11994 obj.xid = reader.read("!L")[0]
11995 _stats_type = reader.read("!H")[0]
11996 assert(_stats_type == 6)
11997 obj.flags = reader.read("!H")[0]
11998 reader.skip(4)
11999 obj.group_id = reader.read("!L")[0]
12000 reader.skip(4)
12001 return obj
12002
12003 def __eq__(self, other):
12004 if type(self) != type(other): return False
12005 if self.xid != other.xid: return False
12006 if self.flags != other.flags: return False
12007 if self.group_id != other.group_id: return False
12008 return True
12009
12010 def pretty_print(self, q):
12011 q.text("group_stats_request {")
12012 with q.group():
12013 with q.indent(2):
12014 q.breakable()
12015 q.text("xid = ");
12016 if self.xid != None:
12017 q.text("%#x" % self.xid)
12018 else:
12019 q.text('None')
12020 q.text(","); q.breakable()
12021 q.text("flags = ");
12022 q.text("%#x" % self.flags)
12023 q.text(","); q.breakable()
12024 q.text("group_id = ");
12025 q.text("%#x" % self.group_id)
12026 q.breakable()
12027 q.text('}')
12028
12029stats_request.subtypes[6] = group_stats_request
12030
12031class hello(message):
12032 version = 5
12033 type = 0
12034
12035 def __init__(self, xid=None, elements=None):
12036 if xid != None:
12037 self.xid = xid
12038 else:
12039 self.xid = None
12040 if elements != None:
12041 self.elements = elements
12042 else:
12043 self.elements = []
12044 return
12045
12046 def pack(self):
12047 packed = []
12048 packed.append(struct.pack("!B", self.version))
12049 packed.append(struct.pack("!B", self.type))
12050 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12051 packed.append(struct.pack("!L", self.xid))
12052 packed.append(loxi.generic_util.pack_list(self.elements))
12053 length = sum([len(x) for x in packed])
12054 packed[2] = struct.pack("!H", length)
12055 return ''.join(packed)
12056
12057 @staticmethod
12058 def unpack(reader):
12059 obj = hello()
12060 _version = reader.read("!B")[0]
12061 assert(_version == 5)
12062 _type = reader.read("!B")[0]
12063 assert(_type == 0)
12064 _length = reader.read("!H")[0]
12065 orig_reader = reader
12066 reader = orig_reader.slice(_length - (2 + 2))
12067 obj.xid = reader.read("!L")[0]
12068 obj.elements = loxi.generic_util.unpack_list(reader, common.hello_elem.unpack)
12069 return obj
12070
12071 def __eq__(self, other):
12072 if type(self) != type(other): return False
12073 if self.xid != other.xid: return False
12074 if self.elements != other.elements: return False
12075 return True
12076
12077 def pretty_print(self, q):
12078 q.text("hello {")
12079 with q.group():
12080 with q.indent(2):
12081 q.breakable()
12082 q.text("xid = ");
12083 if self.xid != None:
12084 q.text("%#x" % self.xid)
12085 else:
12086 q.text('None')
12087 q.text(","); q.breakable()
12088 q.text("elements = ");
12089 q.pp(self.elements)
12090 q.breakable()
12091 q.text('}')
12092
12093message.subtypes[0] = hello
12094
12095class hello_failed_error_msg(error_msg):
12096 version = 5
12097 type = 1
12098 err_type = 0
12099
12100 def __init__(self, xid=None, code=None, data=None):
12101 if xid != None:
12102 self.xid = xid
12103 else:
12104 self.xid = None
12105 if code != None:
12106 self.code = code
12107 else:
12108 self.code = 0
12109 if data != None:
12110 self.data = data
12111 else:
12112 self.data = ''
12113 return
12114
12115 def pack(self):
12116 packed = []
12117 packed.append(struct.pack("!B", self.version))
12118 packed.append(struct.pack("!B", self.type))
12119 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12120 packed.append(struct.pack("!L", self.xid))
12121 packed.append(struct.pack("!H", self.err_type))
12122 packed.append(struct.pack("!H", self.code))
12123 packed.append(self.data)
12124 length = sum([len(x) for x in packed])
12125 packed[2] = struct.pack("!H", length)
12126 return ''.join(packed)
12127
12128 @staticmethod
12129 def unpack(reader):
12130 obj = hello_failed_error_msg()
12131 _version = reader.read("!B")[0]
12132 assert(_version == 5)
12133 _type = reader.read("!B")[0]
12134 assert(_type == 1)
12135 _length = reader.read("!H")[0]
12136 orig_reader = reader
12137 reader = orig_reader.slice(_length - (2 + 2))
12138 obj.xid = reader.read("!L")[0]
12139 _err_type = reader.read("!H")[0]
12140 assert(_err_type == 0)
12141 obj.code = reader.read("!H")[0]
12142 obj.data = str(reader.read_all())
12143 return obj
12144
12145 def __eq__(self, other):
12146 if type(self) != type(other): return False
12147 if self.xid != other.xid: return False
12148 if self.code != other.code: return False
12149 if self.data != other.data: return False
12150 return True
12151
12152 def pretty_print(self, q):
12153 q.text("hello_failed_error_msg {")
12154 with q.group():
12155 with q.indent(2):
12156 q.breakable()
12157 q.text("xid = ");
12158 if self.xid != None:
12159 q.text("%#x" % self.xid)
12160 else:
12161 q.text('None')
12162 q.text(","); q.breakable()
12163 q.text("code = ");
12164 q.text("%#x" % self.code)
12165 q.text(","); q.breakable()
12166 q.text("data = ");
12167 q.pp(self.data)
12168 q.breakable()
12169 q.text('}')
12170
12171error_msg.subtypes[0] = hello_failed_error_msg
12172
12173class meter_config_stats_reply(stats_reply):
12174 version = 5
12175 type = 19
12176 stats_type = 10
12177
12178 def __init__(self, xid=None, flags=None, entries=None):
12179 if xid != None:
12180 self.xid = xid
12181 else:
12182 self.xid = None
12183 if flags != None:
12184 self.flags = flags
12185 else:
12186 self.flags = 0
12187 if entries != None:
12188 self.entries = entries
12189 else:
12190 self.entries = []
12191 return
12192
12193 def pack(self):
12194 packed = []
12195 packed.append(struct.pack("!B", self.version))
12196 packed.append(struct.pack("!B", self.type))
12197 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12198 packed.append(struct.pack("!L", self.xid))
12199 packed.append(struct.pack("!H", self.stats_type))
12200 packed.append(struct.pack("!H", self.flags))
12201 packed.append('\x00' * 4)
12202 packed.append(loxi.generic_util.pack_list(self.entries))
12203 length = sum([len(x) for x in packed])
12204 packed[2] = struct.pack("!H", length)
12205 return ''.join(packed)
12206
12207 @staticmethod
12208 def unpack(reader):
12209 obj = meter_config_stats_reply()
12210 _version = reader.read("!B")[0]
12211 assert(_version == 5)
12212 _type = reader.read("!B")[0]
12213 assert(_type == 19)
12214 _length = reader.read("!H")[0]
12215 orig_reader = reader
12216 reader = orig_reader.slice(_length - (2 + 2))
12217 obj.xid = reader.read("!L")[0]
12218 _stats_type = reader.read("!H")[0]
12219 assert(_stats_type == 10)
12220 obj.flags = reader.read("!H")[0]
12221 reader.skip(4)
12222 obj.entries = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
12223 return obj
12224
12225 def __eq__(self, other):
12226 if type(self) != type(other): return False
12227 if self.xid != other.xid: return False
12228 if self.flags != other.flags: return False
12229 if self.entries != other.entries: return False
12230 return True
12231
12232 def pretty_print(self, q):
12233 q.text("meter_config_stats_reply {")
12234 with q.group():
12235 with q.indent(2):
12236 q.breakable()
12237 q.text("xid = ");
12238 if self.xid != None:
12239 q.text("%#x" % self.xid)
12240 else:
12241 q.text('None')
12242 q.text(","); q.breakable()
12243 q.text("flags = ");
12244 q.text("%#x" % self.flags)
12245 q.text(","); q.breakable()
12246 q.text("entries = ");
12247 q.pp(self.entries)
12248 q.breakable()
12249 q.text('}')
12250
12251stats_reply.subtypes[10] = meter_config_stats_reply
12252
12253class meter_config_stats_request(stats_request):
12254 version = 5
12255 type = 18
12256 stats_type = 10
12257
12258 def __init__(self, xid=None, flags=None, meter_id=None):
12259 if xid != None:
12260 self.xid = xid
12261 else:
12262 self.xid = None
12263 if flags != None:
12264 self.flags = flags
12265 else:
12266 self.flags = 0
12267 if meter_id != None:
12268 self.meter_id = meter_id
12269 else:
12270 self.meter_id = 0
12271 return
12272
12273 def pack(self):
12274 packed = []
12275 packed.append(struct.pack("!B", self.version))
12276 packed.append(struct.pack("!B", self.type))
12277 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12278 packed.append(struct.pack("!L", self.xid))
12279 packed.append(struct.pack("!H", self.stats_type))
12280 packed.append(struct.pack("!H", self.flags))
12281 packed.append('\x00' * 4)
12282 packed.append(struct.pack("!L", self.meter_id))
12283 packed.append('\x00' * 4)
12284 length = sum([len(x) for x in packed])
12285 packed[2] = struct.pack("!H", length)
12286 return ''.join(packed)
12287
12288 @staticmethod
12289 def unpack(reader):
12290 obj = meter_config_stats_request()
12291 _version = reader.read("!B")[0]
12292 assert(_version == 5)
12293 _type = reader.read("!B")[0]
12294 assert(_type == 18)
12295 _length = reader.read("!H")[0]
12296 orig_reader = reader
12297 reader = orig_reader.slice(_length - (2 + 2))
12298 obj.xid = reader.read("!L")[0]
12299 _stats_type = reader.read("!H")[0]
12300 assert(_stats_type == 10)
12301 obj.flags = reader.read("!H")[0]
12302 reader.skip(4)
12303 obj.meter_id = reader.read("!L")[0]
12304 reader.skip(4)
12305 return obj
12306
12307 def __eq__(self, other):
12308 if type(self) != type(other): return False
12309 if self.xid != other.xid: return False
12310 if self.flags != other.flags: return False
12311 if self.meter_id != other.meter_id: return False
12312 return True
12313
12314 def pretty_print(self, q):
12315 q.text("meter_config_stats_request {")
12316 with q.group():
12317 with q.indent(2):
12318 q.breakable()
12319 q.text("xid = ");
12320 if self.xid != None:
12321 q.text("%#x" % self.xid)
12322 else:
12323 q.text('None')
12324 q.text(","); q.breakable()
12325 q.text("flags = ");
12326 q.text("%#x" % self.flags)
12327 q.text(","); q.breakable()
12328 q.text("meter_id = ");
12329 q.text("%#x" % self.meter_id)
12330 q.breakable()
12331 q.text('}')
12332
12333stats_request.subtypes[10] = meter_config_stats_request
12334
12335class meter_features_stats_reply(stats_reply):
12336 version = 5
12337 type = 19
12338 stats_type = 11
12339
12340 def __init__(self, xid=None, flags=None, features=None):
12341 if xid != None:
12342 self.xid = xid
12343 else:
12344 self.xid = None
12345 if flags != None:
12346 self.flags = flags
12347 else:
12348 self.flags = 0
12349 if features != None:
12350 self.features = features
12351 else:
12352 self.features = common.meter_features()
12353 return
12354
12355 def pack(self):
12356 packed = []
12357 packed.append(struct.pack("!B", self.version))
12358 packed.append(struct.pack("!B", self.type))
12359 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12360 packed.append(struct.pack("!L", self.xid))
12361 packed.append(struct.pack("!H", self.stats_type))
12362 packed.append(struct.pack("!H", self.flags))
12363 packed.append('\x00' * 4)
12364 packed.append(self.features.pack())
12365 length = sum([len(x) for x in packed])
12366 packed[2] = struct.pack("!H", length)
12367 return ''.join(packed)
12368
12369 @staticmethod
12370 def unpack(reader):
12371 obj = meter_features_stats_reply()
12372 _version = reader.read("!B")[0]
12373 assert(_version == 5)
12374 _type = reader.read("!B")[0]
12375 assert(_type == 19)
12376 _length = reader.read("!H")[0]
12377 orig_reader = reader
12378 reader = orig_reader.slice(_length - (2 + 2))
12379 obj.xid = reader.read("!L")[0]
12380 _stats_type = reader.read("!H")[0]
12381 assert(_stats_type == 11)
12382 obj.flags = reader.read("!H")[0]
12383 reader.skip(4)
12384 obj.features = common.meter_features.unpack(reader)
12385 return obj
12386
12387 def __eq__(self, other):
12388 if type(self) != type(other): return False
12389 if self.xid != other.xid: return False
12390 if self.flags != other.flags: return False
12391 if self.features != other.features: return False
12392 return True
12393
12394 def pretty_print(self, q):
12395 q.text("meter_features_stats_reply {")
12396 with q.group():
12397 with q.indent(2):
12398 q.breakable()
12399 q.text("xid = ");
12400 if self.xid != None:
12401 q.text("%#x" % self.xid)
12402 else:
12403 q.text('None')
12404 q.text(","); q.breakable()
12405 q.text("flags = ");
12406 q.text("%#x" % self.flags)
12407 q.text(","); q.breakable()
12408 q.text("features = ");
12409 q.pp(self.features)
12410 q.breakable()
12411 q.text('}')
12412
12413stats_reply.subtypes[11] = meter_features_stats_reply
12414
12415class meter_features_stats_request(stats_request):
12416 version = 5
12417 type = 18
12418 stats_type = 11
12419
12420 def __init__(self, xid=None, flags=None):
12421 if xid != None:
12422 self.xid = xid
12423 else:
12424 self.xid = None
12425 if flags != None:
12426 self.flags = flags
12427 else:
12428 self.flags = 0
12429 return
12430
12431 def pack(self):
12432 packed = []
12433 packed.append(struct.pack("!B", self.version))
12434 packed.append(struct.pack("!B", self.type))
12435 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12436 packed.append(struct.pack("!L", self.xid))
12437 packed.append(struct.pack("!H", self.stats_type))
12438 packed.append(struct.pack("!H", self.flags))
12439 packed.append('\x00' * 4)
12440 length = sum([len(x) for x in packed])
12441 packed[2] = struct.pack("!H", length)
12442 return ''.join(packed)
12443
12444 @staticmethod
12445 def unpack(reader):
12446 obj = meter_features_stats_request()
12447 _version = reader.read("!B")[0]
12448 assert(_version == 5)
12449 _type = reader.read("!B")[0]
12450 assert(_type == 18)
12451 _length = reader.read("!H")[0]
12452 orig_reader = reader
12453 reader = orig_reader.slice(_length - (2 + 2))
12454 obj.xid = reader.read("!L")[0]
12455 _stats_type = reader.read("!H")[0]
12456 assert(_stats_type == 11)
12457 obj.flags = reader.read("!H")[0]
12458 reader.skip(4)
12459 return obj
12460
12461 def __eq__(self, other):
12462 if type(self) != type(other): return False
12463 if self.xid != other.xid: return False
12464 if self.flags != other.flags: return False
12465 return True
12466
12467 def pretty_print(self, q):
12468 q.text("meter_features_stats_request {")
12469 with q.group():
12470 with q.indent(2):
12471 q.breakable()
12472 q.text("xid = ");
12473 if self.xid != None:
12474 q.text("%#x" % self.xid)
12475 else:
12476 q.text('None')
12477 q.text(","); q.breakable()
12478 q.text("flags = ");
12479 q.text("%#x" % self.flags)
12480 q.breakable()
12481 q.text('}')
12482
12483stats_request.subtypes[11] = meter_features_stats_request
12484
12485class meter_mod(message):
12486 version = 5
12487 type = 29
12488
12489 def __init__(self, xid=None, command=None, flags=None, meter_id=None, bands=None):
12490 if xid != None:
12491 self.xid = xid
12492 else:
12493 self.xid = None
12494 if command != None:
12495 self.command = command
12496 else:
12497 self.command = 0
12498 if flags != None:
12499 self.flags = flags
12500 else:
12501 self.flags = 0
12502 if meter_id != None:
12503 self.meter_id = meter_id
12504 else:
12505 self.meter_id = 0
12506 if bands != None:
12507 self.bands = bands
12508 else:
12509 self.bands = []
12510 return
12511
12512 def pack(self):
12513 packed = []
12514 packed.append(struct.pack("!B", self.version))
12515 packed.append(struct.pack("!B", self.type))
12516 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12517 packed.append(struct.pack("!L", self.xid))
12518 packed.append(struct.pack("!H", self.command))
12519 packed.append(struct.pack("!H", self.flags))
12520 packed.append(struct.pack("!L", self.meter_id))
12521 packed.append(loxi.generic_util.pack_list(self.bands))
12522 length = sum([len(x) for x in packed])
12523 packed[2] = struct.pack("!H", length)
12524 return ''.join(packed)
12525
12526 @staticmethod
12527 def unpack(reader):
12528 obj = meter_mod()
12529 _version = reader.read("!B")[0]
12530 assert(_version == 5)
12531 _type = reader.read("!B")[0]
12532 assert(_type == 29)
12533 _length = reader.read("!H")[0]
12534 orig_reader = reader
12535 reader = orig_reader.slice(_length - (2 + 2))
12536 obj.xid = reader.read("!L")[0]
12537 obj.command = reader.read("!H")[0]
12538 obj.flags = reader.read("!H")[0]
12539 obj.meter_id = reader.read("!L")[0]
12540 obj.bands = loxi.generic_util.unpack_list(reader, meter_band.meter_band.unpack)
12541 return obj
12542
12543 def __eq__(self, other):
12544 if type(self) != type(other): return False
12545 if self.xid != other.xid: return False
12546 if self.command != other.command: return False
12547 if self.flags != other.flags: return False
12548 if self.meter_id != other.meter_id: return False
12549 if self.bands != other.bands: return False
12550 return True
12551
12552 def pretty_print(self, q):
12553 q.text("meter_mod {")
12554 with q.group():
12555 with q.indent(2):
12556 q.breakable()
12557 q.text("xid = ");
12558 if self.xid != None:
12559 q.text("%#x" % self.xid)
12560 else:
12561 q.text('None')
12562 q.text(","); q.breakable()
12563 q.text("command = ");
12564 q.text("%#x" % self.command)
12565 q.text(","); q.breakable()
12566 q.text("flags = ");
12567 q.text("%#x" % self.flags)
12568 q.text(","); q.breakable()
12569 q.text("meter_id = ");
12570 q.text("%#x" % self.meter_id)
12571 q.text(","); q.breakable()
12572 q.text("bands = ");
12573 q.pp(self.bands)
12574 q.breakable()
12575 q.text('}')
12576
12577message.subtypes[29] = meter_mod
12578
12579class meter_mod_failed_error_msg(error_msg):
12580 version = 5
12581 type = 1
12582 err_type = 12
12583
12584 def __init__(self, xid=None, code=None, data=None):
12585 if xid != None:
12586 self.xid = xid
12587 else:
12588 self.xid = None
12589 if code != None:
12590 self.code = code
12591 else:
12592 self.code = 0
12593 if data != None:
12594 self.data = data
12595 else:
12596 self.data = ''
12597 return
12598
12599 def pack(self):
12600 packed = []
12601 packed.append(struct.pack("!B", self.version))
12602 packed.append(struct.pack("!B", self.type))
12603 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12604 packed.append(struct.pack("!L", self.xid))
12605 packed.append(struct.pack("!H", self.err_type))
12606 packed.append(struct.pack("!H", self.code))
12607 packed.append(self.data)
12608 length = sum([len(x) for x in packed])
12609 packed[2] = struct.pack("!H", length)
12610 return ''.join(packed)
12611
12612 @staticmethod
12613 def unpack(reader):
12614 obj = meter_mod_failed_error_msg()
12615 _version = reader.read("!B")[0]
12616 assert(_version == 5)
12617 _type = reader.read("!B")[0]
12618 assert(_type == 1)
12619 _length = reader.read("!H")[0]
12620 orig_reader = reader
12621 reader = orig_reader.slice(_length - (2 + 2))
12622 obj.xid = reader.read("!L")[0]
12623 _err_type = reader.read("!H")[0]
12624 assert(_err_type == 12)
12625 obj.code = reader.read("!H")[0]
12626 obj.data = str(reader.read_all())
12627 return obj
12628
12629 def __eq__(self, other):
12630 if type(self) != type(other): return False
12631 if self.xid != other.xid: return False
12632 if self.code != other.code: return False
12633 if self.data != other.data: return False
12634 return True
12635
12636 def pretty_print(self, q):
12637 q.text("meter_mod_failed_error_msg {")
12638 with q.group():
12639 with q.indent(2):
12640 q.breakable()
12641 q.text("xid = ");
12642 if self.xid != None:
12643 q.text("%#x" % self.xid)
12644 else:
12645 q.text('None')
12646 q.text(","); q.breakable()
12647 q.text("code = ");
12648 q.text("%#x" % self.code)
12649 q.text(","); q.breakable()
12650 q.text("data = ");
12651 q.pp(self.data)
12652 q.breakable()
12653 q.text('}')
12654
12655error_msg.subtypes[12] = meter_mod_failed_error_msg
12656
12657class meter_stats_reply(stats_reply):
12658 version = 5
12659 type = 19
12660 stats_type = 9
12661
12662 def __init__(self, xid=None, flags=None, entries=None):
12663 if xid != None:
12664 self.xid = xid
12665 else:
12666 self.xid = None
12667 if flags != None:
12668 self.flags = flags
12669 else:
12670 self.flags = 0
12671 if entries != None:
12672 self.entries = entries
12673 else:
12674 self.entries = []
12675 return
12676
12677 def pack(self):
12678 packed = []
12679 packed.append(struct.pack("!B", self.version))
12680 packed.append(struct.pack("!B", self.type))
12681 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12682 packed.append(struct.pack("!L", self.xid))
12683 packed.append(struct.pack("!H", self.stats_type))
12684 packed.append(struct.pack("!H", self.flags))
12685 packed.append('\x00' * 4)
12686 packed.append(loxi.generic_util.pack_list(self.entries))
12687 length = sum([len(x) for x in packed])
12688 packed[2] = struct.pack("!H", length)
12689 return ''.join(packed)
12690
12691 @staticmethod
12692 def unpack(reader):
12693 obj = meter_stats_reply()
12694 _version = reader.read("!B")[0]
12695 assert(_version == 5)
12696 _type = reader.read("!B")[0]
12697 assert(_type == 19)
12698 _length = reader.read("!H")[0]
12699 orig_reader = reader
12700 reader = orig_reader.slice(_length - (2 + 2))
12701 obj.xid = reader.read("!L")[0]
12702 _stats_type = reader.read("!H")[0]
12703 assert(_stats_type == 9)
12704 obj.flags = reader.read("!H")[0]
12705 reader.skip(4)
12706 obj.entries = loxi.generic_util.unpack_list(reader, common.meter_stats.unpack)
12707 return obj
12708
12709 def __eq__(self, other):
12710 if type(self) != type(other): return False
12711 if self.xid != other.xid: return False
12712 if self.flags != other.flags: return False
12713 if self.entries != other.entries: return False
12714 return True
12715
12716 def pretty_print(self, q):
12717 q.text("meter_stats_reply {")
12718 with q.group():
12719 with q.indent(2):
12720 q.breakable()
12721 q.text("xid = ");
12722 if self.xid != None:
12723 q.text("%#x" % self.xid)
12724 else:
12725 q.text('None')
12726 q.text(","); q.breakable()
12727 q.text("flags = ");
12728 q.text("%#x" % self.flags)
12729 q.text(","); q.breakable()
12730 q.text("entries = ");
12731 q.pp(self.entries)
12732 q.breakable()
12733 q.text('}')
12734
12735stats_reply.subtypes[9] = meter_stats_reply
12736
12737class meter_stats_request(stats_request):
12738 version = 5
12739 type = 18
12740 stats_type = 9
12741
12742 def __init__(self, xid=None, flags=None, meter_id=None):
12743 if xid != None:
12744 self.xid = xid
12745 else:
12746 self.xid = None
12747 if flags != None:
12748 self.flags = flags
12749 else:
12750 self.flags = 0
12751 if meter_id != None:
12752 self.meter_id = meter_id
12753 else:
12754 self.meter_id = 0
12755 return
12756
12757 def pack(self):
12758 packed = []
12759 packed.append(struct.pack("!B", self.version))
12760 packed.append(struct.pack("!B", self.type))
12761 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12762 packed.append(struct.pack("!L", self.xid))
12763 packed.append(struct.pack("!H", self.stats_type))
12764 packed.append(struct.pack("!H", self.flags))
12765 packed.append('\x00' * 4)
12766 packed.append(struct.pack("!L", self.meter_id))
12767 packed.append('\x00' * 4)
12768 length = sum([len(x) for x in packed])
12769 packed[2] = struct.pack("!H", length)
12770 return ''.join(packed)
12771
12772 @staticmethod
12773 def unpack(reader):
12774 obj = meter_stats_request()
12775 _version = reader.read("!B")[0]
12776 assert(_version == 5)
12777 _type = reader.read("!B")[0]
12778 assert(_type == 18)
12779 _length = reader.read("!H")[0]
12780 orig_reader = reader
12781 reader = orig_reader.slice(_length - (2 + 2))
12782 obj.xid = reader.read("!L")[0]
12783 _stats_type = reader.read("!H")[0]
12784 assert(_stats_type == 9)
12785 obj.flags = reader.read("!H")[0]
12786 reader.skip(4)
12787 obj.meter_id = reader.read("!L")[0]
12788 reader.skip(4)
12789 return obj
12790
12791 def __eq__(self, other):
12792 if type(self) != type(other): return False
12793 if self.xid != other.xid: return False
12794 if self.flags != other.flags: return False
12795 if self.meter_id != other.meter_id: return False
12796 return True
12797
12798 def pretty_print(self, q):
12799 q.text("meter_stats_request {")
12800 with q.group():
12801 with q.indent(2):
12802 q.breakable()
12803 q.text("xid = ");
12804 if self.xid != None:
12805 q.text("%#x" % self.xid)
12806 else:
12807 q.text('None')
12808 q.text(","); q.breakable()
12809 q.text("flags = ");
12810 q.text("%#x" % self.flags)
12811 q.text(","); q.breakable()
12812 q.text("meter_id = ");
12813 q.text("%#x" % self.meter_id)
12814 q.breakable()
12815 q.text('}')
12816
12817stats_request.subtypes[9] = meter_stats_request
12818
12819class nicira_header(experimenter):
12820 subtypes = {}
12821
12822 version = 5
12823 type = 4
12824 experimenter = 8992
12825
12826 def __init__(self, xid=None, subtype=None):
12827 if xid != None:
12828 self.xid = xid
12829 else:
12830 self.xid = None
12831 if subtype != None:
12832 self.subtype = subtype
12833 else:
12834 self.subtype = 0
12835 return
12836
12837 def pack(self):
12838 packed = []
12839 packed.append(struct.pack("!B", self.version))
12840 packed.append(struct.pack("!B", self.type))
12841 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12842 packed.append(struct.pack("!L", self.xid))
12843 packed.append(struct.pack("!L", self.experimenter))
12844 packed.append(struct.pack("!L", self.subtype))
12845 length = sum([len(x) for x in packed])
12846 packed[2] = struct.pack("!H", length)
12847 return ''.join(packed)
12848
12849 @staticmethod
12850 def unpack(reader):
12851 subtype, = reader.peek('!L', 12)
12852 subclass = nicira_header.subtypes.get(subtype)
12853 if subclass:
12854 return subclass.unpack(reader)
12855
12856 obj = nicira_header()
12857 _version = reader.read("!B")[0]
12858 assert(_version == 5)
12859 _type = reader.read("!B")[0]
12860 assert(_type == 4)
12861 _length = reader.read("!H")[0]
12862 orig_reader = reader
12863 reader = orig_reader.slice(_length - (2 + 2))
12864 obj.xid = reader.read("!L")[0]
12865 _experimenter = reader.read("!L")[0]
12866 assert(_experimenter == 8992)
12867 obj.subtype = reader.read("!L")[0]
12868 return obj
12869
12870 def __eq__(self, other):
12871 if type(self) != type(other): return False
12872 if self.xid != other.xid: return False
12873 if self.subtype != other.subtype: return False
12874 return True
12875
12876 def pretty_print(self, q):
12877 q.text("nicira_header {")
12878 with q.group():
12879 with q.indent(2):
12880 q.breakable()
12881 q.text("xid = ");
12882 if self.xid != None:
12883 q.text("%#x" % self.xid)
12884 else:
12885 q.text('None')
12886 q.breakable()
12887 q.text('}')
12888
12889experimenter.subtypes[8992] = nicira_header
12890
12891class packet_in(message):
12892 version = 5
12893 type = 10
12894
12895 def __init__(self, xid=None, buffer_id=None, total_len=None, reason=None, table_id=None, cookie=None, match=None, data=None):
12896 if xid != None:
12897 self.xid = xid
12898 else:
12899 self.xid = None
12900 if buffer_id != None:
12901 self.buffer_id = buffer_id
12902 else:
12903 self.buffer_id = 0
12904 if total_len != None:
12905 self.total_len = total_len
12906 else:
12907 self.total_len = 0
12908 if reason != None:
12909 self.reason = reason
12910 else:
12911 self.reason = 0
12912 if table_id != None:
12913 self.table_id = table_id
12914 else:
12915 self.table_id = 0
12916 if cookie != None:
12917 self.cookie = cookie
12918 else:
12919 self.cookie = 0
12920 if match != None:
12921 self.match = match
12922 else:
12923 self.match = common.match()
12924 if data != None:
12925 self.data = data
12926 else:
12927 self.data = ''
12928 return
12929
12930 def pack(self):
12931 packed = []
12932 packed.append(struct.pack("!B", self.version))
12933 packed.append(struct.pack("!B", self.type))
12934 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
12935 packed.append(struct.pack("!L", self.xid))
12936 packed.append(struct.pack("!L", self.buffer_id))
12937 packed.append(struct.pack("!H", self.total_len))
12938 packed.append(struct.pack("!B", self.reason))
12939 packed.append(struct.pack("!B", self.table_id))
12940 packed.append(struct.pack("!Q", self.cookie))
12941 packed.append(self.match.pack())
12942 packed.append('\x00' * 2)
12943 packed.append(self.data)
12944 length = sum([len(x) for x in packed])
12945 packed[2] = struct.pack("!H", length)
12946 return ''.join(packed)
12947
12948 @staticmethod
12949 def unpack(reader):
12950 obj = packet_in()
12951 _version = reader.read("!B")[0]
12952 assert(_version == 5)
12953 _type = reader.read("!B")[0]
12954 assert(_type == 10)
12955 _length = reader.read("!H")[0]
12956 orig_reader = reader
12957 reader = orig_reader.slice(_length - (2 + 2))
12958 obj.xid = reader.read("!L")[0]
12959 obj.buffer_id = reader.read("!L")[0]
12960 obj.total_len = reader.read("!H")[0]
12961 obj.reason = reader.read("!B")[0]
12962 obj.table_id = reader.read("!B")[0]
12963 obj.cookie = reader.read("!Q")[0]
12964 obj.match = common.match.unpack(reader)
12965 reader.skip(2)
12966 obj.data = str(reader.read_all())
12967 return obj
12968
12969 def __eq__(self, other):
12970 if type(self) != type(other): return False
12971 if self.xid != other.xid: return False
12972 if self.buffer_id != other.buffer_id: return False
12973 if self.total_len != other.total_len: return False
12974 if self.reason != other.reason: return False
12975 if self.table_id != other.table_id: return False
12976 if self.cookie != other.cookie: return False
12977 if self.match != other.match: return False
12978 if self.data != other.data: return False
12979 return True
12980
12981 def pretty_print(self, q):
12982 q.text("packet_in {")
12983 with q.group():
12984 with q.indent(2):
12985 q.breakable()
12986 q.text("xid = ");
12987 if self.xid != None:
12988 q.text("%#x" % self.xid)
12989 else:
12990 q.text('None')
12991 q.text(","); q.breakable()
12992 q.text("buffer_id = ");
12993 q.text("%#x" % self.buffer_id)
12994 q.text(","); q.breakable()
12995 q.text("total_len = ");
12996 q.text("%#x" % self.total_len)
12997 q.text(","); q.breakable()
12998 q.text("reason = ");
12999 q.text("%#x" % self.reason)
13000 q.text(","); q.breakable()
13001 q.text("table_id = ");
13002 q.text("%#x" % self.table_id)
13003 q.text(","); q.breakable()
13004 q.text("cookie = ");
13005 q.text("%#x" % self.cookie)
13006 q.text(","); q.breakable()
13007 q.text("match = ");
13008 q.pp(self.match)
13009 q.text(","); q.breakable()
13010 q.text("data = ");
13011 q.pp(self.data)
13012 q.breakable()
13013 q.text('}')
13014
13015message.subtypes[10] = packet_in
13016
13017class packet_out(message):
13018 version = 5
13019 type = 13
13020
13021 def __init__(self, xid=None, buffer_id=None, in_port=None, actions=None, data=None):
13022 if xid != None:
13023 self.xid = xid
13024 else:
13025 self.xid = None
13026 if buffer_id != None:
13027 self.buffer_id = buffer_id
13028 else:
13029 self.buffer_id = 0
13030 if in_port != None:
13031 self.in_port = in_port
13032 else:
13033 self.in_port = 0
13034 if actions != None:
13035 self.actions = actions
13036 else:
13037 self.actions = []
13038 if data != None:
13039 self.data = data
13040 else:
13041 self.data = ''
13042 return
13043
13044 def pack(self):
13045 packed = []
13046 packed.append(struct.pack("!B", self.version))
13047 packed.append(struct.pack("!B", self.type))
13048 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13049 packed.append(struct.pack("!L", self.xid))
13050 packed.append(struct.pack("!L", self.buffer_id))
13051 packed.append(util.pack_port_no(self.in_port))
13052 packed.append(struct.pack("!H", 0)) # placeholder for actions_len at index 6
13053 packed.append('\x00' * 6)
13054 packed.append(loxi.generic_util.pack_list(self.actions))
13055 packed[6] = struct.pack("!H", len(packed[-1]))
13056 packed.append(self.data)
13057 length = sum([len(x) for x in packed])
13058 packed[2] = struct.pack("!H", length)
13059 return ''.join(packed)
13060
13061 @staticmethod
13062 def unpack(reader):
13063 obj = packet_out()
13064 _version = reader.read("!B")[0]
13065 assert(_version == 5)
13066 _type = reader.read("!B")[0]
13067 assert(_type == 13)
13068 _length = reader.read("!H")[0]
13069 orig_reader = reader
13070 reader = orig_reader.slice(_length - (2 + 2))
13071 obj.xid = reader.read("!L")[0]
13072 obj.buffer_id = reader.read("!L")[0]
13073 obj.in_port = util.unpack_port_no(reader)
13074 _actions_len = reader.read("!H")[0]
13075 reader.skip(6)
13076 obj.actions = loxi.generic_util.unpack_list(reader.slice(_actions_len), action.action.unpack)
13077 obj.data = str(reader.read_all())
13078 return obj
13079
13080 def __eq__(self, other):
13081 if type(self) != type(other): return False
13082 if self.xid != other.xid: return False
13083 if self.buffer_id != other.buffer_id: return False
13084 if self.in_port != other.in_port: return False
13085 if self.actions != other.actions: return False
13086 if self.data != other.data: return False
13087 return True
13088
13089 def pretty_print(self, q):
13090 q.text("packet_out {")
13091 with q.group():
13092 with q.indent(2):
13093 q.breakable()
13094 q.text("xid = ");
13095 if self.xid != None:
13096 q.text("%#x" % self.xid)
13097 else:
13098 q.text('None')
13099 q.text(","); q.breakable()
13100 q.text("buffer_id = ");
13101 q.text("%#x" % self.buffer_id)
13102 q.text(","); q.breakable()
13103 q.text("in_port = ");
13104 q.text(util.pretty_port(self.in_port))
13105 q.text(","); q.breakable()
13106 q.text("actions = ");
13107 q.pp(self.actions)
13108 q.text(","); q.breakable()
13109 q.text("data = ");
13110 q.pp(self.data)
13111 q.breakable()
13112 q.text('}')
13113
13114message.subtypes[13] = packet_out
13115
13116class port_desc_stats_reply(stats_reply):
13117 version = 5
13118 type = 19
13119 stats_type = 13
13120
13121 def __init__(self, xid=None, flags=None, entries=None):
13122 if xid != None:
13123 self.xid = xid
13124 else:
13125 self.xid = None
13126 if flags != None:
13127 self.flags = flags
13128 else:
13129 self.flags = 0
13130 if entries != None:
13131 self.entries = entries
13132 else:
13133 self.entries = []
13134 return
13135
13136 def pack(self):
13137 packed = []
13138 packed.append(struct.pack("!B", self.version))
13139 packed.append(struct.pack("!B", self.type))
13140 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13141 packed.append(struct.pack("!L", self.xid))
13142 packed.append(struct.pack("!H", self.stats_type))
13143 packed.append(struct.pack("!H", self.flags))
13144 packed.append('\x00' * 4)
13145 packed.append(loxi.generic_util.pack_list(self.entries))
13146 length = sum([len(x) for x in packed])
13147 packed[2] = struct.pack("!H", length)
13148 return ''.join(packed)
13149
13150 @staticmethod
13151 def unpack(reader):
13152 obj = port_desc_stats_reply()
13153 _version = reader.read("!B")[0]
13154 assert(_version == 5)
13155 _type = reader.read("!B")[0]
13156 assert(_type == 19)
13157 _length = reader.read("!H")[0]
13158 orig_reader = reader
13159 reader = orig_reader.slice(_length - (2 + 2))
13160 obj.xid = reader.read("!L")[0]
13161 _stats_type = reader.read("!H")[0]
13162 assert(_stats_type == 13)
13163 obj.flags = reader.read("!H")[0]
13164 reader.skip(4)
13165 obj.entries = loxi.generic_util.unpack_list(reader, common.port_desc.unpack)
13166 return obj
13167
13168 def __eq__(self, other):
13169 if type(self) != type(other): return False
13170 if self.xid != other.xid: return False
13171 if self.flags != other.flags: return False
13172 if self.entries != other.entries: return False
13173 return True
13174
13175 def pretty_print(self, q):
13176 q.text("port_desc_stats_reply {")
13177 with q.group():
13178 with q.indent(2):
13179 q.breakable()
13180 q.text("xid = ");
13181 if self.xid != None:
13182 q.text("%#x" % self.xid)
13183 else:
13184 q.text('None')
13185 q.text(","); q.breakable()
13186 q.text("flags = ");
13187 q.text("%#x" % self.flags)
13188 q.text(","); q.breakable()
13189 q.text("entries = ");
13190 q.pp(self.entries)
13191 q.breakable()
13192 q.text('}')
13193
13194stats_reply.subtypes[13] = port_desc_stats_reply
13195
13196class port_desc_stats_request(stats_request):
13197 version = 5
13198 type = 18
13199 stats_type = 13
13200
13201 def __init__(self, xid=None, flags=None):
13202 if xid != None:
13203 self.xid = xid
13204 else:
13205 self.xid = None
13206 if flags != None:
13207 self.flags = flags
13208 else:
13209 self.flags = 0
13210 return
13211
13212 def pack(self):
13213 packed = []
13214 packed.append(struct.pack("!B", self.version))
13215 packed.append(struct.pack("!B", self.type))
13216 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13217 packed.append(struct.pack("!L", self.xid))
13218 packed.append(struct.pack("!H", self.stats_type))
13219 packed.append(struct.pack("!H", self.flags))
13220 packed.append('\x00' * 4)
13221 length = sum([len(x) for x in packed])
13222 packed[2] = struct.pack("!H", length)
13223 return ''.join(packed)
13224
13225 @staticmethod
13226 def unpack(reader):
13227 obj = port_desc_stats_request()
13228 _version = reader.read("!B")[0]
13229 assert(_version == 5)
13230 _type = reader.read("!B")[0]
13231 assert(_type == 18)
13232 _length = reader.read("!H")[0]
13233 orig_reader = reader
13234 reader = orig_reader.slice(_length - (2 + 2))
13235 obj.xid = reader.read("!L")[0]
13236 _stats_type = reader.read("!H")[0]
13237 assert(_stats_type == 13)
13238 obj.flags = reader.read("!H")[0]
13239 reader.skip(4)
13240 return obj
13241
13242 def __eq__(self, other):
13243 if type(self) != type(other): return False
13244 if self.xid != other.xid: return False
13245 if self.flags != other.flags: return False
13246 return True
13247
13248 def pretty_print(self, q):
13249 q.text("port_desc_stats_request {")
13250 with q.group():
13251 with q.indent(2):
13252 q.breakable()
13253 q.text("xid = ");
13254 if self.xid != None:
13255 q.text("%#x" % self.xid)
13256 else:
13257 q.text('None')
13258 q.text(","); q.breakable()
13259 q.text("flags = ");
13260 q.text("%#x" % self.flags)
13261 q.breakable()
13262 q.text('}')
13263
13264stats_request.subtypes[13] = port_desc_stats_request
13265
13266class port_mod(message):
13267 version = 5
13268 type = 16
13269
13270 def __init__(self, xid=None, port_no=None, hw_addr=None, config=None, mask=None, properties=None):
13271 if xid != None:
13272 self.xid = xid
13273 else:
13274 self.xid = None
13275 if port_no != None:
13276 self.port_no = port_no
13277 else:
13278 self.port_no = 0
13279 if hw_addr != None:
13280 self.hw_addr = hw_addr
13281 else:
13282 self.hw_addr = [0,0,0,0,0,0]
13283 if config != None:
13284 self.config = config
13285 else:
13286 self.config = 0
13287 if mask != None:
13288 self.mask = mask
13289 else:
13290 self.mask = 0
13291 if properties != None:
13292 self.properties = properties
13293 else:
13294 self.properties = []
13295 return
13296
13297 def pack(self):
13298 packed = []
13299 packed.append(struct.pack("!B", self.version))
13300 packed.append(struct.pack("!B", self.type))
13301 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13302 packed.append(struct.pack("!L", self.xid))
13303 packed.append(util.pack_port_no(self.port_no))
13304 packed.append('\x00' * 4)
13305 packed.append(struct.pack("!6B", *self.hw_addr))
13306 packed.append('\x00' * 2)
13307 packed.append(struct.pack("!L", self.config))
13308 packed.append(struct.pack("!L", self.mask))
13309 packed.append(loxi.generic_util.pack_list(self.properties))
13310 length = sum([len(x) for x in packed])
13311 packed[2] = struct.pack("!H", length)
13312 return ''.join(packed)
13313
13314 @staticmethod
13315 def unpack(reader):
13316 obj = port_mod()
13317 _version = reader.read("!B")[0]
13318 assert(_version == 5)
13319 _type = reader.read("!B")[0]
13320 assert(_type == 16)
13321 _length = reader.read("!H")[0]
13322 orig_reader = reader
13323 reader = orig_reader.slice(_length - (2 + 2))
13324 obj.xid = reader.read("!L")[0]
13325 obj.port_no = util.unpack_port_no(reader)
13326 reader.skip(4)
13327 obj.hw_addr = list(reader.read('!6B'))
13328 reader.skip(2)
13329 obj.config = reader.read("!L")[0]
13330 obj.mask = reader.read("!L")[0]
13331 obj.properties = loxi.generic_util.unpack_list(reader, port_mod_prop.port_mod_prop.unpack)
13332 return obj
13333
13334 def __eq__(self, other):
13335 if type(self) != type(other): return False
13336 if self.xid != other.xid: return False
13337 if self.port_no != other.port_no: return False
13338 if self.hw_addr != other.hw_addr: return False
13339 if self.config != other.config: return False
13340 if self.mask != other.mask: return False
13341 if self.properties != other.properties: return False
13342 return True
13343
13344 def pretty_print(self, q):
13345 q.text("port_mod {")
13346 with q.group():
13347 with q.indent(2):
13348 q.breakable()
13349 q.text("xid = ");
13350 if self.xid != None:
13351 q.text("%#x" % self.xid)
13352 else:
13353 q.text('None')
13354 q.text(","); q.breakable()
13355 q.text("port_no = ");
13356 q.text(util.pretty_port(self.port_no))
13357 q.text(","); q.breakable()
13358 q.text("hw_addr = ");
13359 q.text(util.pretty_mac(self.hw_addr))
13360 q.text(","); q.breakable()
13361 q.text("config = ");
13362 q.text("%#x" % self.config)
13363 q.text(","); q.breakable()
13364 q.text("mask = ");
13365 q.text("%#x" % self.mask)
13366 q.text(","); q.breakable()
13367 q.text("properties = ");
13368 q.pp(self.properties)
13369 q.breakable()
13370 q.text('}')
13371
13372message.subtypes[16] = port_mod
13373
13374class port_mod_failed_error_msg(error_msg):
13375 version = 5
13376 type = 1
13377 err_type = 7
13378
13379 def __init__(self, xid=None, code=None, data=None):
13380 if xid != None:
13381 self.xid = xid
13382 else:
13383 self.xid = None
13384 if code != None:
13385 self.code = code
13386 else:
13387 self.code = 0
13388 if data != None:
13389 self.data = data
13390 else:
13391 self.data = ''
13392 return
13393
13394 def pack(self):
13395 packed = []
13396 packed.append(struct.pack("!B", self.version))
13397 packed.append(struct.pack("!B", self.type))
13398 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13399 packed.append(struct.pack("!L", self.xid))
13400 packed.append(struct.pack("!H", self.err_type))
13401 packed.append(struct.pack("!H", self.code))
13402 packed.append(self.data)
13403 length = sum([len(x) for x in packed])
13404 packed[2] = struct.pack("!H", length)
13405 return ''.join(packed)
13406
13407 @staticmethod
13408 def unpack(reader):
13409 obj = port_mod_failed_error_msg()
13410 _version = reader.read("!B")[0]
13411 assert(_version == 5)
13412 _type = reader.read("!B")[0]
13413 assert(_type == 1)
13414 _length = reader.read("!H")[0]
13415 orig_reader = reader
13416 reader = orig_reader.slice(_length - (2 + 2))
13417 obj.xid = reader.read("!L")[0]
13418 _err_type = reader.read("!H")[0]
13419 assert(_err_type == 7)
13420 obj.code = reader.read("!H")[0]
13421 obj.data = str(reader.read_all())
13422 return obj
13423
13424 def __eq__(self, other):
13425 if type(self) != type(other): return False
13426 if self.xid != other.xid: return False
13427 if self.code != other.code: return False
13428 if self.data != other.data: return False
13429 return True
13430
13431 def pretty_print(self, q):
13432 q.text("port_mod_failed_error_msg {")
13433 with q.group():
13434 with q.indent(2):
13435 q.breakable()
13436 q.text("xid = ");
13437 if self.xid != None:
13438 q.text("%#x" % self.xid)
13439 else:
13440 q.text('None')
13441 q.text(","); q.breakable()
13442 q.text("code = ");
13443 q.text("%#x" % self.code)
13444 q.text(","); q.breakable()
13445 q.text("data = ");
13446 q.pp(self.data)
13447 q.breakable()
13448 q.text('}')
13449
13450error_msg.subtypes[7] = port_mod_failed_error_msg
13451
13452class port_stats_reply(stats_reply):
13453 version = 5
13454 type = 19
13455 stats_type = 4
13456
13457 def __init__(self, xid=None, flags=None, entries=None):
13458 if xid != None:
13459 self.xid = xid
13460 else:
13461 self.xid = None
13462 if flags != None:
13463 self.flags = flags
13464 else:
13465 self.flags = 0
13466 if entries != None:
13467 self.entries = entries
13468 else:
13469 self.entries = []
13470 return
13471
13472 def pack(self):
13473 packed = []
13474 packed.append(struct.pack("!B", self.version))
13475 packed.append(struct.pack("!B", self.type))
13476 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13477 packed.append(struct.pack("!L", self.xid))
13478 packed.append(struct.pack("!H", self.stats_type))
13479 packed.append(struct.pack("!H", self.flags))
13480 packed.append('\x00' * 4)
13481 packed.append(loxi.generic_util.pack_list(self.entries))
13482 length = sum([len(x) for x in packed])
13483 packed[2] = struct.pack("!H", length)
13484 return ''.join(packed)
13485
13486 @staticmethod
13487 def unpack(reader):
13488 obj = port_stats_reply()
13489 _version = reader.read("!B")[0]
13490 assert(_version == 5)
13491 _type = reader.read("!B")[0]
13492 assert(_type == 19)
13493 _length = reader.read("!H")[0]
13494 orig_reader = reader
13495 reader = orig_reader.slice(_length - (2 + 2))
13496 obj.xid = reader.read("!L")[0]
13497 _stats_type = reader.read("!H")[0]
13498 assert(_stats_type == 4)
13499 obj.flags = reader.read("!H")[0]
13500 reader.skip(4)
13501 obj.entries = loxi.generic_util.unpack_list(reader, common.port_stats_entry.unpack)
13502 return obj
13503
13504 def __eq__(self, other):
13505 if type(self) != type(other): return False
13506 if self.xid != other.xid: return False
13507 if self.flags != other.flags: return False
13508 if self.entries != other.entries: return False
13509 return True
13510
13511 def pretty_print(self, q):
13512 q.text("port_stats_reply {")
13513 with q.group():
13514 with q.indent(2):
13515 q.breakable()
13516 q.text("xid = ");
13517 if self.xid != None:
13518 q.text("%#x" % self.xid)
13519 else:
13520 q.text('None')
13521 q.text(","); q.breakable()
13522 q.text("flags = ");
13523 q.text("%#x" % self.flags)
13524 q.text(","); q.breakable()
13525 q.text("entries = ");
13526 q.pp(self.entries)
13527 q.breakable()
13528 q.text('}')
13529
13530stats_reply.subtypes[4] = port_stats_reply
13531
13532class port_stats_request(stats_request):
13533 version = 5
13534 type = 18
13535 stats_type = 4
13536
13537 def __init__(self, xid=None, flags=None, port_no=None):
13538 if xid != None:
13539 self.xid = xid
13540 else:
13541 self.xid = None
13542 if flags != None:
13543 self.flags = flags
13544 else:
13545 self.flags = 0
13546 if port_no != None:
13547 self.port_no = port_no
13548 else:
13549 self.port_no = 0
13550 return
13551
13552 def pack(self):
13553 packed = []
13554 packed.append(struct.pack("!B", self.version))
13555 packed.append(struct.pack("!B", self.type))
13556 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13557 packed.append(struct.pack("!L", self.xid))
13558 packed.append(struct.pack("!H", self.stats_type))
13559 packed.append(struct.pack("!H", self.flags))
13560 packed.append('\x00' * 4)
13561 packed.append(util.pack_port_no(self.port_no))
13562 packed.append('\x00' * 4)
13563 length = sum([len(x) for x in packed])
13564 packed[2] = struct.pack("!H", length)
13565 return ''.join(packed)
13566
13567 @staticmethod
13568 def unpack(reader):
13569 obj = port_stats_request()
13570 _version = reader.read("!B")[0]
13571 assert(_version == 5)
13572 _type = reader.read("!B")[0]
13573 assert(_type == 18)
13574 _length = reader.read("!H")[0]
13575 orig_reader = reader
13576 reader = orig_reader.slice(_length - (2 + 2))
13577 obj.xid = reader.read("!L")[0]
13578 _stats_type = reader.read("!H")[0]
13579 assert(_stats_type == 4)
13580 obj.flags = reader.read("!H")[0]
13581 reader.skip(4)
13582 obj.port_no = util.unpack_port_no(reader)
13583 reader.skip(4)
13584 return obj
13585
13586 def __eq__(self, other):
13587 if type(self) != type(other): return False
13588 if self.xid != other.xid: return False
13589 if self.flags != other.flags: return False
13590 if self.port_no != other.port_no: return False
13591 return True
13592
13593 def pretty_print(self, q):
13594 q.text("port_stats_request {")
13595 with q.group():
13596 with q.indent(2):
13597 q.breakable()
13598 q.text("xid = ");
13599 if self.xid != None:
13600 q.text("%#x" % self.xid)
13601 else:
13602 q.text('None')
13603 q.text(","); q.breakable()
13604 q.text("flags = ");
13605 q.text("%#x" % self.flags)
13606 q.text(","); q.breakable()
13607 q.text("port_no = ");
13608 q.text(util.pretty_port(self.port_no))
13609 q.breakable()
13610 q.text('}')
13611
13612stats_request.subtypes[4] = port_stats_request
13613
13614class port_status(message):
13615 version = 5
13616 type = 12
13617
13618 def __init__(self, xid=None, reason=None, desc=None):
13619 if xid != None:
13620 self.xid = xid
13621 else:
13622 self.xid = None
13623 if reason != None:
13624 self.reason = reason
13625 else:
13626 self.reason = 0
13627 if desc != None:
13628 self.desc = desc
13629 else:
13630 self.desc = common.port_desc()
13631 return
13632
13633 def pack(self):
13634 packed = []
13635 packed.append(struct.pack("!B", self.version))
13636 packed.append(struct.pack("!B", self.type))
13637 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13638 packed.append(struct.pack("!L", self.xid))
13639 packed.append(struct.pack("!B", self.reason))
13640 packed.append('\x00' * 7)
13641 packed.append(self.desc.pack())
13642 length = sum([len(x) for x in packed])
13643 packed[2] = struct.pack("!H", length)
13644 return ''.join(packed)
13645
13646 @staticmethod
13647 def unpack(reader):
13648 obj = port_status()
13649 _version = reader.read("!B")[0]
13650 assert(_version == 5)
13651 _type = reader.read("!B")[0]
13652 assert(_type == 12)
13653 _length = reader.read("!H")[0]
13654 orig_reader = reader
13655 reader = orig_reader.slice(_length - (2 + 2))
13656 obj.xid = reader.read("!L")[0]
13657 obj.reason = reader.read("!B")[0]
13658 reader.skip(7)
13659 obj.desc = common.port_desc.unpack(reader)
13660 return obj
13661
13662 def __eq__(self, other):
13663 if type(self) != type(other): return False
13664 if self.xid != other.xid: return False
13665 if self.reason != other.reason: return False
13666 if self.desc != other.desc: return False
13667 return True
13668
13669 def pretty_print(self, q):
13670 q.text("port_status {")
13671 with q.group():
13672 with q.indent(2):
13673 q.breakable()
13674 q.text("xid = ");
13675 if self.xid != None:
13676 q.text("%#x" % self.xid)
13677 else:
13678 q.text('None')
13679 q.text(","); q.breakable()
13680 q.text("reason = ");
13681 q.text("%#x" % self.reason)
13682 q.text(","); q.breakable()
13683 q.text("desc = ");
13684 q.pp(self.desc)
13685 q.breakable()
13686 q.text('}')
13687
13688message.subtypes[12] = port_status
13689
13690class queue_desc_stats_reply(stats_reply):
13691 version = 5
13692 type = 19
13693 stats_type = 15
13694
13695 def __init__(self, xid=None, flags=None, entries=None):
13696 if xid != None:
13697 self.xid = xid
13698 else:
13699 self.xid = None
13700 if flags != None:
13701 self.flags = flags
13702 else:
13703 self.flags = 0
13704 if entries != None:
13705 self.entries = entries
13706 else:
13707 self.entries = []
13708 return
13709
13710 def pack(self):
13711 packed = []
13712 packed.append(struct.pack("!B", self.version))
13713 packed.append(struct.pack("!B", self.type))
13714 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13715 packed.append(struct.pack("!L", self.xid))
13716 packed.append(struct.pack("!H", self.stats_type))
13717 packed.append(struct.pack("!H", self.flags))
13718 packed.append('\x00' * 4)
13719 packed.append(loxi.generic_util.pack_list(self.entries))
13720 length = sum([len(x) for x in packed])
13721 packed[2] = struct.pack("!H", length)
13722 return ''.join(packed)
13723
13724 @staticmethod
13725 def unpack(reader):
13726 obj = queue_desc_stats_reply()
13727 _version = reader.read("!B")[0]
13728 assert(_version == 5)
13729 _type = reader.read("!B")[0]
13730 assert(_type == 19)
13731 _length = reader.read("!H")[0]
13732 orig_reader = reader
13733 reader = orig_reader.slice(_length - (2 + 2))
13734 obj.xid = reader.read("!L")[0]
13735 _stats_type = reader.read("!H")[0]
13736 assert(_stats_type == 15)
13737 obj.flags = reader.read("!H")[0]
13738 reader.skip(4)
13739 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_desc.unpack)
13740 return obj
13741
13742 def __eq__(self, other):
13743 if type(self) != type(other): return False
13744 if self.xid != other.xid: return False
13745 if self.flags != other.flags: return False
13746 if self.entries != other.entries: return False
13747 return True
13748
13749 def pretty_print(self, q):
13750 q.text("queue_desc_stats_reply {")
13751 with q.group():
13752 with q.indent(2):
13753 q.breakable()
13754 q.text("xid = ");
13755 if self.xid != None:
13756 q.text("%#x" % self.xid)
13757 else:
13758 q.text('None')
13759 q.text(","); q.breakable()
13760 q.text("flags = ");
13761 q.text("%#x" % self.flags)
13762 q.text(","); q.breakable()
13763 q.text("entries = ");
13764 q.pp(self.entries)
13765 q.breakable()
13766 q.text('}')
13767
13768stats_reply.subtypes[15] = queue_desc_stats_reply
13769
13770class queue_desc_stats_request(stats_request):
13771 version = 5
13772 type = 18
13773 stats_type = 15
13774
13775 def __init__(self, xid=None, flags=None):
13776 if xid != None:
13777 self.xid = xid
13778 else:
13779 self.xid = None
13780 if flags != None:
13781 self.flags = flags
13782 else:
13783 self.flags = 0
13784 return
13785
13786 def pack(self):
13787 packed = []
13788 packed.append(struct.pack("!B", self.version))
13789 packed.append(struct.pack("!B", self.type))
13790 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13791 packed.append(struct.pack("!L", self.xid))
13792 packed.append(struct.pack("!H", self.stats_type))
13793 packed.append(struct.pack("!H", self.flags))
13794 packed.append('\x00' * 4)
13795 length = sum([len(x) for x in packed])
13796 packed[2] = struct.pack("!H", length)
13797 return ''.join(packed)
13798
13799 @staticmethod
13800 def unpack(reader):
13801 obj = queue_desc_stats_request()
13802 _version = reader.read("!B")[0]
13803 assert(_version == 5)
13804 _type = reader.read("!B")[0]
13805 assert(_type == 18)
13806 _length = reader.read("!H")[0]
13807 orig_reader = reader
13808 reader = orig_reader.slice(_length - (2 + 2))
13809 obj.xid = reader.read("!L")[0]
13810 _stats_type = reader.read("!H")[0]
13811 assert(_stats_type == 15)
13812 obj.flags = reader.read("!H")[0]
13813 reader.skip(4)
13814 return obj
13815
13816 def __eq__(self, other):
13817 if type(self) != type(other): return False
13818 if self.xid != other.xid: return False
13819 if self.flags != other.flags: return False
13820 return True
13821
13822 def pretty_print(self, q):
13823 q.text("queue_desc_stats_request {")
13824 with q.group():
13825 with q.indent(2):
13826 q.breakable()
13827 q.text("xid = ");
13828 if self.xid != None:
13829 q.text("%#x" % self.xid)
13830 else:
13831 q.text('None')
13832 q.text(","); q.breakable()
13833 q.text("flags = ");
13834 q.text("%#x" % self.flags)
13835 q.breakable()
13836 q.text('}')
13837
13838stats_request.subtypes[15] = queue_desc_stats_request
13839
13840class queue_op_failed_error_msg(error_msg):
13841 version = 5
13842 type = 1
13843 err_type = 9
13844
13845 def __init__(self, xid=None, code=None, data=None):
13846 if xid != None:
13847 self.xid = xid
13848 else:
13849 self.xid = None
13850 if code != None:
13851 self.code = code
13852 else:
13853 self.code = 0
13854 if data != None:
13855 self.data = data
13856 else:
13857 self.data = ''
13858 return
13859
13860 def pack(self):
13861 packed = []
13862 packed.append(struct.pack("!B", self.version))
13863 packed.append(struct.pack("!B", self.type))
13864 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13865 packed.append(struct.pack("!L", self.xid))
13866 packed.append(struct.pack("!H", self.err_type))
13867 packed.append(struct.pack("!H", self.code))
13868 packed.append(self.data)
13869 length = sum([len(x) for x in packed])
13870 packed[2] = struct.pack("!H", length)
13871 return ''.join(packed)
13872
13873 @staticmethod
13874 def unpack(reader):
13875 obj = queue_op_failed_error_msg()
13876 _version = reader.read("!B")[0]
13877 assert(_version == 5)
13878 _type = reader.read("!B")[0]
13879 assert(_type == 1)
13880 _length = reader.read("!H")[0]
13881 orig_reader = reader
13882 reader = orig_reader.slice(_length - (2 + 2))
13883 obj.xid = reader.read("!L")[0]
13884 _err_type = reader.read("!H")[0]
13885 assert(_err_type == 9)
13886 obj.code = reader.read("!H")[0]
13887 obj.data = str(reader.read_all())
13888 return obj
13889
13890 def __eq__(self, other):
13891 if type(self) != type(other): return False
13892 if self.xid != other.xid: return False
13893 if self.code != other.code: return False
13894 if self.data != other.data: return False
13895 return True
13896
13897 def pretty_print(self, q):
13898 q.text("queue_op_failed_error_msg {")
13899 with q.group():
13900 with q.indent(2):
13901 q.breakable()
13902 q.text("xid = ");
13903 if self.xid != None:
13904 q.text("%#x" % self.xid)
13905 else:
13906 q.text('None')
13907 q.text(","); q.breakable()
13908 q.text("code = ");
13909 q.text("%#x" % self.code)
13910 q.text(","); q.breakable()
13911 q.text("data = ");
13912 q.pp(self.data)
13913 q.breakable()
13914 q.text('}')
13915
13916error_msg.subtypes[9] = queue_op_failed_error_msg
13917
13918class queue_stats_reply(stats_reply):
13919 version = 5
13920 type = 19
13921 stats_type = 5
13922
13923 def __init__(self, xid=None, flags=None, entries=None):
13924 if xid != None:
13925 self.xid = xid
13926 else:
13927 self.xid = None
13928 if flags != None:
13929 self.flags = flags
13930 else:
13931 self.flags = 0
13932 if entries != None:
13933 self.entries = entries
13934 else:
13935 self.entries = []
13936 return
13937
13938 def pack(self):
13939 packed = []
13940 packed.append(struct.pack("!B", self.version))
13941 packed.append(struct.pack("!B", self.type))
13942 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
13943 packed.append(struct.pack("!L", self.xid))
13944 packed.append(struct.pack("!H", self.stats_type))
13945 packed.append(struct.pack("!H", self.flags))
13946 packed.append('\x00' * 4)
13947 packed.append(loxi.generic_util.pack_list(self.entries))
13948 length = sum([len(x) for x in packed])
13949 packed[2] = struct.pack("!H", length)
13950 return ''.join(packed)
13951
13952 @staticmethod
13953 def unpack(reader):
13954 obj = queue_stats_reply()
13955 _version = reader.read("!B")[0]
13956 assert(_version == 5)
13957 _type = reader.read("!B")[0]
13958 assert(_type == 19)
13959 _length = reader.read("!H")[0]
13960 orig_reader = reader
13961 reader = orig_reader.slice(_length - (2 + 2))
13962 obj.xid = reader.read("!L")[0]
13963 _stats_type = reader.read("!H")[0]
13964 assert(_stats_type == 5)
13965 obj.flags = reader.read("!H")[0]
13966 reader.skip(4)
13967 obj.entries = loxi.generic_util.unpack_list(reader, common.queue_stats_entry.unpack)
13968 return obj
13969
13970 def __eq__(self, other):
13971 if type(self) != type(other): return False
13972 if self.xid != other.xid: return False
13973 if self.flags != other.flags: return False
13974 if self.entries != other.entries: return False
13975 return True
13976
13977 def pretty_print(self, q):
13978 q.text("queue_stats_reply {")
13979 with q.group():
13980 with q.indent(2):
13981 q.breakable()
13982 q.text("xid = ");
13983 if self.xid != None:
13984 q.text("%#x" % self.xid)
13985 else:
13986 q.text('None')
13987 q.text(","); q.breakable()
13988 q.text("flags = ");
13989 q.text("%#x" % self.flags)
13990 q.text(","); q.breakable()
13991 q.text("entries = ");
13992 q.pp(self.entries)
13993 q.breakable()
13994 q.text('}')
13995
13996stats_reply.subtypes[5] = queue_stats_reply
13997
13998class queue_stats_request(stats_request):
13999 version = 5
14000 type = 18
14001 stats_type = 5
14002
14003 def __init__(self, xid=None, flags=None, port_no=None, queue_id=None):
14004 if xid != None:
14005 self.xid = xid
14006 else:
14007 self.xid = None
14008 if flags != None:
14009 self.flags = flags
14010 else:
14011 self.flags = 0
14012 if port_no != None:
14013 self.port_no = port_no
14014 else:
14015 self.port_no = 0
14016 if queue_id != None:
14017 self.queue_id = queue_id
14018 else:
14019 self.queue_id = 0
14020 return
14021
14022 def pack(self):
14023 packed = []
14024 packed.append(struct.pack("!B", self.version))
14025 packed.append(struct.pack("!B", self.type))
14026 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14027 packed.append(struct.pack("!L", self.xid))
14028 packed.append(struct.pack("!H", self.stats_type))
14029 packed.append(struct.pack("!H", self.flags))
14030 packed.append('\x00' * 4)
14031 packed.append(util.pack_port_no(self.port_no))
14032 packed.append(struct.pack("!L", self.queue_id))
14033 length = sum([len(x) for x in packed])
14034 packed[2] = struct.pack("!H", length)
14035 return ''.join(packed)
14036
14037 @staticmethod
14038 def unpack(reader):
14039 obj = queue_stats_request()
14040 _version = reader.read("!B")[0]
14041 assert(_version == 5)
14042 _type = reader.read("!B")[0]
14043 assert(_type == 18)
14044 _length = reader.read("!H")[0]
14045 orig_reader = reader
14046 reader = orig_reader.slice(_length - (2 + 2))
14047 obj.xid = reader.read("!L")[0]
14048 _stats_type = reader.read("!H")[0]
14049 assert(_stats_type == 5)
14050 obj.flags = reader.read("!H")[0]
14051 reader.skip(4)
14052 obj.port_no = util.unpack_port_no(reader)
14053 obj.queue_id = reader.read("!L")[0]
14054 return obj
14055
14056 def __eq__(self, other):
14057 if type(self) != type(other): return False
14058 if self.xid != other.xid: return False
14059 if self.flags != other.flags: return False
14060 if self.port_no != other.port_no: return False
14061 if self.queue_id != other.queue_id: return False
14062 return True
14063
14064 def pretty_print(self, q):
14065 q.text("queue_stats_request {")
14066 with q.group():
14067 with q.indent(2):
14068 q.breakable()
14069 q.text("xid = ");
14070 if self.xid != None:
14071 q.text("%#x" % self.xid)
14072 else:
14073 q.text('None')
14074 q.text(","); q.breakable()
14075 q.text("flags = ");
14076 q.text("%#x" % self.flags)
14077 q.text(","); q.breakable()
14078 q.text("port_no = ");
14079 q.text(util.pretty_port(self.port_no))
14080 q.text(","); q.breakable()
14081 q.text("queue_id = ");
14082 q.text("%#x" % self.queue_id)
14083 q.breakable()
14084 q.text('}')
14085
14086stats_request.subtypes[5] = queue_stats_request
14087
14088class requestforward(message):
14089 version = 5
14090 type = 32
14091
14092 def __init__(self, xid=None, role=None, data=None):
14093 if xid != None:
14094 self.xid = xid
14095 else:
14096 self.xid = None
14097 if role != None:
14098 self.role = role
14099 else:
14100 self.role = 0
14101 if data != None:
14102 self.data = data
14103 else:
14104 self.data = ''
14105 return
14106
14107 def pack(self):
14108 packed = []
14109 packed.append(struct.pack("!B", self.version))
14110 packed.append(struct.pack("!B", self.type))
14111 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14112 packed.append(struct.pack("!L", self.xid))
14113 packed.append(struct.pack("!L", self.role))
14114 packed.append(self.data)
14115 length = sum([len(x) for x in packed])
14116 packed[2] = struct.pack("!H", length)
14117 return ''.join(packed)
14118
14119 @staticmethod
14120 def unpack(reader):
14121 obj = requestforward()
14122 _version = reader.read("!B")[0]
14123 assert(_version == 5)
14124 _type = reader.read("!B")[0]
14125 assert(_type == 32)
14126 _length = reader.read("!H")[0]
14127 orig_reader = reader
14128 reader = orig_reader.slice(_length - (2 + 2))
14129 obj.xid = reader.read("!L")[0]
14130 obj.role = reader.read("!L")[0]
14131 obj.data = str(reader.read_all())
14132 return obj
14133
14134 def __eq__(self, other):
14135 if type(self) != type(other): return False
14136 if self.xid != other.xid: return False
14137 if self.role != other.role: return False
14138 if self.data != other.data: return False
14139 return True
14140
14141 def pretty_print(self, q):
14142 q.text("requestforward {")
14143 with q.group():
14144 with q.indent(2):
14145 q.breakable()
14146 q.text("xid = ");
14147 if self.xid != None:
14148 q.text("%#x" % self.xid)
14149 else:
14150 q.text('None')
14151 q.text(","); q.breakable()
14152 q.text("role = ");
14153 q.text("%#x" % self.role)
14154 q.text(","); q.breakable()
14155 q.text("data = ");
14156 q.pp(self.data)
14157 q.breakable()
14158 q.text('}')
14159
14160message.subtypes[32] = requestforward
14161
14162class role_reply(message):
14163 version = 5
14164 type = 25
14165
14166 def __init__(self, xid=None, role=None, generation_id=None):
14167 if xid != None:
14168 self.xid = xid
14169 else:
14170 self.xid = None
14171 if role != None:
14172 self.role = role
14173 else:
14174 self.role = 0
14175 if generation_id != None:
14176 self.generation_id = generation_id
14177 else:
14178 self.generation_id = 0
14179 return
14180
14181 def pack(self):
14182 packed = []
14183 packed.append(struct.pack("!B", self.version))
14184 packed.append(struct.pack("!B", self.type))
14185 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14186 packed.append(struct.pack("!L", self.xid))
14187 packed.append(struct.pack("!L", self.role))
14188 packed.append('\x00' * 4)
14189 packed.append(struct.pack("!Q", self.generation_id))
14190 length = sum([len(x) for x in packed])
14191 packed[2] = struct.pack("!H", length)
14192 return ''.join(packed)
14193
14194 @staticmethod
14195 def unpack(reader):
14196 obj = role_reply()
14197 _version = reader.read("!B")[0]
14198 assert(_version == 5)
14199 _type = reader.read("!B")[0]
14200 assert(_type == 25)
14201 _length = reader.read("!H")[0]
14202 orig_reader = reader
14203 reader = orig_reader.slice(_length - (2 + 2))
14204 obj.xid = reader.read("!L")[0]
14205 obj.role = reader.read("!L")[0]
14206 reader.skip(4)
14207 obj.generation_id = reader.read("!Q")[0]
14208 return obj
14209
14210 def __eq__(self, other):
14211 if type(self) != type(other): return False
14212 if self.xid != other.xid: return False
14213 if self.role != other.role: return False
14214 if self.generation_id != other.generation_id: return False
14215 return True
14216
14217 def pretty_print(self, q):
14218 q.text("role_reply {")
14219 with q.group():
14220 with q.indent(2):
14221 q.breakable()
14222 q.text("xid = ");
14223 if self.xid != None:
14224 q.text("%#x" % self.xid)
14225 else:
14226 q.text('None')
14227 q.text(","); q.breakable()
14228 q.text("role = ");
14229 q.text("%#x" % self.role)
14230 q.text(","); q.breakable()
14231 q.text("generation_id = ");
14232 q.text("%#x" % self.generation_id)
14233 q.breakable()
14234 q.text('}')
14235
14236message.subtypes[25] = role_reply
14237
14238class role_request(message):
14239 version = 5
14240 type = 24
14241
14242 def __init__(self, xid=None, role=None, generation_id=None):
14243 if xid != None:
14244 self.xid = xid
14245 else:
14246 self.xid = None
14247 if role != None:
14248 self.role = role
14249 else:
14250 self.role = 0
14251 if generation_id != None:
14252 self.generation_id = generation_id
14253 else:
14254 self.generation_id = 0
14255 return
14256
14257 def pack(self):
14258 packed = []
14259 packed.append(struct.pack("!B", self.version))
14260 packed.append(struct.pack("!B", self.type))
14261 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14262 packed.append(struct.pack("!L", self.xid))
14263 packed.append(struct.pack("!L", self.role))
14264 packed.append('\x00' * 4)
14265 packed.append(struct.pack("!Q", self.generation_id))
14266 length = sum([len(x) for x in packed])
14267 packed[2] = struct.pack("!H", length)
14268 return ''.join(packed)
14269
14270 @staticmethod
14271 def unpack(reader):
14272 obj = role_request()
14273 _version = reader.read("!B")[0]
14274 assert(_version == 5)
14275 _type = reader.read("!B")[0]
14276 assert(_type == 24)
14277 _length = reader.read("!H")[0]
14278 orig_reader = reader
14279 reader = orig_reader.slice(_length - (2 + 2))
14280 obj.xid = reader.read("!L")[0]
14281 obj.role = reader.read("!L")[0]
14282 reader.skip(4)
14283 obj.generation_id = reader.read("!Q")[0]
14284 return obj
14285
14286 def __eq__(self, other):
14287 if type(self) != type(other): return False
14288 if self.xid != other.xid: return False
14289 if self.role != other.role: return False
14290 if self.generation_id != other.generation_id: return False
14291 return True
14292
14293 def pretty_print(self, q):
14294 q.text("role_request {")
14295 with q.group():
14296 with q.indent(2):
14297 q.breakable()
14298 q.text("xid = ");
14299 if self.xid != None:
14300 q.text("%#x" % self.xid)
14301 else:
14302 q.text('None')
14303 q.text(","); q.breakable()
14304 q.text("role = ");
14305 q.text("%#x" % self.role)
14306 q.text(","); q.breakable()
14307 q.text("generation_id = ");
14308 q.text("%#x" % self.generation_id)
14309 q.breakable()
14310 q.text('}')
14311
14312message.subtypes[24] = role_request
14313
14314class role_request_failed_error_msg(error_msg):
14315 version = 5
14316 type = 1
14317 err_type = 11
14318
14319 def __init__(self, xid=None, code=None, data=None):
14320 if xid != None:
14321 self.xid = xid
14322 else:
14323 self.xid = None
14324 if code != None:
14325 self.code = code
14326 else:
14327 self.code = 0
14328 if data != None:
14329 self.data = data
14330 else:
14331 self.data = ''
14332 return
14333
14334 def pack(self):
14335 packed = []
14336 packed.append(struct.pack("!B", self.version))
14337 packed.append(struct.pack("!B", self.type))
14338 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14339 packed.append(struct.pack("!L", self.xid))
14340 packed.append(struct.pack("!H", self.err_type))
14341 packed.append(struct.pack("!H", self.code))
14342 packed.append(self.data)
14343 length = sum([len(x) for x in packed])
14344 packed[2] = struct.pack("!H", length)
14345 return ''.join(packed)
14346
14347 @staticmethod
14348 def unpack(reader):
14349 obj = role_request_failed_error_msg()
14350 _version = reader.read("!B")[0]
14351 assert(_version == 5)
14352 _type = reader.read("!B")[0]
14353 assert(_type == 1)
14354 _length = reader.read("!H")[0]
14355 orig_reader = reader
14356 reader = orig_reader.slice(_length - (2 + 2))
14357 obj.xid = reader.read("!L")[0]
14358 _err_type = reader.read("!H")[0]
14359 assert(_err_type == 11)
14360 obj.code = reader.read("!H")[0]
14361 obj.data = str(reader.read_all())
14362 return obj
14363
14364 def __eq__(self, other):
14365 if type(self) != type(other): return False
14366 if self.xid != other.xid: return False
14367 if self.code != other.code: return False
14368 if self.data != other.data: return False
14369 return True
14370
14371 def pretty_print(self, q):
14372 q.text("role_request_failed_error_msg {")
14373 with q.group():
14374 with q.indent(2):
14375 q.breakable()
14376 q.text("xid = ");
14377 if self.xid != None:
14378 q.text("%#x" % self.xid)
14379 else:
14380 q.text('None')
14381 q.text(","); q.breakable()
14382 q.text("code = ");
14383 q.text("%#x" % self.code)
14384 q.text(","); q.breakable()
14385 q.text("data = ");
14386 q.pp(self.data)
14387 q.breakable()
14388 q.text('}')
14389
14390error_msg.subtypes[11] = role_request_failed_error_msg
14391
14392class role_status(message):
14393 version = 5
14394 type = 30
14395
14396 def __init__(self, xid=None, role=None, reason=None, generation_id=None, properties=None):
14397 if xid != None:
14398 self.xid = xid
14399 else:
14400 self.xid = None
14401 if role != None:
14402 self.role = role
14403 else:
14404 self.role = 0
14405 if reason != None:
14406 self.reason = reason
14407 else:
14408 self.reason = 0
14409 if generation_id != None:
14410 self.generation_id = generation_id
14411 else:
14412 self.generation_id = 0
14413 if properties != None:
14414 self.properties = properties
14415 else:
14416 self.properties = []
14417 return
14418
14419 def pack(self):
14420 packed = []
14421 packed.append(struct.pack("!B", self.version))
14422 packed.append(struct.pack("!B", self.type))
14423 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14424 packed.append(struct.pack("!L", self.xid))
14425 packed.append(struct.pack("!L", self.role))
14426 packed.append(struct.pack("!B", self.reason))
14427 packed.append('\x00' * 3)
14428 packed.append(struct.pack("!Q", self.generation_id))
14429 packed.append(loxi.generic_util.pack_list(self.properties))
14430 length = sum([len(x) for x in packed])
14431 packed[2] = struct.pack("!H", length)
14432 return ''.join(packed)
14433
14434 @staticmethod
14435 def unpack(reader):
14436 obj = role_status()
14437 _version = reader.read("!B")[0]
14438 assert(_version == 5)
14439 _type = reader.read("!B")[0]
14440 assert(_type == 30)
14441 _length = reader.read("!H")[0]
14442 orig_reader = reader
14443 reader = orig_reader.slice(_length - (2 + 2))
14444 obj.xid = reader.read("!L")[0]
14445 obj.role = reader.read("!L")[0]
14446 obj.reason = reader.read("!B")[0]
14447 reader.skip(3)
14448 obj.generation_id = reader.read("!Q")[0]
14449 obj.properties = loxi.generic_util.unpack_list(reader, role_prop.role_prop.unpack)
14450 return obj
14451
14452 def __eq__(self, other):
14453 if type(self) != type(other): return False
14454 if self.xid != other.xid: return False
14455 if self.role != other.role: return False
14456 if self.reason != other.reason: return False
14457 if self.generation_id != other.generation_id: return False
14458 if self.properties != other.properties: return False
14459 return True
14460
14461 def pretty_print(self, q):
14462 q.text("role_status {")
14463 with q.group():
14464 with q.indent(2):
14465 q.breakable()
14466 q.text("xid = ");
14467 if self.xid != None:
14468 q.text("%#x" % self.xid)
14469 else:
14470 q.text('None')
14471 q.text(","); q.breakable()
14472 q.text("role = ");
14473 q.text("%#x" % self.role)
14474 q.text(","); q.breakable()
14475 q.text("reason = ");
14476 q.text("%#x" % self.reason)
14477 q.text(","); q.breakable()
14478 q.text("generation_id = ");
14479 q.text("%#x" % self.generation_id)
14480 q.text(","); q.breakable()
14481 q.text("properties = ");
14482 q.pp(self.properties)
14483 q.breakable()
14484 q.text('}')
14485
14486message.subtypes[30] = role_status
14487
14488class set_config(message):
14489 version = 5
14490 type = 9
14491
14492 def __init__(self, xid=None, flags=None, miss_send_len=None):
14493 if xid != None:
14494 self.xid = xid
14495 else:
14496 self.xid = None
14497 if flags != None:
14498 self.flags = flags
14499 else:
14500 self.flags = 0
14501 if miss_send_len != None:
14502 self.miss_send_len = miss_send_len
14503 else:
14504 self.miss_send_len = 0
14505 return
14506
14507 def pack(self):
14508 packed = []
14509 packed.append(struct.pack("!B", self.version))
14510 packed.append(struct.pack("!B", self.type))
14511 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14512 packed.append(struct.pack("!L", self.xid))
14513 packed.append(struct.pack("!H", self.flags))
14514 packed.append(struct.pack("!H", self.miss_send_len))
14515 length = sum([len(x) for x in packed])
14516 packed[2] = struct.pack("!H", length)
14517 return ''.join(packed)
14518
14519 @staticmethod
14520 def unpack(reader):
14521 obj = set_config()
14522 _version = reader.read("!B")[0]
14523 assert(_version == 5)
14524 _type = reader.read("!B")[0]
14525 assert(_type == 9)
14526 _length = reader.read("!H")[0]
14527 orig_reader = reader
14528 reader = orig_reader.slice(_length - (2 + 2))
14529 obj.xid = reader.read("!L")[0]
14530 obj.flags = reader.read("!H")[0]
14531 obj.miss_send_len = reader.read("!H")[0]
14532 return obj
14533
14534 def __eq__(self, other):
14535 if type(self) != type(other): return False
14536 if self.xid != other.xid: return False
14537 if self.flags != other.flags: return False
14538 if self.miss_send_len != other.miss_send_len: return False
14539 return True
14540
14541 def pretty_print(self, q):
14542 q.text("set_config {")
14543 with q.group():
14544 with q.indent(2):
14545 q.breakable()
14546 q.text("xid = ");
14547 if self.xid != None:
14548 q.text("%#x" % self.xid)
14549 else:
14550 q.text('None')
14551 q.text(","); q.breakable()
14552 q.text("flags = ");
14553 q.text("%#x" % self.flags)
14554 q.text(","); q.breakable()
14555 q.text("miss_send_len = ");
14556 q.text("%#x" % self.miss_send_len)
14557 q.breakable()
14558 q.text('}')
14559
14560message.subtypes[9] = set_config
14561
14562class switch_config_failed_error_msg(error_msg):
14563 version = 5
14564 type = 1
14565 err_type = 10
14566
14567 def __init__(self, xid=None, code=None, data=None):
14568 if xid != None:
14569 self.xid = xid
14570 else:
14571 self.xid = None
14572 if code != None:
14573 self.code = code
14574 else:
14575 self.code = 0
14576 if data != None:
14577 self.data = data
14578 else:
14579 self.data = ''
14580 return
14581
14582 def pack(self):
14583 packed = []
14584 packed.append(struct.pack("!B", self.version))
14585 packed.append(struct.pack("!B", self.type))
14586 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14587 packed.append(struct.pack("!L", self.xid))
14588 packed.append(struct.pack("!H", self.err_type))
14589 packed.append(struct.pack("!H", self.code))
14590 packed.append(self.data)
14591 length = sum([len(x) for x in packed])
14592 packed[2] = struct.pack("!H", length)
14593 return ''.join(packed)
14594
14595 @staticmethod
14596 def unpack(reader):
14597 obj = switch_config_failed_error_msg()
14598 _version = reader.read("!B")[0]
14599 assert(_version == 5)
14600 _type = reader.read("!B")[0]
14601 assert(_type == 1)
14602 _length = reader.read("!H")[0]
14603 orig_reader = reader
14604 reader = orig_reader.slice(_length - (2 + 2))
14605 obj.xid = reader.read("!L")[0]
14606 _err_type = reader.read("!H")[0]
14607 assert(_err_type == 10)
14608 obj.code = reader.read("!H")[0]
14609 obj.data = str(reader.read_all())
14610 return obj
14611
14612 def __eq__(self, other):
14613 if type(self) != type(other): return False
14614 if self.xid != other.xid: return False
14615 if self.code != other.code: return False
14616 if self.data != other.data: return False
14617 return True
14618
14619 def pretty_print(self, q):
14620 q.text("switch_config_failed_error_msg {")
14621 with q.group():
14622 with q.indent(2):
14623 q.breakable()
14624 q.text("xid = ");
14625 if self.xid != None:
14626 q.text("%#x" % self.xid)
14627 else:
14628 q.text('None')
14629 q.text(","); q.breakable()
14630 q.text("code = ");
14631 q.text("%#x" % self.code)
14632 q.text(","); q.breakable()
14633 q.text("data = ");
14634 q.pp(self.data)
14635 q.breakable()
14636 q.text('}')
14637
14638error_msg.subtypes[10] = switch_config_failed_error_msg
14639
14640class table_desc_stats_reply(stats_reply):
14641 version = 5
14642 type = 19
14643 stats_type = 14
14644
14645 def __init__(self, xid=None, flags=None, entries=None):
14646 if xid != None:
14647 self.xid = xid
14648 else:
14649 self.xid = None
14650 if flags != None:
14651 self.flags = flags
14652 else:
14653 self.flags = 0
14654 if entries != None:
14655 self.entries = entries
14656 else:
14657 self.entries = []
14658 return
14659
14660 def pack(self):
14661 packed = []
14662 packed.append(struct.pack("!B", self.version))
14663 packed.append(struct.pack("!B", self.type))
14664 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14665 packed.append(struct.pack("!L", self.xid))
14666 packed.append(struct.pack("!H", self.stats_type))
14667 packed.append(struct.pack("!H", self.flags))
14668 packed.append('\x00' * 4)
14669 packed.append(loxi.generic_util.pack_list(self.entries))
14670 length = sum([len(x) for x in packed])
14671 packed[2] = struct.pack("!H", length)
14672 return ''.join(packed)
14673
14674 @staticmethod
14675 def unpack(reader):
14676 obj = table_desc_stats_reply()
14677 _version = reader.read("!B")[0]
14678 assert(_version == 5)
14679 _type = reader.read("!B")[0]
14680 assert(_type == 19)
14681 _length = reader.read("!H")[0]
14682 orig_reader = reader
14683 reader = orig_reader.slice(_length - (2 + 2))
14684 obj.xid = reader.read("!L")[0]
14685 _stats_type = reader.read("!H")[0]
14686 assert(_stats_type == 14)
14687 obj.flags = reader.read("!H")[0]
14688 reader.skip(4)
14689 obj.entries = loxi.generic_util.unpack_list(reader, common.table_desc.unpack)
14690 return obj
14691
14692 def __eq__(self, other):
14693 if type(self) != type(other): return False
14694 if self.xid != other.xid: return False
14695 if self.flags != other.flags: return False
14696 if self.entries != other.entries: return False
14697 return True
14698
14699 def pretty_print(self, q):
14700 q.text("table_desc_stats_reply {")
14701 with q.group():
14702 with q.indent(2):
14703 q.breakable()
14704 q.text("xid = ");
14705 if self.xid != None:
14706 q.text("%#x" % self.xid)
14707 else:
14708 q.text('None')
14709 q.text(","); q.breakable()
14710 q.text("flags = ");
14711 q.text("%#x" % self.flags)
14712 q.text(","); q.breakable()
14713 q.text("entries = ");
14714 q.pp(self.entries)
14715 q.breakable()
14716 q.text('}')
14717
14718stats_reply.subtypes[14] = table_desc_stats_reply
14719
14720class table_desc_stats_request(stats_request):
14721 version = 5
14722 type = 18
14723 stats_type = 14
14724
14725 def __init__(self, xid=None, flags=None):
14726 if xid != None:
14727 self.xid = xid
14728 else:
14729 self.xid = None
14730 if flags != None:
14731 self.flags = flags
14732 else:
14733 self.flags = 0
14734 return
14735
14736 def pack(self):
14737 packed = []
14738 packed.append(struct.pack("!B", self.version))
14739 packed.append(struct.pack("!B", self.type))
14740 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14741 packed.append(struct.pack("!L", self.xid))
14742 packed.append(struct.pack("!H", self.stats_type))
14743 packed.append(struct.pack("!H", self.flags))
14744 packed.append('\x00' * 4)
14745 length = sum([len(x) for x in packed])
14746 packed[2] = struct.pack("!H", length)
14747 return ''.join(packed)
14748
14749 @staticmethod
14750 def unpack(reader):
14751 obj = table_desc_stats_request()
14752 _version = reader.read("!B")[0]
14753 assert(_version == 5)
14754 _type = reader.read("!B")[0]
14755 assert(_type == 18)
14756 _length = reader.read("!H")[0]
14757 orig_reader = reader
14758 reader = orig_reader.slice(_length - (2 + 2))
14759 obj.xid = reader.read("!L")[0]
14760 _stats_type = reader.read("!H")[0]
14761 assert(_stats_type == 14)
14762 obj.flags = reader.read("!H")[0]
14763 reader.skip(4)
14764 return obj
14765
14766 def __eq__(self, other):
14767 if type(self) != type(other): return False
14768 if self.xid != other.xid: return False
14769 if self.flags != other.flags: return False
14770 return True
14771
14772 def pretty_print(self, q):
14773 q.text("table_desc_stats_request {")
14774 with q.group():
14775 with q.indent(2):
14776 q.breakable()
14777 q.text("xid = ");
14778 if self.xid != None:
14779 q.text("%#x" % self.xid)
14780 else:
14781 q.text('None')
14782 q.text(","); q.breakable()
14783 q.text("flags = ");
14784 q.text("%#x" % self.flags)
14785 q.breakable()
14786 q.text('}')
14787
14788stats_request.subtypes[14] = table_desc_stats_request
14789
14790class table_features_failed_error_msg(error_msg):
14791 version = 5
14792 type = 1
14793 err_type = 13
14794
14795 def __init__(self, xid=None, code=None, data=None):
14796 if xid != None:
14797 self.xid = xid
14798 else:
14799 self.xid = None
14800 if code != None:
14801 self.code = code
14802 else:
14803 self.code = 0
14804 if data != None:
14805 self.data = data
14806 else:
14807 self.data = ''
14808 return
14809
14810 def pack(self):
14811 packed = []
14812 packed.append(struct.pack("!B", self.version))
14813 packed.append(struct.pack("!B", self.type))
14814 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14815 packed.append(struct.pack("!L", self.xid))
14816 packed.append(struct.pack("!H", self.err_type))
14817 packed.append(struct.pack("!H", self.code))
14818 packed.append(self.data)
14819 length = sum([len(x) for x in packed])
14820 packed[2] = struct.pack("!H", length)
14821 return ''.join(packed)
14822
14823 @staticmethod
14824 def unpack(reader):
14825 obj = table_features_failed_error_msg()
14826 _version = reader.read("!B")[0]
14827 assert(_version == 5)
14828 _type = reader.read("!B")[0]
14829 assert(_type == 1)
14830 _length = reader.read("!H")[0]
14831 orig_reader = reader
14832 reader = orig_reader.slice(_length - (2 + 2))
14833 obj.xid = reader.read("!L")[0]
14834 _err_type = reader.read("!H")[0]
14835 assert(_err_type == 13)
14836 obj.code = reader.read("!H")[0]
14837 obj.data = str(reader.read_all())
14838 return obj
14839
14840 def __eq__(self, other):
14841 if type(self) != type(other): return False
14842 if self.xid != other.xid: return False
14843 if self.code != other.code: return False
14844 if self.data != other.data: return False
14845 return True
14846
14847 def pretty_print(self, q):
14848 q.text("table_features_failed_error_msg {")
14849 with q.group():
14850 with q.indent(2):
14851 q.breakable()
14852 q.text("xid = ");
14853 if self.xid != None:
14854 q.text("%#x" % self.xid)
14855 else:
14856 q.text('None')
14857 q.text(","); q.breakable()
14858 q.text("code = ");
14859 q.text("%#x" % self.code)
14860 q.text(","); q.breakable()
14861 q.text("data = ");
14862 q.pp(self.data)
14863 q.breakable()
14864 q.text('}')
14865
14866error_msg.subtypes[13] = table_features_failed_error_msg
14867
14868class table_features_stats_reply(stats_reply):
14869 version = 5
14870 type = 19
14871 stats_type = 12
14872
14873 def __init__(self, xid=None, flags=None, entries=None):
14874 if xid != None:
14875 self.xid = xid
14876 else:
14877 self.xid = None
14878 if flags != None:
14879 self.flags = flags
14880 else:
14881 self.flags = 0
14882 if entries != None:
14883 self.entries = entries
14884 else:
14885 self.entries = []
14886 return
14887
14888 def pack(self):
14889 packed = []
14890 packed.append(struct.pack("!B", self.version))
14891 packed.append(struct.pack("!B", self.type))
14892 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14893 packed.append(struct.pack("!L", self.xid))
14894 packed.append(struct.pack("!H", self.stats_type))
14895 packed.append(struct.pack("!H", self.flags))
14896 packed.append('\x00' * 4)
14897 packed.append(loxi.generic_util.pack_list(self.entries))
14898 length = sum([len(x) for x in packed])
14899 packed[2] = struct.pack("!H", length)
14900 return ''.join(packed)
14901
14902 @staticmethod
14903 def unpack(reader):
14904 obj = table_features_stats_reply()
14905 _version = reader.read("!B")[0]
14906 assert(_version == 5)
14907 _type = reader.read("!B")[0]
14908 assert(_type == 19)
14909 _length = reader.read("!H")[0]
14910 orig_reader = reader
14911 reader = orig_reader.slice(_length - (2 + 2))
14912 obj.xid = reader.read("!L")[0]
14913 _stats_type = reader.read("!H")[0]
14914 assert(_stats_type == 12)
14915 obj.flags = reader.read("!H")[0]
14916 reader.skip(4)
14917 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
14918 return obj
14919
14920 def __eq__(self, other):
14921 if type(self) != type(other): return False
14922 if self.xid != other.xid: return False
14923 if self.flags != other.flags: return False
14924 if self.entries != other.entries: return False
14925 return True
14926
14927 def pretty_print(self, q):
14928 q.text("table_features_stats_reply {")
14929 with q.group():
14930 with q.indent(2):
14931 q.breakable()
14932 q.text("xid = ");
14933 if self.xid != None:
14934 q.text("%#x" % self.xid)
14935 else:
14936 q.text('None')
14937 q.text(","); q.breakable()
14938 q.text("flags = ");
14939 q.text("%#x" % self.flags)
14940 q.text(","); q.breakable()
14941 q.text("entries = ");
14942 q.pp(self.entries)
14943 q.breakable()
14944 q.text('}')
14945
14946stats_reply.subtypes[12] = table_features_stats_reply
14947
14948class table_features_stats_request(stats_request):
14949 version = 5
14950 type = 18
14951 stats_type = 12
14952
14953 def __init__(self, xid=None, flags=None, entries=None):
14954 if xid != None:
14955 self.xid = xid
14956 else:
14957 self.xid = None
14958 if flags != None:
14959 self.flags = flags
14960 else:
14961 self.flags = 0
14962 if entries != None:
14963 self.entries = entries
14964 else:
14965 self.entries = []
14966 return
14967
14968 def pack(self):
14969 packed = []
14970 packed.append(struct.pack("!B", self.version))
14971 packed.append(struct.pack("!B", self.type))
14972 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
14973 packed.append(struct.pack("!L", self.xid))
14974 packed.append(struct.pack("!H", self.stats_type))
14975 packed.append(struct.pack("!H", self.flags))
14976 packed.append('\x00' * 4)
14977 packed.append(loxi.generic_util.pack_list(self.entries))
14978 length = sum([len(x) for x in packed])
14979 packed[2] = struct.pack("!H", length)
14980 return ''.join(packed)
14981
14982 @staticmethod
14983 def unpack(reader):
14984 obj = table_features_stats_request()
14985 _version = reader.read("!B")[0]
14986 assert(_version == 5)
14987 _type = reader.read("!B")[0]
14988 assert(_type == 18)
14989 _length = reader.read("!H")[0]
14990 orig_reader = reader
14991 reader = orig_reader.slice(_length - (2 + 2))
14992 obj.xid = reader.read("!L")[0]
14993 _stats_type = reader.read("!H")[0]
14994 assert(_stats_type == 12)
14995 obj.flags = reader.read("!H")[0]
14996 reader.skip(4)
14997 obj.entries = loxi.generic_util.unpack_list(reader, common.table_features.unpack)
14998 return obj
14999
15000 def __eq__(self, other):
15001 if type(self) != type(other): return False
15002 if self.xid != other.xid: return False
15003 if self.flags != other.flags: return False
15004 if self.entries != other.entries: return False
15005 return True
15006
15007 def pretty_print(self, q):
15008 q.text("table_features_stats_request {")
15009 with q.group():
15010 with q.indent(2):
15011 q.breakable()
15012 q.text("xid = ");
15013 if self.xid != None:
15014 q.text("%#x" % self.xid)
15015 else:
15016 q.text('None')
15017 q.text(","); q.breakable()
15018 q.text("flags = ");
15019 q.text("%#x" % self.flags)
15020 q.text(","); q.breakable()
15021 q.text("entries = ");
15022 q.pp(self.entries)
15023 q.breakable()
15024 q.text('}')
15025
15026stats_request.subtypes[12] = table_features_stats_request
15027
15028class table_mod(message):
15029 version = 5
15030 type = 17
15031
15032 def __init__(self, xid=None, table_id=None, config=None, properties=None):
15033 if xid != None:
15034 self.xid = xid
15035 else:
15036 self.xid = None
15037 if table_id != None:
15038 self.table_id = table_id
15039 else:
15040 self.table_id = 0
15041 if config != None:
15042 self.config = config
15043 else:
15044 self.config = 0
15045 if properties != None:
15046 self.properties = properties
15047 else:
15048 self.properties = []
15049 return
15050
15051 def pack(self):
15052 packed = []
15053 packed.append(struct.pack("!B", self.version))
15054 packed.append(struct.pack("!B", self.type))
15055 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15056 packed.append(struct.pack("!L", self.xid))
15057 packed.append(struct.pack("!B", self.table_id))
15058 packed.append('\x00' * 3)
15059 packed.append(struct.pack("!L", self.config))
15060 packed.append(loxi.generic_util.pack_list(self.properties))
15061 length = sum([len(x) for x in packed])
15062 packed[2] = struct.pack("!H", length)
15063 return ''.join(packed)
15064
15065 @staticmethod
15066 def unpack(reader):
15067 obj = table_mod()
15068 _version = reader.read("!B")[0]
15069 assert(_version == 5)
15070 _type = reader.read("!B")[0]
15071 assert(_type == 17)
15072 _length = reader.read("!H")[0]
15073 orig_reader = reader
15074 reader = orig_reader.slice(_length - (2 + 2))
15075 obj.xid = reader.read("!L")[0]
15076 obj.table_id = reader.read("!B")[0]
15077 reader.skip(3)
15078 obj.config = reader.read("!L")[0]
15079 obj.properties = loxi.generic_util.unpack_list(reader, table_mod_prop.table_mod_prop.unpack)
15080 return obj
15081
15082 def __eq__(self, other):
15083 if type(self) != type(other): return False
15084 if self.xid != other.xid: return False
15085 if self.table_id != other.table_id: return False
15086 if self.config != other.config: return False
15087 if self.properties != other.properties: return False
15088 return True
15089
15090 def pretty_print(self, q):
15091 q.text("table_mod {")
15092 with q.group():
15093 with q.indent(2):
15094 q.breakable()
15095 q.text("xid = ");
15096 if self.xid != None:
15097 q.text("%#x" % self.xid)
15098 else:
15099 q.text('None')
15100 q.text(","); q.breakable()
15101 q.text("table_id = ");
15102 q.text("%#x" % self.table_id)
15103 q.text(","); q.breakable()
15104 q.text("config = ");
15105 q.text("%#x" % self.config)
15106 q.text(","); q.breakable()
15107 q.text("properties = ");
15108 q.pp(self.properties)
15109 q.breakable()
15110 q.text('}')
15111
15112message.subtypes[17] = table_mod
15113
15114class table_mod_failed_error_msg(error_msg):
15115 version = 5
15116 type = 1
15117 err_type = 8
15118
15119 def __init__(self, xid=None, code=None, data=None):
15120 if xid != None:
15121 self.xid = xid
15122 else:
15123 self.xid = None
15124 if code != None:
15125 self.code = code
15126 else:
15127 self.code = 0
15128 if data != None:
15129 self.data = data
15130 else:
15131 self.data = ''
15132 return
15133
15134 def pack(self):
15135 packed = []
15136 packed.append(struct.pack("!B", self.version))
15137 packed.append(struct.pack("!B", self.type))
15138 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15139 packed.append(struct.pack("!L", self.xid))
15140 packed.append(struct.pack("!H", self.err_type))
15141 packed.append(struct.pack("!H", self.code))
15142 packed.append(self.data)
15143 length = sum([len(x) for x in packed])
15144 packed[2] = struct.pack("!H", length)
15145 return ''.join(packed)
15146
15147 @staticmethod
15148 def unpack(reader):
15149 obj = table_mod_failed_error_msg()
15150 _version = reader.read("!B")[0]
15151 assert(_version == 5)
15152 _type = reader.read("!B")[0]
15153 assert(_type == 1)
15154 _length = reader.read("!H")[0]
15155 orig_reader = reader
15156 reader = orig_reader.slice(_length - (2 + 2))
15157 obj.xid = reader.read("!L")[0]
15158 _err_type = reader.read("!H")[0]
15159 assert(_err_type == 8)
15160 obj.code = reader.read("!H")[0]
15161 obj.data = str(reader.read_all())
15162 return obj
15163
15164 def __eq__(self, other):
15165 if type(self) != type(other): return False
15166 if self.xid != other.xid: return False
15167 if self.code != other.code: return False
15168 if self.data != other.data: return False
15169 return True
15170
15171 def pretty_print(self, q):
15172 q.text("table_mod_failed_error_msg {")
15173 with q.group():
15174 with q.indent(2):
15175 q.breakable()
15176 q.text("xid = ");
15177 if self.xid != None:
15178 q.text("%#x" % self.xid)
15179 else:
15180 q.text('None')
15181 q.text(","); q.breakable()
15182 q.text("code = ");
15183 q.text("%#x" % self.code)
15184 q.text(","); q.breakable()
15185 q.text("data = ");
15186 q.pp(self.data)
15187 q.breakable()
15188 q.text('}')
15189
15190error_msg.subtypes[8] = table_mod_failed_error_msg
15191
15192class table_stats_reply(stats_reply):
15193 version = 5
15194 type = 19
15195 stats_type = 3
15196
15197 def __init__(self, xid=None, flags=None, entries=None):
15198 if xid != None:
15199 self.xid = xid
15200 else:
15201 self.xid = None
15202 if flags != None:
15203 self.flags = flags
15204 else:
15205 self.flags = 0
15206 if entries != None:
15207 self.entries = entries
15208 else:
15209 self.entries = []
15210 return
15211
15212 def pack(self):
15213 packed = []
15214 packed.append(struct.pack("!B", self.version))
15215 packed.append(struct.pack("!B", self.type))
15216 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15217 packed.append(struct.pack("!L", self.xid))
15218 packed.append(struct.pack("!H", self.stats_type))
15219 packed.append(struct.pack("!H", self.flags))
15220 packed.append('\x00' * 4)
15221 packed.append(loxi.generic_util.pack_list(self.entries))
15222 length = sum([len(x) for x in packed])
15223 packed[2] = struct.pack("!H", length)
15224 return ''.join(packed)
15225
15226 @staticmethod
15227 def unpack(reader):
15228 obj = table_stats_reply()
15229 _version = reader.read("!B")[0]
15230 assert(_version == 5)
15231 _type = reader.read("!B")[0]
15232 assert(_type == 19)
15233 _length = reader.read("!H")[0]
15234 orig_reader = reader
15235 reader = orig_reader.slice(_length - (2 + 2))
15236 obj.xid = reader.read("!L")[0]
15237 _stats_type = reader.read("!H")[0]
15238 assert(_stats_type == 3)
15239 obj.flags = reader.read("!H")[0]
15240 reader.skip(4)
15241 obj.entries = loxi.generic_util.unpack_list(reader, common.table_stats_entry.unpack)
15242 return obj
15243
15244 def __eq__(self, other):
15245 if type(self) != type(other): return False
15246 if self.xid != other.xid: return False
15247 if self.flags != other.flags: return False
15248 if self.entries != other.entries: return False
15249 return True
15250
15251 def pretty_print(self, q):
15252 q.text("table_stats_reply {")
15253 with q.group():
15254 with q.indent(2):
15255 q.breakable()
15256 q.text("xid = ");
15257 if self.xid != None:
15258 q.text("%#x" % self.xid)
15259 else:
15260 q.text('None')
15261 q.text(","); q.breakable()
15262 q.text("flags = ");
15263 q.text("%#x" % self.flags)
15264 q.text(","); q.breakable()
15265 q.text("entries = ");
15266 q.pp(self.entries)
15267 q.breakable()
15268 q.text('}')
15269
15270stats_reply.subtypes[3] = table_stats_reply
15271
15272class table_stats_request(stats_request):
15273 version = 5
15274 type = 18
15275 stats_type = 3
15276
15277 def __init__(self, xid=None, flags=None):
15278 if xid != None:
15279 self.xid = xid
15280 else:
15281 self.xid = None
15282 if flags != None:
15283 self.flags = flags
15284 else:
15285 self.flags = 0
15286 return
15287
15288 def pack(self):
15289 packed = []
15290 packed.append(struct.pack("!B", self.version))
15291 packed.append(struct.pack("!B", self.type))
15292 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15293 packed.append(struct.pack("!L", self.xid))
15294 packed.append(struct.pack("!H", self.stats_type))
15295 packed.append(struct.pack("!H", self.flags))
15296 packed.append('\x00' * 4)
15297 length = sum([len(x) for x in packed])
15298 packed[2] = struct.pack("!H", length)
15299 return ''.join(packed)
15300
15301 @staticmethod
15302 def unpack(reader):
15303 obj = table_stats_request()
15304 _version = reader.read("!B")[0]
15305 assert(_version == 5)
15306 _type = reader.read("!B")[0]
15307 assert(_type == 18)
15308 _length = reader.read("!H")[0]
15309 orig_reader = reader
15310 reader = orig_reader.slice(_length - (2 + 2))
15311 obj.xid = reader.read("!L")[0]
15312 _stats_type = reader.read("!H")[0]
15313 assert(_stats_type == 3)
15314 obj.flags = reader.read("!H")[0]
15315 reader.skip(4)
15316 return obj
15317
15318 def __eq__(self, other):
15319 if type(self) != type(other): return False
15320 if self.xid != other.xid: return False
15321 if self.flags != other.flags: return False
15322 return True
15323
15324 def pretty_print(self, q):
15325 q.text("table_stats_request {")
15326 with q.group():
15327 with q.indent(2):
15328 q.breakable()
15329 q.text("xid = ");
15330 if self.xid != None:
15331 q.text("%#x" % self.xid)
15332 else:
15333 q.text('None')
15334 q.text(","); q.breakable()
15335 q.text("flags = ");
15336 q.text("%#x" % self.flags)
15337 q.breakable()
15338 q.text('}')
15339
15340stats_request.subtypes[3] = table_stats_request
15341
15342class table_status(message):
15343 version = 5
15344 type = 31
15345
15346 def __init__(self, xid=None, role=None, reason=None, table=None):
15347 if xid != None:
15348 self.xid = xid
15349 else:
15350 self.xid = None
15351 if role != None:
15352 self.role = role
15353 else:
15354 self.role = 0
15355 if reason != None:
15356 self.reason = reason
15357 else:
15358 self.reason = 0
15359 if table != None:
15360 self.table = table
15361 else:
15362 self.table = common.table_desc()
15363 return
15364
15365 def pack(self):
15366 packed = []
15367 packed.append(struct.pack("!B", self.version))
15368 packed.append(struct.pack("!B", self.type))
15369 packed.append(struct.pack("!H", 0)) # placeholder for length at index 2
15370 packed.append(struct.pack("!L", self.xid))
15371 packed.append(struct.pack("!L", self.role))
15372 packed.append(struct.pack("!B", self.reason))
15373 packed.append('\x00' * 7)
15374 packed.append(self.table.pack())
15375 length = sum([len(x) for x in packed])
15376 packed[2] = struct.pack("!H", length)
15377 return ''.join(packed)
15378
15379 @staticmethod
15380 def unpack(reader):
15381 obj = table_status()
15382 _version = reader.read("!B")[0]
15383 assert(_version == 5)
15384 _type = reader.read("!B")[0]
15385 assert(_type == 31)
15386 _length = reader.read("!H")[0]
15387 orig_reader = reader
15388 reader = orig_reader.slice(_length - (2 + 2))
15389 obj.xid = reader.read("!L")[0]
15390 obj.role = reader.read("!L")[0]
15391 obj.reason = reader.read("!B")[0]
15392 reader.skip(7)
15393 obj.table = common.table_desc.unpack(reader)
15394 return obj
15395
15396 def __eq__(self, other):
15397 if type(self) != type(other): return False
15398 if self.xid != other.xid: return False
15399 if self.role != other.role: return False
15400 if self.reason != other.reason: return False
15401 if self.table != other.table: return False
15402 return True
15403
15404 def pretty_print(self, q):
15405 q.text("table_status {")
15406 with q.group():
15407 with q.indent(2):
15408 q.breakable()
15409 q.text("xid = ");
15410 if self.xid != None:
15411 q.text("%#x" % self.xid)
15412 else:
15413 q.text('None')
15414 q.text(","); q.breakable()
15415 q.text("role = ");
15416 q.text("%#x" % self.role)
15417 q.text(","); q.breakable()
15418 q.text("reason = ");
15419 q.text("%#x" % self.reason)
15420 q.text(","); q.breakable()
15421 q.text("table = ");
15422 q.pp(self.table)
15423 q.breakable()
15424 q.text('}')
15425
15426message.subtypes[31] = table_status
15427
15428
15429def parse_header(buf):
15430 if len(buf) < 8:
15431 raise loxi.ProtocolError("too short to be an OpenFlow message")
15432 return struct.unpack_from("!BBHL", buf)
15433
15434def parse_message(buf):
15435 msg_ver, msg_type, msg_len, msg_xid = parse_header(buf)
15436 if msg_ver != const.OFP_VERSION and msg_type != const.OFPT_HELLO:
15437 raise loxi.ProtocolError("wrong OpenFlow version (expected %d, got %d)" % (const.OFP_VERSION, msg_ver))
15438 if len(buf) != msg_len:
15439 raise loxi.ProtocolError("incorrect message size")
15440 return message.unpack(loxi.generic_util.OFReader(buf))